Commit 95a0a5c7 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

winex11.drv: Add xrandr_get_screen_resources() helper.

Getting screen resources will be used in multiple places. So put it in a function. Signed-off-by: 's avatarZhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: 's avatarHuw Davies <huw@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 8f45d9a9
......@@ -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 )))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment