[mutter] window: Implement single-touch window dragging



commit f28f5dc0b66f9acd6fd990b44ee48e21a1e8e23d
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Jul 22 01:17:40 2014 +0200

    window: Implement single-touch window dragging
    
    On X11 this works because only emulated pointer events are listened for. On
    wayland, the single touch behavior must be enforced in touch events, ignoring
    every other sequence.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=733631

 src/core/window.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index 21b94d8..f21b682 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -6121,6 +6121,7 @@ gboolean
 meta_window_handle_mouse_grab_op_event  (MetaWindow         *window,
                                          const ClutterEvent *event)
 {
+  ClutterEventSequence *sequence = clutter_event_get_event_sequence (event);
   ClutterModifierType modifier_state;
   gfloat x, y;
 
@@ -6141,6 +6142,12 @@ meta_window_handle_mouse_grab_op_event  (MetaWindow         *window,
         }
       return TRUE;
 
+    case CLUTTER_TOUCH_END:
+      if (meta_display_is_pointer_emulating_sequence (window->display, sequence))
+        end_grab_op (window, event);
+
+      return TRUE;
+
     case CLUTTER_BUTTON_RELEASE:
       if (event->button.button == 1 ||
           event->button.button == (unsigned int) meta_prefs_get_mouse_button_resize ())
@@ -6150,6 +6157,17 @@ meta_window_handle_mouse_grab_op_event  (MetaWindow         *window,
         }
       return TRUE;
 
+    case CLUTTER_TOUCH_BEGIN:
+      /* This will only catch the keybinding and menu cases, just deal with this
+       * like a CLUTTER_TOUCH_UPDATE rather than a CLUTTER_BUTTON_PRESS, and
+       * wait until CLUTTER_TOUCH_END to undo the grab, just so the window
+       * doesn't warp below the finger and remain there.
+       */
+    case CLUTTER_TOUCH_UPDATE:
+      if (!meta_display_is_pointer_emulating_sequence (window->display, sequence))
+        return FALSE;
+
+      /* Fall through */
     case CLUTTER_MOTION:
       modifier_state = clutter_event_get_state (event);
       clutter_event_get_coords (event, &x, &y);


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