Damage tracking for transformed outputs

This commit is contained in:
emersion 2018-01-26 22:11:09 +01:00
parent a98ece68d3
commit ece2c1e4e2
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
12 changed files with 185 additions and 154 deletions

View file

@ -581,15 +581,14 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output,
}
struct wlr_box hotspot = {
.width = plane->surf.width,
.height = plane->surf.height,
.x = hotspot_x,
.y = hotspot_y,
};
enum wl_output_transform transform =
wlr_output_transform_invert(output->transform);
struct wlr_box transformed_hotspot;
wlr_box_transform(&hotspot, transform, &transformed_hotspot);
wlr_box_transform(&hotspot, transform,
plane->surf.width, plane->surf.height, &transformed_hotspot);
plane->cursor_hotspot_x = transformed_hotspot.x;
plane->cursor_hotspot_y = transformed_hotspot.y;
@ -650,15 +649,15 @@ static bool wlr_drm_connector_move_cursor(struct wlr_output *output,
}
struct wlr_drm_plane *plane = conn->crtc->cursor;
struct wlr_box box;
box.x = x;
box.y = y;
wlr_output_effective_resolution(output, &box.width, &box.height);
struct wlr_box box = { .x = x, .y = y };
int width, height;
wlr_output_effective_resolution(output, &width, &height);
enum wl_output_transform transform =
wlr_output_transform_invert(output->transform);
struct wlr_box transformed_box;
wlr_box_transform(&box, transform, &transformed_box);
wlr_box_transform(&box, transform, width, height, &transformed_box);
if (plane != NULL) {
transformed_box.x -= plane->cursor_hotspot_x;

View file

@ -54,14 +54,16 @@ static void pointer_handle_motion(void *data, struct wl_pointer *wl_pointer,
struct wlr_output *wlr_output = &wlr_wl_pointer->current_output->wlr_output;
struct wlr_box box;
int width, height;
wl_egl_window_get_attached_size(wlr_wl_pointer->current_output->egl_window,
&box.width, &box.height);
box.x = wl_fixed_to_int(surface_x);
box.y = wl_fixed_to_int(surface_y);
&width, &height);
struct wlr_box box = {
.x = wl_fixed_to_int(surface_x),
.y = wl_fixed_to_int(surface_y),
};
struct wlr_box transformed;
wlr_box_transform(&box, wlr_output->transform, &transformed);
wlr_box_transform(&box, wlr_output->transform, width, height, &transformed);
transformed.x /= wlr_output->scale;
transformed.y /= wlr_output->scale;