[gtk/wip/carlosg/fixes: 2/8] gdkevent: Give touchpad hold events a sequence




commit 6238f97cb632704aea3c061c97ce76163eab9e1e
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Aug 5 11:35:28 2022 +0200

    gdkevent: Give touchpad hold events a sequence
    
    Following what was done for pinch/swipe events, give hold gestures their
    own distinct sequence as well. Without this it was NULL, which was already
    distinct to other touchpad gestures.

 gdk/gdkevents.c                 | 2 ++
 gdk/gdkeventsprivate.h          | 1 +
 gdk/wayland/gdkdevice-wayland.c | 4 ++++
 gtk/gtkmain.c                   | 1 +
 4 files changed, 8 insertions(+)
---
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index 044eb72292..ba185c2ffb 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -2611,6 +2611,7 @@ gdk_touchpad_event_new_pinch (GdkSurface              *surface,
 
 GdkEvent *
 gdk_touchpad_event_new_hold (GdkSurface              *surface,
+                             GdkEventSequence        *sequence,
                              GdkDevice               *device,
                              guint32                  time,
                              GdkModifierType          state,
@@ -2623,6 +2624,7 @@ gdk_touchpad_event_new_hold (GdkSurface              *surface,
 
   self->state = state;
   self->phase = phase;
+  self->sequence = sequence;
   self->x = x;
   self->y = y;
   self->n_fingers = n_fingers;
diff --git a/gdk/gdkeventsprivate.h b/gdk/gdkeventsprivate.h
index 3d6c507a0e..661de6baa8 100644
--- a/gdk/gdkeventsprivate.h
+++ b/gdk/gdkeventsprivate.h
@@ -533,6 +533,7 @@ GdkEvent * gdk_touchpad_event_new_pinch (GdkSurface              *surface,
                                          double                   angle_delta);
 
 GdkEvent * gdk_touchpad_event_new_hold  (GdkSurface              *surface,
+                                         GdkEventSequence        *sequence,
                                          GdkDevice               *device,
                                          guint32                  time,
                                          GdkModifierType          state,
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index e407ce811e..35a0fcc30d 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -2840,7 +2840,11 @@ emit_gesture_hold_event (GdkWaylandSeat          *seat,
 
   seat->pointer_info.time = _time;
 
+  if (phase == GDK_TOUCHPAD_GESTURE_PHASE_BEGIN)
+    seat->pointer_info.touchpad_event_sequence++;
+
   event = gdk_touchpad_event_new_hold (seat->pointer_info.focus,
+                                       GDK_SLOT_TO_EVENT_SEQUENCE 
(seat->pointer_info.touchpad_event_sequence),
                                        seat->logical_pointer,
                                        _time,
                                        device_get_modifiers (seat->logical_pointer),
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 80c7542b03..de77602d9f 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -973,6 +973,7 @@ rewrite_event_for_surface (GdkEvent  *event,
                                            gdk_touchpad_event_get_pinch_angle_delta (event));
     case GDK_TOUCHPAD_HOLD:
       return gdk_touchpad_event_new_hold (new_surface,
+                                          gdk_event_get_event_sequence (event),
                                           gdk_event_get_device (event),
                                           gdk_event_get_time (event),
                                           gdk_event_get_modifier_state (event),


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