[mutter/wip/carlosg/crossings: 6/11] clutter/main: Add clutter_stage_repick_device() call




commit b04e326572deb63882f7365ef9643467c369f750
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Dec 22 18:22:41 2020 +0100

    clutter/main: Add clutter_stage_repick_device() call
    
    This is the very same code than meta_wayland_pointer_repick(),
    made part of Clutter, so triggering repicks on the same pointer
    coordinates is made easy.
    
    The intention is to remove meta_wayland_pointer_repick() in favor
    of this call.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1654>

 clutter/clutter/clutter-main.c   | 20 ++++++++++++++++++++
 clutter/clutter/clutter-mutter.h |  3 +++
 2 files changed, 23 insertions(+)
---
diff --git a/clutter/clutter/clutter-main.c b/clutter/clutter/clutter-main.c
index 1ce5320125..c2d31b4dd8 100644
--- a/clutter/clutter/clutter-main.c
+++ b/clutter/clutter/clutter-main.c
@@ -1642,6 +1642,26 @@ clutter_stage_update_device (ClutterStage         *stage,
     }
 }
 
+void
+clutter_stage_repick_device (ClutterStage       *stage,
+                             ClutterInputDevice *device)
+{
+  graphene_point_t point;
+  ClutterActor *new_actor;
+
+  clutter_stage_get_device_coords (stage, device, NULL, &point);
+  new_actor =
+    clutter_stage_get_actor_at_pos (stage, CLUTTER_PICK_REACTIVE,
+                                    point.x, point.y);
+
+  clutter_stage_update_device (stage,
+                               device, NULL,
+                               point,
+                               CLUTTER_CURRENT_TIME,
+                               new_actor,
+                               TRUE);
+}
+
 static ClutterActor *
 update_device_for_event (ClutterStage *stage,
                          ClutterEvent *event,
diff --git a/clutter/clutter/clutter-mutter.h b/clutter/clutter/clutter-mutter.h
index 63b3fbf358..4e479c0178 100644
--- a/clutter/clutter/clutter-mutter.h
+++ b/clutter/clutter/clutter-mutter.h
@@ -89,6 +89,9 @@ void clutter_stage_get_device_coords (ClutterStage         *stage,
                                       ClutterInputDevice   *device,
                                       ClutterEventSequence *sequence,
                                       graphene_point_t     *coords);
+CLUTTER_EXPORT
+void clutter_stage_repick_device (ClutterStage       *stage,
+                                  ClutterInputDevice *device);
 
 #undef __CLUTTER_H_INSIDE__
 


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