1
0
Fork 0

wayland: Move Xwayland specific call to xwayland

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2399>
This commit is contained in:
Bilal Elmoussaoui 2022-06-15 13:24:45 +02:00 committed by Marge Bot
parent 36f30341ac
commit 4bbad6063a
2 changed files with 26 additions and 27 deletions

View file

@ -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;

View file

@ -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,