[clutter] evdev: Mark either of smooth/discrete scroll events as emulating



commit a9f16c3d1f3152eab1987cb84562872685a08bac
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Oct 23 16:56:00 2015 +0200

    evdev: Mark either of smooth/discrete scroll events as emulating
    
    We're always emulating one of those, depending on the scrolling
    device/source, so mark these as such.

 clutter/evdev/clutter-device-manager-evdev.c |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/clutter/evdev/clutter-device-manager-evdev.c b/clutter/evdev/clutter-device-manager-evdev.c
index 32ffea8..ffb535a 100644
--- a/clutter/evdev/clutter-device-manager-evdev.c
+++ b/clutter/evdev/clutter-device-manager-evdev.c
@@ -454,7 +454,8 @@ discrete_to_direction (gdouble discrete_x,
 static void
 notify_discrete_scroll (ClutterInputDevice     *input_device,
                         guint32                 time_,
-                        ClutterScrollDirection  direction)
+                        ClutterScrollDirection  direction,
+                        gboolean                emulated)
 {
   ClutterInputDeviceEvdev *device_evdev;
   ClutterSeatEvdev *seat;
@@ -487,6 +488,8 @@ notify_discrete_scroll (ClutterInputDevice     *input_device,
   clutter_event_set_device (event, seat->core_pointer);
   clutter_event_set_source_device (event, input_device);
 
+  _clutter_event_set_pointer_emulated (event, emulated);
+
   queue_event (event);
 }
 
@@ -494,7 +497,8 @@ static void
 notify_scroll (ClutterInputDevice *input_device,
                guint32             time_,
                gdouble             dx,
-               gdouble             dy)
+               gdouble             dy,
+               gboolean            emulated)
 {
   ClutterInputDeviceEvdev *device_evdev;
   ClutterSeatEvdev *seat;
@@ -532,6 +536,8 @@ notify_scroll (ClutterInputDevice *input_device,
   clutter_event_set_device (event, seat->core_pointer);
   clutter_event_set_source_device (event, input_device);
 
+  _clutter_event_set_pointer_emulated (event, emulated);
+
   queue_event (event);
 }
 
@@ -1277,14 +1283,16 @@ check_notify_discrete_scroll (ClutterDeviceManagerEvdev *manager_evdev,
     {
       notify_discrete_scroll (device, time_,
                               seat->accum_scroll_dx > 0 ?
-                              CLUTTER_SCROLL_RIGHT : CLUTTER_SCROLL_LEFT);
+                              CLUTTER_SCROLL_RIGHT : CLUTTER_SCROLL_LEFT,
+                              TRUE);
     }
 
   for (i = 0; i < n_yscrolls; i++)
     {
       notify_discrete_scroll (device, time_,
                               seat->accum_scroll_dy > 0 ?
-                              CLUTTER_SCROLL_DOWN : CLUTTER_SCROLL_UP);
+                              CLUTTER_SCROLL_DOWN : CLUTTER_SCROLL_UP,
+                              TRUE);
     }
 
   seat->accum_scroll_dx = fmodf (seat->accum_scroll_dx, DISCRETE_SCROLL_STEP);
@@ -1450,12 +1458,13 @@ process_device_event (ClutterDeviceManagerEvdev *manager_evdev,
           {
             notify_scroll (device, time,
                            discrete_x * DISCRETE_SCROLL_STEP,
-                           discrete_y * DISCRETE_SCROLL_STEP);
-            notify_discrete_scroll (device, time, discrete_to_direction (discrete_x, discrete_y));
+                           discrete_y * DISCRETE_SCROLL_STEP,
+                           TRUE);
+            notify_discrete_scroll (device, time, discrete_to_direction (discrete_x, discrete_y), FALSE);
           }
         else
           {
-            notify_scroll (device, time, dx, dy);
+            notify_scroll (device, time, dx, dy, FALSE);
             check_notify_discrete_scroll (manager_evdev, device, time);
           }
 


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