-- v7: win32u: Set generic DEVMODEW fields in NtUserEnumDisplaySettings. win32u: Move default UpdateDisplayDevices implementation out of nulldrv. win32u: Add invisible winstation virtual monitor outside of nulldrv.
From: Rémi Bernon rbernon@codeweavers.com
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/win32u/driver.c | 1 - dlls/win32u/sysparams.c | 27 +++++++++++++-------------- 2 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c index 4a853b516f4..af6d0d610fe 100644 --- a/dlls/win32u/driver.c +++ b/dlls/win32u/driver.c @@ -767,7 +767,6 @@ static BOOL nulldrv_EnumDisplaySettingsEx( LPCWSTR name, DWORD num, LPDEVMODEW m static void nulldrv_UpdateDisplayDevices( const struct gdi_device_manager *manager, BOOL force, void *param ) { - manager->add_monitor( NULL, param ); /* use virtual monitor */ }
static BOOL nulldrv_CreateDesktopWindow( HWND hwnd ) diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index a5a69a84bd9..6c30bef29fa 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -192,8 +192,6 @@ static const WCHAR guid_devinterface_monitorW[] = {'{','E','6','F','0','7','B','5','F','-','E','E','9','7','-','4','A','9','0','-', 'B','0','7','6','-','3','3','F','5','7','B','F','4','E','A','A','7','}',0};
-#define NULLDRV_DEFAULT_HMONITOR ((HMONITOR)(UINT_PTR)(0x10000 + 1)) - /* Cached display device information */ struct display_device { @@ -233,9 +231,10 @@ static pthread_mutex_t display_lock = PTHREAD_MUTEX_INITIALIZER;
BOOL enable_thunk_lock = FALSE;
+#define VIRTUAL_HMONITOR ((HMONITOR)(UINT_PTR)(0x10000 + 1)) static struct monitor virtual_monitor = { - .handle = NULLDRV_DEFAULT_HMONITOR, + .handle = VIRTUAL_HMONITOR, .flags = MONITORINFOF_PRIMARY, .rc_monitor.right = 1024, .rc_monitor.bottom = 768, @@ -804,7 +803,6 @@ struct device_manager_ctx WCHAR gpu_guid[64]; LUID gpu_luid; HKEY adapter_key; - BOOL virtual_monitor; };
static void link_device( const WCHAR *instance, const WCHAR *class ) @@ -1078,12 +1076,6 @@ static void add_monitor( const struct gdi_monitor *monitor, void *param ) static const WCHAR default_monitorW[] = {'M','O','N','I','T','O','R','\','D','e','f','a','u','l','t','_','M','o','n','i','t','o','r',0,0};
- if (!monitor) - { - ctx->virtual_monitor = TRUE; - return; - } - TRACE( "%s %s %s\n", debugstr_w(monitor->name), wine_dbgstr_rect(&monitor->rc_monitor), wine_dbgstr_rect(&monitor->rc_work) );
@@ -1319,17 +1311,24 @@ static BOOL update_display_cache_from_registry(void)
static BOOL update_display_cache(void) { - struct device_manager_ctx ctx = { 0 }; + HWINSTA winstation = NtUserGetProcessWindowStation(); + struct device_manager_ctx ctx = {0}; + USEROBJECTFLAGS flags;
- user_driver->pUpdateDisplayDevices( &device_manager, FALSE, &ctx ); - release_display_manager_ctx( &ctx ); - if (ctx.virtual_monitor) + /* services do not have any adapters, only a virtual monitor */ + if (NtUserGetObjectInformation( winstation, UOI_FLAGS, &flags, sizeof(flags), NULL ) + && !(flags.dwFlags & WSF_VISIBLE)) { + pthread_mutex_lock( &display_lock ); clear_display_devices(); list_add_tail( &monitors, &virtual_monitor.entry ); + pthread_mutex_unlock( &display_lock ); return TRUE; }
+ user_driver->pUpdateDisplayDevices( &device_manager, FALSE, &ctx ); + release_display_manager_ctx( &ctx ); + if (update_display_cache_from_registry()) return TRUE; if (ctx.gpu_count) {
From: Rémi Bernon rbernon@codeweavers.com
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/win32u/driver.c | 9 ++++----- dlls/win32u/sysparams.c | 38 ++++++++++++++++++------------------- dlls/wineandroid.drv/init.c | 12 ++++++++++-- dlls/winemac.drv/display.c | 8 ++++---- dlls/winemac.drv/macdrv.h | 2 +- dlls/winex11.drv/display.c | 9 ++++----- dlls/winex11.drv/x11drv.h | 2 +- include/wine/gdi_driver.h | 4 ++-- 8 files changed, 45 insertions(+), 39 deletions(-)
diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c index af6d0d610fe..baa0143be61 100644 --- a/dlls/win32u/driver.c +++ b/dlls/win32u/driver.c @@ -764,9 +764,9 @@ static BOOL nulldrv_EnumDisplaySettingsEx( LPCWSTR name, DWORD num, LPDEVMODEW m return FALSE; }
-static void nulldrv_UpdateDisplayDevices( const struct gdi_device_manager *manager, - BOOL force, void *param ) +static BOOL nulldrv_UpdateDisplayDevices( const struct gdi_device_manager *manager, BOOL force, void *param ) { + return FALSE; }
static BOOL nulldrv_CreateDesktopWindow( HWND hwnd ) @@ -1111,10 +1111,9 @@ static void loaderdrv_UpdateClipboard(void) load_driver()->pUpdateClipboard(); }
-static void loaderdrv_UpdateDisplayDevices( const struct gdi_device_manager *manager, - BOOL force, void *param ) +static BOOL loaderdrv_UpdateDisplayDevices( const struct gdi_device_manager *manager, BOOL force, void *param ) { - load_driver()->pUpdateDisplayDevices( manager, force, param ); + return load_driver()->pUpdateDisplayDevices( manager, force, param ); }
static BOOL loaderdrv_CreateDesktopWindow( HWND hwnd ) diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 6c30bef29fa..e9d7df9f00b 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -1007,13 +1007,6 @@ static void add_adapter( const struct gdi_adapter *adapter, void *param )
TRACE( "\n" );
- if (!ctx->gpu_count) - { - static const struct gdi_gpu default_gpu; - TRACE( "adding default fake GPU\n" ); - add_gpu( &default_gpu, ctx ); - } - if (ctx->adapter_key) { NtClose( ctx->adapter_key ); @@ -1079,17 +1072,6 @@ static void add_monitor( const struct gdi_monitor *monitor, void *param ) TRACE( "%s %s %s\n", debugstr_w(monitor->name), wine_dbgstr_rect(&monitor->rc_monitor), wine_dbgstr_rect(&monitor->rc_work) );
- if (!ctx->adapter_count) - { - static const struct gdi_adapter default_adapter = - { - .state_flags = DISPLAY_DEVICE_ATTACHED_TO_DESKTOP | DISPLAY_DEVICE_PRIMARY_DEVICE | - DISPLAY_DEVICE_VGA_COMPATIBLE, - }; - TRACE( "adding default fake adapter\n" ); - add_adapter( &default_adapter, ctx ); - } - monitor_index = ctx->monitor_count++; output_index = ctx->output_count++;
@@ -1336,7 +1318,25 @@ static BOOL update_display_cache(void) return FALSE; }
- user_driver->pUpdateDisplayDevices( &device_manager, TRUE, &ctx ); + if (!user_driver->pUpdateDisplayDevices( &device_manager, TRUE, &ctx )) + { + static const struct gdi_gpu gpu; + static const struct gdi_adapter adapter = + { + .state_flags = DISPLAY_DEVICE_ATTACHED_TO_DESKTOP | DISPLAY_DEVICE_PRIMARY_DEVICE | DISPLAY_DEVICE_VGA_COMPATIBLE, + }; + DEVMODEW mode = {.dmPelsWidth = 1024, .dmPelsHeight = 768}; + struct gdi_monitor monitor = + { + .state_flags = DISPLAY_DEVICE_ACTIVE | DISPLAY_DEVICE_ATTACHED, + .rc_monitor = {.right = mode.dmPelsWidth, .bottom = mode.dmPelsHeight}, + .rc_work = {.right = mode.dmPelsWidth, .bottom = mode.dmPelsHeight}, + }; + + add_gpu( &gpu, &ctx ); + add_adapter( &adapter, &ctx ); + add_monitor( &monitor, &ctx ); + } release_display_manager_ctx( &ctx );
if (!update_display_cache_from_registry()) diff --git a/dlls/wineandroid.drv/init.c b/dlls/wineandroid.drv/init.c index 170ccb064a7..5d1c81a77bf 100644 --- a/dlls/wineandroid.drv/init.c +++ b/dlls/wineandroid.drv/init.c @@ -273,20 +273,28 @@ LONG ANDROID_ChangeDisplaySettingsEx( LPCWSTR devname, LPDEVMODEW devmode, /*********************************************************************** * ANDROID_UpdateDisplayDevices */ -void ANDROID_UpdateDisplayDevices( const struct gdi_device_manager *device_manager, - BOOL force, void *param ) +BOOL ANDROID_UpdateDisplayDevices( const struct gdi_device_manager *device_manager, BOOL force, void *param ) { if (force || force_display_devices_refresh) { + static const struct gdi_gpu gpu; + static const struct gdi_adapter adapter = + { + .state_flags = DISPLAY_DEVICE_ATTACHED_TO_DESKTOP | DISPLAY_DEVICE_PRIMARY_DEVICE | DISPLAY_DEVICE_VGA_COMPATIBLE, + }; struct gdi_monitor gdi_monitor = { .rc_monitor = virtual_screen_rect, .rc_work = monitor_rc_work, .state_flags = DISPLAY_DEVICE_ACTIVE | DISPLAY_DEVICE_ATTACHED, }; + device_manager->add_gpu( &gpu, param ); + device_manager->add_adapter( &adapter, param ); device_manager->add_monitor( &gdi_monitor, param ); force_display_devices_refresh = FALSE; } + + return TRUE; }
diff --git a/dlls/winemac.drv/display.c b/dlls/winemac.drv/display.c index 19b9a9cdd9d..0507acae1a9 100644 --- a/dlls/winemac.drv/display.c +++ b/dlls/winemac.drv/display.c @@ -1457,8 +1457,7 @@ void macdrv_displays_changed(const macdrv_event *event)
static BOOL force_display_devices_refresh;
-void macdrv_UpdateDisplayDevices( const struct gdi_device_manager *device_manager, - BOOL force, void *param ) +BOOL macdrv_UpdateDisplayDevices( const struct gdi_device_manager *device_manager, BOOL force, void *param ) { struct macdrv_adapter *adapters, *adapter; struct macdrv_monitor *monitors, *monitor; @@ -1466,14 +1465,14 @@ void macdrv_UpdateDisplayDevices( const struct gdi_device_manager *device_manage INT gpu_count, adapter_count, monitor_count; DWORD len;
- if (!force && !force_display_devices_refresh) return; + if (!force && !force_display_devices_refresh) return TRUE; force_display_devices_refresh = FALSE;
/* Initialize GPUs */ if (macdrv_get_gpus(&gpus, &gpu_count)) { ERR("could not get GPUs\n"); - return; + return FALSE; } TRACE("GPU count: %d\n", gpu_count);
@@ -1528,6 +1527,7 @@ void macdrv_UpdateDisplayDevices( const struct gdi_device_manager *device_manage }
macdrv_free_gpus(gpus); + return TRUE; }
/*********************************************************************** diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index 7c0f7127883..72bd1cefaeb 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -131,7 +131,7 @@ extern LONG macdrv_ChangeDisplaySettingsEx(LPCWSTR devname, LPDEVMODEW devmode, extern BOOL macdrv_EnumDisplaySettingsEx(LPCWSTR devname, DWORD mode, LPDEVMODEW devmode, DWORD flags) DECLSPEC_HIDDEN; extern LRESULT macdrv_ClipboardWindowProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) DECLSPEC_HIDDEN; -extern void macdrv_UpdateDisplayDevices( const struct gdi_device_manager *device_manager, +extern BOOL macdrv_UpdateDisplayDevices( const struct gdi_device_manager *device_manager, BOOL force, void *param ) DECLSPEC_HIDDEN; extern BOOL macdrv_GetDeviceGammaRamp(PHYSDEV dev, LPVOID ramp) DECLSPEC_HIDDEN; extern BOOL macdrv_SetDeviceGammaRamp(PHYSDEV dev, LPVOID ramp) DECLSPEC_HIDDEN; diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c index dec9d0afba8..31f73898897 100644 --- a/dlls/winex11.drv/display.c +++ b/dlls/winex11.drv/display.c @@ -1198,8 +1198,7 @@ void X11DRV_DisplayDevices_Update(BOOL send_display_change)
static BOOL force_display_devices_refresh;
-void X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manager, - BOOL force, void *param ) +BOOL X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manager, BOOL force, void *param ) { struct x11drv_display_device_handler *handler; struct gdi_adapter *adapters; @@ -1208,15 +1207,14 @@ void X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manage INT gpu_count, adapter_count, monitor_count; INT gpu, adapter, monitor;
- if (!force && !force_display_devices_refresh) return; + if (!force && !force_display_devices_refresh) return TRUE; force_display_devices_refresh = FALSE; handler = is_virtual_desktop() ? &desktop_handler : &host_handler;
TRACE("via %s\n", wine_dbgstr_a(handler->name));
/* Initialize GPUs */ - if (!handler->get_gpus(&gpus, &gpu_count)) - return; + if (!handler->get_gpus( &gpus, &gpu_count )) return FALSE; TRACE("GPU count: %d\n", gpu_count);
for (gpu = 0; gpu < gpu_count; gpu++) @@ -1248,6 +1246,7 @@ void X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manage }
handler->free_gpus(gpus); + return TRUE; }
void X11DRV_DisplayDevices_Init(BOOL force) diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 003604cd97d..cd0d33f59bf 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -217,7 +217,7 @@ extern LONG X11DRV_ChangeDisplaySettingsEx( LPCWSTR devname, LPDEVMODEW devmode, HWND hwnd, DWORD flags, LPVOID lpvoid ) DECLSPEC_HIDDEN; extern BOOL X11DRV_EnumDisplaySettingsEx( LPCWSTR name, DWORD n, LPDEVMODEW devmode, DWORD flags ) DECLSPEC_HIDDEN; -extern void X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manager, +extern BOOL X11DRV_UpdateDisplayDevices( const struct gdi_device_manager *device_manager, BOOL force, void *param ) DECLSPEC_HIDDEN; extern BOOL X11DRV_CreateDesktopWindow( HWND hwnd ) DECLSPEC_HIDDEN; extern BOOL X11DRV_CreateWindow( HWND hwnd ) DECLSPEC_HIDDEN; diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index 998aa3ed3e9..77ccc431e51 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -168,7 +168,7 @@ struct gdi_dc_funcs };
/* increment this when you change the DC function table */ -#define WINE_GDI_DRIVER_VERSION 80 +#define WINE_GDI_DRIVER_VERSION 81
#define GDI_PRIORITY_NULL_DRV 0 /* null driver */ #define GDI_PRIORITY_FONT_DRV 100 /* any font driver */ @@ -296,7 +296,7 @@ struct user_driver_funcs /* display modes */ LONG (*pChangeDisplaySettingsEx)(LPCWSTR,LPDEVMODEW,HWND,DWORD,LPVOID); BOOL (*pEnumDisplaySettingsEx)(LPCWSTR,DWORD,LPDEVMODEW,DWORD); - void (*pUpdateDisplayDevices)(const struct gdi_device_manager *,BOOL,void*); + BOOL (*pUpdateDisplayDevices)(const struct gdi_device_manager *,BOOL,void*); /* windowing functions */ BOOL (*pCreateDesktopWindow)(HWND); BOOL (*pCreateWindow)(HWND);
From: Rémi Bernon rbernon@codeweavers.com
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/win32u/sysparams.c | 27 +++++++++++++++------------ dlls/wineandroid.drv/init.c | 8 -------- dlls/winemac.drv/display.c | 9 --------- dlls/winex11.drv/display.c | 25 ++++++++----------------- 4 files changed, 23 insertions(+), 46 deletions(-)
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index e9d7df9f00b..ea343ab7dd3 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -1926,14 +1926,14 @@ LONG WINAPI NtUserChangeDisplaySettings( UNICODE_STRING *devname, DEVMODEW *devm /*********************************************************************** * NtUserEnumDisplaySettings (win32u.@) */ -BOOL WINAPI NtUserEnumDisplaySettings( UNICODE_STRING *device, DWORD mode, - DEVMODEW *dev_mode, DWORD flags ) +BOOL WINAPI NtUserEnumDisplaySettings( UNICODE_STRING *device, DWORD index, DEVMODEW *devmode, DWORD flags ) { + static const WCHAR wine_display_driverW[] = {'W','i','n','e',' ','D','i','s','p','l','a','y',' ','D','r','i','v','e','r',0}; WCHAR device_name[CCHDEVICENAME]; struct adapter *adapter; BOOL ret;
- TRACE( "%s %#x %p %#x\n", debugstr_us(device), mode, dev_mode, flags ); + TRACE( "device %s, index %#x, devmode %p, flags %#x\n", debugstr_us(device), index, devmode, flags );
if (!lock_display_devices()) return FALSE; if ((adapter = find_adapter( device ))) lstrcpyW( device_name, adapter->dev.device_name ); @@ -1944,15 +1944,18 @@ BOOL WINAPI NtUserEnumDisplaySettings( UNICODE_STRING *device, DWORD mode, return FALSE; }
- ret = user_driver->pEnumDisplaySettingsEx( device_name, mode, dev_mode, flags ); - if (ret) - TRACE( "device:%s mode index:%#x position:(%d,%d) resolution:%ux%u frequency:%uHz " - "depth:%ubits orientation:%#x.\n", debugstr_w(device_name), mode, - dev_mode->dmPosition.x, dev_mode->dmPosition.y, dev_mode->dmPelsWidth, - dev_mode->dmPelsHeight, dev_mode->dmDisplayFrequency, dev_mode->dmBitsPerPel, - dev_mode->dmDisplayOrientation ); - else - WARN( "Failed to query %s display settings.\n", wine_dbgstr_w(device_name) ); + lstrcpynW( devmode->dmDeviceName, wine_display_driverW, ARRAY_SIZE(devmode->dmDeviceName) ); + devmode->dmSpecVersion = DM_SPECVERSION; + devmode->dmDriverVersion = DM_SPECVERSION; + devmode->dmSize = offsetof(DEVMODEW, dmICMMethod); + memset( &devmode->dmDriverExtra, 0, devmode->dmSize - offsetof(DEVMODEW, dmDriverExtra) ); + + ret = user_driver->pEnumDisplaySettingsEx( device_name, index, devmode, flags ); + + if (!ret) WARN( "Failed to query %s display settings.\n", debugstr_w(device_name) ); + else TRACE( "position %dx%d, resolution %ux%u, frequency %u, depth %u, orientation %#x.\n", + devmode->dmPosition.x, devmode->dmPosition.y, devmode->dmPelsWidth, devmode->dmPelsHeight, + devmode->dmDisplayFrequency, devmode->dmBitsPerPel, devmode->dmDisplayOrientation ); return ret; }
diff --git a/dlls/wineandroid.drv/init.c b/dlls/wineandroid.drv/init.c index 5d1c81a77bf..e2cebb974c3 100644 --- a/dlls/wineandroid.drv/init.c +++ b/dlls/wineandroid.drv/init.c @@ -303,14 +303,6 @@ BOOL ANDROID_UpdateDisplayDevices( const struct gdi_device_manager *device_manag */ BOOL ANDROID_EnumDisplaySettingsEx( LPCWSTR name, DWORD n, LPDEVMODEW devmode, DWORD flags ) { - static const WCHAR dev_name[CCHDEVICENAME] = - { 'W','i','n','e',' ','A','n','d','r','o','i','d',' ','d','r','i','v','e','r',0 }; - - devmode->dmSize = offsetof( DEVMODEW, dmICMMethod ); - devmode->dmSpecVersion = DM_SPECVERSION; - devmode->dmDriverVersion = DM_SPECVERSION; - memcpy( devmode->dmDeviceName, dev_name, sizeof(dev_name) ); - devmode->dmDriverExtra = 0; devmode->u2.dmDisplayFlags = 0; devmode->dmDisplayFrequency = 0; devmode->u1.s2.dmPosition.x = 0; diff --git a/dlls/winemac.drv/display.c b/dlls/winemac.drv/display.c index 0507acae1a9..191dc1f789b 100644 --- a/dlls/winemac.drv/display.c +++ b/dlls/winemac.drv/display.c @@ -1044,8 +1044,6 @@ better: */ BOOL macdrv_EnumDisplaySettingsEx(LPCWSTR devname, DWORD mode, DEVMODEW *devmode, DWORD flags) { - static const WCHAR dev_name[CCHDEVICENAME] = - { 'W','i','n','e',' ','M','a','c',' ','d','r','i','v','e','r',0 }; struct macdrv_display *displays = NULL; int num_displays; CGDisplayModeRef display_mode; @@ -1058,13 +1056,6 @@ BOOL macdrv_EnumDisplaySettingsEx(LPCWSTR devname, DWORD mode, DEVMODEW *devmode
init_original_display_mode();
- memcpy(devmode->dmDeviceName, dev_name, sizeof(dev_name)); - devmode->dmSpecVersion = DM_SPECVERSION; - devmode->dmDriverVersion = DM_SPECVERSION; - devmode->dmSize = FIELD_OFFSET(DEVMODEW, dmICMMethod); - devmode->dmDriverExtra = 0; - memset(&devmode->dmFields, 0, devmode->dmSize - FIELD_OFFSET(DEVMODEW, dmFields)); - if (mode == ENUM_REGISTRY_SETTINGS) { TRACE("mode %d (registry) -- getting default mode\n", mode); diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c index 31f73898897..740e018247b 100644 --- a/dlls/winex11.drv/display.c +++ b/dlls/winex11.drv/display.c @@ -464,9 +464,7 @@ static DWORD get_display_depth(ULONG_PTR display_id) */ BOOL X11DRV_EnumDisplaySettingsEx( LPCWSTR name, DWORD n, LPDEVMODEW devmode, DWORD flags) { - static const WCHAR dev_name[CCHDEVICENAME] = - { 'W','i','n','e',' ','X','1','1',' ','d','r','i','v','e','r',0 }; - DEVMODEW *modes; + DEVMODEW *modes, mode; UINT mode_count; ULONG_PTR id;
@@ -477,21 +475,20 @@ BOOL X11DRV_EnumDisplaySettingsEx( LPCWSTR name, DWORD n, LPDEVMODEW devmode, DW ERR("Failed to get %s registry display settings.\n", wine_dbgstr_w(name)); return FALSE; } - goto done; + return TRUE; }
if (n == ENUM_CURRENT_SETTINGS) { - if (!settings_handler.get_id(name, &id) || !settings_handler.get_current_mode(id, devmode)) + if (!settings_handler.get_id( name, &id ) || !settings_handler.get_current_mode( id, &mode )) { ERR("Failed to get %s current display settings.\n", wine_dbgstr_w(name)); return FALSE; }
- if (!is_detached_mode(devmode)) - devmode->dmBitsPerPel = get_display_depth(id); - - goto done; + memcpy( &devmode->dmFields, &mode.dmFields, devmode->dmSize - offsetof(DEVMODEW, dmFields) ); + if (!is_detached_mode( devmode )) devmode->dmBitsPerPel = get_display_depth( id ); + return TRUE; }
pthread_mutex_lock( &settings_mutex ); @@ -522,16 +519,10 @@ BOOL X11DRV_EnumDisplaySettingsEx( LPCWSTR name, DWORD n, LPDEVMODEW devmode, DW return FALSE; }
- memcpy(devmode, (BYTE *)cached_modes + (sizeof(*cached_modes) + cached_modes[0].dmDriverExtra) * n, sizeof(*devmode)); + mode = *(DEVMODEW *)((BYTE *)cached_modes + (sizeof(*cached_modes) + cached_modes[0].dmDriverExtra) * n); pthread_mutex_unlock( &settings_mutex );
-done: - /* Set generic fields */ - devmode->dmSize = FIELD_OFFSET(DEVMODEW, dmICMMethod); - devmode->dmDriverExtra = 0; - devmode->dmSpecVersion = DM_SPECVERSION; - devmode->dmDriverVersion = DM_SPECVERSION; - lstrcpyW(devmode->dmDeviceName, dev_name); + memcpy( &devmode->dmFields, &mode.dmFields, devmode->dmSize - offsetof(DEVMODEW, dmFields) ); return TRUE; }
Updated with only the first three commits. Looks like from https://testbot.winehq.org/JobDetails.pl?Key=118394 that reading registry settings needs some fixes.
On Wed Jul 6 12:22:55 2022 +0000, Rémi Bernon wrote:
Argh... yeah, though I suspect this one might be coming from the first commit. I probably broke something with the static virtual monitor.
I kept the existing virtual_monitor `clear_display_devices` check.