Getting screen resources will be used in multiple places. So put it in a function.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/winex11.drv/xrandr.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c index 9f63310291..288b83fde5 100644 --- a/dlls/winex11.drv/xrandr.c +++ b/dlls/winex11.drv/xrandr.c @@ -274,6 +274,20 @@ static void xrandr10_init_modes(void)
#ifdef HAVE_XRRGETSCREENRESOURCES
+static XRRScreenResources *xrandr_get_screen_resources(void) +{ + XRRScreenResources *resources = pXRRGetScreenResourcesCurrent( gdi_display, root_window ); + if (resources && !resources->ncrtc) + { + pXRRFreeScreenResources( resources ); + resources = pXRRGetScreenResources( gdi_display, root_window ); + } + + if (!resources) + ERR("Failed to get screen resources.\n"); + return resources; +} + static int xrandr12_get_current_mode(void) { XRRScreenResources *resources; @@ -448,21 +462,8 @@ static int xrandr12_init_modes(void) int ret = -1; int i, j;
- if (!(resources = pXRRGetScreenResourcesCurrent( gdi_display, root_window ))) - { - ERR("Failed to get screen resources.\n"); + if (!(resources = xrandr_get_screen_resources())) return ret; - } - - if (!resources->ncrtc) - { - pXRRFreeScreenResources( resources ); - if (!(resources = pXRRGetScreenResources( gdi_display, root_window ))) - { - ERR("Failed to get screen resources.\n"); - return ret; - } - }
if (!(crtc_info = xrandr12_get_primary_crtc_info( resources, &primary_crtc ))) {
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=55473
Your paranoid android.
=== debian10 (32 bit report) ===
user32: msg.c:5145: Test succeeded inside todo block: ShowWindow(SW_SHOWMINIMIZED):overlapped: marked "todo_wine" but succeeds
Report errors: user32:msg prints too much data (35221 bytes)
=== debian10 (32 bit Chinese:China report) ===
user32: menu.c:2354: Test failed: test 25 msg.c:5145: Test succeeded inside todo block: ShowWindow(SW_SHOWMINIMIZED):overlapped: marked "todo_wine" but succeeds
Report errors: user32:msg prints too much data (35221 bytes)
=== debian10 (32 bit WoW report) ===
user32: menu.c:2354: Test failed: test 25 msg.c:5145: Test succeeded inside todo block: ShowWindow(SW_SHOWMINIMIZED):overlapped: marked "todo_wine" but succeeds
Report errors: user32:msg prints too much data (35222 bytes)
=== debian10 (64 bit WoW report) ===
user32: msg.c:5145: Test succeeded inside todo block: ShowWindow(SW_SHOWMINIMIZED):overlapped: marked "todo_wine" but succeeds
Report errors: user32:msg prints too much data (35221 bytes)