View view_at (and pointer events) for hidpi

This commit is contained in:
Drew DeVault 2017-10-25 22:46:20 -04:00
parent a6930cd8ea
commit bafb970871

View file

@ -61,11 +61,9 @@ static void view_update_output(const struct roots_view *view,
desktop->layout, output->wlr_output, desktop->layout, output->wlr_output,
view->x, view->y, view->x + box.width, view->y + box.height); view->x, view->y, view->x + box.width, view->y + box.height);
if (intersected && !intersects) { if (intersected && !intersects) {
wlr_log(L_DEBUG, "Leaving output %s", output->wlr_output->name);
wlr_surface_send_leave(view->wlr_surface, output->wlr_output); wlr_surface_send_leave(view->wlr_surface, output->wlr_output);
} }
if (!intersected && intersects) { if (!intersected && intersects) {
wlr_log(L_DEBUG, "Entering output %s", output->wlr_output->name);
wlr_surface_send_enter(view->wlr_surface, output->wlr_output); wlr_surface_send_enter(view->wlr_surface, output->wlr_output);
} }
} }
@ -167,14 +165,15 @@ struct roots_view *view_at(struct roots_desktop *desktop, double lx, double ly,
continue; continue;
} }
double view_sx = lx - view->x; int scale = view->wlr_surface->current->scale;
double view_sy = ly - view->y; double view_sx = (lx - view->x) / (double)scale;
double view_sy = (ly - view->y) / (double)scale;
struct wlr_box box = { struct wlr_box box = {
.x = 0, .x = 0,
.y = 0, .y = 0,
.width = view->wlr_surface->current->buffer_width, .width = view->wlr_surface->current->buffer_width * scale,
.height = view->wlr_surface->current->buffer_height, .height = view->wlr_surface->current->buffer_height * 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