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
This commit is contained in:
Rui Matos 2014-02-24 16:41:51 +01:00
parent d67b38f960
commit 458de1178d

View File

@ -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;
}