evdev: Extract code for setting the libinput seat out

We're going to create the main seat at an earlier time, when
we don't have the physical libinput_seat yet, so we need to
do the association later.

https://bugzilla.gnome.org/show_bug.cgi?id=726199
This commit is contained in:
Jasper St. Pierre 2014-03-10 10:20:52 -04:00
parent 5facd710c8
commit defe55ff09

View File

@ -636,6 +636,17 @@ clutter_event_source_free (ClutterEventSource *source)
g_source_unref (g_source);
}
static void
clutter_seat_evdev_set_libinput_seat (ClutterSeatEvdev *seat,
struct libinput_seat *libinput_seat)
{
g_assert (seat->libinput_seat == NULL);
libinput_seat_ref (libinput_seat);
libinput_seat_set_user_data (libinput_seat, seat);
seat->libinput_seat = libinput_seat;
}
static ClutterSeatEvdev *
clutter_seat_evdev_new (ClutterDeviceManagerEvdev *manager_evdev,
struct libinput_seat *libinput_seat)
@ -652,9 +663,7 @@ clutter_seat_evdev_new (ClutterDeviceManagerEvdev *manager_evdev,
if (!seat)
return NULL;
libinput_seat_ref (libinput_seat);
libinput_seat_set_user_data (libinput_seat, seat);
seat->libinput_seat = libinput_seat;
clutter_seat_evdev_set_libinput_seat (seat, libinput_seat);
device = _clutter_input_device_evdev_new_virtual (
manager, seat, CLUTTER_POINTER_DEVICE);