From: Pierre Ossman Date: Thu, 7 Dec 2017 14:17:58 +0000 (+0100) Subject: Adjust dimensions for rotated monitors X-Git-Tag: v1.8.90~57^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F553%2Fhead;p=tigervnc.git Adjust dimensions for rotated monitors We need to flip the dimensions in the case the monitor is rotated 90° or they won't map correctly to the framebuffer. --- 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 }