diff options
author | emersion <contact@emersion.fr> | 2018-04-29 15:06:28 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-04-30 10:48:35 +0100 |
commit | 178ac8bffee3c76de39e6c0bf37838b58cb7280f (patch) | |
tree | 7ee2138da910973fa5a7d8722ec400679d5d5bb2 /backend/x11 | |
parent | 62d7337d005c09fdbf8cf05af1aab3fb3a5189e2 (diff) |
backend/{wayland,x11}: fix pointer coords for transformed outputs
Diffstat (limited to 'backend/x11')
-rw-r--r-- | backend/x11/input_device.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/backend/x11/input_device.c b/backend/x11/input_device.c index 6e5ca592..f8b87630 100644 --- a/backend/x11/input_device.c +++ b/backend/x11/input_device.c @@ -33,14 +33,20 @@ static void x11_handle_pointer_position(struct wlr_x11_output *output, struct wlr_x11_backend *x11 = output->x11; struct wlr_output *wlr_output = &output->wlr_output; + struct wlr_box box = { .x = x, .y = y }; + wlr_box_transform(&box, wlr_output->transform, wlr_output->width, + wlr_output->height, &box); + box.x /= wlr_output->scale; + box.y /= wlr_output->scale; + int output_width, output_height; wlr_output_effective_resolution(wlr_output, &output_width, &output_height); struct wlr_event_pointer_motion_absolute event = { .device = &output->pointer_dev, .time_msec = time, - .x = (double)x / output_width, - .y = (double)y / output_height, + .x = (double)box.x / output_width, + .y = (double)box.y / output_height, }; wlr_signal_emit_safe(&output->pointer.events.motion_absolute, &event); |