Commit a7dba33c authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

winex11.drv: Use registry settings as a default display mode.

parent e388a493
......@@ -156,7 +156,6 @@ void X11DRV_init_desktop( Window win, unsigned int width, unsigned int height )
make_modes();
X11DRV_Settings_AddDepthModes();
dd_mode_count = X11DRV_Settings_GetModeCount();
X11DRV_Settings_SetDefaultMode(0);
}
......
......@@ -44,7 +44,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(x11settings);
static LPDDHALMODEINFO dd_modes = NULL;
static unsigned int dd_mode_count = 0;
static unsigned int dd_max_modes = 0;
static int dd_mode_default = 0;
static const unsigned int depths[] = {8, 16, 32};
/* pointers to functions that actually do the hard stuff */
......@@ -130,12 +129,6 @@ void X11DRV_Settings_AddDepthModes(void)
}
}
/* set the default mode */
void X11DRV_Settings_SetDefaultMode(int mode)
{
dd_mode_default = mode;
}
/* return the number of modes that are initialized */
unsigned int X11DRV_Settings_GetModeCount(void)
{
......@@ -377,20 +370,26 @@ LONG X11DRV_ChangeDisplaySettingsEx( LPCWSTR devname, LPDEVMODEW devmode,
if (devmode->dmFields & DM_DISPLAYFREQUENCY) def_mode &= !devmode->dmDisplayFrequency;
}
if (def_mode)
if (def_mode || !dwBpp)
{
TRACE("Return to original display mode (%s)\n", handler_name);
if (!X11DRV_EnumDisplaySettingsEx(devname, dd_mode_default, &dm, 0))
if (!X11DRV_EnumDisplaySettingsEx(devname, ENUM_REGISTRY_SETTINGS, &dm, 0))
{
ERR("Default mode not found!\n");
return DISP_CHANGE_BADMODE;
}
devmode = &dm;
if (def_mode)
{
TRACE("Return to original display mode (%s)\n", handler_name);
devmode = &dm;
}
dwBpp = dm.dmBitsPerPel;
}
dwBpp = !dwBpp ? dd_modes[dd_mode_default].dwBPP : dwBpp;
if ((devmode->dmFields & (DM_PELSWIDTH | DM_PELSHEIGHT)) != (DM_PELSWIDTH | DM_PELSHEIGHT))
{
WARN("devmode doesn't specify the resolution: %04x\n", devmode->dmFields);
return DISP_CHANGE_BADMODE;
}
for (i = 0; i < dd_mode_count; i++)
{
......@@ -423,13 +422,14 @@ LONG X11DRV_ChangeDisplaySettingsEx( LPCWSTR devname, LPDEVMODEW devmode,
if (!(flags & (CDS_TEST | CDS_NORESET)))
return pSetCurrentMode(i);
return DISP_CHANGE_SUCCESSFUL;
}
/* no valid modes found */
ERR("No matching mode found(%dx%dx%d)! (%s)\n",
ERR("No matching mode found %ux%ux%u @%u! (%s)\n",
devmode->dmPelsWidth, devmode->dmPelsHeight,
devmode->dmBitsPerPel, handler_name);
devmode->dmBitsPerPel, devmode->dmDisplayFrequency, handler_name);
return DISP_CHANGE_BADMODE;
}
......
......@@ -739,7 +739,6 @@ extern int X11DRV_Settings_CreateDriver(LPDDHALINFO info);
extern LPDDHALMODEINFO X11DRV_Settings_CreateModes(unsigned int max_modes, int reserve_depths);
unsigned int X11DRV_Settings_GetModeCount(void);
void X11DRV_Settings_Init(void);
extern void X11DRV_Settings_SetDefaultMode(int mode);
LPDDHALMODEINFO X11DRV_Settings_SetHandlers(const char *name,
int (*pNewGCM)(void),
LONG (*pNewSCM)(int),
......
......@@ -304,7 +304,6 @@ void X11DRV_XRandR_Init(void)
make_modes();
X11DRV_Settings_AddDepthModes();
dd_mode_count = X11DRV_Settings_GetModeCount();
X11DRV_Settings_SetDefaultMode(0);
TRACE("Available DD modes: count=%d\n", dd_mode_count);
TRACE("Enabling XRandR\n");
......
......@@ -197,10 +197,6 @@ void X11DRV_XF86VM_Init(void)
dd_mode_count = X11DRV_Settings_GetModeCount();
TRACE("Available DD modes: count=%d\n", dd_mode_count);
/* the first mode in the list seems to be the default */
X11DRV_Settings_SetDefaultMode(0);
TRACE("Enabling XVidMode\n");
}
......
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