-- v3: 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 | 121 +++++++++++++++--------------------- dlls/winex11.drv/xinerama.c | 3 - dlls/winex11.drv/xrandr.c | 1 - 3 files changed, 51 insertions(+), 74 deletions(-)
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 988da5a7641..a617d613ffc 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; @@ -1440,13 +1451,20 @@ static void add_monitor( const struct gdi_monitor *gdi_monitor, void *param ) static void add_mode( const DEVMODEW *mode, BOOL current, void *param ) { struct device_manager_ctx *ctx = param; - DEVMODEW nopos_mode; + DEVMODEW nopos_mode, detached_mode;
if (!ctx->gpu.source_count) { 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; @@ -1454,13 +1472,20 @@ static void add_mode( const DEVMODEW *mode, BOOL current, void *param ) nopos_mode.dmPosition.y = 0; nopos_mode.dmFields &= ~DM_POSITION;
+ detached_mode = *mode; + detached_mode.dmPelsWidth = 0; + detached_mode.dmPelsHeight = 0; + + if (!(ctx->source.state_flags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP)) + mode = &detached_mode; + 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 )) + if (mode == &detached_mode || !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 ); } @@ -1470,7 +1495,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 +1808,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 +1840,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 +1882,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 +1891,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 +1901,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 +1951,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 +1982,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 | 65 ++++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 27 deletions(-)
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index a617d613ffc..73923855bff 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 ); @@ -1451,7 +1456,7 @@ static void add_monitor( const struct gdi_monitor *gdi_monitor, void *param ) static void add_mode( const DEVMODEW *mode, BOOL current, void *param ) { struct device_manager_ctx *ctx = param; - DEVMODEW nopos_mode, detached_mode; + DEVMODEW nopos_mode;
if (!ctx->gpu.source_count) { @@ -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; @@ -1472,23 +1476,10 @@ static void add_mode( const DEVMODEW *mode, BOOL current, void *param ) nopos_mode.dmPosition.y = 0; nopos_mode.dmFields &= ~DM_POSITION;
- detached_mode = *mode; - detached_mode.dmPelsWidth = 0; - detached_mode.dmPelsHeight = 0; - - if (!(ctx->source.state_flags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP)) - mode = &detached_mode; - 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 (mode == &detached_mode || !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) ); } }
@@ -1517,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 ); @@ -1891,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 )) { @@ -1906,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; } @@ -1951,6 +1944,24 @@ 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)}, *current = &ctx->current, detached; + + detached = *current; + detached.dmPelsWidth = 0; + detached.dmPelsHeight = 0; + + if (!(ctx->source.state_flags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP)) + current = &detached; + + if (current == &detached || !read_source_mode( ctx->source_key, ENUM_REGISTRY_SETTINGS, &tmp_mode )) + write_source_mode( ctx->source_key, ENUM_REGISTRY_SETTINGS, current ); + + write_source_mode( ctx->source_key, ENUM_CURRENT_SETTINGS, 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 | 96 ++++++++++++++++++++--------------------- 1 file changed, 48 insertions(+), 48 deletions(-)
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 73923855bff..4f7a80f1918 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,54 @@ static BOOL add_virtual_source( struct device_manager_ctx *ctx ) {1920, 1200}, {2560, 1600} }; - - UINT screen_width, screen_height, max_width, max_height; - unsigned int depths[] = {8, 16, 0}; - DEVMODEW current, mode = + 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;
- max_width = ctx->primary.dmPelsWidth; - max_height = ctx->primary.dmPelsHeight; - depths[ARRAY_SIZE(depths) - 1] = ctx->primary.dmBitsPerPel; + 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 > 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; +}
- if (!get_default_desktop_size( &screen_width, &screen_height )) +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; + DEVMODEW current, mode = ctx->primary, maximum = mode, initial = mode; + struct gdi_monitor monitor = {0}; + + 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 ); @@ -1899,9 +1928,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 +1938,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; }
Updated to write detached current / registry modes for detached display devices.
Anything to do here?
On Mon Apr 22 12:02:28 2024 +0000, Rémi Bernon wrote:
Anything to do here?
Sorry, I haven't found the time to review this yet. I will take a look soon.
This merge request was closed by Rémi Bernon.