[mutter] events: Handle move/resize grab ops as a first special case



commit 813206393a8365f3b6ceecf283f4c4f6a97e668a
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Apr 21 11:21:19 2014 -0400

    events: Handle move/resize grab ops as a first special case

 src/core/events.c         |   39 +++++++++++++--------------------------
 src/core/window-private.h |    4 ++--
 src/core/window.c         |   10 +++++-----
 3 files changed, 20 insertions(+), 33 deletions(-)
---
diff --git a/src/core/events.c b/src/core/events.c
index 0b35945..51b17a1 100644
--- a/src/core/events.c
+++ b/src/core/events.c
@@ -1941,6 +1941,17 @@ meta_display_handle_event (MetaDisplay        *display,
         }
     }
 
+  if (display->grab_window == window &&
+      meta_grab_op_is_moving_or_resizing (display->grab_op))
+    {
+      if (meta_window_handle_mouse_grab_op_event (window, event))
+        {
+          bypass_clutter = TRUE;
+          bypass_wayland = TRUE;
+          goto out;
+        }
+    }
+
   switch (event->type)
     {
     case CLUTTER_BUTTON_PRESS:
@@ -1949,14 +1960,6 @@ meta_display_handle_event (MetaDisplay        *display,
 
       display->overlay_key_only_pressed = FALSE;
 
-      if (display->grab_window == window &&
-          meta_grab_op_is_moving_or_resizing (display->grab_op))
-        {
-          meta_window_handle_mouse_grab_op_event (window, event);
-          bypass_clutter = TRUE;
-          bypass_wayland = TRUE;
-        }
-
       if (window && display->grab_op == META_GRAB_OP_NONE)
         {
           ClutterModifierType grab_mask;
@@ -2111,26 +2114,9 @@ meta_display_handle_event (MetaDisplay        *display,
         break;
 
       display->overlay_key_only_pressed = FALSE;
-
-      if (display->grab_window == window &&
-          meta_grab_op_is_moving_or_resizing (display->grab_op))
-        {
-          meta_window_handle_mouse_grab_op_event (window, event);
-          bypass_clutter = TRUE;
-          bypass_wayland = TRUE;
-        }
       break;
-    case CLUTTER_MOTION:
-      if (grab_op_should_block_mouse_events (display->grab_op))
-        break;
 
-      if (display->grab_window == window &&
-          meta_grab_op_is_moving_or_resizing (display->grab_op))
-        {
-          meta_window_handle_mouse_grab_op_event (window, event);
-          bypass_clutter = TRUE;
-          bypass_wayland = TRUE;
-        }
+    case CLUTTER_MOTION:
       break;
 
     case CLUTTER_KEY_PRESS:
@@ -2152,6 +2138,7 @@ meta_display_handle_event (MetaDisplay        *display,
       break;
     }
 
+ out:
   /* If the compositor has a grab, don't pass that through to Wayland */
   if (display->grab_op == META_GRAB_OP_COMPOSITOR)
     bypass_wayland = TRUE;
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 2efd620..a865fe0 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -643,8 +643,8 @@ void meta_window_update_sync_request_counter (MetaWindow *window,
                                               gint64      new_counter_value);
 #endif /* HAVE_XSYNC */
 
-void meta_window_handle_mouse_grab_op_event  (MetaWindow         *window,
-                                              const ClutterEvent *event);
+gboolean meta_window_handle_mouse_grab_op_event  (MetaWindow         *window,
+                                                  const ClutterEvent *event);
 
 GList* meta_window_get_workspaces (MetaWindow *window);
 
diff --git a/src/core/window.c b/src/core/window.c
index 4306fb8..48bc18e 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -7564,7 +7564,7 @@ end_grab_op (MetaWindow *window,
   meta_display_end_grab_op (window->display, event->any.time);
 }
 
-void
+gboolean
 meta_window_handle_mouse_grab_op_event  (MetaWindow         *window,
                                          const ClutterEvent *event)
 {
@@ -7582,7 +7582,7 @@ meta_window_handle_mouse_grab_op_event  (MetaWindow         *window,
         {
           end_grab_op (window, event);
         }
-      break;
+      return TRUE;
 
     case CLUTTER_BUTTON_RELEASE:
       if (event->button.button == 1 ||
@@ -7590,7 +7590,7 @@ meta_window_handle_mouse_grab_op_event  (MetaWindow         *window,
         {
           end_grab_op (window, event);
         }
-      break;
+      return TRUE;
 
     case CLUTTER_MOTION:
       meta_display_check_threshold_reached (window->display,
@@ -7611,10 +7611,10 @@ meta_window_handle_mouse_grab_op_event  (MetaWindow         *window,
                          event->motion.y,
                          FALSE);
         }
-      break;
+      return TRUE;
 
     default:
-      break;
+      return FALSE;
     }
 }
 


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