[mutter/wayland] wayland: Exempt CLICKING grab ops when syncing wayland input focus



commit 76dc0ca681819e2cbb7f422c6a7f4fef6aeea0e1
Author: Rui Matos <tiagomatos gmail com>
Date:   Mon Mar 17 20:53:19 2014 +0100

    wayland: Exempt CLICKING grab ops when syncing wayland input focus
    
    If we have a CLICKING grab op we still need to send events to xwayland
    so that we get them back for gtk+ to process thus we can't steer
    wayland input focus away from it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=726123

 src/compositor/compositor.c     |   25 +------------------------
 src/core/display-private.h      |    2 ++
 src/core/display.c              |   33 +++++++++++++++++++++++++++++++--
 src/wayland/meta-wayland-seat.c |    2 +-
 4 files changed, 35 insertions(+), 27 deletions(-)
---
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index 6a5fb46..2d79875 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -848,29 +848,6 @@ meta_compositor_window_surface_changed (MetaCompositor *compositor,
 }
 
 static gboolean
-grab_op_is_clicking (MetaGrabOp grab_op)
-{
-  switch (grab_op)
-    {
-    case META_GRAB_OP_CLICKING_MINIMIZE:
-    case META_GRAB_OP_CLICKING_MAXIMIZE:
-    case META_GRAB_OP_CLICKING_UNMAXIMIZE:
-    case META_GRAB_OP_CLICKING_DELETE:
-    case META_GRAB_OP_CLICKING_MENU:
-    case META_GRAB_OP_CLICKING_SHADE:
-    case META_GRAB_OP_CLICKING_UNSHADE:
-    case META_GRAB_OP_CLICKING_ABOVE:
-    case META_GRAB_OP_CLICKING_UNABOVE:
-    case META_GRAB_OP_CLICKING_STICK:
-    case META_GRAB_OP_CLICKING_UNSTICK:
-      return TRUE;
-
-    default:
-      return FALSE;
-    }
-}
-
-static gboolean
 event_is_passive_button_grab (MetaDisplay   *display,
                               XIDeviceEvent *device_event)
 {
@@ -925,7 +902,7 @@ maybe_spoof_event_as_stage_event (MetaCompScreen *info,
           /* If this is a window frame, and we think GTK+ needs to handle the event,
              let GTK+ handle it without mangling */
           if (window && window->frame && device_event->event == window->frame->xwindow &&
-              (grab_op_is_clicking (display->grab_op) ||
+              (meta_grab_op_is_clicking (display->grab_op) ||
                (display->grab_op == META_GRAB_OP_NONE && !event_is_passive_button_grab (display, 
device_event))))
             break;
 
diff --git a/src/core/display-private.h b/src/core/display-private.h
index 14725c1..c4548fc 100644
--- a/src/core/display-private.h
+++ b/src/core/display-private.h
@@ -454,6 +454,8 @@ int meta_resize_gravity_from_grab_op (MetaGrabOp op);
 gboolean meta_grab_op_is_moving   (MetaGrabOp op);
 gboolean meta_grab_op_is_resizing (MetaGrabOp op);
 gboolean meta_grab_op_is_mouse    (MetaGrabOp op);
+gboolean meta_grab_op_is_clicking (MetaGrabOp op);
+gboolean meta_grab_op_is_wayland  (MetaGrabOp op);
 
 void meta_display_devirtualize_modifiers (MetaDisplay        *display,
                                           MetaVirtualModifier modifiers,
diff --git a/src/core/display.c b/src/core/display.c
index 58dede3..67efd2c 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -1424,6 +1424,35 @@ grab_op_should_block_mouse_events (MetaGrabOp op)
     }
 }
 
+gboolean
+meta_grab_op_is_clicking (MetaGrabOp grab_op)
+{
+  switch (grab_op)
+    {
+    case META_GRAB_OP_CLICKING_MINIMIZE:
+    case META_GRAB_OP_CLICKING_MAXIMIZE:
+    case META_GRAB_OP_CLICKING_UNMAXIMIZE:
+    case META_GRAB_OP_CLICKING_DELETE:
+    case META_GRAB_OP_CLICKING_MENU:
+    case META_GRAB_OP_CLICKING_SHADE:
+    case META_GRAB_OP_CLICKING_UNSHADE:
+    case META_GRAB_OP_CLICKING_ABOVE:
+    case META_GRAB_OP_CLICKING_UNABOVE:
+    case META_GRAB_OP_CLICKING_STICK:
+    case META_GRAB_OP_CLICKING_UNSTICK:
+      return TRUE;
+
+    default:
+      return FALSE;
+    }
+}
+
+gboolean
+meta_grab_op_is_wayland (MetaGrabOp op)
+{
+  return (op != META_GRAB_OP_NONE && !meta_grab_op_is_clicking (op));
+}
+
 /**
  * meta_display_xserver_time_is_before:
  * @display: a #MetaDisplay
@@ -1748,7 +1777,7 @@ meta_display_sync_wayland_input_focus (MetaDisplay *display)
   MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
   MetaWindow *focus_window;
 
-  if (display->grab_op != META_GRAB_OP_NONE)
+  if (meta_grab_op_is_wayland (display->grab_op))
     focus_window = NULL;
   else if (meta_display_xwindow_is_a_no_focus_window (display, display->focus_xwindow))
     focus_window = NULL;
@@ -1759,7 +1788,7 @@ meta_display_sync_wayland_input_focus (MetaDisplay *display)
 
   meta_wayland_compositor_set_input_focus (compositor, focus_window);
 
-  if (display->grab_op != META_GRAB_OP_NONE)
+  if (meta_grab_op_is_wayland (display->grab_op))
     meta_wayland_pointer_set_focus (&compositor->seat->pointer, NULL);
   else
     meta_wayland_seat_repick (compositor->seat, NULL);
diff --git a/src/wayland/meta-wayland-seat.c b/src/wayland/meta-wayland-seat.c
index 4b08e4a..8ec7b2b 100644
--- a/src/wayland/meta-wayland-seat.c
+++ b/src/wayland/meta-wayland-seat.c
@@ -436,7 +436,7 @@ meta_wayland_seat_repick (MetaWaylandSeat    *seat,
   MetaWaylandSurface *surface = NULL;
   MetaDisplay        *display = meta_get_display ();
 
-  if (display->grab_op != META_GRAB_OP_NONE)
+  if (meta_grab_op_is_wayland (display->grab_op))
     {
       meta_wayland_pointer_update_current_focus (pointer, NULL);
       return;


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