+/*
+ * 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
#include <include/winsta.h>
#include <include/msgqueue.h>
#include <ddk/ntddmou.h>
+#include <include/mouse.h>
#define NDEBUG
#include <debug.h>
static KEVENT InputThreadsStart;
static BOOLEAN InputThreadsRunning = FALSE;
-VOID MouseGDICallBack(PMOUSE_INPUT_DATA Data, ULONG InputCount);
-
/* FUNCTIONS *****************************************************************/
-NTSTATUS STDCALL STATIC
+VOID STDCALL_FUNC STATIC
KeyboardThreadMain(PVOID StartContext)
{
UNICODE_STRING KeyboardDeviceName;
FILE_SYNCHRONOUS_IO_ALERT);
if (!NT_SUCCESS(Status))
{
- DbgPrint("W32K: Failed to open keyboard.\n");
- return(Status);
+ DbgPrint("Win32K: Failed to open keyboard.\n");
+ return; //(Status);
}
for (;;)
UserMode,
TRUE,
NULL);
+
/*
* Receive and process keyboard input.
*/
{
KEY_EVENT_RECORD KeyEvent;
LPARAM lParam;
+ BOOLEAN SysKey;
Status = NtReadFile (KeyboardDeviceHandle,
NULL,
sizeof(KEY_EVENT_RECORD),
NULL,
NULL);
+ DbgPrint( "KeyRaw: %s %04x\n",
+ KeyEvent.bKeyDown ? "down" : "up",
+ KeyEvent.wVirtualScanCode );
+
if (Status == STATUS_ALERTED && !InputThreadsRunning)
{
break;
}
if (!NT_SUCCESS(Status))
{
- DbgPrint("W32K: Failed to read from keyboard.\n");
- return(Status);
+ DbgPrint("Win32K: Failed to read from keyboard.\n");
+ return; //(Status);
}
+ SysKey = KeyEvent.dwControlKeyState & (LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED);
+ DbgPrint( "Key: %s\n", KeyEvent.bKeyDown ? "down" : "up" );
+
/*
* Post a keyboard message.
*/
if (KeyEvent.bKeyDown)
{
- /* FIXME: Bit 24 indicates if this is an extended key. */
lParam = KeyEvent.wRepeatCount |
- ((KeyEvent.wVirtualScanCode << 16) & 0x00FF0000) | 0x40000000;
- MsqPostKeyboardMessage(WM_KEYDOWN, KeyEvent.wVirtualKeyCode,
+ ((KeyEvent.wVirtualScanCode << 16) & 0x00FF0000) | 0x40000000;
+
+ /* Bit 24 indicates if this is an extended key */
+ if (KeyEvent.dwControlKeyState & ENHANCED_KEY)
+ {
+ lParam |= (1 << 24);
+ }
+
+ if (SysKey)
+ {
+ lParam |= (1 << 29); /* Context mode. 1 if ALT if pressed while the key is pressed */
+ }
+
+ MsqPostKeyboardMessage(SysKey ? WM_SYSKEYDOWN : WM_KEYDOWN, KeyEvent.wVirtualKeyCode,
lParam);
}
else
{
- /* FIXME: Bit 24 indicates if this is an extended key. */
lParam = KeyEvent.wRepeatCount |
- ((KeyEvent.wVirtualScanCode << 16) & 0x00FF0000) | 0xC0000000;
- MsqPostKeyboardMessage(WM_KEYUP, KeyEvent.wVirtualKeyCode,
+ ((KeyEvent.wVirtualScanCode << 16) & 0x00FF0000) | 0xC0000000;
+
+ /* Bit 24 indicates if this is an extended key */
+ if (KeyEvent.dwControlKeyState & ENHANCED_KEY)
+ {
+ lParam |= (1 << 24);
+ }
+
+ if (SysKey)
+ {
+ lParam |= (1 << 29); /* Context mode. 1 if ALT if pressed while the key is pressed */
+ }
+ MsqPostKeyboardMessage(SysKey ? WM_SYSKEYUP : WM_KEYUP, KeyEvent.wVirtualKeyCode,
lParam);
}
}
return(STATUS_SUCCESS);
}
-NTSTATUS
+NTSTATUS FASTCALL
InitInputImpl(VOID)
{
NTSTATUS Status;
NULL);
if (!NT_SUCCESS(Status))
{
- DbgPrint("W32K: Failed to create keyboard thread.\n");
+ DbgPrint("Win32K: Failed to create keyboard thread.\n");
}
/*
0);
if (!NT_SUCCESS(Status))
{
- DbgPrint("W32K: Failed to open mouse.\n");
+ DbgPrint("Win32K: Failed to open mouse.\n");
return(Status);
}
Status = ObReferenceObjectByHandle(MouseDeviceHandle,
if (!NT_SUCCESS(Status))
{
- DbgPrint("W32K: Failed to reference mouse file object.\n");
+ DbgPrint("Win32K: Failed to reference mouse file object.\n");
return(Status);
}
KeInitializeEvent(&IoEvent, FALSE, NotificationEvent);
TRUE,
&FileObject->Event,
&Iosb);
+
+ //trigger FileObject/Event dereferencing
+ Irp->Tail.Overlay.OriginalFileObject = FileObject;
+
StackPtr = IoGetNextIrpStackLocation(Irp);
StackPtr->FileObject = FileObject;
StackPtr->DeviceObject = FileObject->DeviceObject;
}
if (!NT_SUCCESS(Status))
{
- DbgPrint("W32K: Failed to connect to mouse driver.\n");
+ DbgPrint("Win32K: Failed to connect to mouse driver.\n");
return(Status);
}
return(STATUS_SUCCESS);
}
-NTSTATUS
+NTSTATUS FASTCALL
CleanupInputImp(VOID)
{
return(STATUS_SUCCESS);
}
+BOOL
+STDCALL
+NtUserDragDetect(
+ HWND hWnd,
+ LONG x,
+ LONG y)
+{
+ UNIMPLEMENTED
+ return 0;
+}
+
+
/* EOF */