diff options
author | emersion <contact@emersion.fr> | 2018-03-28 14:11:39 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-28 14:11:39 -0400 |
commit | 5dd022da1300185780ddf4b70014a6f8f306de85 (patch) | |
tree | 331f0e5f7b748387a338b678b625bf5a1ae7f693 /backend/libinput | |
parent | 52d621e0979c3b393753d1c67b2b0fd23212ca41 (diff) | |
parent | 3813121fefb1734ed2c2537759e6eead1c0d9a74 (diff) |
Merge pull request #765 from swaywm/transformed-events
Use libinput transformed events instead of width_mm/height_mm
Diffstat (limited to 'backend/libinput')
-rw-r--r-- | backend/libinput/events.c | 2 | ||||
-rw-r--r-- | backend/libinput/pointer.c | 5 | ||||
-rw-r--r-- | backend/libinput/tablet_tool.c | 5 | ||||
-rw-r--r-- | backend/libinput/touch.c | 10 |
4 files changed, 10 insertions, 12 deletions
diff --git a/backend/libinput/events.c b/backend/libinput/events.c index d92de830..da7b2be4 100644 --- a/backend/libinput/events.c +++ b/backend/libinput/events.c @@ -46,6 +46,8 @@ static struct wlr_input_device *allocate_device( return NULL; } struct wlr_input_device *wlr_dev = &wlr_libinput_dev->wlr_input_device; + libinput_device_get_size(libinput_dev, + &wlr_dev->width_mm, &wlr_dev->height_mm); wl_list_insert(wlr_devices, &wlr_dev->link); wlr_libinput_dev->handle = libinput_dev; libinput_device_ref(libinput_dev); diff --git a/backend/libinput/pointer.c b/backend/libinput/pointer.c index 8a31d312..9ccda634 100644 --- a/backend/libinput/pointer.c +++ b/backend/libinput/pointer.c @@ -53,9 +53,8 @@ void handle_pointer_motion_abs(struct libinput_event *event, wlr_event.device = wlr_dev; wlr_event.time_msec = usec_to_msec(libinput_event_pointer_get_time_usec(pevent)); - wlr_event.x_mm = libinput_event_pointer_get_absolute_x(pevent); - wlr_event.y_mm = libinput_event_pointer_get_absolute_y(pevent); - libinput_device_get_size(libinput_dev, &wlr_event.width_mm, &wlr_event.height_mm); + wlr_event.x = libinput_event_pointer_get_absolute_x_transformed(pevent, 1); + wlr_event.y = libinput_event_pointer_get_absolute_y_transformed(pevent, 1); wlr_signal_emit_safe(&wlr_dev->pointer->events.motion_absolute, &wlr_event); } diff --git a/backend/libinput/tablet_tool.c b/backend/libinput/tablet_tool.c index 27cf7c81..815c4daf 100644 --- a/backend/libinput/tablet_tool.c +++ b/backend/libinput/tablet_tool.c @@ -34,14 +34,13 @@ void handle_tablet_tool_axis(struct libinput_event *event, wlr_event.device = wlr_dev; wlr_event.time_msec = usec_to_msec(libinput_event_tablet_tool_get_time_usec(tevent)); - libinput_device_get_size(libinput_dev, &wlr_event.width_mm, &wlr_event.height_mm); if (libinput_event_tablet_tool_x_has_changed(tevent)) { wlr_event.updated_axes |= WLR_TABLET_TOOL_AXIS_X; - wlr_event.x_mm = libinput_event_tablet_tool_get_x(tevent); + wlr_event.x = libinput_event_tablet_tool_get_x_transformed(tevent, 1); } if (libinput_event_tablet_tool_y_has_changed(tevent)) { wlr_event.updated_axes |= WLR_TABLET_TOOL_AXIS_Y; - wlr_event.y_mm = libinput_event_tablet_tool_get_y(tevent); + wlr_event.y = libinput_event_tablet_tool_get_y_transformed(tevent, 1); } if (libinput_event_tablet_tool_pressure_has_changed(tevent)) { wlr_event.updated_axes |= WLR_TABLET_TOOL_AXIS_PRESSURE; diff --git a/backend/libinput/touch.c b/backend/libinput/touch.c index 2b87f9cd..419c11ea 100644 --- a/backend/libinput/touch.c +++ b/backend/libinput/touch.c @@ -35,9 +35,8 @@ void handle_touch_down(struct libinput_event *event, wlr_event.time_msec = usec_to_msec(libinput_event_touch_get_time_usec(tevent)); wlr_event.touch_id = libinput_event_touch_get_slot(tevent); - wlr_event.x_mm = libinput_event_touch_get_x(tevent); - wlr_event.y_mm = libinput_event_touch_get_y(tevent); - libinput_device_get_size(libinput_dev, &wlr_event.width_mm, &wlr_event.height_mm); + wlr_event.x = libinput_event_touch_get_x_transformed(tevent, 1); + wlr_event.y = libinput_event_touch_get_y_transformed(tevent, 1); wlr_signal_emit_safe(&wlr_dev->touch->events.down, &wlr_event); } @@ -74,9 +73,8 @@ void handle_touch_motion(struct libinput_event *event, wlr_event.time_msec = usec_to_msec(libinput_event_touch_get_time_usec(tevent)); wlr_event.touch_id = libinput_event_touch_get_slot(tevent); - wlr_event.x_mm = libinput_event_touch_get_x(tevent); - wlr_event.y_mm = libinput_event_touch_get_y(tevent); - libinput_device_get_size(libinput_dev, &wlr_event.width_mm, &wlr_event.height_mm); + wlr_event.x = libinput_event_touch_get_x_transformed(tevent, 1); + wlr_event.y = libinput_event_touch_get_y_transformed(tevent, 1); wlr_signal_emit_safe(&wlr_dev->touch->events.motion, &wlr_event); } |