- monitor device name start with "\\.\\DISPLAY<number>" than with "\\??\\DISPLAY<number>"

- 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
This commit is contained in:
Johannes Anderwald 2008-05-20 15:20:28 +00:00
parent dd8f25a940
commit 0f40cce788

View file

@ -174,7 +174,7 @@ IntAttachMonitor(IN GDIDEVICE *pGdiDevice,
return STATUS_INSUFFICIENT_RESOURCES; 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)) if (!RtlCreateUnicodeString(&Monitor->DeviceName, Buffer))
{ {
DPRINT("Couldn't duplicate monitor name!\n"); DPRINT("Couldn't duplicate monitor name!\n");
@ -322,7 +322,7 @@ IntGetMonitorsFromRect(OPTIONAL IN LPCRECT pRect,
OPTIONAL IN DWORD listSize, OPTIONAL IN DWORD listSize,
OPTIONAL IN DWORD flags) OPTIONAL IN DWORD flags)
{ {
PMONITOR_OBJECT Monitor, NearestMonitor = NULL; PMONITOR_OBJECT Monitor, NearestMonitor = NULL, PrimaryMonitor = NULL;
UINT iCount = 0; UINT iCount = 0;
LONG iNearestDistanceX = 0x7fffffff, iNearestDistanceY = 0x7fffffff; LONG iNearestDistanceX = 0x7fffffff, iNearestDistanceY = 0x7fffffff;
@ -384,6 +384,11 @@ IntGetMonitorsFromRect(OPTIONAL IN LPCRECT pRect,
IntersectionRect = MonitorRect; IntersectionRect = MonitorRect;
} }
if (flags == MONITOR_DEFAULTTOPRIMARY && Monitor->IsPrimary)
{
PrimaryMonitor = Monitor;
}
if (iCount < listSize) if (iCount < listSize)
{ {
if (hMonitorList != NULL) if (hMonitorList != NULL)
@ -403,7 +408,15 @@ IntGetMonitorsFromRect(OPTIONAL IN LPCRECT pRect,
} }
iCount++; iCount++;
} }
else if (iCount == 0 && flags == MONITOR_DEFAULTTOPRIMARY)
{
if (iCount < listSize)
{
if (hMonitorList != NULL)
hMonitorList[iCount] = PrimaryMonitor->Handle;
}
iCount++;
}
return iCount; return iCount;
} }
@ -878,7 +891,12 @@ NtUserMonitorFromWindow(
if (!(Window = UserGetWindowObject(hWnd))) 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; Rect.left = Rect.right = Window->Wnd->WindowRect.left;