diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c index 481789daf..942960a2b 100644 --- a/src/wayland/meta-wayland.c +++ b/src/wayland/meta-wayland.c @@ -504,25 +504,6 @@ meta_wayland_compositor_class_init (MetaWaylandCompositorClass *klass) G_TYPE_NONE, 0); } -#ifdef HAVE_XWAYLAND -static bool -meta_xwayland_global_filter (const struct wl_client *client, - const struct wl_global *global, - void *data) -{ - MetaWaylandCompositor *compositor = (MetaWaylandCompositor *) data; - MetaXWaylandManager *xwayland_manager = &compositor->xwayland_manager; - - /* Keyboard grabbing protocol is for Xwayland only */ - if (client != xwayland_manager->client) - return (wl_global_get_interface (global) != - &zwp_xwayland_keyboard_grab_manager_v1_interface); - - /* All others are visible to all clients */ - return true; -} -#endif - void meta_wayland_override_display_name (const char *display_name) { @@ -654,14 +635,6 @@ meta_wayland_compositor_new (MetaContext *context) meta_wayland_activation_init (compositor); meta_wayland_transaction_init (compositor); -#ifdef HAVE_XWAYLAND - /* Xwayland specific protocol, needs to be filtered out for all other clients */ - if (meta_xwayland_grab_keyboard_init (compositor)) - wl_display_set_global_filter (compositor->wayland_display, - meta_xwayland_global_filter, - compositor); -#endif - #ifdef HAVE_WAYLAND_EGLSTREAM { gboolean should_enable_eglstream_controller = TRUE; diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c index 08156c07e..9faeab297 100644 --- a/src/wayland/meta-xwayland.c +++ b/src/wayland/meta-xwayland.c @@ -72,6 +72,10 @@ static void meta_xwayland_stop_xserver (MetaXWaylandManager *manager); static void meta_xwayland_set_primary_output (MetaX11Display *x11_display); +static bool +meta_xwayland_global_filter (const struct wl_client *client, + const struct wl_global *global, + void *data); static MetaMonitorManager * monitor_manager_from_x11_display (MetaX11Display *x11_display) @@ -1122,6 +1126,11 @@ meta_xwayland_init (MetaXWaylandManager *manager, G_CALLBACK (meta_xwayland_shutdown), NULL); + /* Xwayland specific protocol, needs to be filtered out for all other clients */ + meta_xwayland_grab_keyboard_init (compositor); + wl_display_set_global_filter (compositor->wayland_display, + meta_xwayland_global_filter, + compositor); return TRUE; } @@ -1291,6 +1300,23 @@ meta_xwayland_manager_handle_xevent (MetaXWaylandManager *manager, return FALSE; } +static bool +meta_xwayland_global_filter (const struct wl_client *client, + const struct wl_global *global, + void *data) +{ + MetaWaylandCompositor *compositor = (MetaWaylandCompositor *) data; + MetaXWaylandManager *xwayland_manager = &compositor->xwayland_manager; + + /* Keyboard grabbing protocol is for Xwayland only */ + if (client != xwayland_manager->client) + return (wl_global_get_interface (global) != + &zwp_xwayland_keyboard_grab_manager_v1_interface); + + /* All others are visible to all clients */ + return true; +} + gboolean meta_xwayland_signal (MetaXWaylandManager *manager, int signum,