aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
Diffstat (limited to 'backend')
-rw-r--r--backend/wayland/wl_seat.c17
-rw-r--r--backend/x11/input_device.c10
2 files changed, 21 insertions, 6 deletions
diff --git a/backend/wayland/wl_seat.c b/backend/wayland/wl_seat.c
index 1000cf6a..454a2bb0 100644
--- a/backend/wayland/wl_seat.c
+++ b/backend/wayland/wl_seat.c
@@ -63,7 +63,6 @@ static void pointer_handle_leave(void *data, struct wl_pointer *wl_pointer,
}
backend->current_pointer = NULL;
- wlr_log(L_DEBUG, "leave %p", surface);
}
static void pointer_handle_motion(void *data, struct wl_pointer *wl_pointer,
@@ -74,6 +73,17 @@ static void pointer_handle_motion(void *data, struct wl_pointer *wl_pointer,
return;
}
+ struct wlr_output *wlr_output = &pointer->output->wlr_output;
+
+ struct wlr_box box = {
+ .x = wl_fixed_to_int(sx),
+ .y = wl_fixed_to_int(sy),
+ };
+ 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(&pointer->output->wlr_output,
&output_width, &output_height);
@@ -81,10 +91,9 @@ static void pointer_handle_motion(void *data, struct wl_pointer *wl_pointer,
struct wlr_event_pointer_motion_absolute event = {
.device = &pointer->input_device->wlr_input_device,
.time_msec = time,
- .x = (double)wl_fixed_to_int(sx) / output_width,
- .y = (double)wl_fixed_to_int(sy) / output_height,
+ .x = (double)box.x / output_width,
+ .y = (double)box.y / output_height,
};
- wlr_log(L_DEBUG, "motion: %f,%f", event.x, event.y);
wlr_signal_emit_safe(&pointer->wlr_pointer.events.motion_absolute, &event);
}
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);