The visible window station check was accidentally deleted in 95be042.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51590 Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/user32/sysparams.c | 10 +++++++++- dlls/user32/tests/monitor.c | 7 +++++++ 2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c index 1c943767927..24e39206746 100644 --- a/dlls/user32/sysparams.c +++ b/dlls/user32/sysparams.c @@ -4111,12 +4111,20 @@ static BOOL CALLBACK enum_mon_callback( HMONITOR monitor, HDC hdc, LPRECT rect,
BOOL CDECL nulldrv_EnumDisplayMonitors( HDC hdc, RECT *rect, MONITORENUMPROC proc, LPARAM lp ) { + BOOL is_winstation_visible = FALSE; + USEROBJECTFLAGS flags; + HWINSTA winstation; RECT monitor_rect; DWORD i = 0;
TRACE("(%p, %p, %p, 0x%lx)\n", hdc, rect, proc, lp);
- if (update_monitor_cache()) + /* Report physical monitor information only if window station has visible display surfaces */ + winstation = GetProcessWindowStation(); + if (GetUserObjectInformationW( winstation, UOI_FLAGS, &flags, sizeof(flags), NULL )) + is_winstation_visible = flags.dwFlags & WSF_VISIBLE; + + if (is_winstation_visible && update_monitor_cache()) { while (TRUE) { diff --git a/dlls/user32/tests/monitor.c b/dlls/user32/tests/monitor.c index 654f77ed617..dfb57d3e2c2 100644 --- a/dlls/user32/tests/monitor.c +++ b/dlls/user32/tests/monitor.c @@ -1563,6 +1563,7 @@ static void test_EnumDisplayMonitors(void) static const DWORD DESKTOP_ALL_ACCESS = 0x01ff; HWINSTA winstation, old_winstation; HDESK desktop, old_desktop; + USEROBJECTFLAGS flags; INT count, old_count; DWORD error; BOOL ret; @@ -1602,6 +1603,12 @@ static void test_EnumDisplayMonitors(void) ok(ret, "SetProcessWindowStation failed, error %#x.\n", GetLastError()); ok(winstation == GetProcessWindowStation(), "Expected %p, got %p.\n", GetProcessWindowStation(), winstation);
+ flags.fInherit = FALSE; + flags.fReserved = FALSE; + flags.dwFlags = WSF_VISIBLE; + ret = SetUserObjectInformationW(winstation, UOI_FLAGS, &flags, sizeof(flags)); + ok(ret, "SetUserObjectInformationW failed, error %#x.\n", GetLastError()); + desktop = CreateDesktopW(L"test_desktop", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL); ok(!!desktop && desktop != old_desktop, "CreateDesktopW failed, error %#x.\n", GetLastError()); ret = SetThreadDesktop(desktop);