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




commit b9a443b59aa792850bbb8aa6fae65f3324a63cd6
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.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403

 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 e2851ed054..9c4e72fd27 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 2deee45510..c3a6dc51b6 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 6162db2e24..0a21d1f254 100644
--- a/clutter/clutter/clutter-main.c
+++ b/clutter/clutter/clutter-main.c
@@ -1625,7 +1625,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;
@@ -1776,7 +1777,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;
 
@@ -1886,7 +1888,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 210f813baa..dfd46ddafa 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -1363,7 +1363,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]