Based on: ca39b1c22dfa ("user32: Don't report mirrored slave monitors in EnumDisplayMonitors.") 2affb854e524 ("user32: Change slave to a more neutral word.")
Which seems to got lost during: 318673405c62 ("win32u: Move NtUserEnumDisplayMonitors implementation from user32.")
Fixes regression with Elite Dangerous launcher freezing when cloned displays are present.
Signed-off-by: Arkadiusz Hiler ahiler@codeweavers.com
CC: @zhiyi @jacek
-- v2: win32u: Don't report cloned monitors in EnumDisplayMonitors().
From: Arkadiusz Hiler ahiler@codeweavers.com
Based on: ca39b1c22dfa ("user32: Don't report mirrored slave monitors in EnumDisplayMonitors.") 2affb854e524 ("user32: Change slave to a more neutral word.")
Which seems to got lost during: 318673405c62 ("win32u: Move NtUserEnumDisplayMonitors implementation from user32.")
Fixes regression with Elite Dangerous launcher freezing when cloned displays are present.
Signed-off-by: Arkadiusz Hiler ahiler@codeweavers.com --- dlls/win32u/sysparams.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index a8c1d977c7d..0a9cb76cb6d 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -1249,9 +1249,10 @@ static BOOL update_display_cache_from_registry(void) DWORD adapter_id, monitor_id, monitor_count = 0, size; KEY_BASIC_INFORMATION key; struct adapter *adapter; - struct monitor *monitor; + struct monitor *monitor, *monitor2; HANDLE mutex = NULL; NTSTATUS status; + BOOL is_cloned; BOOL ret;
/* If user driver did initialize the registry, then exit */ @@ -1295,6 +1296,22 @@ static BOOL update_display_cache_from_registry(void) break; }
+ is_cloned = FALSE; + LIST_FOR_EACH_ENTRY(monitor2, &monitors, struct monitor, entry) + { + if (EqualRect(&monitor2->rc_monitor, &monitor->rc_monitor)) + { + is_cloned = TRUE; + break; + } + } + + if (is_cloned) + { + free( monitor ); + continue; + } + monitor->handle = UlongToHandle( ++monitor_count ); list_add_tail( &monitors, &monitor->entry ); }
This merge request was approved by Zhiyi Zhang.
Jacek Caban (@jacek) commented about dlls/win32u/sysparams.c:
is_cloned = FALSE;
LIST_FOR_EACH_ENTRY(monitor2, &monitors, struct monitor, entry)
{
if (EqualRect(&monitor2->rc_monitor, &monitor->rc_monitor))
{
is_cloned = TRUE;
break;
}
}
if (is_cloned)
{
free( monitor );
continue;
}
We will eventually want to move QueryDisplayConfig to win32u as well and it will need to be aware of mirrored monitors, so I think it's better to have them in the list. Note that most places should already handle that fine. I think it would be better to have a flag in monitor struct and skip mirrored monitors during monitor enumeration when appropriate.