-- v2: win32u: Split virtual desktop modes to a add_virtual_modes helper. win32u: Delay writing current display settings to the registry. winex11: Let win32u decide when to force update the display cache. win32u: Don't force refresh the display cache on thread desktop change. winex11: Report all sources as detached in virtual desktop mode.
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/sysparams.c | 110 ++++++++++++++---------------------- dlls/winex11.drv/xinerama.c | 3 - dlls/winex11.drv/xrandr.c | 1 - 3 files changed, 42 insertions(+), 72 deletions(-)
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 988da5a7641..fdbdb9c0568 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -1294,10 +1294,8 @@ static BOOL write_source_to_registry( const struct source *source, HKEY *source_ return TRUE; }
-static void add_source( const char *name, UINT state_flags, void *param ) +static void add_source( struct device_manager_ctx *ctx, const char *name, UINT state_flags ) { - struct device_manager_ctx *ctx = param; - TRACE( "name %s, state_flags %#x\n", name, state_flags );
if (ctx->source_key) @@ -1324,6 +1322,19 @@ static void add_source( const char *name, UINT state_flags, void *param ) } }
+static void add_physical_source( const char *name, UINT state_flags, void *param ) +{ + struct device_manager_ctx *ctx = param; + + TRACE( "name %s, state_flags %#x\n", name, state_flags ); + + /* in virtual desktop mode, report all physical sources as detached */ + ctx->is_primary = !!(state_flags & DISPLAY_DEVICE_PRIMARY_DEVICE); + if (is_virtual_desktop()) state_flags &= ~(DISPLAY_DEVICE_ATTACHED_TO_DESKTOP | DISPLAY_DEVICE_PRIMARY_DEVICE); + + add_source( ctx, name, state_flags ); +} + static BOOL write_monitor_to_registry( struct monitor *monitor, const BYTE *edid, UINT edid_len ) { char buffer[1024], *tmp; @@ -1446,7 +1457,14 @@ static void add_mode( const DEVMODEW *mode, BOOL current, void *param ) { static const DWORD source_flags = DISPLAY_DEVICE_ATTACHED_TO_DESKTOP | DISPLAY_DEVICE_PRIMARY_DEVICE | DISPLAY_DEVICE_VGA_COMPATIBLE; TRACE( "adding default fake source\n" ); - add_source( "Default", source_flags, ctx ); + add_physical_source( "Default", source_flags, ctx ); + } + + if (ctx->is_primary && current) + { + ctx->primary_bpp = mode->dmBitsPerPel; + ctx->primary_width = mode->dmPelsWidth; + ctx->primary_height = mode->dmPelsHeight; }
nopos_mode = *mode; @@ -1470,7 +1488,7 @@ static void add_mode( const DEVMODEW *mode, BOOL current, void *param ) static const struct gdi_device_manager device_manager = { add_gpu, - add_source, + add_physical_source, add_monitor, add_mode, }; @@ -1783,12 +1801,6 @@ static BOOL default_update_display_devices( const struct gdi_device_manager *man return TRUE; }
-static BOOL update_display_devices( const struct gdi_device_manager *manager, BOOL force, struct device_manager_ctx *ctx ) -{ - if (user_driver->pUpdateDisplayDevices( manager, force, ctx )) return TRUE; - return default_update_display_devices( manager, force, ctx ); -} - /* parse the desktop size specification */ static BOOL parse_size( const WCHAR *size, unsigned int *width, unsigned int *height ) { @@ -1821,44 +1833,9 @@ static BOOL get_default_desktop_size( unsigned int *width, unsigned int *height return TRUE; }
-static void desktop_add_gpu( const struct gdi_gpu *gpu, void *param ) -{ -} - -static void desktop_add_source( const char *name, UINT state_flags, void *param ) -{ - struct device_manager_ctx *ctx = param; - ctx->is_primary = !!(state_flags & DISPLAY_DEVICE_PRIMARY_DEVICE); -} - -static void desktop_add_monitor( const struct gdi_monitor *monitor, void *param ) -{ -} - -static void desktop_add_mode( const DEVMODEW *mode, BOOL current, void *param ) -{ - struct device_manager_ctx *ctx = param; - - if (ctx->is_primary && current) - { - ctx->primary_bpp = mode->dmBitsPerPel; - ctx->primary_width = mode->dmPelsWidth; - ctx->primary_height = mode->dmPelsHeight; - } -} - -static const struct gdi_device_manager desktop_device_manager = -{ - desktop_add_gpu, - desktop_add_source, - desktop_add_monitor, - desktop_add_mode, -}; - -static BOOL desktop_update_display_devices( BOOL force, struct device_manager_ctx *ctx ) +static BOOL add_virtual_source( struct device_manager_ctx *ctx ) { static const DWORD source_flags = DISPLAY_DEVICE_ATTACHED_TO_DESKTOP | DISPLAY_DEVICE_PRIMARY_DEVICE | DISPLAY_DEVICE_VGA_COMPATIBLE; - static const struct gdi_gpu gpu; struct gdi_monitor monitor = {0}; static struct screen_size { @@ -1898,7 +1875,6 @@ static BOOL desktop_update_display_devices( BOOL force, struct device_manager_ct {2560, 1600} };
- struct device_manager_ctx desktop_ctx = {0}; UINT screen_width, screen_height, max_width, max_height; unsigned int depths[] = {8, 16, 0}; DEVMODEW current, mode = @@ -1908,13 +1884,9 @@ static BOOL desktop_update_display_devices( BOOL force, struct device_manager_ct }; UINT i, j;
- if (!force) return TRUE; - /* in virtual desktop mode, read the device list from the user driver but expose virtual devices */ - if (!update_display_devices( &desktop_device_manager, TRUE, &desktop_ctx )) return FALSE; - - max_width = desktop_ctx.primary_width; - max_height = desktop_ctx.primary_height; - depths[ARRAY_SIZE(depths) - 1] = desktop_ctx.primary_bpp; + max_width = ctx->primary_width; + max_height = ctx->primary_height; + depths[ARRAY_SIZE(depths) - 1] = ctx->primary_bpp;
if (!get_default_desktop_size( &screen_width, &screen_height )) { @@ -1922,13 +1894,12 @@ static BOOL desktop_update_display_devices( BOOL force, struct device_manager_ct screen_height = max_height; }
- add_gpu( &gpu, ctx ); - add_source( "Default", source_flags, ctx ); + add_source( ctx, "Virtual", source_flags ); if (!read_source_mode( ctx->source_key, ENUM_CURRENT_SETTINGS, ¤t )) { current = mode; current.dmFields |= DM_POSITION; - current.dmBitsPerPel = desktop_ctx.primary_bpp; + current.dmBitsPerPel = ctx->primary_bpp; current.dmPelsWidth = screen_width; current.dmPelsHeight = screen_height; } @@ -1973,13 +1944,24 @@ static BOOL desktop_update_display_devices( BOOL force, struct device_manager_ct return TRUE; }
+static BOOL update_display_devices( BOOL force, struct device_manager_ctx *ctx ) +{ + if (user_driver->pUpdateDisplayDevices( &device_manager, force, ctx )) + { + if (ctx->source_count && is_virtual_desktop()) return add_virtual_source( ctx ); + return TRUE; + } + + return default_update_display_devices( &device_manager, force, ctx ); +} + BOOL update_display_cache( BOOL force ) { static const WCHAR wine_service_station_name[] = {'_','_','w','i','n','e','s','e','r','v','i','c','e','_','w','i','n','s','t','a','t','i','o','n',0}; HWINSTA winstation = NtUserGetProcessWindowStation(); struct device_manager_ctx ctx = {0}; - BOOL was_virtual_desktop, ret; + BOOL ret; WCHAR name[MAX_PATH];
/* services do not have any adapters, only a virtual monitor */ @@ -1993,15 +1975,7 @@ BOOL update_display_cache( BOOL force ) return TRUE; }
- if ((was_virtual_desktop = is_virtual_desktop())) ret = TRUE; - else ret = update_display_devices( &device_manager, force, &ctx ); - - /* as update_display_devices calls the user driver, it starts explorer and may change the virtual desktop state */ - if (ret && is_virtual_desktop()) - { - reset_display_manager_ctx( &ctx ); - ret = desktop_update_display_devices( force || !was_virtual_desktop, &ctx ); - } + ret = update_display_devices( force, &ctx );
release_display_manager_ctx( &ctx ); if (!ret) WARN( "Failed to update display devices\n" ); diff --git a/dlls/winex11.drv/xinerama.c b/dlls/winex11.drv/xinerama.c index 426ea6c11d4..fbf80819204 100644 --- a/dlls/winex11.drv/xinerama.c +++ b/dlls/winex11.drv/xinerama.c @@ -344,9 +344,6 @@ void xinerama_init( unsigned int width, unsigned int height ) int i; RECT rect;
- if (is_virtual_desktop()) - return; - pthread_mutex_lock( &xinerama_mutex );
SetRect( &rect, 0, 0, width, height ); diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c index 0e7b9a07818..002ab77c086 100644 --- a/dlls/winex11.drv/xrandr.c +++ b/dlls/winex11.drv/xrandr.c @@ -1662,7 +1662,6 @@ void X11DRV_XRandR_Init(void)
if (major) return; /* already initialized? */ if (!usexrandr) return; /* disabled in config */ - if (is_virtual_desktop()) return; if (!(ret = load_xrandr())) return; /* can't load the Xrandr library */
/* see if Xrandr is available */
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/winstation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/win32u/winstation.c b/dlls/win32u/winstation.c index 6ddd5411f94..18b55ec684a 100644 --- a/dlls/win32u/winstation.c +++ b/dlls/win32u/winstation.c @@ -264,7 +264,7 @@ BOOL WINAPI NtUserSetThreadDesktop( HDESK handle ) thread_info->client_info.top_window = 0; thread_info->client_info.msg_window = 0; if (key_state_info) key_state_info->time = 0; - if (was_virtual_desktop != is_virtual_desktop()) update_display_cache( TRUE ); + if (was_virtual_desktop != is_virtual_desktop()) update_display_cache( FALSE ); } return ret; }
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winex11.drv/window.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 5a014c9080d..4e0a17ad00c 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1947,10 +1947,7 @@ void X11DRV_SetDesktopWindow( HWND hwnd )
if (!width && !height) /* not initialized yet */ { - RECT rect; - - X11DRV_DisplayDevices_Init( TRUE ); - rect = NtUserGetVirtualScreenRect(); + RECT rect = NtUserGetVirtualScreenRect();
SERVER_START_REQ( set_window_pos ) { @@ -1983,11 +1980,7 @@ void X11DRV_SetDesktopWindow( HWND hwnd ) else { Window win = (Window)NtUserGetProp( hwnd, whole_window_prop ); - if (win && win != root_window) - { - X11DRV_init_desktop( win, width, height ); - X11DRV_DisplayDevices_Init( TRUE ); - } + if (win && win != root_window) X11DRV_init_desktop( win, width, height ); } }
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/sysparams.c | 49 +++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 19 deletions(-)
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index fdbdb9c0568..992252342fa 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -922,9 +922,8 @@ struct device_manager_ctx HKEY source_key; /* for the virtual desktop settings */ BOOL is_primary; - UINT primary_bpp; - UINT primary_width; - UINT primary_height; + DEVMODEW current; + DEVMODEW primary; };
static void link_device( const char *instance, const char *class ) @@ -1173,6 +1172,8 @@ static BOOL write_gpu_to_registry( const struct gpu *gpu, const struct pci_id *p return TRUE; }
+static void write_current_mode( struct device_manager_ctx *ctx ); + static void add_gpu( const struct gdi_gpu *gpu, void *param ) { const struct pci_id pci_id = @@ -1194,6 +1195,8 @@ static void add_gpu( const struct gdi_gpu *gpu, void *param ) if (!enum_key && !(enum_key = reg_create_ascii_key( NULL, enum_keyA, 0, NULL ))) return;
+ if (ctx->source.mode_count) write_current_mode( ctx ); + if (!ctx->mutex) { pthread_mutex_lock( &display_lock ); @@ -1298,6 +1301,8 @@ static void add_source( struct device_manager_ctx *ctx, const char *name, UINT s { TRACE( "name %s, state_flags %#x\n", name, state_flags );
+ if (ctx->source.mode_count) write_current_mode( ctx ); + if (ctx->source_key) { NtClose( ctx->source_key ); @@ -1460,11 +1465,10 @@ static void add_mode( const DEVMODEW *mode, BOOL current, void *param ) add_physical_source( "Default", source_flags, ctx ); }
- if (ctx->is_primary && current) + if (current) { - ctx->primary_bpp = mode->dmBitsPerPel; - ctx->primary_width = mode->dmPelsWidth; - ctx->primary_height = mode->dmPelsHeight; + if (ctx->is_primary) ctx->primary = *mode; + ctx->current = *mode; }
nopos_mode = *mode; @@ -1474,14 +1478,8 @@ static void add_mode( const DEVMODEW *mode, BOOL current, void *param )
if (write_source_mode( ctx->source_key, ctx->source.mode_count, &nopos_mode )) { - ctx->source.mode_count++; - set_reg_value( ctx->source_key, mode_countW, REG_DWORD, &ctx->source.mode_count, sizeof(ctx->source.mode_count) ); - if (current) - { - if (!read_source_mode( ctx->source_key, ENUM_REGISTRY_SETTINGS, &nopos_mode )) - write_source_mode( ctx->source_key, ENUM_REGISTRY_SETTINGS, mode ); - write_source_mode( ctx->source_key, ENUM_CURRENT_SETTINGS, mode ); - } + DWORD mode_count = ++ctx->source.mode_count; + set_reg_value( ctx->source_key, mode_countW, REG_DWORD, &mode_count, sizeof(mode_count) ); } }
@@ -1510,6 +1508,8 @@ static void reset_display_manager_ctx( struct device_manager_ctx *ctx )
static void release_display_manager_ctx( struct device_manager_ctx *ctx ) { + if (ctx->source.mode_count) write_current_mode( ctx ); + if (ctx->mutex) { pthread_mutex_unlock( &display_lock ); @@ -1884,9 +1884,9 @@ static BOOL add_virtual_source( struct device_manager_ctx *ctx ) }; UINT i, j;
- max_width = ctx->primary_width; - max_height = ctx->primary_height; - depths[ARRAY_SIZE(depths) - 1] = ctx->primary_bpp; + max_width = ctx->primary.dmPelsWidth; + max_height = ctx->primary.dmPelsHeight; + depths[ARRAY_SIZE(depths) - 1] = ctx->primary.dmBitsPerPel;
if (!get_default_desktop_size( &screen_width, &screen_height )) { @@ -1899,7 +1899,7 @@ static BOOL add_virtual_source( struct device_manager_ctx *ctx ) { current = mode; current.dmFields |= DM_POSITION; - current.dmBitsPerPel = ctx->primary_bpp; + current.dmBitsPerPel = ctx->primary.dmBitsPerPel; current.dmPelsWidth = screen_width; current.dmPelsHeight = screen_height; } @@ -1944,6 +1944,17 @@ static BOOL add_virtual_source( struct device_manager_ctx *ctx ) return TRUE; }
+static void write_current_mode( struct device_manager_ctx *ctx ) +{ + DEVMODEW tmp_mode = {.dmSize = sizeof(DEVMODEW)}; + + if (!read_source_mode( ctx->source_key, ENUM_REGISTRY_SETTINGS, &tmp_mode )) + write_source_mode( ctx->source_key, ENUM_REGISTRY_SETTINGS, &ctx->current ); + + write_source_mode( ctx->source_key, ENUM_CURRENT_SETTINGS, &ctx->current ); + ctx->source.mode_count = 0; +} + static BOOL update_display_devices( BOOL force, struct device_manager_ctx *ctx ) { if (user_driver->pUpdateDisplayDevices( &device_manager, force, ctx ))
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/sysparams.c | 102 ++++++++++++++++++++++------------------ 1 file changed, 56 insertions(+), 46 deletions(-)
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 992252342fa..fb9d8fd09d7 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -1802,7 +1802,7 @@ static BOOL default_update_display_devices( const struct gdi_device_manager *man }
/* parse the desktop size specification */ -static BOOL parse_size( const WCHAR *size, unsigned int *width, unsigned int *height ) +static BOOL parse_size( const WCHAR *size, DWORD *width, DWORD *height ) { WCHAR *end;
@@ -1815,7 +1815,7 @@ static BOOL parse_size( const WCHAR *size, unsigned int *width, unsigned int *he }
/* retrieve the default desktop size from the registry */ -static BOOL get_default_desktop_size( unsigned int *width, unsigned int *height ) +static BOOL get_default_desktop_size( DWORD *width, DWORD *height ) { WCHAR buffer[4096]; KEY_VALUE_PARTIAL_INFORMATION *value = (void *)buffer; @@ -1833,10 +1833,9 @@ static BOOL get_default_desktop_size( unsigned int *width, unsigned int *height return TRUE; }
-static BOOL add_virtual_source( struct device_manager_ctx *ctx ) +static BOOL add_virtual_modes( struct device_manager_ctx *ctx, const DEVMODEW *maximum, + const DEVMODEW *initial, const DEVMODEW *current ) { - static const DWORD source_flags = DISPLAY_DEVICE_ATTACHED_TO_DESKTOP | DISPLAY_DEVICE_PRIMARY_DEVICE | DISPLAY_DEVICE_VGA_COMPATIBLE; - struct gdi_monitor monitor = {0}; static struct screen_size { unsigned int width; @@ -1874,24 +1873,63 @@ static BOOL add_virtual_source( struct device_manager_ctx *ctx ) {1920, 1200}, {2560, 1600} }; + unsigned int depths[] = {8, 16, initial->dmBitsPerPel}; + DEVMODEW mode = + { + .dmFields = DM_DISPLAYORIENTATION | DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFLAGS | DM_DISPLAYFREQUENCY, + .dmDisplayFrequency = 60, + }; + UINT i, j; + + for (i = 0; i < ARRAY_SIZE(depths); ++i) + { + mode.dmBitsPerPel = depths[i];
- UINT screen_width, screen_height, max_width, max_height; - unsigned int depths[] = {8, 16, 0}; + for (j = 0; j < ARRAY_SIZE(screen_sizes); ++j) + { + mode.dmPelsWidth = screen_sizes[j].width; + mode.dmPelsHeight = screen_sizes[j].height; + + if (mode.dmPelsWidth > maximum->dmPelsWidth || mode.dmPelsHeight > maximum->dmPelsWidth) continue; + if (mode.dmPelsWidth == maximum->dmPelsWidth && mode.dmPelsHeight == maximum->dmPelsWidth) continue; + if (mode.dmPelsWidth == initial->dmPelsWidth && mode.dmPelsHeight == initial->dmPelsHeight) continue; + if (!is_same_devmode( &mode, current )) add_mode( &mode, FALSE, ctx ); + } + + mode.dmPelsWidth = initial->dmPelsWidth; + mode.dmPelsHeight = initial->dmPelsHeight; + if (!is_same_devmode( &mode, current )) add_mode( &mode, FALSE, ctx ); + + if (maximum->dmPelsWidth != initial->dmPelsWidth || maximum->dmPelsWidth != initial->dmPelsHeight) + { + mode.dmPelsWidth = maximum->dmPelsWidth; + mode.dmPelsHeight = maximum->dmPelsHeight; + if (!is_same_devmode( &mode, current )) add_mode( &mode, FALSE, ctx ); + } + } + + return TRUE; +} + +static BOOL add_virtual_source( struct device_manager_ctx *ctx ) +{ + static const DWORD source_flags = DISPLAY_DEVICE_ATTACHED_TO_DESKTOP | DISPLAY_DEVICE_PRIMARY_DEVICE | DISPLAY_DEVICE_VGA_COMPATIBLE; + struct gdi_monitor monitor = {0}; + + DEVMODEW maximum = {0}, initial = {0}; DEVMODEW current, mode = { .dmFields = DM_DISPLAYORIENTATION | DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFLAGS | DM_DISPLAYFREQUENCY, .dmDisplayFrequency = 60, }; - UINT i, j;
- max_width = ctx->primary.dmPelsWidth; - max_height = ctx->primary.dmPelsHeight; - depths[ARRAY_SIZE(depths) - 1] = ctx->primary.dmBitsPerPel; + maximum.dmPelsWidth = ctx->primary.dmPelsWidth; + maximum.dmPelsHeight = ctx->primary.dmPelsHeight;
- if (!get_default_desktop_size( &screen_width, &screen_height )) + if (!get_default_desktop_size( &initial.dmPelsWidth, &initial.dmPelsHeight )) { - screen_width = max_width; - screen_height = max_height; + initial.dmPelsWidth = maximum.dmPelsWidth; + initial.dmPelsHeight = maximum.dmPelsHeight; }
add_source( ctx, "Virtual", source_flags ); @@ -1900,8 +1938,8 @@ static BOOL add_virtual_source( struct device_manager_ctx *ctx ) current = mode; current.dmFields |= DM_POSITION; current.dmBitsPerPel = ctx->primary.dmBitsPerPel; - current.dmPelsWidth = screen_width; - current.dmPelsHeight = screen_height; + current.dmPelsWidth = initial.dmPelsWidth; + current.dmPelsHeight = initial.dmPelsHeight; }
monitor.rc_monitor.right = current.dmPelsWidth; @@ -1910,36 +1948,8 @@ static BOOL add_virtual_source( struct device_manager_ctx *ctx ) monitor.rc_work.bottom = current.dmPelsHeight; add_monitor( &monitor, ctx );
- for (i = 0; i < ARRAY_SIZE(depths); ++i) - { - mode.dmBitsPerPel = depths[i]; - - for (j = 0; j < ARRAY_SIZE(screen_sizes); ++j) - { - mode.dmPelsWidth = screen_sizes[j].width; - mode.dmPelsHeight = screen_sizes[j].height; - - if (mode.dmPelsWidth > max_width || mode.dmPelsHeight > max_height) continue; - if (mode.dmPelsWidth == max_width && mode.dmPelsHeight == max_height) continue; - if (mode.dmPelsWidth == screen_width && mode.dmPelsHeight == screen_height) continue; - - if (is_same_devmode( &mode, ¤t )) add_mode( ¤t, TRUE, ctx ); - else add_mode( &mode, FALSE, ctx ); - } - - mode.dmPelsWidth = screen_width; - mode.dmPelsHeight = screen_height; - if (is_same_devmode( &mode, ¤t )) add_mode( ¤t, TRUE, ctx ); - else add_mode( &mode, FALSE, ctx ); - - if (max_width != screen_width || max_height != screen_height) - { - mode.dmPelsWidth = max_width; - mode.dmPelsHeight = max_height; - if (is_same_devmode( &mode, ¤t )) add_mode( ¤t, TRUE, ctx ); - else add_mode( &mode, FALSE, ctx ); - } - } + add_mode( ¤t, TRUE, ctx ); + add_virtual_modes( ctx, &maximum, &initial, ¤t );
return TRUE; }
Also, why should update_display_cache() concern itself with whether to use the current display mode?
This was mostly because the sources were previously reusing the same registry key. I forgot about it but I think it can now be dropped since they now have unique name and the "Virtual" source will keep its display settings separately.
And calling is_virtual_desktop() in xrandr14_get_adapters() seems weird. I am afraid that you have to simplify it a bit more.
Right, I changed it to handle everything on the win32u side.
I feel like this patch is making things more convoluted and difficult to review. For example, the line between virtual desktop display devices and real display devices was clearer before this patch.
Well, I don't think it's more convoluted that the current way, which redirects the display device manager callbacks in an awkward way and has to make sure the virtual desktop mode is properly handled as it could have been activated by the UpdateDisplayDevices call.
Then, yes, it blurs the lines a bit between physical and virtual display devices, and that's actually on purpose, as described in https://gitlab.winehq.org/wine/wine/-/merge_requests/5057. I think it would be a nice feature to have if we could emulate virtual monitors through dedicated windows. It also makes it easier to partially virtualize a physical output, which would be needed for wayland and if we want to upstream winex11 fullscreen hack (which I actually do).
It also more properly fixes the incorrectness of having separate desktops expose different display settings to their respective threads. Even though we now have a workaround using some sort of "inherited" virtual desktop mode, it's still incorrect.