From 5dc303fc26a765c3cff26fe1ee8e5b492d64f2d7 Mon Sep 17 00:00:00 2001 From: emersion Date: Fri, 8 Dec 2017 14:33:02 +0100 Subject: Fix client cursors hotspot on scaled outputs --- types/wlr_output.c | 14 ++++---------- 1 file 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 && -- cgit v1.2.3