diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-03-28 14:04:23 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2018-03-28 14:04:23 -0400 |
commit | 3813121fefb1734ed2c2537759e6eead1c0d9a74 (patch) | |
tree | cd9dff8dcf323455963c0ca630a962b8576a9bb4 /backend | |
parent | 32bdcdf7191be40a4ad74ece7e152a264358220a (diff) |
Fix wayland output absolute input handling
Diffstat (limited to 'backend')
-rw-r--r-- | backend/wayland/wl_seat.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/backend/wayland/wl_seat.c b/backend/wayland/wl_seat.c index 2d4f76de..a5821311 100644 --- a/backend/wayland/wl_seat.c +++ b/backend/wayland/wl_seat.c @@ -64,6 +64,9 @@ static void pointer_handle_motion(void *data, struct wl_pointer *wl_pointer, wl_egl_window_get_attached_size(wlr_wl_pointer->current_output->egl_window, &width, &height); + int owidth, oheight; + wlr_output_effective_resolution(wlr_output, &owidth, &oheight); + struct wlr_box box = { .x = wl_fixed_to_int(surface_x), .y = wl_fixed_to_int(surface_y), @@ -80,8 +83,15 @@ static void pointer_handle_motion(void *data, struct wl_pointer *wl_pointer, struct wlr_event_pointer_motion_absolute wlr_event; wlr_event.device = dev; wlr_event.time_msec = time; - wlr_event.x = transformed.x / layout_box.width; - wlr_event.y = transformed.y / layout_box.height; + + double tx = transformed.x / (double)owidth; + double ty = transformed.y / (double)oheight; + double ox = wlr_output->lx / (double)layout_box.width; + double oy = wlr_output->ly / (double)layout_box.height; + + wlr_event.x = tx * ((double)owidth / layout_box.width) + ox; + wlr_event.y = ty * ((double)oheight / layout_box.height) + oy; + wlr_signal_emit_safe(&dev->pointer->events.motion_absolute, &wlr_event); } |