From f480de4ecd05b077e40db5ca9acdf10f4bd5fdf3 Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Fri, 8 Mar 2024 12:39:50 +0100 Subject: [PATCH] plugin-manager: Guard MetaPluginClass.xevent_filter As we are getting close to have a Wayland-only build, guard those usages so we don't 'regress'. Once Kiosk figures it use case, we can revert both this commit and the previous one. Part-of: --- src/backends/x11/meta-backend-x11.c | 6 +++++- src/compositor/meta-plugin-manager.c | 3 ++- src/compositor/meta-plugin-manager.h | 2 ++ src/compositor/meta-plugin.c | 8 +++++++- src/meta/meta-plugin.h | 4 +++- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/backends/x11/meta-backend-x11.c b/src/backends/x11/meta-backend-x11.c index 3b44920f6..86aa63810 100644 --- a/src/backends/x11/meta-backend-x11.c +++ b/src/backends/x11/meta-backend-x11.c @@ -348,9 +348,11 @@ handle_host_xevent (MetaBackend *backend, MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11); ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend); ClutterSeat *seat = clutter_backend_get_default_seat (clutter_backend); - MetaContext *context = meta_backend_get_context (backend); gboolean bypass_clutter = FALSE; +#ifdef HAVE_X11 + MetaContext *context = meta_backend_get_context (backend); MetaDisplay *display; +#endif switch (event->type) { @@ -365,6 +367,7 @@ handle_host_xevent (MetaBackend *backend, XGetEventData (priv->xdisplay, &event->xcookie); +#ifdef HAVE_X11 display = meta_context_get_display (context); if (display) { @@ -375,6 +378,7 @@ handle_host_xevent (MetaBackend *backend, if (meta_plugin_manager_xevent_filter (plugin_mgr, event)) bypass_clutter = TRUE; } +#endif bypass_clutter = (meta_backend_x11_handle_host_xevent (x11, event) || bypass_clutter); diff --git a/src/compositor/meta-plugin-manager.c b/src/compositor/meta-plugin-manager.c index 404ea5e5b..fb38917b5 100644 --- a/src/compositor/meta-plugin-manager.c +++ b/src/compositor/meta-plugin-manager.c @@ -26,7 +26,6 @@ #include #include -#include "backends/x11/meta-clutter-backend-x11.h" #include "compositor/compositor-private.h" #include "compositor/meta-module.h" #include "core/meta-inhibit-shortcuts-dialog-default-private.h" @@ -332,6 +331,7 @@ meta_plugin_manager_filter_keybinding (MetaPluginManager *plugin_mgr, return FALSE; } +#ifdef HAVE_X11 gboolean meta_plugin_manager_xevent_filter (MetaPluginManager *plugin_mgr, XEvent *xev) @@ -340,6 +340,7 @@ meta_plugin_manager_xevent_filter (MetaPluginManager *plugin_mgr, return _meta_plugin_xevent_filter (plugin, xev); } +#endif void meta_plugin_manager_confirm_display_change (MetaPluginManager *plugin_mgr) diff --git a/src/compositor/meta-plugin-manager.h b/src/compositor/meta-plugin-manager.h index 3e6ed75dd..f011d6276 100644 --- a/src/compositor/meta-plugin-manager.h +++ b/src/compositor/meta-plugin-manager.h @@ -70,10 +70,12 @@ gboolean meta_plugin_manager_switch_workspace (MetaPluginManager *mgr, gboolean meta_plugin_manager_filter_keybinding (MetaPluginManager *mgr, MetaKeyBinding *binding); +#ifdef HAVE_X11 gboolean meta_plugin_manager_xevent_filter (MetaPluginManager *mgr, XEvent *xev); gboolean _meta_plugin_xevent_filter (MetaPlugin *plugin, XEvent *xev); +#endif void meta_plugin_manager_confirm_display_change (MetaPluginManager *mgr); diff --git a/src/compositor/meta-plugin.c b/src/compositor/meta-plugin.c index 8c25563a5..b69f88953 100644 --- a/src/compositor/meta-plugin.c +++ b/src/compositor/meta-plugin.c @@ -30,12 +30,16 @@ #include "meta/meta-plugin.h" #include +#ifdef HAVE_X11 #include #include #include +#endif -#include "backends/meta-monitor-manager-private.h" +#ifdef HAVE_X11 #include "backends/x11/meta-clutter-backend-x11.h" +#endif +#include "backends/meta-monitor-manager-private.h" #include "compositor/compositor-private.h" #include "compositor/meta-window-actor-private.h" #include "compositor/meta-plugin-manager.h" @@ -71,6 +75,7 @@ meta_plugin_get_info (MetaPlugin *plugin) return NULL; } +#ifdef HAVE_X11 gboolean _meta_plugin_xevent_filter (MetaPlugin *plugin, XEvent *xev) @@ -82,6 +87,7 @@ _meta_plugin_xevent_filter (MetaPlugin *plugin, else return FALSE; } +#endif void meta_plugin_switch_workspace_completed (MetaPlugin *plugin) diff --git a/src/meta/meta-plugin.h b/src/meta/meta-plugin.h index f522673b9..c6fb0872f 100644 --- a/src/meta/meta-plugin.h +++ b/src/meta/meta-plugin.h @@ -21,7 +21,6 @@ #pragma once -#include #include #include "clutter/clutter.h" @@ -38,6 +37,9 @@ G_DECLARE_DERIVABLE_TYPE (MetaPlugin, meta_plugin, META, PLUGIN, GObject) typedef struct _MetaPluginInfo MetaPluginInfo; +/* Allows us to keep the xevent_filter vfunc even when building Mutter without X11 */ +typedef union _XEvent XEvent; + /** * MetaPluginClass: * @start: virtual function called when the compositor starts managing a screen