aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2017-12-08 14:33:02 +0100
committeremersion <contact@emersion.fr>2017-12-08 14:33:02 +0100
commit5dc303fc26a765c3cff26fe1ee8e5b492d64f2d7 (patch)
tree2b16ee518f6810267a1d469026077c5a0439aa7a
parentc5fa415a0373e0fbd974d4a8aee94014050b93f2 (diff)
Fix client cursors hotspot on scaled outputs
-rw-r--r--types/wlr_output.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/types/wlr_output.c b/types/wlr_output.c
index 3141e9ef..b4ee4176 100644
--- a/types/wlr_output.c
+++ b/types/wlr_output.c
@@ -346,12 +346,6 @@ static void output_cursor_render(struct wlr_output_cursor *cursor,
float translate[16];
wlr_matrix_translate(&translate, cursor_box.x, cursor_box.y, 0);
- // Assume cursors without a surface are already scaled for the output
- if (cursor->surface != NULL) {
- cursor_box.width *= cursor->output->scale;
- cursor_box.height *= cursor->output->scale;
- }
-
float scale[16];
wlr_matrix_scale(&scale, cursor_box.width, cursor_box.height, 1);
@@ -546,8 +540,8 @@ static void output_cursor_update_visible(struct wlr_output_cursor *cursor) {
static void output_cursor_commit(struct wlr_output_cursor *cursor) {
// Some clients commit a cursor surface with a NULL buffer to hide it.
cursor->enabled = wlr_surface_has_buffer(cursor->surface);
- cursor->width = cursor->surface->current->width;
- cursor->height = cursor->surface->current->height;
+ cursor->width = cursor->surface->current->width * cursor->output->scale;
+ cursor->height = cursor->surface->current->height * cursor->output->scale;
if (cursor->output->hardware_cursor != cursor) {
cursor->output->needs_swap = true;
@@ -580,8 +574,8 @@ void wlr_output_cursor_set_surface(struct wlr_output_cursor *cursor,
return;
}
- cursor->hotspot_x = hotspot_x;
- cursor->hotspot_y = hotspot_y;
+ cursor->hotspot_x = hotspot_x * cursor->output->scale;
+ cursor->hotspot_y = hotspot_y * cursor->output->scale;
if (surface && surface == cursor->surface) {
if (cursor->output->hardware_cursor == cursor &&