]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
[resolution/x11] Preserve the rotation
authorJohn Wolfe <jwolfe@vmware.com>
Fri, 22 Jan 2021 20:25:40 +0000 (12:25 -0800)
committerJohn Wolfe <jwolfe@vmware.com>
Fri, 22 Jan 2021 20:25:40 +0000 (12:25 -0800)
The screen orientation/rotation was being reset on each mode set.
In general that is not a bad behavior.   But it does break with a
fit to window and such as it will continuously reset the user
requested orientation.
This patch preserves the orientation/rotation on mode changes.

open-vm-tools/services/plugins/resolutionSet/resolutionRandR12.c

index 6340b113b9687934d28d79f7be34aee470783645..d2add44646700de905f0da6b521dcdb9cb6ddcd2 100644 (file)
@@ -779,6 +779,7 @@ RandR12SetupOutput(Display *display,        // IN: The display connection
                    int height)              // IN: Height of scanout area
 {
    RRCrtc crtcID = info->xrrRes->crtcs[rrOutput->crtc];
+   XRRCrtcInfo *crtcInfo = info->crtcs[rrOutput->crtc];
    XRRModeInfo *mode;
    Status ret;
 
@@ -791,9 +792,14 @@ RandR12SetupOutput(Display *display,        // IN: The display connection
    if (!mode) {
       return FALSE;
    }
+   if (!crtcInfo) {
+       g_warning("%s: Wasn't able to find crtc info for crtc id %d.\n", __func__,
+                   (int)crtcID);
+       return FALSE;
+   }
 
    ret = XRRSetCrtcConfig(display, info->xrrRes, crtcID, CurrentTime, x, y,
-                          mode->id, RR_Rotate_0, &rrOutput->id, 1);
+                          mode->id, crtcInfo->rotation, &rrOutput->id, 1);
    if (ret == Success) {
       rrOutput->mode = mode->id;
       return TRUE;