From defe55ff097aa53897bdd43c5ffdeadaab9f2a85 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Mon, 10 Mar 2014 10:20:52 -0400 Subject: [PATCH] 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 --- clutter/evdev/clutter-device-manager-evdev.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/clutter/evdev/clutter-device-manager-evdev.c b/clutter/evdev/clutter-device-manager-evdev.c index 81ae92c97..ad342d5f6 100644 --- a/clutter/evdev/clutter-device-manager-evdev.c +++ b/clutter/evdev/clutter-device-manager-evdev.c @@ -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);