[mutter/wip/carlosg/input-thread: 86/159] clutter: Pass timestamp to clutter_input_device_set_actor()




commit ff881b94fae0307e7c7b7e9fedc1264e1d318a0c
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Jun 5 19:12:14 2020 +0200

    clutter: Pass timestamp to clutter_input_device_set_actor()
    
    This function emits crossing events, so needs a (most times truthful)
    timestamp. Make it explicit instead of fetching it from the device.

 clutter/clutter/clutter-input-device-private.h |  7 ++-----
 clutter/clutter/clutter-input-device.c         | 18 +++++++++++-------
 clutter/clutter/clutter-main.c                 |  9 ++++++---
 clutter/clutter/clutter-stage.c                |  3 ++-
 src/wayland/meta-wayland-pointer.c             |  3 ++-
 5 files changed, 23 insertions(+), 17 deletions(-)
---
diff --git a/clutter/clutter/clutter-input-device-private.h b/clutter/clutter/clutter-input-device-private.h
index 9b8dd37102..8396f3a9a0 100644
--- a/clutter/clutter/clutter-input-device-private.h
+++ b/clutter/clutter/clutter-input-device-private.h
@@ -185,15 +185,12 @@ void _clutter_input_device_set_state (ClutterInputDevice  *device,
 CLUTTER_EXPORT
 void _clutter_input_device_set_time (ClutterInputDevice *device,
                                      guint32             time_);
-void _clutter_input_device_set_actor (ClutterInputDevice   *device,
-                                      ClutterEventSequence *sequence,
-                                      ClutterActor         *actor,
-                                      gboolean              emit_crossing);
 CLUTTER_EXPORT
 ClutterActor * clutter_input_device_update (ClutterInputDevice   *device,
                                             ClutterEventSequence *sequence,
                                             ClutterStage         *stage,
-                                            gboolean              emit_crossing);
+                                            gboolean              emit_crossing,
+                                            uint32_t              time_);
 CLUTTER_EXPORT
 void _clutter_input_device_add_event_sequence (ClutterInputDevice *device,
                                                ClutterEvent       *event);
diff --git a/clutter/clutter/clutter-input-device.c b/clutter/clutter/clutter-input-device.c
index cc97271ab3..709d439a06 100644
--- a/clutter/clutter/clutter-input-device.c
+++ b/clutter/clutter/clutter-input-device.c
@@ -735,11 +735,12 @@ on_cursor_actor_reactive_changed (ClutterActor       *actor,
  *   - set to %TRUE the :has-pointer property of the new pointer
  *     actor
  */
-void
+static void
 _clutter_input_device_set_actor (ClutterInputDevice   *device,
                                  ClutterEventSequence *sequence,
                                  ClutterActor         *actor,
-                                 gboolean              emit_crossing)
+                                 gboolean              emit_crossing,
+                                 uint32_t              time_)
 {
   ClutterActor *old_actor = clutter_input_device_get_actor (device, sequence);
   ClutterStage *stage = NULL;
@@ -767,7 +768,7 @@ _clutter_input_device_set_actor (ClutterInputDevice   *device,
           ClutterEvent *event;
 
           event = clutter_event_new (CLUTTER_LEAVE);
-          event->crossing.time = device->current_time;
+          event->crossing.time = time_;
           event->crossing.flags = 0;
           event->crossing.stage = stage;
           event->crossing.source = old_actor;
@@ -804,7 +805,7 @@ _clutter_input_device_set_actor (ClutterInputDevice   *device,
           ClutterEvent *event;
 
           event = clutter_event_new (CLUTTER_ENTER);
-          event->crossing.time = device->current_time;
+          event->crossing.time = time_;
           event->crossing.flags = 0;
           event->crossing.stage = stage;
           event->crossing.x = device->current_x;
@@ -971,7 +972,8 @@ ClutterActor *
 clutter_input_device_update (ClutterInputDevice   *device,
                              ClutterEventSequence *sequence,
                              ClutterStage         *stage,
-                             gboolean              emit_crossing)
+                             gboolean              emit_crossing,
+                             uint32_t              time_)
 {
   ClutterActor *new_cursor_actor;
   ClutterActor *old_cursor_actor;
@@ -1008,7 +1010,8 @@ clutter_input_device_update (ClutterInputDevice   *device,
 
   _clutter_input_device_set_actor (device, sequence,
                                    new_cursor_actor,
-                                   emit_crossing);
+                                   emit_crossing,
+                                   time_);
 
   return new_cursor_actor;
 }
@@ -1611,7 +1614,8 @@ _clutter_input_device_remove_event_sequence (ClutterInputDevice *device,
 
       g_hash_table_replace (device->inv_touch_sequence_actors,
                             info->actor, sequences);
-      _clutter_input_device_set_actor (device, sequence, NULL, TRUE);
+      _clutter_input_device_set_actor (device, sequence, NULL, TRUE,
+                                       clutter_event_get_time (event));
     }
 
   g_hash_table_remove (device->touch_sequences_info, sequence);
diff --git a/clutter/clutter/clutter-main.c b/clutter/clutter/clutter-main.c
index 66af391c54..520d7ced02 100644
--- a/clutter/clutter/clutter-main.c
+++ b/clutter/clutter/clutter-main.c
@@ -1714,7 +1714,8 @@ _clutter_process_event_details (ClutterActor        *stage,
             emit_crossing_event (event, device);
 
             actor = clutter_input_device_update (device, NULL,
-                                                 CLUTTER_STAGE (stage), FALSE);
+                                                 CLUTTER_STAGE (stage), FALSE,
+                                                 clutter_event_get_time (event));
             if (actor != stage)
               {
                 ClutterEvent *crossing;
@@ -1870,7 +1871,8 @@ _clutter_process_event_details (ClutterActor        *stage,
 
               actor = clutter_input_device_update (device, NULL,
                                                    CLUTTER_STAGE (stage),
-                                                   TRUE);
+                                                   TRUE,
+                                                   clutter_event_get_time (event));
               if (actor == NULL)
                 break;
 
@@ -1980,7 +1982,8 @@ _clutter_process_event_details (ClutterActor        *stage,
 
               actor = clutter_input_device_update (device, sequence,
                                                    CLUTTER_STAGE (stage),
-                                                   TRUE);
+                                                   TRUE,
+                                                   clutter_event_get_time (event));
               if (actor == NULL)
                 break;
 
diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c
index c36a4bb6a8..3056d70c2c 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -1380,7 +1380,8 @@ clutter_stage_update_devices (ClutterStage *stage,
   for (l = devices; l; l = l->next)
     {
       ClutterInputDevice *device = l->data;
-      clutter_input_device_update (device, NULL, stage, TRUE);
+      clutter_input_device_update (device, NULL, stage, TRUE,
+                                   CLUTTER_CURRENT_TIME);
     }
 }
 
diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c
index 198b23d197..eb46ecc1d2 100644
--- a/src/wayland/meta-wayland-pointer.c
+++ b/src/wayland/meta-wayland-pointer.c
@@ -1047,7 +1047,8 @@ meta_wayland_pointer_repick (MetaWaylandPointer *pointer)
   MetaBackend *backend = meta_get_backend ();
   ClutterStage *stage = CLUTTER_STAGE (meta_backend_get_stage (backend));
 
-  clutter_input_device_update (pointer->device, NULL, stage, FALSE);
+  clutter_input_device_update (pointer->device, NULL, stage, FALSE,
+                               CLUTTER_CURRENT_TIME);
   repick_for_event (pointer, NULL);
 }
 


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