[PATCH 4/5] winex11: Simplify X11DRV_XRandR_Init() error handling a bit.

Henri Verbeet hverbeet at codeweavers.com
Wed Jul 11 05:19:04 CDT 2012


---
 dlls/winex11.drv/xrandr.c |   23 +++++++++--------------
 1 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c
index f818a61..c597be7 100644
--- a/dlls/winex11.drv/xrandr.c
+++ b/dlls/winex11.drv/xrandr.c
@@ -267,8 +267,6 @@ static void xrandr_init_modes(void)
 
 void X11DRV_XRandR_Init(void)
 {
-    Bool ok;
-
     if (xrandr_major) return; /* already initialized? */
     if (!usexrandr) return; /* disabled in config */
     if (root_window != DefaultRootWindow( gdi_display )) return;
@@ -276,18 +274,15 @@ void X11DRV_XRandR_Init(void)
 
     /* see if Xrandr is available */
     wine_tsx11_lock();
-    ok = pXRRQueryExtension(gdi_display, &xrandr_event, &xrandr_error);
-    if (ok)
-    {
-        X11DRV_expect_error(gdi_display, XRandRErrorHandler, NULL);
-        ok = pXRRQueryVersion(gdi_display, &xrandr_major, &xrandr_minor);
-        if (X11DRV_check_error()) ok = FALSE;
-    }
-    if (ok)
-    {
-        TRACE("Found XRandR - major: %d, minor: %d\n", xrandr_major, xrandr_minor);
-        xrandr_init_modes();
-    }
+    if (!pXRRQueryExtension( gdi_display, &xrandr_event, &xrandr_error )) goto done;
+    X11DRV_expect_error( gdi_display, XRandRErrorHandler, NULL );
+    if (!pXRRQueryVersion( gdi_display, &xrandr_major, &xrandr_minor )) goto done;
+    if (X11DRV_check_error()) goto done;
+
+    TRACE("Found XRandR %d.%d.\n", xrandr_major, xrandr_minor);
+    xrandr_init_modes();
+
+done:
     wine_tsx11_unlock();
 }
 
-- 
1.7.8.6




More information about the wine-patches mailing list