[gtk: 2/3] Drop pointer_emulated discrete scroll events




commit 7752467847c14ea1c84a716110d0b3e7ab152afe
Author: Luca Bacci <luca bacci982 gmail com>
Date:   Fri May 6 13:50:23 2022 +0200

    Drop pointer_emulated discrete scroll events
    
    GTK4 has had smooth scroll events since the beginning, so we
    prefer not to emit emulated discrete scroll events at all

 gdk/broadway/gdkeventsource.c         |  3 +--
 gdk/gdkevents.c                       | 12 +-----------
 gdk/gdkeventsprivate.h                |  6 +-----
 gdk/macos/gdkmacosdisplay-translate.c |  3 +--
 gdk/wayland/gdkdevice-wayland.c       |  3 +--
 gdk/x11/gdkdevicemanager-xi2.c        |  6 ++----
 6 files changed, 7 insertions(+), 26 deletions(-)
---
diff --git a/gdk/broadway/gdkeventsource.c b/gdk/broadway/gdkeventsource.c
index 9ae9022a41..045c8f3040 100644
--- a/gdk/broadway/gdkeventsource.c
+++ b/gdk/broadway/gdkeventsource.c
@@ -189,8 +189,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
                                                message->pointer.state,
                                                message->scroll.dir == 0
                                                  ? GDK_SCROLL_UP
-                                                 : GDK_SCROLL_DOWN,
-                                               FALSE);
+                                                 : GDK_SCROLL_DOWN);
 
         node = _gdk_event_queue_append (display, event);
         _gdk_windowing_got_event (display, node, event, message->base.serial);
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index cc06e5e0c0..044eb72292 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -920,14 +920,6 @@ gdk_event_get_pointer_emulated (GdkEvent *event)
         return tevent->pointer_emulated;
       }
 
-    case GDK_SCROLL:
-    case GDK_SCROLL_SMOOTH:
-      {
-        GdkScrollEvent *sevent = (GdkScrollEvent *) event;
-
-        return sevent->pointer_emulated;
-      }
-
     default:
       break;
     }
@@ -2373,15 +2365,13 @@ gdk_scroll_event_new_discrete (GdkSurface         *surface,
                                GdkDeviceTool      *tool,
                                guint32             time,
                                GdkModifierType     state,
-                               GdkScrollDirection  direction,
-                               gboolean            emulated)
+                               GdkScrollDirection  direction)
 {
   GdkScrollEvent *self = gdk_event_alloc (GDK_SCROLL, surface, device, time);
 
   self->tool = tool != NULL ? g_object_ref (tool) : NULL;
   self->state = state;
   self->direction = direction;
-  self->pointer_emulated = emulated;
   self->unit = GDK_SCROLL_UNIT_WHEEL;
 
   return (GdkEvent *) self;
diff --git a/gdk/gdkeventsprivate.h b/gdk/gdkeventsprivate.h
index 3b1bcd4b94..3d6c507a0e 100644
--- a/gdk/gdkeventsprivate.h
+++ b/gdk/gdkeventsprivate.h
@@ -206,8 +206,6 @@ struct _GdkTouchEvent
  *   %GDK_SCROLL_SMOOTH).
  * @delta_x: the x coordinate of the scroll delta
  * @delta_y: the y coordinate of the scroll delta
- * @pointer_emulated: whether the scroll event was the result of
- *   a pointer emulation
  * @tool: a `GdkDeviceTool`
  * @history: (element-type GdkTimeCoord): array of times and deltas
  *   for other scroll events that were compressed before delivering the
@@ -231,7 +229,6 @@ struct _GdkScrollEvent
   GdkScrollDirection direction;
   double delta_x;
   double delta_y;
-  gboolean pointer_emulated;
   gboolean is_stop;
   GdkDeviceTool *tool;
   GArray *history; /* <GdkTimeCoord> */
@@ -496,8 +493,7 @@ GdkEvent * gdk_scroll_event_new_discrete (GdkSurface         *surface,
                                           GdkDeviceTool      *tool,
                                           guint32             time,
                                           GdkModifierType     state,
-                                          GdkScrollDirection  direction,
-                                          gboolean            emulated);
+                                          GdkScrollDirection  direction);
 
 GdkEvent * gdk_touch_event_new          (GdkEventType      type,
                                          GdkEventSequence *sequence,
diff --git a/gdk/macos/gdkmacosdisplay-translate.c b/gdk/macos/gdkmacosdisplay-translate.c
index 7767faef67..7eaa6dca03 100644
--- a/gdk/macos/gdkmacosdisplay-translate.c
+++ b/gdk/macos/gdkmacosdisplay-translate.c
@@ -700,8 +700,7 @@ fill_scroll_event (GdkMacosDisplay *self,
                                            NULL,
                                            get_time_from_ns_event (nsevent),
                                            state,
-                                           direction,
-                                           FALSE);
+                                           direction);
     }
 
   if (phase == NSEventPhaseEnded || phase == NSEventPhaseCancelled)
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 322ee2d88b..2d192f8550 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -1394,8 +1394,7 @@ flush_discrete_scroll_event (GdkWaylandSeat     *seat,
                                          NULL,
                                          seat->pointer_info.time,
                                          device_get_modifiers (seat->logical_pointer),
-                                         direction,
-                                         TRUE);
+                                         direction);
 
   _gdk_wayland_display_deliver_event (seat->display, event);
 }
diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c
index be5598ed25..a146333b5d 100644
--- a/gdk/x11/gdkdevicemanager-xi2.c
+++ b/gdk/x11/gdkdevicemanager-xi2.c
@@ -1655,8 +1655,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
                                                    NULL,
                                                    xev->time,
                                                    _gdk_x11_device_xi2_translate_state (&xev->mods, 
&xev->buttons, &xev->group),
-                                                   direction,
-                                                   FALSE);
+                                                   direction);
 
           }
         else
@@ -1758,8 +1757,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
                                                        NULL,
                                                        xev->time,
                                                        state,
-                                                       direction,
-                                                       FALSE);
+                                                       direction);
               }
             else
               {


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