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
This commit is contained in:
Drew DeVault 2017-10-25 23:03:30 -04:00
parent bafb970871
commit c8f97a3a2c
2 changed files with 12 additions and 3 deletions

View file

@ -429,8 +429,17 @@ void wlr_output_swap_buffers(struct wlr_output *output) {
// with a NULL buffer to hide it // with a NULL buffer to hide it
if (renderer && texture && texture->valid) { if (renderer && texture && texture->valid) {
float matrix[16]; float matrix[16];
wlr_texture_get_matrix(texture, &matrix, &output->transform_matrix, 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); output->cursor.x, output->cursor.y);
}
wlr_render_with_matrix(renderer, texture, &matrix); wlr_render_with_matrix(renderer, texture, &matrix);
} }
} }

View file

@ -656,7 +656,7 @@ void wlr_surface_get_matrix(struct wlr_surface *surface,
if (transform) { if (transform) {
wlr_matrix_mul(matrix, transform, matrix); 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(matrix, &scale, matrix);
wlr_matrix_mul(projection, matrix, matrix); wlr_matrix_mul(projection, matrix, matrix);
} }