[mutter/wip/new-api: 68/68] MetaPluginManager: don't require plugins to pass events to clutter



commit 940c6e7069a5c46c7434f0e66bd177549ff04cce
Author: Giovanni Campagna <gcampagn redhat com>
Date:   Wed Sep 4 18:11:43 2013 +0200

    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

 src/compositor/compositor.c          |    5 +----
 src/compositor/meta-plugin-manager.c |   20 +-------------------
 src/compositor/meta-plugin-manager.h |    2 ++
 src/compositor/meta-plugin.c         |   12 ++++++++++++
 4 files changed, 16 insertions(+), 23 deletions(-)
---
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index 5b936f0..71497e1 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -944,10 +944,7 @@ meta_compositor_process_event (MetaCompositor *compositor,
 {
   if (compositor->modal_plugin && is_grabbed_event (compositor->display, event))
     {
-      MetaPluginClass *klass = META_PLUGIN_GET_CLASS (compositor->modal_plugin);
-
-      if (klass->xevent_filter)
-        klass->xevent_filter (compositor->modal_plugin, event);
+      _meta_plugin_xevent_filter (compositor->modal_plugin, event);
 
       /* We always consume events even if the plugin says it didn't handle them;
        * exclusive is exclusive */
diff --git a/src/compositor/meta-plugin-manager.c b/src/compositor/meta-plugin-manager.c
index 43f9931..dee1b08 100644
--- a/src/compositor/meta-plugin-manager.c
+++ b/src/compositor/meta-plugin-manager.c
@@ -306,31 +306,13 @@ meta_plugin_manager_filter_keybinding (MetaPluginManager *plugin_mgr,
   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
 meta_plugin_manager_xevent_filter (MetaPluginManager *plugin_mgr,
                                    XEvent            *xev)
 {
   MetaPlugin *plugin = plugin_mgr->plugin;
-  MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
 
-  /* We need to make sure that clutter gets certain events, like
-   * 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);
-  else
-    return clutter_x11_handle_event (xev) != CLUTTER_X11_FILTER_CONTINUE;
+  return _meta_plugin_xevent_filter (plugin, xev);
 }
 
 void
diff --git a/src/compositor/meta-plugin-manager.h b/src/compositor/meta-plugin-manager.h
index 215d450..f39f5ca 100644
--- a/src/compositor/meta-plugin-manager.h
+++ b/src/compositor/meta-plugin-manager.h
@@ -72,6 +72,8 @@ gboolean meta_plugin_manager_filter_keybinding (MetaPluginManager  *mgr,
 
 gboolean meta_plugin_manager_xevent_filter (MetaPluginManager *mgr,
                                             XEvent            *xev);
+gboolean _meta_plugin_xevent_filter (MetaPlugin *plugin,
+                                     XEvent     *xev);
 
 void     meta_plugin_manager_confirm_display_change (MetaPluginManager *mgr);
 
diff --git a/src/compositor/meta-plugin.c b/src/compositor/meta-plugin.c
index 723b4eb..b12351f 100644
--- a/src/compositor/meta-plugin.c
+++ b/src/compositor/meta-plugin.c
@@ -183,6 +183,18 @@ _meta_plugin_effect_started (MetaPlugin *plugin)
   priv->running++;
 }
 
+gboolean
+_meta_plugin_xevent_filter (MetaPlugin *plugin,
+                            XEvent     *xev)
+{
+  MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
+
+  if (klass->xevent_filter && klass->xevent_filter (plugin, xev))
+    return TRUE;
+  else
+    return clutter_x11_handle_event (xev) != CLUTTER_X11_FILTER_CONTINUE;
+}
+
 void
 meta_plugin_switch_workspace_completed (MetaPlugin *plugin)
 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]