[PATCH] winex11.drv: Get the minimum screen size from XRRGetScreenSizeRange().

Zhiyi Zhang zzhang at codeweavers.com
Mon Mar 30 09:38:28 CDT 2020


RandR minimum screen size is not necessarily 0x0. Some drivers report
resolutions smaller than the minimum screen size. When Wine tries to
switch to these resolutions, a X error is generated and causes process
exit.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
 dlls/winex11.drv/xrandr.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c
index 930e0282be..bdfe3d42d9 100644
--- a/dlls/winex11.drv/xrandr.c
+++ b/dlls/winex11.drv/xrandr.c
@@ -60,6 +60,7 @@ MAKE_FUNCPTR(XRRFreeScreenResources)
 MAKE_FUNCPTR(XRRGetCrtcInfo)
 MAKE_FUNCPTR(XRRGetOutputInfo)
 MAKE_FUNCPTR(XRRGetScreenResources)
+MAKE_FUNCPTR(XRRGetScreenSizeRange)
 MAKE_FUNCPTR(XRRSetCrtcConfig)
 MAKE_FUNCPTR(XRRSetScreenSize)
 static typeof(XRRGetScreenResources) *pXRRGetScreenResourcesCurrent;
@@ -114,6 +115,7 @@ static int load_xrandr(void)
         LOAD_FUNCPTR(XRRGetCrtcInfo)
         LOAD_FUNCPTR(XRRGetOutputInfo)
         LOAD_FUNCPTR(XRRGetScreenResources)
+        LOAD_FUNCPTR(XRRGetScreenSizeRange)
         LOAD_FUNCPTR(XRRSetCrtcConfig)
         LOAD_FUNCPTR(XRRSetScreenSize)
         r = 2;
@@ -361,9 +363,13 @@ static int xrandr12_get_current_mode(void)
 
 static void get_screen_size( XRRScreenResources *resources, unsigned int *width, unsigned int *height )
 {
+    int min_width = 0, min_height = 0, max_width, max_height;
     XRRCrtcInfo *crtc_info;
     int i;
-    *width = *height = 0;
+
+    pXRRGetScreenSizeRange( gdi_display, root_window, &min_width, &min_height, &max_width, &max_height );
+    *width = min_width;
+    *height = min_height;
 
     for (i = 0; i < resources->ncrtc; ++i)
     {
-- 
2.20.1



More information about the wine-devel mailing list