From dc27b95bd2a2a99049c4b0516e4a371106982287 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Thu, 7 Dec 2017 15:17:58 +0100 Subject: [PATCH] Adjust dimensions for rotated monitors MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit We need to flip the dimensions in the case the monitor is rotated 90° or they won't map correctly to the framebuffer. --- unix/xserver/hw/vnc/XorgGlue.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/unix/xserver/hw/vnc/XorgGlue.c b/unix/xserver/hw/vnc/XorgGlue.c index 8c1e0857..141023a8 100644 --- a/unix/xserver/hw/vnc/XorgGlue.c +++ b/unix/xserver/hw/vnc/XorgGlue.c @@ -305,11 +305,21 @@ void vncRandRGetOutputDimensions(int scrIdx, int outputIdx, { #ifdef RANDR rrScrPrivPtr rp = rrGetScrPriv(screenInfo.screens[scrIdx]); + int swap; *x = rp->outputs[outputIdx]->crtc->x; *y = rp->outputs[outputIdx]->crtc->y; *width = rp->outputs[outputIdx]->crtc->mode->mode.width; *height = rp->outputs[outputIdx]->crtc->mode->mode.height; + + switch (rp->outputs[outputIdx]->crtc->rotation & 0xf) { + case RR_Rotate_90: + case RR_Rotate_270: + swap = *width; + *width = *height; + *height = swap; + break; + } #endif } -- 2.39.5