[mutter] Pass event to clutter when the plugin doesn't have xevent_filter



commit d91d503eb25412432e8aa9b4863d469d5828a4b7
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Wed Jul 22 14:37:43 2009 -0400

    Pass event to clutter when the plugin doesn't have xevent_filter
    
    With recent changes, Clutter no longer sets up the viewport correctly,
    unless it receives ConfigureNotify events. If there is a plugin with
    an xevent_filter function, then it's that plugins responsibility to pass
    the event to Clutter if it doesn't want it. If there is no plugin,
    or the plugin doesn't have an xevent_filter function, then we should
    call clutter_x11_handle_event() ourselves.
    
    http://bugzilla.gnome.org/show_bug.cgi?id=589419

 src/compositor/mutter-plugin-manager.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/compositor/mutter-plugin-manager.c b/src/compositor/mutter-plugin-manager.c
index 98d3f19..9d8ae74 100644
--- a/src/compositor/mutter-plugin-manager.c
+++ b/src/compositor/mutter-plugin-manager.c
@@ -30,6 +30,8 @@
 
 #include <string.h>
 
+#include <clutter/x11/clutter-x11.h>
+
 /*
  * There is only one instace of each module per the process.
  */
@@ -585,12 +587,31 @@ mutter_plugin_manager_xevent_filter (MutterPluginManager *plugin_mgr,
                                      XEvent              *xev)
 {
   GList *l;
+  gboolean have_plugin_xevent_func;
 
   if (!plugin_mgr)
     return FALSE;
 
   l = plugin_mgr->plugins;
 
+  /* 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.
+   *
+   * What happens if there are two plugins with xevent_filter functions
+   * is undefined; in general, multiple competing plugins are something
+   * we don't support well or care much about.
+   *
+   * FIXME: Really, we should just always handle sending the event to
+   *  clutter if a plugin doesn't report the event as handled by
+   *  returning TRUE, but it doesn't seem worth breaking compatibility
+   *  of the plugin interface right now to achieve this; the way it is
+   *  now works fine in practice.
+   */
+  have_plugin_xevent_func = FALSE;
+
   while (l)
     {
       MutterPlugin      *plugin = l->data;
@@ -598,6 +619,7 @@ mutter_plugin_manager_xevent_filter (MutterPluginManager *plugin_mgr,
 
       if (klass->xevent_filter)
         {
+          have_plugin_xevent_func = TRUE;
           if (klass->xevent_filter (plugin, xev) == TRUE)
             return TRUE;
         }
@@ -605,5 +627,8 @@ mutter_plugin_manager_xevent_filter (MutterPluginManager *plugin_mgr,
       l = l->next;
     }
 
+  if (!have_plugin_xevent_func)
+    return clutter_x11_handle_event (xev) != CLUTTER_X11_FILTER_CONTINUE;
+
   return FALSE;
 }



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