mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 06:02:59 +00:00
win32k now can handle piped mouse input, the obsolete gdi callback can be disabled by changing ENABLEMOUSEGDICALLBACK to 0 (in input.c).
Feel free to fix mouclass to be windows compatible. svn path=/trunk/; revision=7022
This commit is contained in:
parent
dbc9a2e835
commit
5571270a01
1 changed files with 109 additions and 13 deletions
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: input.c,v 1.24 2003/12/07 19:29:33 weiden Exp $
|
/* $Id: input.c,v 1.25 2003/12/14 14:05:47 weiden Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -48,6 +48,8 @@
|
||||||
/* GLOBALS *******************************************************************/
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
static HANDLE MouseDeviceHandle;
|
static HANDLE MouseDeviceHandle;
|
||||||
|
static HANDLE MouseThreadHandle;
|
||||||
|
static CLIENT_ID MouseThreadId;
|
||||||
static HANDLE KeyboardThreadHandle;
|
static HANDLE KeyboardThreadHandle;
|
||||||
static CLIENT_ID KeyboardThreadId;
|
static CLIENT_ID KeyboardThreadId;
|
||||||
static HANDLE KeyboardDeviceHandle;
|
static HANDLE KeyboardDeviceHandle;
|
||||||
|
@ -55,8 +57,86 @@ static KEVENT InputThreadsStart;
|
||||||
static BOOLEAN InputThreadsRunning = FALSE;
|
static BOOLEAN InputThreadsRunning = FALSE;
|
||||||
PUSER_MESSAGE_QUEUE pmPrimitiveMessageQueue = 0;
|
PUSER_MESSAGE_QUEUE pmPrimitiveMessageQueue = 0;
|
||||||
|
|
||||||
|
#define ENABLEMOUSEGDICALLBACK 1
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
VOID STDCALL_FUNC STATIC
|
||||||
|
MouseThreadMain(PVOID StartContext)
|
||||||
|
{
|
||||||
|
UNICODE_STRING MouseDeviceName;
|
||||||
|
OBJECT_ATTRIBUTES MouseObjectAttributes;
|
||||||
|
IO_STATUS_BLOCK Iosb;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
RtlRosInitUnicodeStringFromLiteral(&MouseDeviceName, L"\\??\\Mouse"); /* FIXME - does win use the same? */
|
||||||
|
InitializeObjectAttributes(&MouseObjectAttributes,
|
||||||
|
&MouseDeviceName,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
Status = NtOpenFile(&MouseDeviceHandle,
|
||||||
|
FILE_ALL_ACCESS,
|
||||||
|
&MouseObjectAttributes,
|
||||||
|
&Iosb,
|
||||||
|
0,
|
||||||
|
FILE_SYNCHRONOUS_IO_ALERT);
|
||||||
|
if(!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Win32K: Failed to open mouse.\n");
|
||||||
|
return; //(Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Wait to start input.
|
||||||
|
*/
|
||||||
|
DPRINT("Mouse Input Thread Waiting for start event\n");
|
||||||
|
Status = KeWaitForSingleObject(&InputThreadsStart,
|
||||||
|
0,
|
||||||
|
KernelMode,
|
||||||
|
TRUE,
|
||||||
|
NULL);
|
||||||
|
DPRINT("Mouse Input Thread Starting...\n");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Receive and process keyboard input.
|
||||||
|
*/
|
||||||
|
while(InputThreadsRunning)
|
||||||
|
{
|
||||||
|
MOUSE_INPUT_DATA MouseInput;
|
||||||
|
Status = NtReadFile(MouseDeviceHandle,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
&Iosb,
|
||||||
|
&MouseInput,
|
||||||
|
sizeof(MOUSE_INPUT_DATA),
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
if(Status == STATUS_ALERTED && !InputThreadsRunning)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(Status == STATUS_PENDING)
|
||||||
|
{
|
||||||
|
NtWaitForSingleObject(MouseDeviceHandle, FALSE, NULL);
|
||||||
|
Status = Iosb.Status;
|
||||||
|
}
|
||||||
|
if(!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Win32K: Failed to read from mouse.\n");
|
||||||
|
return; //(Status);
|
||||||
|
}
|
||||||
|
DPRINT("MouseEvent\n");
|
||||||
|
|
||||||
|
MouseGDICallBack(&MouseInput, sizeof(MOUSE_INPUT_DATA));
|
||||||
|
}
|
||||||
|
DPRINT("Mouse Input Thread Stopped...\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
VOID STDCALL_FUNC STATIC
|
VOID STDCALL_FUNC STATIC
|
||||||
KeyboardThreadMain(PVOID StartContext)
|
KeyboardThreadMain(PVOID StartContext)
|
||||||
{
|
{
|
||||||
|
@ -91,13 +171,13 @@ KeyboardThreadMain(PVOID StartContext)
|
||||||
/*
|
/*
|
||||||
* Wait to start input.
|
* Wait to start input.
|
||||||
*/
|
*/
|
||||||
DPRINT( "Input Thread Waiting for start event\n" );
|
DPRINT( "Keyboard Input Thread Waiting for start event\n" );
|
||||||
Status = KeWaitForSingleObject(&InputThreadsStart,
|
Status = KeWaitForSingleObject(&InputThreadsStart,
|
||||||
0,
|
0,
|
||||||
UserMode,
|
KernelMode,
|
||||||
TRUE,
|
TRUE,
|
||||||
NULL);
|
NULL);
|
||||||
DPRINT( "Input Thread Starting...\n" );
|
DPRINT( "Keyboard Input Thread Starting...\n" );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Receive and process keyboard input.
|
* Receive and process keyboard input.
|
||||||
|
@ -224,7 +304,7 @@ KeyboardThreadMain(PVOID StartContext)
|
||||||
MsqPostKeyboardMessage(msg.message,msg.wParam,msg.lParam);
|
MsqPostKeyboardMessage(msg.message,msg.wParam,msg.lParam);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DPRINT( "Input Thread Stopped...\n" );
|
DPRINT( "KeyboardInput Thread Stopped...\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,6 +333,7 @@ NTSTATUS FASTCALL
|
||||||
InitInputImpl(VOID)
|
InitInputImpl(VOID)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
#if ENABLEMOUSEGDICALLBACK
|
||||||
UNICODE_STRING MouseDeviceName;
|
UNICODE_STRING MouseDeviceName;
|
||||||
OBJECT_ATTRIBUTES MouseObjectAttributes;
|
OBJECT_ATTRIBUTES MouseObjectAttributes;
|
||||||
IO_STATUS_BLOCK Iosb;
|
IO_STATUS_BLOCK Iosb;
|
||||||
|
@ -261,6 +342,7 @@ InitInputImpl(VOID)
|
||||||
GDI_INFORMATION GdiInfo;
|
GDI_INFORMATION GdiInfo;
|
||||||
KEVENT IoEvent;
|
KEVENT IoEvent;
|
||||||
PIO_STACK_LOCATION StackPtr;
|
PIO_STACK_LOCATION StackPtr;
|
||||||
|
#endif
|
||||||
|
|
||||||
KeInitializeEvent(&InputThreadsStart, NotificationEvent, FALSE);
|
KeInitializeEvent(&InputThreadsStart, NotificationEvent, FALSE);
|
||||||
|
|
||||||
|
@ -272,10 +354,26 @@ InitInputImpl(VOID)
|
||||||
KeyboardThreadMain,
|
KeyboardThreadMain,
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("Win32K: Failed to create keyboard thread.\n");
|
DPRINT1("Win32K: Failed to create keyboard thread.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Initialize the default keyboard layout */
|
||||||
|
(VOID)W32kGetDefaultKeyLayout();
|
||||||
|
|
||||||
|
Status = PsCreateSystemThread(&MouseThreadHandle,
|
||||||
|
THREAD_ALL_ACCESS,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
&MouseThreadId,
|
||||||
|
MouseThreadMain,
|
||||||
|
NULL);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Win32K: Failed to create keyboard thread.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#if ENABLEMOUSEGDICALLBACK
|
||||||
/*
|
/*
|
||||||
* Connect to the mouse class driver.
|
* Connect to the mouse class driver.
|
||||||
* Failures here don't result in a failure return, the system must be
|
* Failures here don't result in a failure return, the system must be
|
||||||
|
@ -346,11 +444,9 @@ InitInputImpl(VOID)
|
||||||
NtClose(MouseDeviceHandle);
|
NtClose(MouseDeviceHandle);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
/* Initialize the default keyboard layout */
|
|
||||||
(VOID)W32kGetDefaultKeyLayout();
|
return STATUS_SUCCESS;
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS FASTCALL
|
NTSTATUS FASTCALL
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue