winex11.drv: Initialize new display device registry display settings.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
aadae4d1ea
commit
2b484b1ac7
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue