XF86VidModeSwitchMode does not wrap after reducing resolution via xrandr
Submitted by Evan Danaher
Assigned to Xorg Project Team
Description
Switching video modes via Ctrl-Alt-+/- and xvidtune normally wraps around from the largest to the smallest resolutions. However, after switching to a lower resolution using xrandr, this no longer happens - zooming out from the largest resolution or in from the smallest does nothing.
I believe this is due to XF86VidModeSwitchMode attempting to switch a resolution larger than the current server size set by xrandr; so it silently fails. My simple solution is to keep trying modes as long as the resolution does not change; if no other resolution works, eventually it will wrap to the current resolution and do nothing.
The following patch implements this change:
diff -pur xorg-server-1.1.1/hw/xfree86/common/xf86Cursor.c xorg-server-1.1.1-mine/hw/xfree86/common/xf86Cursor.c --- xorg-server-1.1.1/hw/xfree86/common/xf86Cursor.c 2006-07-05 14:31:40.000000000 -0400 +++ xorg-server-1.1.1-mine/hw/xfree86/common/xf86Cursor.c 2006-10-12 13:01:49.000000000 -0400 @@ -295,13 +295,17 @@ xf86ZoomViewport(ScreenPtr pScreen, int return;
do {
- if (zoom > 0)
-
mode = mode->next;
- else
-
mode = mode->prev;
- } while (mode != pScr->currentMode && !(mode->type & M_T_USERDEF));
-
do {
-
if (zoom > 0)
-
mode = mode->next;
-
else
-
mode = mode->prev;
-
} while (mode != pScr->currentMode && !(mode->type & M_T_USERDEF));
-
(void)xf86SwitchMode(pScreen, mode);
- } while(mode != pScr->currentMode);
- (void)xf86SwitchMode(pScreen, mode); }
Version: 7.1 (2006.05)