Fix pointer input for rotated views on HiDPI outputs

This commit is contained in:
emersion 2017-11-12 12:38:08 +01:00
parent c1eff3d3af
commit 0b3f83d93a
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
1 changed files with 4 additions and 3 deletions

View File

@ -216,7 +216,7 @@ void view_teardown(struct roots_view *view) {
struct roots_view *view_at(struct roots_desktop *desktop, double lx, double ly, struct roots_view *view_at(struct roots_desktop *desktop, double lx, double ly,
struct wlr_surface **surface, double *sx, double *sy) { struct wlr_surface **surface, double *sx, double *sy) {
for (int i = desktop->views->length - 1; i >= 0; --i) { for (ssize_t i = desktop->views->length - 1; i >= 0; --i) {
struct roots_view *view = desktop->views->items[i]; struct roots_view *view = desktop->views->items[i];
if (view->type == ROOTS_WL_SHELL_VIEW && if (view->type == ROOTS_WL_SHELL_VIEW &&
@ -228,11 +228,12 @@ struct roots_view *view_at(struct roots_desktop *desktop, double lx, double ly,
double view_sx = lx - view->x; double view_sx = lx - view->x;
double view_sy = ly - view->y; double view_sy = ly - view->y;
struct wlr_surface_state *state = view->wlr_surface->current;
struct wlr_box box = { struct wlr_box box = {
.x = 0, .x = 0,
.y = 0, .y = 0,
.width = view->wlr_surface->current->buffer_width, .width = state->buffer_width / state->scale,
.height = view->wlr_surface->current->buffer_height, .height = state->buffer_height / state->scale,
}; };
if (view->rotation != 0.0) { if (view->rotation != 0.0) {
// Coordinates relative to the center of the view // Coordinates relative to the center of the view