split USE_X11_BACKEND from XWayland: USE_XWAYLAND now controls X11 support in the wayland backend (X11 wrapper functions, error handlers, XWayland event loop, X11 window helpers), separate from USE_X11_BACKEND which controls the x11_backend.c classic WM mode
This commit is contained in:
parent
598f6f304b
commit
0453888f08
|
|
@ -240,6 +240,10 @@ AM_CPPFLAGS = $(DFLAGS) \
|
|||
-I$(srcdir)/backend/wayland \
|
||||
@HEADER_SEARCH_PATH@
|
||||
|
||||
if USE_X11_BACKEND
|
||||
AM_CPPFLAGS += -DUSE_XWAYLAND
|
||||
endif
|
||||
|
||||
|
||||
wmaker_LDADD = \
|
||||
$(top_builddir)/WINGs/libWINGs.la\
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ frame_timer_cb(void *data)
|
|||
#define VIEW_FROM_LISTENER(ptr, field) \
|
||||
((struct wl_toplevel_view *)((char *)(ptr) - offsetof(struct wl_toplevel_view, field)))
|
||||
|
||||
#if USE_X11_BACKEND
|
||||
#if USE_XWAYLAND
|
||||
/* X error handler — defined near the vtable at the bottom of this file. */
|
||||
int wl_catch_xwayland_error(Display *edpy, XErrorEvent *error);
|
||||
#endif
|
||||
|
|
@ -264,7 +264,7 @@ wl_startup_pump_thread(void *arg)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#if USE_X11_BACKEND
|
||||
#if USE_XWAYLAND
|
||||
/* Called by the Wayland event loop whenever the X11 connection fd is readable. */
|
||||
static int
|
||||
wl_handle_x11_events(int fd, uint32_t mask, void *data)
|
||||
|
|
@ -341,7 +341,7 @@ wl_display_open(const char *name)
|
|||
wl_list_init(&wl_state.real_pointer_axis_listener.link);
|
||||
wl_list_init(&wl_state.real_pointer_destroy_listener.link);
|
||||
|
||||
#if USE_X11_BACKEND
|
||||
#if USE_XWAYLAND
|
||||
XInitThreads();
|
||||
/* Install X error handler: Mesa/EGL via XWayland */
|
||||
XSetErrorHandler(wl_catch_xwayland_error);
|
||||
|
|
@ -1009,7 +1009,7 @@ wl_display_close(void)
|
|||
wl_event_source_remove(wl_state.x11_event_source);
|
||||
wl_state.x11_event_source = NULL;
|
||||
}
|
||||
#if USE_X11_BACKEND
|
||||
#if USE_XWAYLAND
|
||||
if (wl_state.x_display) {
|
||||
XCloseDisplay(wl_state.x_display);
|
||||
wl_state.x_display = NULL;
|
||||
|
|
@ -1734,7 +1734,7 @@ handle_layer_shell_new_surface(struct wl_listener *listener, void *data)
|
|||
void wl_screen_set_root_cursor(WScreen *scr, int cursor_id) { (void)scr; (void)cursor_id; }
|
||||
void wl_screen_set_icon_sizes(WScreen *scr, int min_size, int max_size) { (void)scr; (void)min_size; (void)max_size; }
|
||||
void wl_screen_setup_noticeboard(WScreen *scr) { (void)scr; }
|
||||
#if USE_X11_BACKEND
|
||||
#if USE_XWAYLAND
|
||||
void
|
||||
wl_screen_alloc_gcs(WScreen *scr)
|
||||
{
|
||||
|
|
@ -1763,7 +1763,7 @@ wl_screen_alloc_gcs(WScreen *scr)
|
|||
* the explicit window-ID filter in handle_xwayland_new_surface, this
|
||||
* prevents BadDrawable/RenderBadPicture cascade and the resulting broken
|
||||
* pipe from the nested Wayland backend. */
|
||||
#if USE_X11_BACKEND
|
||||
#if USE_XWAYLAND
|
||||
if (scr->w_win) {
|
||||
wl_state.rcontext_xwin = (WNativeWindow)scr->w_win;
|
||||
XSetWindowAttributes or_attr;
|
||||
|
|
@ -1844,7 +1844,7 @@ wl_screen_create_internals(WScreen *scr)
|
|||
FILE *fp = fopen("/tmp/wl_backend_trace.log", "a");
|
||||
if (fp) { fprintf(fp, "wl_screen_create_internals: scr=%p\n", (void*)scr); fclose(fp); }
|
||||
}
|
||||
#if USE_X11_BACKEND
|
||||
#if USE_XWAYLAND
|
||||
/* Create off-screen InputOnly X window as focus sink */
|
||||
if (wl_state.x_display) {
|
||||
XSetWindowAttributes attribs;
|
||||
|
|
@ -1874,7 +1874,7 @@ wl_screen_create_internals(WScreen *scr)
|
|||
|
||||
wSetModifierMasks(WM_MOD_MOD1, WM_MOD_MOD1, WM_MOD_MOD4, 0);
|
||||
|
||||
#if USE_X11_BACKEND
|
||||
#if USE_XWAYLAND
|
||||
/* XWayland bridge: create X11 helper window for EWMH */
|
||||
if (wl_state.x_display) {
|
||||
XSetWindowAttributes iattr;
|
||||
|
|
|
|||
|
|
@ -513,7 +513,7 @@ void wl_client_kill_impl(WWindow *wwin)
|
|||
wm_backend->client_close(wwin->client_win);
|
||||
}
|
||||
|
||||
#if USE_X11_BACKEND
|
||||
#if USE_XWAYLAND
|
||||
void wl_client_message_forward(WMEvent *event, WNativeWindow target_win)
|
||||
{
|
||||
if (!wl_state.x_display || !event) return;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#if USE_X11_BACKEND
|
||||
#if USE_XWAYLAND
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
|
|
@ -66,7 +66,7 @@ wl_shape_combine_mask(WNativeWindow win, WNativeWindow mask)
|
|||
|
||||
pixman_region32_fini(®ion);
|
||||
}
|
||||
#if USE_X11_BACKEND
|
||||
#if USE_XWAYLAND
|
||||
int
|
||||
wl_catch_xwayland_error(Display *edpy, XErrorEvent *error)
|
||||
{
|
||||
|
|
@ -144,7 +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 */
|
||||
#endif /* USE_XWAYLAND */
|
||||
|
||||
void
|
||||
wl_texture_alloc_color(WScreen *scr, WMColorRGB *color)
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ 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
|
||||
#if USE_XWAYLAND
|
||||
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
|
||||
|
|
@ -399,7 +399,7 @@ const WMBackend wl_backend = {
|
|||
.cursors_init = wl_cursors_init,
|
||||
.cursor_create_named = wl_cursor_create_named,
|
||||
.shape_combine_mask = wl_shape_combine_mask,
|
||||
#if USE_X11_BACKEND
|
||||
#if USE_XWAYLAND
|
||||
.register_error_handlers = wl_register_error_handlers,
|
||||
.texture_create_gc = wl_texture_create_gc,
|
||||
.texture_free_gc = wl_texture_free_gc,
|
||||
|
|
@ -498,7 +498,7 @@ 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
|
||||
#if USE_XWAYLAND
|
||||
.client_message_forward = wl_client_message_forward,
|
||||
.client_send_key = wl_client_send_key,
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -526,7 +526,7 @@ void wl_extensions_init(void);
|
|||
void wl_cursors_init(void);
|
||||
WNativeWindow wl_cursor_create_named(const char *name);
|
||||
void wl_shape_combine_mask(WNativeWindow win, WNativeWindow mask);
|
||||
#if USE_X11_BACKEND
|
||||
#if USE_XWAYLAND
|
||||
int wl_catch_xwayland_error(Display *edpy, XErrorEvent *error);
|
||||
int wl_catch_xwayland_io_error(Display *edpy);
|
||||
void wl_register_error_handlers(void);
|
||||
|
|
@ -558,7 +558,7 @@ void wm_shm_surface_commit(struct wm_shm_surface *s, struct wlr_scene_tree *pare
|
|||
void wm_shm_surface_destroy(struct wm_shm_surface *s);
|
||||
WMScreen *wl_get_wmscreen(void);
|
||||
void wl_wings_dispatch(int timeout_ms, void *ud);
|
||||
#if USE_X11_BACKEND
|
||||
#if USE_XWAYLAND
|
||||
Display *wl_get_x_display(void);
|
||||
#endif
|
||||
unsigned long wl_xdisplay_intern_atom(const char *name);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ struct wl_frame_buf *frame_buf_find(WNativeWindow id);
|
|||
extern void *W_RegisterBacking(unsigned long id, void *img);
|
||||
extern void W_UnregisterBacking(unsigned long id);
|
||||
struct wl_toplevel_view *wl_find_view_by_id(WNativeWindow id);
|
||||
#ifdef USE_X11_BACKEND
|
||||
#ifdef USE_XWAYLAND
|
||||
pixman_image_t *get_window_image_from_x11(Display *x_display, WNativeWindow win);
|
||||
#else
|
||||
pixman_image_t *get_window_image_from_x11(Display *x_display, WNativeWindow win) { (void)x_display; (void)win; return NULL; }
|
||||
|
|
@ -692,7 +692,7 @@ int wl_window_get_command(WNativeWindow win, char ***argv_out, int *argc_out)
|
|||
|
||||
const char *cmd = NULL;
|
||||
if (v->xw_surface) {
|
||||
#if USE_X11_BACKEND
|
||||
#if USE_XWAYLAND
|
||||
/* XWayland: try WM_COMMAND first via the X server. */
|
||||
if (wl_state.x_display && v->xw_surface->window_id) {
|
||||
char **cmd_argv = NULL;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ Display *wl_get_x_display(void)
|
|||
return wl_state.x_display;
|
||||
}
|
||||
|
||||
#if USE_X11_BACKEND
|
||||
#if USE_XWAYLAND
|
||||
unsigned long
|
||||
wl_xdisplay_intern_atom(const char *name)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -380,7 +380,7 @@ handle_xwayland_new_surface(struct wl_listener *listener, void *data)
|
|||
/* ------------------------------------------------------------------ */
|
||||
/* XWayland snapshot capture — called from wl_client_snapshot() */
|
||||
|
||||
#if USE_X11_BACKEND
|
||||
#if USE_XWAYLAND
|
||||
RImage *
|
||||
wl_xwayland_capture_snapshot(WScreen *scr, struct wlr_xwayland_surface *xw)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue