MetaPluginManager: don't require plugins to pass events to clutter

We don't want the shell to know if it's running on ClutterX11 or
not, so we should forward the event ourselves.

https://bugzilla.gnome.org/show_bug.cgi?id=707482
This commit is contained in:
Giovanni Campagna 2013-09-04 18:11:43 +02:00
parent 168ea64a45
commit 004ee2d3b5
4 changed files with 26 additions and 33 deletions

View File

@ -1066,10 +1066,7 @@ meta_compositor_process_event (MetaCompositor *compositor,
{ {
if (compositor->modal_plugin && is_grabbed_event (compositor->display, event)) if (compositor->modal_plugin && is_grabbed_event (compositor->display, event))
{ {
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (compositor->modal_plugin); _meta_plugin_xevent_filter (compositor->modal_plugin, event);
if (klass->xevent_filter)
klass->xevent_filter (compositor->modal_plugin, event);
/* We always consume events even if the plugin says it didn't handle them; /* We always consume events even if the plugin says it didn't handle them;
* exclusive is exclusive */ * exclusive is exclusive */

View File

@ -306,41 +306,13 @@ meta_plugin_manager_filter_keybinding (MetaPluginManager *plugin_mgr,
return FALSE; return FALSE;
} }
/*
* The public method that the compositor hooks into for desktop switching.
*
* Returns TRUE if the plugin handled the event type (i.e.,
* if the return value is FALSE, there will be no subsequent call to the
* manager completed() callback, and the compositor must ensure that any
* appropriate post-effect cleanup is carried out.
*/
gboolean gboolean
meta_plugin_manager_xevent_filter (MetaPluginManager *plugin_mgr, meta_plugin_manager_xevent_filter (MetaPluginManager *plugin_mgr,
XEvent *xev) XEvent *xev)
{ {
MetaPlugin *plugin = plugin_mgr->plugin; MetaPlugin *plugin = plugin_mgr->plugin;
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
/* We need to make sure that clutter gets certain events, like return _meta_plugin_xevent_filter (plugin, xev);
* ConfigureNotify on the stage window. If there is a plugin that
* provides an xevent_filter function, then it's the responsibility
* of that plugin to pass events to Clutter. Otherwise, we send the
* event directly to Clutter ourselves.
*/
if (klass->xevent_filter)
return klass->xevent_filter (plugin, xev);
/* When mutter is running as a wayland compositor, things like input
* events just come directly from clutter so it won't have disabled
* clutter's event retrieval and won't need to forward it events (if
* it did it would lead to recursion). Also when running as a
* wayland compositor we shouldn't be assuming that we're running
* with the clutter x11 backend.
*/
if (meta_is_wayland_compositor ())
return FALSE;
return clutter_x11_handle_event (xev) != CLUTTER_X11_FILTER_CONTINUE;
} }
void void

View File

@ -72,6 +72,8 @@ gboolean meta_plugin_manager_filter_keybinding (MetaPluginManager *mgr,
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,
XEvent *xev);
void meta_plugin_manager_confirm_display_change (MetaPluginManager *mgr); void meta_plugin_manager_confirm_display_change (MetaPluginManager *mgr);

View File

@ -183,6 +183,28 @@ _meta_plugin_effect_started (MetaPlugin *plugin)
priv->running++; priv->running++;
} }
gboolean
_meta_plugin_xevent_filter (MetaPlugin *plugin,
XEvent *xev)
{
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
/* When mutter is running as a wayland compositor, things like input
* events just come directly from clutter so it won't have disabled
* clutter's event retrieval and won't need to forward it events (if
* it did it would lead to recursion). Also when running as a
* wayland compositor we shouldn't be assuming that we're running
* with the clutter x11 backend.
*/
if (klass->xevent_filter && klass->xevent_filter (plugin, xev))
return TRUE;
else if (!meta_is_wayland_compositor ())
return clutter_x11_handle_event (xev) != CLUTTER_X11_FILTER_CONTINUE;
else
return FALSE;
}
void void
meta_plugin_switch_workspace_completed (MetaPlugin *plugin) meta_plugin_switch_workspace_completed (MetaPlugin *plugin)
{ {