aboutsummaryrefslogtreecommitdiff
path: root/backend/drm
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-08-29 12:12:18 -0500
committerGitHub <noreply@github.com>2017-08-29 12:12:18 -0500
commit6daf9e9ab2bb6e11987d3b2562fc053fd0f489c1 (patch)
tree11b9bbe78deff0e4baa76bd00e1c13d16340ceb9 /backend/drm
parentc46168cf9acd360ae37b4d2a54ed1778f0b89c72 (diff)
parentd9ab631f5d540d67d927e9d0975e2adb782e2e87 (diff)
Merge pull request #120 from acrisci/feature/wlr-cursor
wlr_cursor
Diffstat (limited to 'backend/drm')
-rw-r--r--backend/drm/drm.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index 332926b9..5b24e05f 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -598,6 +598,8 @@ static bool wlr_drm_output_set_cursor(struct wlr_output *_output,
wlr_matrix_texture(plane->matrix, plane->width, plane->height,
output->output.transform ^ WL_OUTPUT_TRANSFORM_FLIPPED_180);
+ // TODO the image needs to be rotated depending on the output rotation
+
plane->wlr_rend = wlr_gles2_renderer_create(&backend->backend);
if (!plane->wlr_rend) {
return false;
@@ -651,6 +653,31 @@ static bool wlr_drm_output_move_cursor(struct wlr_output *_output,
struct wlr_drm_output *output = (struct wlr_drm_output *)_output;
struct wlr_drm_backend *backend =
wl_container_of(output->renderer, backend, renderer);
+
+ int width, height, tmp;
+ wlr_output_effective_resolution(_output, &width, &height);
+
+ switch (_output->transform) {
+ case WL_OUTPUT_TRANSFORM_NORMAL:
+ // nothing to do
+ break;
+ case WL_OUTPUT_TRANSFORM_270:
+ tmp = x;
+ x = y;
+ y = -(tmp - width);
+ break;
+ case WL_OUTPUT_TRANSFORM_90:
+ tmp = x;
+ x = -(y - height);
+ y = tmp;
+ break;
+ default:
+ // TODO other transformations
+ wlr_log(L_ERROR, "TODO: handle surface to crtc for transformation = %d",
+ _output->transform);
+ break;
+ }
+
return backend->iface->crtc_move_cursor(backend, output->crtc, x, y);
}