diff --git a/clutter/clutter/evdev/clutter-device-manager-evdev.c b/clutter/clutter/evdev/clutter-device-manager-evdev.c index ab1b21a45..2a3c76861 100644 --- a/clutter/clutter/evdev/clutter-device-manager-evdev.c +++ b/clutter/clutter/evdev/clutter-device-manager-evdev.c @@ -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); +} diff --git a/clutter/clutter/evdev/clutter-evdev.h b/clutter/clutter/evdev/clutter-evdev.h index 8e8f8d94c..e17ec12e2 100644 --- a/clutter/clutter/evdev/clutter-evdev.h +++ b/clutter/clutter/evdev/clutter-evdev.h @@ -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 diff --git a/src/backends/native/meta-launcher.c b/src/backends/native/meta-launcher.c index abba17e4f..75d07ce2a 100644 --- a/src/backends/native/meta-launcher.c +++ b/src/backends/native/meta-launcher.c @@ -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);