libinput: Use floating point instead of fixed point numbers
Also update configure.ac to require libinput 0.3 when enabled, as it is the version where double replaced li_fixed_t. Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
This commit is contained in:
+1
-1
@@ -159,7 +159,7 @@ AC_ARG_ENABLE(libinput-backend, [ --enable-libinput-backend],,
|
|||||||
AM_CONDITIONAL([ENABLE_LIBINPUT_BACKEND], [test x$enable_libinput_backend = xyes])
|
AM_CONDITIONAL([ENABLE_LIBINPUT_BACKEND], [test x$enable_libinput_backend = xyes])
|
||||||
if test x$enable_libinput_backend = xyes; then
|
if test x$enable_libinput_backend = xyes; then
|
||||||
AC_DEFINE([BUILD_LIBINPUT_BACKEND], [1], [Build the libinput input device backend])
|
AC_DEFINE([BUILD_LIBINPUT_BACKEND], [1], [Build the libinput input device backend])
|
||||||
PKG_CHECK_MODULES(LIBINPUT_BACKEND, [libinput >= 0.1.0])
|
PKG_CHECK_MODULES(LIBINPUT_BACKEND, [libinput >= 0.3.0])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+18
-9
@@ -73,11 +73,14 @@ handle_pointer_motion(struct libinput_device *libinput_device,
|
|||||||
{
|
{
|
||||||
struct evdev_device *device =
|
struct evdev_device *device =
|
||||||
libinput_device_get_user_data(libinput_device);
|
libinput_device_get_user_data(libinput_device);
|
||||||
|
wl_fixed_t dx, dy;
|
||||||
|
|
||||||
|
dx = wl_fixed_from_double(libinput_event_pointer_get_dx(pointer_event));
|
||||||
|
dy = wl_fixed_from_double(libinput_event_pointer_get_dy(pointer_event));
|
||||||
notify_motion(device->seat,
|
notify_motion(device->seat,
|
||||||
libinput_event_pointer_get_time(pointer_event),
|
libinput_event_pointer_get_time(pointer_event),
|
||||||
libinput_event_pointer_get_dx(pointer_event),
|
dx,
|
||||||
libinput_event_pointer_get_dy(pointer_event));
|
dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -99,10 +102,12 @@ handle_pointer_motion_absolute(
|
|||||||
width = device->output->current_mode->width;
|
width = device->output->current_mode->width;
|
||||||
height = device->output->current_mode->height;
|
height = device->output->current_mode->height;
|
||||||
|
|
||||||
x = libinput_event_pointer_get_absolute_x_transformed(pointer_event,
|
x = wl_fixed_from_double(
|
||||||
width);
|
libinput_event_pointer_get_absolute_x_transformed(pointer_event,
|
||||||
y = libinput_event_pointer_get_absolute_y_transformed(pointer_event,
|
width));
|
||||||
height);
|
y = wl_fixed_from_double(
|
||||||
|
libinput_event_pointer_get_absolute_y_transformed(pointer_event,
|
||||||
|
height));
|
||||||
|
|
||||||
weston_output_transform_coordinate(device->output, x, y, &x, &y);
|
weston_output_transform_coordinate(device->output, x, y, &x, &y);
|
||||||
notify_motion_absolute(device->seat, time, x, y);
|
notify_motion_absolute(device->seat, time, x, y);
|
||||||
@@ -127,11 +132,13 @@ handle_pointer_axis(struct libinput_device *libinput_device,
|
|||||||
{
|
{
|
||||||
struct evdev_device *device =
|
struct evdev_device *device =
|
||||||
libinput_device_get_user_data(libinput_device);
|
libinput_device_get_user_data(libinput_device);
|
||||||
|
double value;
|
||||||
|
|
||||||
|
value = libinput_event_pointer_get_axis_value(pointer_event);
|
||||||
notify_axis(device->seat,
|
notify_axis(device->seat,
|
||||||
libinput_event_pointer_get_time(pointer_event),
|
libinput_event_pointer_get_time(pointer_event),
|
||||||
libinput_event_pointer_get_axis(pointer_event),
|
libinput_event_pointer_get_axis(pointer_event),
|
||||||
libinput_event_pointer_get_axis_value(pointer_event));
|
wl_fixed_from_double(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -155,8 +162,10 @@ handle_touch_with_coords(struct libinput_device *libinput_device,
|
|||||||
|
|
||||||
width = device->output->current_mode->width;
|
width = device->output->current_mode->width;
|
||||||
height = device->output->current_mode->height;
|
height = device->output->current_mode->height;
|
||||||
x = libinput_event_touch_get_x_transformed(touch_event, width);
|
x = wl_fixed_from_double(
|
||||||
y = libinput_event_touch_get_y_transformed(touch_event, height);
|
libinput_event_touch_get_x_transformed(touch_event, width));
|
||||||
|
y = wl_fixed_from_double(
|
||||||
|
libinput_event_touch_get_y_transformed(touch_event, height));
|
||||||
|
|
||||||
weston_output_transform_coordinate(device->output,
|
weston_output_transform_coordinate(device->output,
|
||||||
x, y, &x, &y);
|
x, y, &x, &y);
|
||||||
|
|||||||
Reference in New Issue
Block a user