Commit 2b484b1a authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

winex11.drv: Initialize new display device registry display settings.

parent aadae4d1
......@@ -177,6 +177,38 @@ void X11DRV_Settings_Init(void)
X11DRV_Settings_SetHandler(&nores_handler);
}
/* Initialize registry display settings when new display devices are added */
void init_registry_display_settings(void)
{
DEVMODEW dm = {.dmSize = sizeof(dm)};
DISPLAY_DEVICEW dd = {sizeof(dd)};
DWORD i = 0;
LONG ret;
while (EnumDisplayDevicesW(NULL, i++, &dd, 0))
{
/* Skip if the device already has registry display settings */
if (EnumDisplaySettingsExW(dd.DeviceName, ENUM_REGISTRY_SETTINGS, &dm, 0))
continue;
if (!EnumDisplaySettingsExW(dd.DeviceName, ENUM_CURRENT_SETTINGS, &dm, 0))
{
ERR("Failed to query current display settings for %s.\n", wine_dbgstr_w(dd.DeviceName));
continue;
}
TRACE("Device %s current display mode %ux%u %ubits %uHz at %d,%d.\n",
wine_dbgstr_w(dd.DeviceName), dm.dmPelsWidth, dm.dmPelsHeight, dm.dmBitsPerPel,
dm.dmDisplayFrequency, dm.u1.s2.dmPosition.x, dm.u1.s2.dmPosition.y);
ret = ChangeDisplaySettingsExW(dd.DeviceName, &dm, NULL,
CDS_GLOBAL | CDS_NORESET | CDS_UPDATEREGISTRY, NULL);
if (ret != DISP_CHANGE_SUCCESSFUL)
ERR("Failed to save registry display settings for %s, returned %d.\n",
wine_dbgstr_w(dd.DeviceName), ret);
}
}
static BOOL get_display_device_reg_key(const WCHAR *device_name, WCHAR *key, unsigned len)
{
static const WCHAR display[] = {'\\','\\','.','\\','D','I','S','P','L','A','Y'};
......
......@@ -701,6 +701,7 @@ extern void X11DRV_Settings_SetHandler(const struct x11drv_settings_handler *han
extern void X11DRV_init_desktop( Window win, unsigned int width, unsigned int height ) DECLSPEC_HIDDEN;
extern void X11DRV_resize_desktop(BOOL) DECLSPEC_HIDDEN;
extern void init_registry_display_settings(void) DECLSPEC_HIDDEN;
extern BOOL is_virtual_desktop(void) DECLSPEC_HIDDEN;
extern BOOL is_desktop_fullscreen(void) DECLSPEC_HIDDEN;
extern BOOL is_detached_mode(const DEVMODEW *) DECLSPEC_HIDDEN;
......
......@@ -1072,6 +1072,8 @@ static BOOL xrandr14_device_change_handler( HWND hwnd, XEvent *event )
* ChangeDisplaySettings(). Otherwise, ChangeDisplaySettings() would send multiple
* WM_DISPLAYCHANGE messages instead of just one */
X11DRV_DisplayDevices_Update( FALSE );
init_registry_display_settings();
}
return FALSE;
}
......
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