197 lines
6.9 KiB
Diff
197 lines
6.9 KiB
Diff
Submitted By: Armin K. <krejzi at email dot com>
|
|
Date: 2014-07-22
|
|
Initial Package Version: 1.18.2
|
|
Upstream Status: Fixed
|
|
Origin: Upstream
|
|
Description: Fixes building with libinput-0.4.0
|
|
|
|
--- a/clutter/evdev/clutter-device-manager-evdev.c 2014-04-02 19:48:36.000000000 +0200
|
|
+++ b/clutter/evdev/clutter-device-manager-evdev.c 2014-07-01 19:05:00.136732530 +0200
|
|
@@ -375,8 +375,8 @@
|
|
static void
|
|
notify_relative_motion (ClutterInputDevice *input_device,
|
|
guint32 time_,
|
|
- li_fixed_t dx,
|
|
- li_fixed_t dy)
|
|
+ double dx,
|
|
+ double dy)
|
|
{
|
|
gfloat new_x, new_y;
|
|
ClutterInputDeviceEvdev *device_evdev;
|
|
@@ -391,17 +391,9 @@
|
|
device_evdev = CLUTTER_INPUT_DEVICE_EVDEV (input_device);
|
|
seat = _clutter_input_device_evdev_get_seat (device_evdev);
|
|
|
|
- /* Append previously discarded fraction. */
|
|
- dx += device_evdev->dx_frac;
|
|
- dy += device_evdev->dy_frac;
|
|
-
|
|
clutter_input_device_get_coords (seat->core_pointer, NULL, &point);
|
|
- new_x = point.x + li_fixed_to_int (dx);
|
|
- new_y = point.y + li_fixed_to_int (dy);
|
|
-
|
|
- /* Save the discarded fraction part for next motion event. */
|
|
- device_evdev->dx_frac = (dx < 0 ? -1 : 1) * (0xff & dx);
|
|
- device_evdev->dy_frac = (dy < 0 ? -1 : 1) * (0xff & dy);
|
|
+ new_x = point.x + dx;
|
|
+ new_y = point.y + dy;
|
|
|
|
notify_absolute_motion (input_device, time_, new_x, new_y);
|
|
}
|
|
@@ -988,7 +980,7 @@
|
|
time = libinput_event_keyboard_get_time (key_event);
|
|
key = libinput_event_keyboard_get_key (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);
|
|
|
|
break;
|
|
@@ -997,7 +989,7 @@
|
|
case LIBINPUT_EVENT_POINTER_MOTION:
|
|
{
|
|
guint32 time;
|
|
- li_fixed_t dx, dy;
|
|
+ double dx, dy;
|
|
struct libinput_event_pointer *motion_event =
|
|
libinput_event_get_pointer_event (event);
|
|
device = libinput_device_get_user_data (libinput_device);
|
|
@@ -1013,7 +1005,7 @@
|
|
case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE:
|
|
{
|
|
guint32 time;
|
|
- li_fixed_t x, y;
|
|
+ double x, y;
|
|
gfloat stage_width, stage_height;
|
|
ClutterStage *stage;
|
|
struct libinput_event_pointer *motion_event =
|
|
@@ -1032,10 +1024,7 @@
|
|
stage_width);
|
|
y = libinput_event_pointer_get_absolute_y_transformed (motion_event,
|
|
stage_height);
|
|
- notify_absolute_motion (device,
|
|
- time,
|
|
- li_fixed_to_double(x),
|
|
- li_fixed_to_double(y));
|
|
+ notify_absolute_motion (device, time, x, y);
|
|
|
|
break;
|
|
}
|
|
@@ -1050,7 +1039,7 @@
|
|
time = libinput_event_pointer_get_time (button_event);
|
|
button = libinput_event_pointer_get_button (button_event);
|
|
button_state = libinput_event_pointer_get_button_state (button_event) ==
|
|
- LIBINPUT_POINTER_BUTTON_STATE_PRESSED;
|
|
+ LIBINPUT_BUTTON_STATE_PRESSED;
|
|
notify_button (device, time, button, button_state);
|
|
|
|
break;
|
|
@@ -1066,18 +1055,17 @@
|
|
device = libinput_device_get_user_data (libinput_device);
|
|
|
|
time = libinput_event_pointer_get_time (axis_event);
|
|
- value = li_fixed_to_double (
|
|
- libinput_event_pointer_get_axis_value (axis_event));
|
|
+ value = libinput_event_pointer_get_axis_value (axis_event);
|
|
axis = libinput_event_pointer_get_axis (axis_event);
|
|
|
|
switch (axis)
|
|
{
|
|
- case LIBINPUT_POINTER_AXIS_VERTICAL_SCROLL:
|
|
+ case LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL:
|
|
dx = 0;
|
|
dy = value;
|
|
break;
|
|
|
|
- case LIBINPUT_POINTER_AXIS_HORIZONTAL_SCROLL:
|
|
+ case LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL:
|
|
dx = value;
|
|
dy = 0;
|
|
break;
|
|
@@ -1178,7 +1166,7 @@
|
|
struct udev *udev;
|
|
|
|
udev = udev_new ();
|
|
- if (!udev)
|
|
+ if (G_UNLIKELY (udev == NULL))
|
|
{
|
|
g_warning ("Failed to create udev object");
|
|
return;
|
|
@@ -1187,18 +1175,25 @@
|
|
manager_evdev = CLUTTER_DEVICE_MANAGER_EVDEV (gobject);
|
|
priv = manager_evdev->priv;
|
|
|
|
- priv->libinput = libinput_udev_create_for_seat (&libinput_interface,
|
|
- manager_evdev,
|
|
- udev,
|
|
- "seat0");
|
|
- udev_unref (udev);
|
|
+ priv->libinput = libinput_udev_create_context (&libinput_interface,
|
|
+ manager_evdev,
|
|
+ udev);
|
|
+ if (priv->libinput == NULL)
|
|
+ {
|
|
+ g_critical ("Failed to create the libinput object.");
|
|
+ return;
|
|
+ }
|
|
|
|
- if (!priv->libinput)
|
|
+ if (libinput_udev_assign_seat (priv->libinput, "seat0") == -1)
|
|
{
|
|
- g_warning ("Failed to create libinput object");
|
|
+ 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);
|
|
|
|
dispatch_libinput (manager_evdev);
|
|
@@ -1244,26 +1239,21 @@
|
|
{
|
|
ClutterDeviceManagerEvdev *manager_evdev;
|
|
ClutterDeviceManagerEvdevPrivate *priv;
|
|
- GSList *l;
|
|
|
|
manager_evdev = CLUTTER_DEVICE_MANAGER_EVDEV (object);
|
|
priv = manager_evdev->priv;
|
|
|
|
- for (l = priv->seats; l; l = g_slist_next (l))
|
|
- {
|
|
- ClutterSeatEvdev *seat = l->data;
|
|
-
|
|
- clutter_seat_evdev_free (seat);
|
|
- }
|
|
- g_slist_free (priv->seats);
|
|
+ g_slist_free_full (priv->seats, (GDestroyNotify) clutter_seat_evdev_free);
|
|
g_slist_free (priv->devices);
|
|
|
|
- clutter_event_source_free (priv->event_source);
|
|
+ if (priv->event_source != NULL)
|
|
+ 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);
|
|
|
|
- libinput_destroy (priv->libinput);
|
|
+ if (priv->libinput != NULL)
|
|
+ libinput_unref (priv->libinput);
|
|
|
|
G_OBJECT_CLASS (clutter_device_manager_evdev_parent_class)->finalize (object);
|
|
}
|
|
--- a/clutter/evdev/clutter-input-device-evdev.h 2014-04-02 19:48:36.000000000 +0200
|
|
+++ b/clutter/evdev/clutter-input-device-evdev.h 2014-07-01 19:04:44.152439734 +0200
|
|
@@ -64,8 +64,6 @@
|
|
|
|
struct libinput_device *libinput_device;
|
|
ClutterSeatEvdev *seat;
|
|
- li_fixed_t dx_frac;
|
|
- li_fixed_t dy_frac;
|
|
};
|
|
|
|
GType _clutter_input_device_evdev_get_type (void) G_GNUC_CONST;
|