[mutter/wip/carlosg/input-thread: 30/104] clutter: Specify stage on clutter_input_device_update() function




commit 9dc337ec46a5581d5e8e8c4a01c57501a1706498
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Jun 5 15:33:25 2020 +0200

    clutter: Specify stage on clutter_input_device_update() function
    
    This is the function performing the picking, tell it explicitly the
    stage it should happen on.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403

 clutter/clutter/clutter-input-device-private.h |  5 +++--
 clutter/clutter/clutter-input-device.c         | 11 +----------
 clutter/clutter/clutter-main.c                 | 15 ++++++++++++---
 clutter/clutter/clutter-stage.c                |  2 +-
 src/wayland/meta-wayland-pointer.c             |  5 ++++-
 5 files changed, 21 insertions(+), 17 deletions(-)
---
diff --git a/clutter/clutter/clutter-input-device-private.h b/clutter/clutter/clutter-input-device-private.h
index cad9b23a17..ed4c48073d 100644
--- a/clutter/clutter/clutter-input-device-private.h
+++ b/clutter/clutter/clutter-input-device-private.h
@@ -200,8 +200,9 @@ void _clutter_input_device_set_actor (ClutterInputDevice   *device,
                                       gboolean              emit_crossing);
 CLUTTER_EXPORT
 ClutterActor * clutter_input_device_update (ClutterInputDevice   *device,
-                                           ClutterEventSequence *sequence,
-                                           gboolean              emit_crossing);
+                                            ClutterEventSequence *sequence,
+                                            ClutterStage         *stage,
+                                            gboolean              emit_crossing);
 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 ae52292a0b..5f6ad11888 100644
--- a/clutter/clutter/clutter-input-device.c
+++ b/clutter/clutter/clutter-input-device.c
@@ -1001,9 +1001,9 @@ clutter_input_device_get_coords (ClutterInputDevice   *device,
 ClutterActor *
 clutter_input_device_update (ClutterInputDevice   *device,
                              ClutterEventSequence *sequence,
+                             ClutterStage         *stage,
                              gboolean              emit_crossing)
 {
-  ClutterStage *stage;
   ClutterActor *new_cursor_actor;
   ClutterActor *old_cursor_actor;
   graphene_point_t point = GRAPHENE_POINT_INIT (-1.0f, -1.0f);
@@ -1012,15 +1012,6 @@ clutter_input_device_update (ClutterInputDevice   *device,
   g_assert (device_type != CLUTTER_KEYBOARD_DEVICE &&
             device_type != CLUTTER_PAD_DEVICE);
 
-  stage = device->stage;
-  if (G_UNLIKELY (stage == NULL))
-    {
-      CLUTTER_NOTE (EVENT, "No stage defined for device %d '%s'",
-                    clutter_input_device_get_device_id (device),
-                    clutter_input_device_get_device_name (device));
-      return NULL;
-    }
-
   clutter_input_device_get_coords (device, sequence, &point);
 
   old_cursor_actor = clutter_input_device_get_actor (device, sequence);
diff --git a/clutter/clutter/clutter-main.c b/clutter/clutter/clutter-main.c
index 1dbca4782d..2f6f4d1462 100644
--- a/clutter/clutter/clutter-main.c
+++ b/clutter/clutter/clutter-main.c
@@ -1624,7 +1624,8 @@ _clutter_process_event_details (ClutterActor        *stage,
 
             emit_crossing_event (event, device);
 
-            actor = clutter_input_device_update (device, NULL, FALSE);
+            actor = clutter_input_device_update (device, NULL,
+                                                 CLUTTER_STAGE (stage), FALSE);
             if (actor != stage)
               {
                 ClutterEvent *crossing;
@@ -1778,7 +1779,11 @@ _clutter_process_event_details (ClutterActor        *stage,
                * get the actor underneath
                */
               if (device != NULL)
-                actor = clutter_input_device_update (device, NULL, TRUE);
+                {
+                  actor = clutter_input_device_update (device, NULL,
+                                                       CLUTTER_STAGE (stage),
+                                                       TRUE);
+                }
               else
                 {
                   CLUTTER_NOTE (EVENT, "No device found: picking");
@@ -1896,7 +1901,11 @@ _clutter_process_event_details (ClutterActor        *stage,
                 }
 
               if (device != NULL)
-                actor = clutter_input_device_update (device, sequence, TRUE);
+                {
+                  actor = clutter_input_device_update (device, sequence,
+                                                       CLUTTER_STAGE (stage),
+                                                       TRUE);
+                }
               else
                 {
                   CLUTTER_NOTE (EVENT, "No device found: picking");
diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c
index c9680388b6..fb6c81e399 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -1366,7 +1366,7 @@ clutter_stage_update_devices (ClutterStage *stage,
   for (l = devices; l; l = l->next)
     {
       ClutterInputDevice *device = l->data;
-      clutter_input_device_update (device, NULL, TRUE);
+      clutter_input_device_update (device, NULL, stage, TRUE);
     }
 }
 
diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c
index ab2ae9315e..198b23d197 100644
--- a/src/wayland/meta-wayland-pointer.c
+++ b/src/wayland/meta-wayland-pointer.c
@@ -1044,7 +1044,10 @@ meta_wayland_pointer_start_popup_grab (MetaWaylandPointer      *pointer,
 void
 meta_wayland_pointer_repick (MetaWaylandPointer *pointer)
 {
-  clutter_input_device_update (pointer->device, NULL, FALSE);
+  MetaBackend *backend = meta_get_backend ();
+  ClutterStage *stage = CLUTTER_STAGE (meta_backend_get_stage (backend));
+
+  clutter_input_device_update (pointer->device, NULL, stage, FALSE);
   repick_for_event (pointer, NULL);
 }
 


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