diff --git a/src/backend/wayland/wl_client.c b/src/backend/wayland/wl_client.c index 2834308..be671a0 100644 --- a/src/backend/wayland/wl_client.c +++ b/src/backend/wayland/wl_client.c @@ -513,10 +513,9 @@ void wl_client_kill_impl(WWindow *wwin) wm_backend->client_close(wwin->client_win); } +#if USE_X11_BACKEND void wl_client_message_forward(WMEvent *event, WNativeWindow target_win) { - /* Forward OffiX DND ClientMessage to the real client_win for - * XWayland clients. Native Wayland clients have no analog. */ if (!wl_state.x_display || !event) return; XEvent *xev = (XEvent *)event->_x11_raw; if (!xev) return; @@ -527,9 +526,6 @@ void wl_client_message_forward(WMEvent *event, WNativeWindow target_win) void wl_client_send_key(WNativeWindow win, unsigned int keycode, unsigned int modifier_mask, int press) { - /* For XWayland clients, deliver via the X server (wl_state.x_display) - * the same way the X11 backend does. Native Wayland clients are not - * yet supported (would require zwp_virtual_keyboard_v1). */ if (!wl_state.x_display) return; XEvent ev; memset(&ev, 0, sizeof(ev)); @@ -545,6 +541,7 @@ void wl_client_send_key(WNativeWindow win, unsigned int keycode, XSendEvent(wl_state.x_display, (WNativeWindow)win, press ? False : True, press ? WM_EVMASK_KEY_PRESS : WM_EVMASK_KEY_RELEASE, &ev); } +#endif char *wl_get_command_for_window(WNativeWindow win, int elements) { diff --git a/src/backend/wayland/wl_extensions.c b/src/backend/wayland/wl_extensions.c index 02e7958..f274ffd 100644 --- a/src/backend/wayland/wl_extensions.c +++ b/src/backend/wayland/wl_extensions.c @@ -3,9 +3,11 @@ #endif #include #include +#if USE_X11_BACKEND #include #include #include +#endif #include #include #include @@ -64,20 +66,16 @@ wl_shape_combine_mask(WNativeWindow win, WNativeWindow mask) pixman_region32_fini(®ion); } +#if USE_X11_BACKEND int wl_catch_xwayland_error(Display *edpy, XErrorEvent *error) { (void)edpy; - /* BadMatch on X_SetInputFocus is benign: the target window may not be - * viewable yet (e.g. during XWayland startup or between map/unmap). - * Silence it so it does not reach Xlib's default handler. */ if (error->error_code == BadMatch && error->request_code == X_SetInputFocus) return 0; - /* BadWindow is also common during window teardown; ignore silently. */ if (error->error_code == BadWindow) return 0; - /* Everything else: print via wwarning and continue. */ char buf[256]; XGetErrorText(edpy, error->error_code, buf, sizeof(buf)); wwarning("wl_backend: X error from XWayland: %s (request %d, resource 0x%lx)", @@ -146,6 +144,7 @@ wl_register_error_handlers(void) * the silent exit(1) from Xlib's default handler when XWayland disconnects. */ XSetIOErrorHandler(wl_catch_xwayland_io_error); } +#endif /* USE_X11_BACKEND */ void wl_texture_alloc_color(WScreen *scr, WMColorRGB *color) diff --git a/src/backend/wayland/wl_stubs.c b/src/backend/wayland/wl_stubs.c index 376e65d..7e75714 100644 --- a/src/backend/wayland/wl_stubs.c +++ b/src/backend/wayland/wl_stubs.c @@ -49,8 +49,10 @@ void wl_client_set_maximized(WNativeWindow win, int maximized); void wl_client_send_protocol(WWindow *wwin, unsigned long protocol, unsigned long timestamp); void wl_client_kill_impl(WWindow *wwin); char *wl_get_command_for_window(WNativeWindow win, int elements); +#if USE_X11_BACKEND void wl_client_message_forward(WMEvent *event, WNativeWindow target_win); void wl_client_send_key(WNativeWindow win, unsigned int keycode, unsigned int modifiers, int grabbed); +#endif int wl_get_color_for_colormap(unsigned long colormap, const char *color_name, WMColorRGB *color); void wl_frame_paint_resizebar(WFrameWindow *fwin); void wl_frame_paint_titlebar(WFrameWindow *fwin, int state); @@ -496,8 +498,10 @@ const WMBackend wl_backend = { .event_check_window = wl_noop_event_check_window, .event_check_type = wl_noop_event_check_type, .client_send_event = wl_noop_client_send_event, +#if USE_X11_BACKEND .client_message_forward = wl_client_message_forward, .client_send_key = wl_client_send_key, +#endif .window_exists = wl_noop_window_exists, .window_get_colormap = wl_noop_window_get_colormap, .pointer_query_window = wl_noop_pointer_query_window,