evdev: Update after libinput API changes
This commit is contained in:
parent
3b77e5565c
commit
ac26dbbbe9
@ -1105,7 +1105,7 @@ process_device_event (ClutterDeviceManagerEvdev *manager_evdev,
|
|||||||
time = libinput_event_keyboard_get_time (key_event);
|
time = libinput_event_keyboard_get_time (key_event);
|
||||||
key = libinput_event_keyboard_get_key (key_event);
|
key = libinput_event_keyboard_get_key (key_event);
|
||||||
key_state = libinput_event_keyboard_get_key_state (key_event) ==
|
key_state = libinput_event_keyboard_get_key_state (key_event) ==
|
||||||
LIBINPUT_KEYBOARD_KEY_STATE_PRESSED;
|
LIBINPUT_KEY_STATE_PRESSED;
|
||||||
notify_key_device (device, time, key, key_state, TRUE);
|
notify_key_device (device, time, key, key_state, TRUE);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -1185,12 +1185,12 @@ process_device_event (ClutterDeviceManagerEvdev *manager_evdev,
|
|||||||
|
|
||||||
switch (axis)
|
switch (axis)
|
||||||
{
|
{
|
||||||
case LIBINPUT_POINTER_AXIS_VERTICAL_SCROLL:
|
case LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL:
|
||||||
dx = 0;
|
dx = 0;
|
||||||
dy = value;
|
dy = value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LIBINPUT_POINTER_AXIS_HORIZONTAL_SCROLL:
|
case LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL:
|
||||||
dx = value;
|
dx = value;
|
||||||
dy = 0;
|
dy = 0;
|
||||||
break;
|
break;
|
||||||
@ -1434,7 +1434,7 @@ clutter_device_manager_evdev_constructed (GObject *gobject)
|
|||||||
struct udev *udev;
|
struct udev *udev;
|
||||||
|
|
||||||
udev = udev_new ();
|
udev = udev_new ();
|
||||||
if (!udev)
|
if (G_UNLIKELY (udev == NULL))
|
||||||
{
|
{
|
||||||
g_warning ("Failed to create udev object");
|
g_warning ("Failed to create udev object");
|
||||||
return;
|
return;
|
||||||
@ -1443,18 +1443,25 @@ clutter_device_manager_evdev_constructed (GObject *gobject)
|
|||||||
manager_evdev = CLUTTER_DEVICE_MANAGER_EVDEV (gobject);
|
manager_evdev = CLUTTER_DEVICE_MANAGER_EVDEV (gobject);
|
||||||
priv = manager_evdev->priv;
|
priv = manager_evdev->priv;
|
||||||
|
|
||||||
priv->libinput = libinput_udev_create_for_seat (&libinput_interface,
|
priv->libinput = libinput_udev_create_context (&libinput_interface,
|
||||||
manager_evdev,
|
manager_evdev,
|
||||||
udev,
|
udev);
|
||||||
"seat0");
|
if (priv->libinput == NULL)
|
||||||
udev_unref (udev);
|
|
||||||
|
|
||||||
if (!priv->libinput)
|
|
||||||
{
|
{
|
||||||
g_warning ("Failed to create libinput object");
|
g_critical ("Failed to create the libinput object.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (libinput_udev_assign_seat (priv->libinput, "seat0") == -1)
|
||||||
|
{
|
||||||
|
g_critical ("Failed to assign a seat to the libinput object.");
|
||||||
|
libinput_unref (priv->libinput);
|
||||||
|
priv->libinput = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
udev_unref (udev);
|
||||||
|
|
||||||
priv->main_seat = clutter_seat_evdev_new (manager_evdev);
|
priv->main_seat = clutter_seat_evdev_new (manager_evdev);
|
||||||
|
|
||||||
dispatch_libinput (manager_evdev);
|
dispatch_libinput (manager_evdev);
|
||||||
@ -1500,26 +1507,21 @@ clutter_device_manager_evdev_finalize (GObject *object)
|
|||||||
{
|
{
|
||||||
ClutterDeviceManagerEvdev *manager_evdev;
|
ClutterDeviceManagerEvdev *manager_evdev;
|
||||||
ClutterDeviceManagerEvdevPrivate *priv;
|
ClutterDeviceManagerEvdevPrivate *priv;
|
||||||
GSList *l;
|
|
||||||
|
|
||||||
manager_evdev = CLUTTER_DEVICE_MANAGER_EVDEV (object);
|
manager_evdev = CLUTTER_DEVICE_MANAGER_EVDEV (object);
|
||||||
priv = manager_evdev->priv;
|
priv = manager_evdev->priv;
|
||||||
|
|
||||||
for (l = priv->seats; l; l = g_slist_next (l))
|
g_slist_free_full (priv->seats, (GDestroyNotify) clutter_seat_evdev_free);
|
||||||
{
|
|
||||||
ClutterSeatEvdev *seat = l->data;
|
|
||||||
|
|
||||||
clutter_seat_evdev_free (seat);
|
|
||||||
}
|
|
||||||
g_slist_free (priv->seats);
|
|
||||||
g_slist_free (priv->devices);
|
g_slist_free (priv->devices);
|
||||||
|
|
||||||
|
if (priv->event_source != NULL)
|
||||||
clutter_event_source_free (priv->event_source);
|
clutter_event_source_free (priv->event_source);
|
||||||
|
|
||||||
if (priv->constrain_data_notify)
|
if (priv->constrain_data_notify != NULL)
|
||||||
priv->constrain_data_notify (priv->constrain_data);
|
priv->constrain_data_notify (priv->constrain_data);
|
||||||
|
|
||||||
libinput_destroy (priv->libinput);
|
if (priv->libinput != NULL)
|
||||||
|
libinput_unref (priv->libinput);
|
||||||
|
|
||||||
G_OBJECT_CLASS (clutter_device_manager_evdev_parent_class)->finalize (object);
|
G_OBJECT_CLASS (clutter_device_manager_evdev_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user