From 0f40cce788f64c53825f347543ca6fd2cf1c2d68 Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Tue, 20 May 2008 15:20:28 +0000 Subject: [PATCH] - monitor device name start with "\\.\\DISPLAY" than with "\\??\\DISPLAY" - implement handling MONITOR_DEFAULTTOPRIMARY in IntGetMonitorsFromRect - implement handling MONITOR_DEFAULTTONULL in NtUserMonitorFromWIndow - ReactOS now passes all user32_winetest monitor tests svn path=/trunk/; revision=33613 --- .../subsystems/win32/win32k/ntuser/monitor.c | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/monitor.c b/reactos/subsystems/win32/win32k/ntuser/monitor.c index 3102d8cde5a..4245c005500 100644 --- a/reactos/subsystems/win32/win32k/ntuser/monitor.c +++ b/reactos/subsystems/win32/win32k/ntuser/monitor.c @@ -174,7 +174,7 @@ IntAttachMonitor(IN GDIDEVICE *pGdiDevice, return STATUS_INSUFFICIENT_RESOURCES; } - _snwprintf(Buffer, CCHDEVICENAME, L"\\??\\DISPLAY%d", DisplayNumber + 1); + _snwprintf(Buffer, CCHDEVICENAME, L"\\\\.\\DISPLAY%d", DisplayNumber + 1); if (!RtlCreateUnicodeString(&Monitor->DeviceName, Buffer)) { DPRINT("Couldn't duplicate monitor name!\n"); @@ -322,7 +322,7 @@ IntGetMonitorsFromRect(OPTIONAL IN LPCRECT pRect, OPTIONAL IN DWORD listSize, OPTIONAL IN DWORD flags) { - PMONITOR_OBJECT Monitor, NearestMonitor = NULL; + PMONITOR_OBJECT Monitor, NearestMonitor = NULL, PrimaryMonitor = NULL; UINT iCount = 0; LONG iNearestDistanceX = 0x7fffffff, iNearestDistanceY = 0x7fffffff; @@ -384,6 +384,11 @@ IntGetMonitorsFromRect(OPTIONAL IN LPCRECT pRect, IntersectionRect = MonitorRect; } + if (flags == MONITOR_DEFAULTTOPRIMARY && Monitor->IsPrimary) + { + PrimaryMonitor = Monitor; + } + if (iCount < listSize) { if (hMonitorList != NULL) @@ -403,7 +408,15 @@ IntGetMonitorsFromRect(OPTIONAL IN LPCRECT pRect, } iCount++; } - + else if (iCount == 0 && flags == MONITOR_DEFAULTTOPRIMARY) + { + if (iCount < listSize) + { + if (hMonitorList != NULL) + hMonitorList[iCount] = PrimaryMonitor->Handle; + } + iCount++; + } return iCount; } @@ -878,7 +891,12 @@ NtUserMonitorFromWindow( if (!(Window = UserGetWindowObject(hWnd))) { - RETURN(NULL); + if (dwFlags == MONITOR_DEFAULTTONULL) + { + RETURN(hMonitor); + } + IntGetMonitorsFromRect(NULL, &hMonitor, NULL, 1, dwFlags); + RETURN(hMonitor); } Rect.left = Rect.right = Window->Wnd->WindowRect.left;