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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3652>
This commit is contained in:
Bilal Elmoussaoui 2024-03-08 12:39:50 +01:00
parent eb1d1883c2
commit f480de4ecd
5 changed files with 19 additions and 4 deletions

View File

@ -348,9 +348,11 @@ handle_host_xevent (MetaBackend *backend,
MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11); MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11);
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend); ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
ClutterSeat *seat = clutter_backend_get_default_seat (clutter_backend); ClutterSeat *seat = clutter_backend_get_default_seat (clutter_backend);
MetaContext *context = meta_backend_get_context (backend);
gboolean bypass_clutter = FALSE; gboolean bypass_clutter = FALSE;
#ifdef HAVE_X11
MetaContext *context = meta_backend_get_context (backend);
MetaDisplay *display; MetaDisplay *display;
#endif
switch (event->type) switch (event->type)
{ {
@ -365,6 +367,7 @@ handle_host_xevent (MetaBackend *backend,
XGetEventData (priv->xdisplay, &event->xcookie); XGetEventData (priv->xdisplay, &event->xcookie);
#ifdef HAVE_X11
display = meta_context_get_display (context); display = meta_context_get_display (context);
if (display) if (display)
{ {
@ -375,6 +378,7 @@ handle_host_xevent (MetaBackend *backend,
if (meta_plugin_manager_xevent_filter (plugin_mgr, event)) if (meta_plugin_manager_xevent_filter (plugin_mgr, event))
bypass_clutter = TRUE; bypass_clutter = TRUE;
} }
#endif
bypass_clutter = (meta_backend_x11_handle_host_xevent (x11, event) || bypass_clutter = (meta_backend_x11_handle_host_xevent (x11, event) ||
bypass_clutter); bypass_clutter);

View File

@ -26,7 +26,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "backends/x11/meta-clutter-backend-x11.h"
#include "compositor/compositor-private.h" #include "compositor/compositor-private.h"
#include "compositor/meta-module.h" #include "compositor/meta-module.h"
#include "core/meta-inhibit-shortcuts-dialog-default-private.h" #include "core/meta-inhibit-shortcuts-dialog-default-private.h"
@ -332,6 +331,7 @@ meta_plugin_manager_filter_keybinding (MetaPluginManager *plugin_mgr,
return FALSE; return FALSE;
} }
#ifdef HAVE_X11
gboolean gboolean
meta_plugin_manager_xevent_filter (MetaPluginManager *plugin_mgr, meta_plugin_manager_xevent_filter (MetaPluginManager *plugin_mgr,
XEvent *xev) XEvent *xev)
@ -340,6 +340,7 @@ meta_plugin_manager_xevent_filter (MetaPluginManager *plugin_mgr,
return _meta_plugin_xevent_filter (plugin, xev); return _meta_plugin_xevent_filter (plugin, xev);
} }
#endif
void void
meta_plugin_manager_confirm_display_change (MetaPluginManager *plugin_mgr) meta_plugin_manager_confirm_display_change (MetaPluginManager *plugin_mgr)

View File

@ -70,10 +70,12 @@ gboolean meta_plugin_manager_switch_workspace (MetaPluginManager *mgr,
gboolean meta_plugin_manager_filter_keybinding (MetaPluginManager *mgr, gboolean meta_plugin_manager_filter_keybinding (MetaPluginManager *mgr,
MetaKeyBinding *binding); MetaKeyBinding *binding);
#ifdef HAVE_X11
gboolean meta_plugin_manager_xevent_filter (MetaPluginManager *mgr, gboolean meta_plugin_manager_xevent_filter (MetaPluginManager *mgr,
XEvent *xev); XEvent *xev);
gboolean _meta_plugin_xevent_filter (MetaPlugin *plugin, gboolean _meta_plugin_xevent_filter (MetaPlugin *plugin,
XEvent *xev); XEvent *xev);
#endif
void meta_plugin_manager_confirm_display_change (MetaPluginManager *mgr); void meta_plugin_manager_confirm_display_change (MetaPluginManager *mgr);

View File

@ -30,12 +30,16 @@
#include "meta/meta-plugin.h" #include "meta/meta-plugin.h"
#include <string.h> #include <string.h>
#ifdef HAVE_X11
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/extensions/Xfixes.h> #include <X11/extensions/Xfixes.h>
#include <X11/extensions/shape.h> #include <X11/extensions/shape.h>
#endif
#include "backends/meta-monitor-manager-private.h" #ifdef HAVE_X11
#include "backends/x11/meta-clutter-backend-x11.h" #include "backends/x11/meta-clutter-backend-x11.h"
#endif
#include "backends/meta-monitor-manager-private.h"
#include "compositor/compositor-private.h" #include "compositor/compositor-private.h"
#include "compositor/meta-window-actor-private.h" #include "compositor/meta-window-actor-private.h"
#include "compositor/meta-plugin-manager.h" #include "compositor/meta-plugin-manager.h"
@ -71,6 +75,7 @@ meta_plugin_get_info (MetaPlugin *plugin)
return NULL; return NULL;
} }
#ifdef HAVE_X11
gboolean gboolean
_meta_plugin_xevent_filter (MetaPlugin *plugin, _meta_plugin_xevent_filter (MetaPlugin *plugin,
XEvent *xev) XEvent *xev)
@ -82,6 +87,7 @@ _meta_plugin_xevent_filter (MetaPlugin *plugin,
else else
return FALSE; return FALSE;
} }
#endif
void void
meta_plugin_switch_workspace_completed (MetaPlugin *plugin) meta_plugin_switch_workspace_completed (MetaPlugin *plugin)

View File

@ -21,7 +21,6 @@
#pragma once #pragma once
#include <X11/extensions/Xfixes.h>
#include <gmodule.h> #include <gmodule.h>
#include "clutter/clutter.h" #include "clutter/clutter.h"
@ -38,6 +37,9 @@ G_DECLARE_DERIVABLE_TYPE (MetaPlugin, meta_plugin, META, PLUGIN, GObject)
typedef struct _MetaPluginInfo MetaPluginInfo; typedef struct _MetaPluginInfo MetaPluginInfo;
/* Allows us to keep the xevent_filter vfunc even when building Mutter without X11 */
typedef union _XEvent XEvent;
/** /**
* MetaPluginClass: * MetaPluginClass:
* @start: virtual function called when the compositor starts managing a screen * @start: virtual function called when the compositor starts managing a screen