[clutter] events: Deliver touch events that continue off stage (soft grab)



commit 318d0d596509a5eb2fb74f02c85b52b416e9891d
Author: Emanuele Aina <emanuele aina collabora com>
Date:   Fri Oct 5 14:34:20 2012 +0200

    events: Deliver touch events that continue off stage (soft grab)
    
    If a button press happen on stage and the pointer is moved outside
    the stage while holding the mouse button, the motion and release
    events are still delivered to actors. Do the same X11 soft grab
    emulation for touch events.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=685589

 clutter/clutter-main.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c
index 089dc5a..46ae7d8 100644
--- a/clutter/clutter-main.c
+++ b/clutter/clutter-main.c
@@ -2700,6 +2700,27 @@ _clutter_process_event_details (ClutterActor        *stage,
            */
           if (event->any.source == NULL)
             {
+              /* same as the mouse events above, emulate the X11 implicit
+               * soft grab */
+              if (is_off_stage (stage, x, y))
+                {
+                  CLUTTER_NOTE (EVENT,
+                                "Touch %s off stage received at %.2f, %.2f",
+                                event->type == CLUTTER_TOUCH_UPDATE ? "Touch update" :
+                                event->type == CLUTTER_TOUCH_END ? "Touch end" :
+                                event->type == CLUTTER_TOUCH_CANCEL ? "Touch cancel" :
+                                "?", x, y);
+
+                  event->button.source = stage;
+
+                  emit_touch_event (event, device);
+
+                  if (event->type == CLUTTER_TOUCH_END)
+                    _clutter_input_device_remove_event_sequence (device, event);
+
+                  break;
+                }
+
               if (device != NULL)
                 actor = _clutter_input_device_update (device, sequence, TRUE);
               else



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