1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

win32u: Fix a possible condition that makes EnumDisplayMonitors() not reporting any monitors.

When there are two monitors and they are mirrored, both of them are considered primary. When the
first primary monitor happens to be a clone, EnumDisplayMonitors() ends up not reporting any
monitors because should_enumerate_monitor() returns FALSE and we break out the loop to enumerate
primary monitors after that.

This is a regression from b59619d and my review comments. My indent was to break out of the loop
after finding the *master* primary monitor, not cloned primary monitors, to avoid unnecessary
iterations. However, the primary monitor count is small and it's cleaner this way so let's break
when should_enumerate_monitor() returns TRUE.
This commit is contained in:
Zhiyi Zhang 2024-03-15 11:56:30 +08:00 committed by Alexandre Julliard
parent 1600f2e6bd
commit 6505403e58

View file

@ -3459,8 +3459,10 @@ BOOL WINAPI NtUserEnumDisplayMonitors( HDC hdc, RECT *rect, MONITORENUMPROC proc
{
if (!is_monitor_primary( monitor )) continue;
if (should_enumerate_monitor( monitor, &origin, &limit, &enum_info[count].rect ))
{
enum_info[count++].handle = monitor->handle;
break;
break;
}
}
/* then non-primary monitors */