backends: Pass seat ID to evdev ClutterDeviceManager

Clutter assumed seat0 which is most usually, but not always correct.
Add an evdev-backend specific function to allow passing the seat
that will be used for ClutterDeviceManager construction, which we
already obtain in MetaLauncher.

https://bugzilla.gnome.org/show_bug.cgi?id=778092
This commit is contained in:
Carlos Garnacho 2017-02-02 19:01:25 +01:00
parent c7853730ed
commit 9c79a1631d
3 changed files with 23 additions and 1 deletions

View File

@ -124,6 +124,7 @@ G_DEFINE_TYPE_WITH_CODE (ClutterDeviceManagerEvdev,
static ClutterOpenDeviceCallback device_open_callback;
static ClutterCloseDeviceCallback device_close_callback;
static gpointer device_callback_data;
static gchar * evdev_seat_id;
#ifdef CLUTTER_ENABLE_DEBUG
static const char *device_type_str[] = {
@ -2045,7 +2046,8 @@ clutter_device_manager_evdev_constructed (GObject *gobject)
return;
}
if (libinput_udev_assign_seat (priv->libinput, "seat0") == -1)
if (libinput_udev_assign_seat (priv->libinput,
evdev_seat_id ? evdev_seat_id : "seat0") == -1)
{
g_critical ("Failed to assign a seat to the libinput object.");
libinput_unref (priv->libinput);
@ -2794,3 +2796,18 @@ clutter_evdev_warp_pointer (ClutterInputDevice *pointer_device,
{
notify_absolute_motion (pointer_device, ms2us(time_), x, y, NULL);
}
/**
* clutter_evdev_set_seat_id:
* @seat_id: The seat ID
*
* Sets the seat to assign to the libinput context.
*
* For reliable effects, this function must be called before clutter_init().
*/
void
clutter_evdev_set_seat_id (const gchar *seat_id)
{
g_free (evdev_seat_id);
evdev_seat_id = g_strdup (seat_id);
}

View File

@ -57,6 +57,9 @@ void clutter_evdev_set_device_callbacks (ClutterOpenDeviceCallback open_callba
ClutterCloseDeviceCallback close_callback,
gpointer user_data);
CLUTTER_AVAILABLE_IN_ALL
void clutter_evdev_set_seat_id (const gchar *seat_id);
CLUTTER_AVAILABLE_IN_1_10
void clutter_evdev_release_devices (void);
CLUTTER_AVAILABLE_IN_1_10

View File

@ -545,6 +545,8 @@ meta_launcher_new (GError **error)
self->kms_fd = kms_fd;
self->kms_file_path = kms_file_path;
clutter_evdev_set_seat_id (seat_id);
clutter_evdev_set_device_callbacks (on_evdev_device_open,
on_evdev_device_close,
self);