aboutsummaryrefslogtreecommitdiff
path: root/backend/drm
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2017-10-29 18:45:53 +0100
committeremersion <contact@emersion.fr>2017-10-31 12:30:57 +0100
commitc3b09f73da0d1fc4815f4b085ca07e30d175f549 (patch)
tree99536edd699875c9fee792951b00ffecaf13ddb0 /backend/drm
parent4230a577cc878607c2db1e6e5e7051b9e7653584 (diff)
Fix cursor hotspot with rotated outputs on DRM backend
Diffstat (limited to 'backend/drm')
-rw-r--r--backend/drm/drm.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index 23b9a9fa..6cbb0535 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -558,6 +558,40 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output,
}
}
+ switch (output->transform) {
+ case WL_OUTPUT_TRANSFORM_90:
+ plane->cursor_hotspot_x = hotspot_x;
+ plane->cursor_hotspot_y = -plane->surf.height + hotspot_y;
+ break;
+ case WL_OUTPUT_TRANSFORM_180:
+ plane->cursor_hotspot_x = plane->surf.width - hotspot_x;
+ plane->cursor_hotspot_y = plane->surf.height - hotspot_y;
+ break;
+ case WL_OUTPUT_TRANSFORM_270:
+ plane->cursor_hotspot_x = -plane->surf.height + hotspot_x;
+ plane->cursor_hotspot_y = hotspot_y;
+ break;
+ case WL_OUTPUT_TRANSFORM_FLIPPED:
+ plane->cursor_hotspot_x = plane->surf.width - hotspot_x;
+ plane->cursor_hotspot_y = hotspot_y;
+ break;
+ case WL_OUTPUT_TRANSFORM_FLIPPED_90:
+ plane->cursor_hotspot_x = hotspot_x;
+ plane->cursor_hotspot_y = -hotspot_y;
+ break;
+ case WL_OUTPUT_TRANSFORM_FLIPPED_180:
+ plane->cursor_hotspot_x = hotspot_x;
+ plane->cursor_hotspot_y = plane->surf.height - hotspot_y;
+ break;
+ case WL_OUTPUT_TRANSFORM_FLIPPED_270:
+ plane->cursor_hotspot_x = -plane->surf.height + hotspot_x;
+ plane->cursor_hotspot_y = plane->surf.width - hotspot_y;
+ break;
+ default: // WL_OUTPUT_TRANSFORM_NORMAL
+ plane->cursor_hotspot_x = hotspot_x;
+ plane->cursor_hotspot_y = hotspot_y;
+ }
+
if (!update_pixels) {
// Only update the cursor hotspot
return true;
@@ -605,6 +639,10 @@ static bool wlr_drm_connector_move_cursor(struct wlr_output *output,
struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend;
+ struct wlr_drm_plane *plane = conn->crtc->cursor;
+ x -= plane->cursor_hotspot_x;
+ y -= plane->cursor_hotspot_y;
+
int width, height, tmp;
wlr_output_effective_resolution(output, &width, &height);