Simple implementation of some multi-monitor APIs.

svn path=/trunk/; revision=11677
This commit is contained in:
Gregor Anich 2004-11-16 16:29:21 +00:00
parent 43d65f019d
commit 3de1bbc635
9 changed files with 203 additions and 76 deletions

View file

@ -345,7 +345,7 @@ NtUserEndDeferWindowPosEx 2
NtUserEndMenu 0
NtUserEndPaint 2
NtUserEnumDisplayDevices 4
NtUserEnumDisplayMonitors 4
NtUserEnumDisplayMonitors 5
NtUserEnumDisplaySettings 4
NtUserEvent 1
NtUserExcludeUpdateRgn 2
@ -399,6 +399,7 @@ NtUserGetMenuIndex 2
NtUserGetMenuItemRect 4
NtUserGetMessage 4
NtUserGetMinMaxInfo 3
NtUserGetMonitorInfo 2
NtUserGetMouseMovePointsEx 5
NtUserGetObjectInformation 5
NtUserGetOpenClipboardWindow 0
@ -443,6 +444,9 @@ NtUserMessageCall 7
NtUserMNDragLeave 0
NtUserMNDragOver 2
NtUserModifyUserStartupInfoFlags 2
NtUserMonitorFromPoint 3
NtUserMonitorFromRect 2
NtUserMonitorFromWindow 2
NtUserMoveWindow 6
NtUserNotifyIMEStatus 3
NtUserNotifyWinEvent 4

View file

@ -489,13 +489,27 @@ NtUserEnumDisplayDevices (
PDISPLAY_DEVICE lpDisplayDevice, /* device information */
DWORD dwFlags ); /* reserved */
BOOL
/*BOOL
STDCALL
NtUserEnumDisplayMonitors (
HDC hdc,
LPCRECT lprcClip,
MONITORENUMPROC lpfnEnum,
LPARAM dwData );
LPARAM dwData );*/
#define MONITORINFOF_PRIMARY 1
#define MONITOR_DEFAULTTONULL 0
#define MONITOR_DEFAULTTOPRIMARY 1
#define MONITOR_DEFAULTTONEAREST 2
INT
STDCALL
NtUserEnumDisplayMonitors(
OPTIONAL IN HDC hDC,
OPTIONAL IN LPCRECT pRect,
OPTIONAL OUT HMONITOR *hMonitorList,
OPTIONAL OUT LPRECT monitorRectList,
OPTIONAL IN DWORD listSize );
BOOL
STDCALL
@ -762,6 +776,12 @@ NtUserGetMessage(
UINT wMsgFilterMin,
UINT wMsgFilterMax);
BOOL
STDCALL
NtUserGetMonitorInfo(
IN HMONITOR hMonitor,
OUT LPMONITORINFO pMonitorInfo);
DWORD
STDCALL
NtUserGetMouseMovePointsEx(
@ -996,6 +1016,25 @@ NtUserModifyUserStartupInfoFlags(
DWORD Unknown0,
DWORD Unknown1);
HMONITOR
STDCALL
NtUserMonitorFromPoint(
IN POINT point,
IN DWORD dwFlags);
HMONITOR
STDCALL
NtUserMonitorFromRect(
IN LPCRECT pRect,
IN DWORD dwFlags);
HMONITOR
STDCALL
NtUserMonitorFromWindow(
IN HWND hWnd,
IN DWORD dwFlags);
BOOL
STDCALL
NtUserMoveWindow(

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: display.c,v 1.12 2004/08/15 21:36:28 chorns Exp $
/* $Id: display.c,v 1.13 2004/11/16 16:27:48 blight Exp $
*
* PROJECT: ReactOS user32.dll
* FILE: lib/user32/misc/dde.c
@ -110,7 +110,63 @@ EnumDisplayMonitors(
MONITORENUMPROC lpfnEnum,
LPARAM dwData)
{
return NtUserEnumDisplayMonitors ( hdc, lprcClip, lpfnEnum, dwData );
INT iCount, i;
HMONITOR *hMonitorList;
LPRECT pRectList;
HANDLE hHeap;
/* get list of monitors/rects */
iCount = NtUserEnumDisplayMonitors(hdc, lprcClip, NULL, NULL, 0);
if (iCount < 0)
{
/* FIXME: SetLastError() */
return FALSE;
}
if (iCount == 0)
{
return TRUE;
}
hHeap = GetProcessHeap();
hMonitorList = HeapAlloc(hHeap, 0, sizeof (HMONITOR) * iCount);
if (hMonitorList == NULL)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
pRectList = HeapAlloc(hHeap, 0, sizeof (RECT) * iCount);
if (pRectList == NULL)
{
HeapFree(hHeap, 0, hMonitorList);
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
iCount = NtUserEnumDisplayMonitors(hdc, lprcClip, hMonitorList, pRectList, iCount);
if (iCount <= 0)
{
/* FIXME: SetLastError() */
return FALSE;
}
/* enumerate list */
for (i = 0; i < iCount; i++)
{
HMONITOR hMonitor = hMonitorList[i];
LPRECT pMonitorRect = pRectList + i;
HDC hMonitorDC = NULL;
if (hdc != NULL)
{
/* make monitor DC */
hMonitorDC = hdc;
}
if (!lpfnEnum(hMonitor, hMonitorDC, pMonitorRect, dwData))
break;
}
return TRUE;
}
@ -156,7 +212,7 @@ EnumDisplaySettingsA(
DWORD iModeNum,
LPDEVMODEA lpDevMode)
{
return EnumDisplaySettingsExA ( lpszDeviceName, iModeNum, lpDevMode, 0 );
return EnumDisplaySettingsExA ( lpszDeviceName, iModeNum, lpDevMode, 0 );
}
@ -194,12 +250,12 @@ EnumDisplaySettingsW(
DWORD iModeNum,
LPDEVMODEW lpDevMode)
{
return EnumDisplaySettingsExW ( lpszDeviceName, iModeNum, lpDevMode, 0 );
return EnumDisplaySettingsExW ( lpszDeviceName, iModeNum, lpDevMode, 0 );
}
/*
* @unimplemented
* @implemented
*/
BOOL
STDCALL
@ -207,13 +263,42 @@ GetMonitorInfoA(
HMONITOR hMonitor,
LPMONITORINFO lpmi)
{
UNIMPLEMENTED;
return FALSE;
if (lpmi->cbSize == sizeof (MONITORINFO))
{
return NtUserGetMonitorInfo(hMonitor, lpmi);
}
else if (lpmi->cbSize != sizeof (MONITORINFOEXA))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
else
{
MONITORINFOEXW miExW;
INT res;
miExW.cbSize = sizeof (MONITORINFOEXW);
if (!NtUserGetMonitorInfo(hMonitor, (LPMONITORINFO)&miExW))
{
return FALSE;
}
memcpy(lpmi, &miExW, sizeof (MONITORINFO));
res = WideCharToMultiByte(CP_THREAD_ACP, 0, miExW.szDevice, -1,
((LPMONITORINFOEXA)lpmi)->szDevice, CCHDEVICENAME,
NULL, NULL);
if (res == 0)
{
DPRINT("WideCharToMultiByte() failed!\n");
return FALSE;
}
}
return TRUE;
}
/*
* @unimplemented
* @implemented
*/
BOOL
STDCALL
@ -221,8 +306,46 @@ GetMonitorInfoW(
HMONITOR hMonitor,
LPMONITORINFO lpmi)
{
UNIMPLEMENTED;
return FALSE;
return NtUserGetMonitorInfo(hMonitor, lpmi);
}
/*
* @implemented
*/
HMONITOR
STDCALL
MonitorFromPoint(
IN POINT ptPoint,
IN DWORD dwFlags )
{
return NtUserMonitorFromPoint(ptPoint, dwFlags);
}
/*
* @implemented
*/
HMONITOR
STDCALL
MonitorFromRect(
IN LPCRECT lpcRect,
IN DWORD dwFlags )
{
return NtUserMonitorFromRect(lpcRect, dwFlags);
}
/*
* @implemented
*/
HMONITOR
STDCALL
MonitorFromWindow(
IN HWND hWnd,
IN DWORD dwFlags )
{
return NtUserMonitorFromWindow(hWnd, dwFlags);
}

View file

@ -1,4 +1,4 @@
/* $Id: stubs.c,v 1.67 2004/09/12 19:47:49 weiden Exp $
/* $Id: stubs.c,v 1.68 2004/11/16 16:27:48 blight Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@ -109,48 +109,6 @@ LockWorkStation(VOID)
}
/*
* @unimplemented
*/
HMONITOR
STDCALL
MonitorFromPoint(
POINT pt,
DWORD dwFlags)
{
UNIMPLEMENTED;
return (HMONITOR)0;
}
/*
* @unimplemented
*/
HMONITOR
STDCALL
MonitorFromRect(
LPRECT lprc,
DWORD dwFlags)
{
UNIMPLEMENTED;
return (HMONITOR)0;
}
/*
* @unimplemented
*/
HMONITOR
STDCALL
MonitorFromWindow(
HWND hwnd,
DWORD dwFlags)
{
UNIMPLEMENTED;
return (HMONITOR)0;
}
/*
* @unimplemented
*/

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: dllmain.c,v 1.80 2004/09/28 15:02:30 weiden Exp $
/* $Id: dllmain.c,v 1.81 2004/11/16 16:27:48 blight Exp $
*
* Entry Point for win32k.sys
*/
@ -104,6 +104,7 @@ Win32kProcessCallback (struct _EPROCESS *Process,
IntRemoveProcessWndProcHandles((HANDLE)Process->UniqueProcessId);
IntCleanupMenus(Process, Win32Process);
IntCleanupCurIcons(Process, Win32Process);
CleanupMonitorImpl();
CleanupForProcess(Process, Process->UniqueProcessId);
@ -277,6 +278,13 @@ DllMain (
return(Status);
}
Status = InitMonitorImpl();
if (!NT_SUCCESS(Status))
{
DbgPrint("Failed to initialize monitor implementation!\n");
return STATUS_UNSUCCESSFUL;
}
Status = MsqInitializeImpl();
if (!NT_SUCCESS(Status))
{

View file

@ -1,4 +1,4 @@
# $Id: makefile,v 1.104 2004/10/20 20:51:21 chorns Exp $
# $Id: makefile,v 1.105 2004/11/16 16:29:21 blight Exp $
PATH_TO_TOP = ../..
@ -64,9 +64,10 @@ NTUSER_OBJECTS = ntuser/accelerator.o ntuser/callback.o ntuser/caret.o ntuser/cl
ntuser/clipboard.o ntuser/csr.o ntuser/focus.o ntuser/desktop.o \
ntuser/guicheck.o ntuser/hook.o ntuser/hotkey.o ntuser/input.o \
ntuser/keyboard.o ntuser/menu.o ntuser/message.o ntuser/metric.o \
ntuser/misc.o ntuser/msgqueue.o ntuser/painting.o ntuser/prop.o \
ntuser/scrollbar.o ntuser/stubs.o ntuser/timer.o ntuser/useratom.o \
ntuser/vis.o ntuser/windc.o ntuser/window.o ntuser/winpos.o ntuser/winsta.o
ntuser/misc.o ntuser/monitor.o ntuser/msgqueue.o ntuser/painting.o \
ntuser/prop.o ntuser/scrollbar.o ntuser/stubs.o ntuser/timer.o \
ntuser/useratom.o ntuser/vis.o ntuser/windc.o ntuser/window.o \
ntuser/winpos.o ntuser/winsta.o
OBJECTS_OBJECTS = objects/bitmaps.o objects/brush.o objects/cliprgn.o \
objects/color.o objects/coord.o objects/dc.o \

View file

@ -1,4 +1,4 @@
/* $Id: stubs.c,v 1.46 2004/08/03 19:55:57 blight Exp $
/* $Id: stubs.c,v 1.47 2004/11/16 16:27:49 blight Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -246,19 +246,6 @@ NtUserEnumDisplayDevices (
return 0;
}
BOOL
STDCALL
NtUserEnumDisplayMonitors(
HDC hdc,
LPCRECT lprcClip,
MONITORENUMPROC lpfnEnum,
LPARAM dwData)
{
UNIMPLEMENTED
return 0;
}
DWORD
STDCALL
NtUserEvent(

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: dc.c,v 1.146 2004/08/03 19:55:58 blight Exp $
/* $Id: dc.c,v 1.147 2004/11/16 16:27:49 blight Exp $
*
* DC.C - Device context functions
*
@ -648,6 +648,9 @@ IntCreatePrimarySurface()
continue;
}
/* attach monitor */
IntAttachMonitor(&PrimarySurface, DisplayNumber);
SurfObj = EngLockSurface((HSURF)PrimarySurface.Handle);
SurfObj->dhpdev = PrimarySurface.PDev;
SurfSize = SurfObj->sizlBitmap;
@ -664,6 +667,9 @@ IntDestroyPrimarySurface()
{
DRIVER_UnreferenceDriver(L"DISPLAY");
/* detach monitor */
IntDetachMonitor(&PrimarySurface);
/*
* FIXME: Hide a mouse pointer there. Also because we have to prevent
* memory leaks with the Eng* mouse routines.

View file

@ -50,6 +50,7 @@
#include <include/inteng.h>
#include <include/intgdi.h>
#include <include/menu.h>
#include <include/monitor.h>
#include <include/mouse.h>
#include <include/msgqueue.h>
#include <include/object.h>