[clutter/clutter-1.18] evdev: Set the initial core pointer coordinates to a sane value



commit 458de1178dcfd2371ca8d1e684c403b631c552cf
Author: Rui Matos <tiagomatos gmail com>
Date:   Mon Feb 24 16:41:51 2014 +0100

    evdev: Set the initial core pointer coordinates to a sane value
    
    ClutterInputDevice's default initial coordinates is (-1, -1) and since
    they're updated from events in a relative way it means that the
    pointer can go outside the stage right from the first event.
    
    We usually let this up to higher layers to fix through the pointer
    constraint callback but that doesn't work if the first event doesn't
    put the pointer immediately inside the stage.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=725103

 clutter/evdev/clutter-device-manager-evdev.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/clutter/evdev/clutter-device-manager-evdev.c b/clutter/evdev/clutter-device-manager-evdev.c
index 266d08f..1bd7d9b 100644
--- a/clutter/evdev/clutter-device-manager-evdev.c
+++ b/clutter/evdev/clutter-device-manager-evdev.c
@@ -56,6 +56,11 @@
 
 #define AUTOREPEAT_VALUE 2
 
+/* Try to keep the pointer inside the stage. Hopefully no one is using
+ * this backend with stages smaller than this. */
+#define INITIAL_POINTER_X 16
+#define INITIAL_POINTER_Y 16
+
 struct _ClutterSeatEvdev
 {
   struct libinput_seat *libinput_seat;
@@ -1182,6 +1187,13 @@ clutter_device_manager_evdev_constructed (GObject *gobject)
 
   dispatch_libinput (manager_evdev);
 
+  g_assert (priv->main_seat != NULL);
+  g_assert (priv->main_seat->core_pointer != NULL);
+  _clutter_input_device_set_coords (priv->main_seat->core_pointer,
+                                    NULL,
+                                    INITIAL_POINTER_X, INITIAL_POINTER_Y,
+                                    NULL);
+
   source = clutter_event_source_new (manager_evdev);
   priv->event_source = source;
 }


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