From c8f97a3a2c43948147e4225e09437884a848fa9d Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 25 Oct 2017 23:03:30 -0400 Subject: [PATCH] Use surface matrix for software cursors A similar change should probably be applied to hardware cursors, though more complicated. Also, this doesn't actually fix the issue where the cursor is too small when over a scale=2 surface. Apparently they don't set their cursor scales to 2. Seems like a client bug? idk --- types/wlr_output.c | 13 +++++++++++-- types/wlr_surface.c | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/types/wlr_output.c b/types/wlr_output.c index d6efd9bf..4bc9d6aa 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -429,8 +429,17 @@ void wlr_output_swap_buffers(struct wlr_output *output) { // with a NULL buffer to hide it if (renderer && texture && texture->valid) { float matrix[16]; - wlr_texture_get_matrix(texture, &matrix, &output->transform_matrix, - output->cursor.x, output->cursor.y); + if (output->cursor.surface) { + float translation[16]; + wlr_matrix_translate(&translation, + output->cursor.x, output->cursor.y, 0); + wlr_surface_get_matrix(output->cursor.surface, + &matrix, &output->transform_matrix, &translation); + } else { + wlr_texture_get_matrix(texture, + &matrix, &output->transform_matrix, + output->cursor.x, output->cursor.y); + } wlr_render_with_matrix(renderer, texture, &matrix); } } diff --git a/types/wlr_surface.c b/types/wlr_surface.c index a21be8de..a6f91d47 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -656,7 +656,7 @@ void wlr_surface_get_matrix(struct wlr_surface *surface, if (transform) { wlr_matrix_mul(matrix, transform, matrix); } - wlr_matrix_scale(&scale, width, height, surface->current->scale); + wlr_matrix_scale(&scale, width, height, 1); wlr_matrix_mul(matrix, &scale, matrix); wlr_matrix_mul(projection, matrix, matrix); }