+/*
+ * ReactOS W32 Subsystem
+ * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
/* $Id$
*
* COPYRIGHT: See COPYING in the top level directory
/* INCLUDES ******************************************************************/
-#include <ddk/ntddk.h>
+#define NTOS_MODE_KERNEL
+#include <ntos.h>
+#include <ddk/ntddmou.h>
#include <win32k/win32k.h>
#include <include/winsta.h>
#include <include/object.h>
-#include <include/guicheck.h>
#include <napi/win32.h>
#include <include/class.h>
#include <include/window.h>
+#include <include/error.h>
+#include <include/mouse.h>
+#include <include/callback.h>
#define NDEBUG
#include <debug.h>
#define WINSTA_ROOT_NAME L"\\Windows\\WindowStations"
LRESULT CALLBACK
-W32kDesktopWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
+IntDesktopWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
STATIC PWNDCLASS_OBJECT DesktopWindowClass;
/* Currently active desktop */
STATIC HDESK InputDesktopHandle = NULL;
STATIC PDESKTOP_OBJECT InputDesktop = NULL;
-STATIC PWINSTATION_OBJECT InputWindowStation = NULL;
+//STATIC PWINSTATION_OBJECT InputWindowStation = NULL;
static HDC ScreenDeviceContext = NULL;
/* FUNCTIONS *****************************************************************/
-PDESKTOP_OBJECT
-W32kGetActiveDesktop(VOID)
+
+PDESKTOP_OBJECT FASTCALL
+IntGetActiveDesktop(VOID)
{
return(InputDesktop);
}
-NTSTATUS
+PDESKTOP_OBJECT FASTCALL
+IntGetDesktopObject ( HDESK hDesk )
+{
+ /* FIXME - this obviously isn't right */
+ return IntGetActiveDesktop();
+}
+
+VOID STDCALL
+IntSetFocusMessageQueue(PUSER_MESSAGE_QUEUE NewQueue)
+{
+ PDESKTOP_OBJECT pdo = IntGetActiveDesktop();
+
+ pdo->ActiveMessageQueue = NewQueue;
+}
+
+PUSER_MESSAGE_QUEUE FASTCALL
+IntGetFocusMessageQueue(VOID)
+{
+ PDESKTOP_OBJECT pdo = IntGetActiveDesktop();
+
+ if (!pdo)
+ {
+ DPRINT("No active desktop\n");
+ return(NULL);
+ }
+
+ return (PUSER_MESSAGE_QUEUE)pdo->ActiveMessageQueue;
+}
+
+PWINDOW_OBJECT STDCALL
+IntGetCaptureWindow(VOID)
+{
+ PDESKTOP_OBJECT pdo = IntGetActiveDesktop();
+ if (!pdo)
+ {
+ DPRINT("No active desktop\n");
+ return(NULL);
+ }
+ return(pdo->CaptureWindow);
+}
+
+VOID STDCALL
+IntSetCaptureWindow(PWINDOW_OBJECT Window)
+{
+ PDESKTOP_OBJECT pdo = IntGetActiveDesktop();
+ if (!pdo)
+ {
+ DPRINT("No active desktop\n");
+ }
+ pdo->CaptureWindow = Window;
+}
+
+NTSTATUS FASTCALL
InitWindowStationImpl(VOID)
{
OBJECT_ATTRIBUTES ObjectAttributes;
HANDLE WindowStationsDirectory;
UNICODE_STRING UnicodeString;
NTSTATUS Status;
- WNDCLASSEX wcx;
-
+ WNDCLASSEXW wcx;
+
+ InputWindowStation = NULL;
+
/*
* Create the '\Windows\WindowStations' directory
*/
* Create the desktop window class
*/
wcx.style = 0;
- wcx.lpfnWndProc = W32kDesktopWindowProc;
+ wcx.lpfnWndProc = IntDesktopWindowProc;
wcx.cbClsExtra = wcx.cbWndExtra = 0;
wcx.hInstance = wcx.hIcon = wcx.hCursor = NULL;
wcx.hbrBackground = NULL;
wcx.lpszMenuName = NULL;
wcx.lpszClassName = L"DesktopWindowClass";
- DesktopWindowClass = W32kCreateClass(&wcx, TRUE);
+ DesktopWindowClass = IntCreateClass(&wcx, TRUE, (RTL_ATOM)32880);
return(STATUS_SUCCESS);
}
-NTSTATUS
+NTSTATUS FASTCALL
CleanupWindowStationImpl(VOID)
{
return STATUS_SUCCESS;
}
-NTSTATUS
+NTSTATUS STDCALL
ValidateWindowStationHandle(HWINSTA WindowStation,
KPROCESSOR_MODE AccessMode,
ACCESS_MASK DesiredAccess,
return Status;
}
-NTSTATUS
+NTSTATUS STDCALL
ValidateDesktopHandle(HDESK Desktop,
KPROCESSOR_MODE AccessMode,
ACCESS_MASK DesiredAccess,
DPRINT("Creating window station (%wZ)\n", &WindowStationName);
- Status = ObCreateObject(&WinSta,
+ Status = ObRosCreateObject(&WinSta,
STANDARD_RIGHTS_REQUIRED,
&ObjectAttributes,
ExWindowStationObjectType,
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
return((HWINSTA)0);
}
+
+ ExInitializeFastMutex(&WinStaObject->SystemCursor.CursorMutex);
+ WinStaObject->SystemCursor.Enabled = FALSE;
+ WinStaObject->SystemCursor.CurrentCursor = 0;
+ WinStaObject->SystemCursor.x = (LONG)0;
+ WinStaObject->SystemCursor.y = (LONG)0;
+ WinStaObject->SystemCursor.CursorClipInfo.IsClipped = FALSE;
+ WinStaObject->SystemCursor.LastBtnDown = 0;
+
+ /* FIXME Obtain the following information from the registry */
+ WinStaObject->SystemCursor.SwapButtons = FALSE;
+ WinStaObject->SystemCursor.SafetySwitch = FALSE;
+ WinStaObject->SystemCursor.SafetySwitch2 = TRUE;
+ WinStaObject->SystemCursor.DblClickSpeed = 500;
+ WinStaObject->SystemCursor.DblClickWidth = 4;
+ WinStaObject->SystemCursor.DblClickHeight = 4;
+
+ /* FIXME tell user32 to load the cursors from it's rosource file or
+ to load the user's cursor scheme */
+ WinStaObject->SystemCursor.SystemCursors[0].hCursor = (HANDLE)1;
+ WinStaObject->SystemCursor.SystemCursors[0].cx = 32;
+ WinStaObject->SystemCursor.SystemCursors[0].cy = 32;
+
+ /* FIXME setup system cursors */
DPRINT("Window station successfully created (%wZ)\n", &WindowStationName);
{
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING WindowStationName;
- PWINSTATION_OBJECT WinStaObject;
+ //PWINSTATION_OBJECT WinStaObject;
WCHAR NameBuffer[MAX_PATH];
NTSTATUS Status;
HWINSTA WinSta;
DPRINT("Status for open operation (0x%X)\n", Status);
- Status = ObCreateObject(&Desktop,
+ Status = ObRosCreateObject(&Desktop,
STANDARD_RIGHTS_REQUIRED,
&ObjectAttributes,
ExDesktopObjectType,
/* Initialize some local (to win32k) desktop state. */
DesktopObject->ActiveMessageQueue = NULL;
- InitializeListHead(&DesktopObject->WindowListHead);
DesktopObject->DesktopWindow =
- W32kCreateDesktopWindow(DesktopObject->WindowStation,
+ IntCreateDesktopWindow(DesktopObject->WindowStation,
DesktopWindowClass,
640, 480);
BOOL STDCALL
NtUserSetThreadDesktop(HDESK hDesktop)
-{
+{
PDESKTOP_OBJECT DesktopObject;
NTSTATUS Status;
- /* Initialize the Win32 state if necessary. */
- W32kGuiCheck();
-
/* Validate the new desktop. */
Status = ValidateDesktopHandle(hDesktop,
KernelMode,
/* FIXME: Should check here to see if the thread has any windows. */
- ObDereferenceObject(PsGetWin32Thread()->Desktop);
+ if (PsGetWin32Thread()->Desktop != NULL)
+ {
+ ObDereferenceObject(PsGetWin32Thread()->Desktop);
+ }
PsGetWin32Thread()->Desktop = DesktopObject;
return(TRUE);
return(TRUE);
}
-VOID
-W32kInitializeDesktopGraphics(VOID)
+VOID FASTCALL
+IntInitializeDesktopGraphics(VOID)
{
- ScreenDeviceContext = W32kCreateDC(L"DISPLAY", NULL, NULL, NULL);
+ ScreenDeviceContext = NtGdiCreateDC(L"DISPLAY", NULL, NULL, NULL);
GDIOBJ_MarkObjectGlobal(ScreenDeviceContext);
+ /* not the best place to load the cursors but it's good for now */
+ IntLoadDefaultCursors();
EnableMouse(ScreenDeviceContext);
NtUserAcquireOrReleaseInputOwnership(FALSE);
}
-VOID
-W32kEndDesktopGraphics(VOID)
+VOID FASTCALL
+IntEndDesktopGraphics(VOID)
{
NtUserAcquireOrReleaseInputOwnership(TRUE);
EnableMouse(FALSE);
if (NULL != ScreenDeviceContext)
{
- W32kDeleteDC(ScreenDeviceContext);
+ GDIOBJ_UnmarkObjectGlobal(ScreenDeviceContext);
+ NtGdiDeleteDC(ScreenDeviceContext);
ScreenDeviceContext = NULL;
}
}
-HDC
-W32kGetScreenDC(VOID)
+HDC FASTCALL
+IntGetScreenDC(VOID)
{
return(ScreenDeviceContext);
}
LRESULT CALLBACK
-W32kDesktopWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+IntDesktopWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
}
}
+BOOL FASTCALL
+IntGetWindowStationObject(PWINSTATION_OBJECT Object)
+{
+ NTSTATUS Status;
+
+ Status = ObReferenceObjectByPointer(Object,
+ KernelMode,
+ ExWindowStationObjectType,
+ 0);
+
+ return NT_SUCCESS(Status);
+}
+
/* EOF */