[mutter/wip/focus: 14/16] compositor: fix mouse interactions on frames



commit 394b44a2c28f03eff410c99daecf2ee113effbe8
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Wed Feb 26 23:46:08 2014 +0100

    compositor: fix mouse interactions on frames
    
    meta_ui_window_is_widget() returns FALSE for frame windows, so we
    must filter those explicitly (by letting the event go to gtk
    and from there to MetaFrames). Also, for proper gtk widgets
    (window menus) we want to let gtk see all events, including
    keyboard, otherwise we break keynav in the window menu.
    This means that having a window menu open disables keybindings
    (because the event doesn't run through clutter)

 src/compositor/compositor.c             |   13 +++++++++----
 src/compositor/meta-surface-actor-x11.c |    1 +
 2 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index 8982bbd..bb2092f 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -76,6 +76,7 @@
 #include "window-private.h" /* to check window->hidden */
 #include "display-private.h" /* for meta_display_lookup_x_window() */
 #include "util-private.h"
+#include "frame.h"
 #include "meta-wayland-private.h"
 #include "meta-wayland-pointer.h"
 #include "meta-wayland-keyboard.h"
@@ -963,6 +964,7 @@ meta_compositor_window_surface_changed (MetaCompositor *compositor,
  */
 static void
 maybe_spoof_event_as_stage_event (MetaCompScreen *info,
+                                  MetaWindow     *window,
                                   XEvent         *event)
 {
   MetaDisplay *display = meta_screen_get_display (info->screen);
@@ -978,14 +980,17 @@ maybe_spoof_event_as_stage_event (MetaCompScreen *info,
         case XI_Motion:
         case XI_ButtonPress:
         case XI_ButtonRelease:
+          /* If this is a window frame, let GTK+ handle it without mangling */
+          if (window && window->frame && device_event->event == window->frame->xwindow)
+            break;
+
+        case XI_KeyPress:
+        case XI_KeyRelease:
             /* If this is a GTK+ widget, like a window menu, let GTK+ handle
              * it as-is without mangling. */
             if (meta_ui_window_is_widget (info->screen->ui, device_event->event))
               break;
 
-            /* fall through */
-        case XI_KeyPress:
-        case XI_KeyRelease:
             device_event->event = clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage));
           break;
         default:
@@ -1021,7 +1026,7 @@ meta_compositor_process_event (MetaCompositor *compositor,
       return TRUE;
     }
 
-  maybe_spoof_event_as_stage_event (info, event);
+  maybe_spoof_event_as_stage_event (info, window, event);
 
   if (meta_plugin_manager_xevent_filter (info->plugin_mgr, event))
     {
diff --git a/src/compositor/meta-surface-actor-x11.c b/src/compositor/meta-surface-actor-x11.c
index 020c847..cc2f0a5 100644
--- a/src/compositor/meta-surface-actor-x11.c
+++ b/src/compositor/meta-surface-actor-x11.c
@@ -456,6 +456,7 @@ meta_surface_actor_x11_new (MetaWindow *window)
   priv->unredirected = FALSE;
   sync_unredirected (self);
 
+  clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE);
   return META_SURFACE_ACTOR (self);
 }
 


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