Commit 2b067584 authored by Ulrich Weigand's avatar Ulrich Weigand Committed by Alexandre Julliard

USER-side part of input event handling: contains implementation of

keybd_event and mouse_event, and USER-related code removed from windows/event.c and windows/keyboard.c.
parent a6663e85
......@@ -20,6 +20,8 @@
#include "except.h"
#include "win.h"
#include "flatthunk.h"
#include "mouse.h"
#include "keyboard.h"
#include "debug.h"
......@@ -690,6 +692,125 @@ static BOOL32 WINAPI THUNK_WOWCallback16Ex(
return TRUE;
}
/***********************************************************************
* THUNK_MOUSE_Enable (MOUSE.2)
*/
static VOID WINAPI THUNK_CallMouseEventProc( FARPROC16 proc,
DWORD dwFlags, DWORD dx, DWORD dy,
DWORD cButtons, DWORD dwExtraInfo )
{
CONTEXT context;
memset( &context, 0, sizeof(context) );
CS_reg(&context) = SELECTOROF( proc );
EIP_reg(&context) = OFFSETOF( proc );
AX_reg(&context) = (WORD)dwFlags;
BX_reg(&context) = (WORD)dx;
CX_reg(&context) = (WORD)dy;
DX_reg(&context) = (WORD)cButtons;
SI_reg(&context) = LOWORD( dwExtraInfo );
DI_reg(&context) = HIWORD( dwExtraInfo );
CallTo16_sreg_( &context, 0 );
}
VOID WINAPI THUNK_MOUSE_Enable( FARPROC16 proc )
{
static THUNK *lastThunk = NULL;
static FARPROC16 lastProc = NULL;
if ( lastProc != proc )
{
if ( lastThunk )
THUNK_Free( lastThunk );
if ( !proc )
lastThunk = NULL;
else
lastThunk = THUNK_Alloc( proc, (RELAY)THUNK_CallMouseEventProc );
lastProc = proc;
}
return MOUSE_Enable( (LPMOUSE_EVENT_PROC)lastThunk );
}
/***********************************************************************
* GetMouseEventProc (USER.337)
*/
FARPROC16 WINAPI GetMouseEventProc(void)
{
HMODULE16 hmodule = GetModuleHandle16("USER");
return NE_GetEntryPoint( hmodule, NE_GetOrdinal( hmodule, "mouse_event" ));
}
/***********************************************************************
* WIN16_mouse_event (USER.299)
*/
void WINAPI WIN16_mouse_event( CONTEXT *context )
{
mouse_event( AX_reg(context), BX_reg(context), CX_reg(context),
DX_reg(context), MAKELONG(SI_reg(context), DI_reg(context)) );
}
/***********************************************************************
* THUNK_KEYBD_Enable (KEYBOARD.2)
*/
static VOID WINAPI THUNK_CallKeybdEventProc( FARPROC16 proc,
BYTE bVk, BYTE bScan,
DWORD dwFlags, DWORD dwExtraInfo )
{
CONTEXT context;
memset( &context, 0, sizeof(context) );
CS_reg(&context) = SELECTOROF( proc );
EIP_reg(&context) = OFFSETOF( proc );
AH_reg(&context) = (dwFlags & KEYEVENTF_KEYUP)? 0x80 : 0;
AL_reg(&context) = bVk;
BH_reg(&context) = (dwFlags & KEYEVENTF_EXTENDEDKEY)? 1 : 0;
BL_reg(&context) = bScan;
SI_reg(&context) = LOWORD( dwExtraInfo );
DI_reg(&context) = HIWORD( dwExtraInfo );
CallTo16_sreg_( &context, 0 );
}
VOID WINAPI THUNK_KEYBOARD_Enable( FARPROC16 proc, LPBYTE lpKeyState )
{
static THUNK *lastThunk = NULL;
static FARPROC16 lastProc = NULL;
if ( lastProc != proc )
{
if ( lastThunk )
THUNK_Free( lastThunk );
if ( !proc )
lastThunk = NULL;
else
lastThunk = THUNK_Alloc( proc, (RELAY)THUNK_CallKeybdEventProc );
lastProc = proc;
}
return KEYBOARD_Enable( (LPKEYBD_EVENT_PROC)lastThunk, lpKeyState );
}
/***********************************************************************
* WIN16_keybd_event (USER.289)
*/
void WINAPI WIN16_keybd_event( CONTEXT *context )
{
DWORD dwFlags = 0;
if (AH_reg(context) & 0x80) dwFlags |= KEYEVENTF_KEYUP;
if (BH_reg(context) & 1 ) dwFlags |= KEYEVENTF_EXTENDEDKEY;
keybd_event( AL_reg(context), BL_reg(context),
dwFlags, MAKELONG(SI_reg(context), DI_reg(context)) );
}
/***********************************************************************
* 16->32 Flat Thunk routines:
......
......@@ -294,13 +294,13 @@ file user.exe
286 pascal16 GetDesktopWindow() GetDesktopWindow16
287 pascal16 GetLastActivePopup(word) GetLastActivePopup16
288 pascal GetMessageExtraInfo() GetMessageExtraInfo
#289 KEYB_EVENT
289 register keybd_event() WIN16_keybd_event
290 pascal16 RedrawWindow(word ptr word word) RedrawWindow16
291 pascal SetWindowsHookEx(s_word segptr word word) THUNK_SetWindowsHookEx16
292 pascal16 UnhookWindowsHookEx(segptr) THUNK_UnhookWindowsHookEx16
293 pascal CallNextHookEx(segptr s_word word long) CallNextHookEx16
294 pascal16 LockWindowUpdate(word) LockWindowUpdate16
299 register Mouse_Event() Mouse_Event
299 register mouse_event() WIN16_mouse_event
300 stub UnloadInstalledDrivers
#301 BOZOSLIVEHERE :-)) <- this is actually EditWndProc
#306 BEAR306
......
/*
* USER input header file
* Copyright 1997 David Faure
*
*/
#ifndef __WINE_INPUT_H
#define __WINE_INPUT_H
extern BOOL32 MouseButtonsStates[3];
extern BOOL32 AsyncMouseButtonsStates[3];
extern BYTE InputKeyStateTable[256];
extern BYTE QueueKeyStateTable[256];
extern BYTE AsyncKeyStateTable[256];
#endif /* __WINE_INPUT_H */
......@@ -3417,12 +3417,20 @@ typedef struct
#define MK_CONTROL 0x0008
#define MK_MBUTTON 0x0010
/* Mouse_Event flags */
#define ME_MOVE 0x01
#define ME_LDOWN 0x02
#define ME_LUP 0x04
#define ME_RDOWN 0x08
#define ME_RUP 0x10
/* keybd_event flags */
#define KEYEVENTF_EXTENDEDKEY 0x0001
#define KEYEVENTF_KEYUP 0x0002
#define KEYEVENTF_WINE_FORCEEXTENDED 0x8000
/* mouse_event flags */
#define MOUSEEVENTF_MOVE 0x0001
#define MOUSEEVENTF_LEFTDOWN 0x0002
#define MOUSEEVENTF_LEFTUP 0x0004
#define MOUSEEVENTF_RIGHTDOWN 0x0008
#define MOUSEEVENTF_RIGHTUP 0x0010
#define MOUSEEVENTF_MIDDLEDOWN 0x0020
#define MOUSEEVENTF_MIDDLEUP 0x0040
#define MOUSEEVENTF_ABSOLUTE 0x8000
/* Queue status flags */
#define QS_KEY 0x0001
......@@ -7121,6 +7129,8 @@ BOOL32 WINAPI WriteConsole32W(HANDLE32,LPCVOID,DWORD,LPDWORD,LPVOID);
BOOL32 WINAPI WriteFile(HANDLE32,LPCVOID,DWORD,LPDWORD,LPOVERLAPPED);
VOID WINAPI ZeroMemory(LPVOID,UINT32);
#define ZeroMemory RtlZeroMemory
VOID WINAPI keybd_event(BYTE,BYTE,DWORD,DWORD);
VOID WINAPI mouse_event(DWORD,DWORD,DWORD,DWORD,DWORD);
/* Declarations for functions that are the same in Win16 and Win32 */
......
......@@ -584,8 +584,8 @@ init MAIN_UserInit
580 stdcall WinHelpW(long wstr long long) WinHelp32W
581 stdcall WindowFromDC(long) WindowFromDC32
582 stdcall WindowFromPoint(long long) WindowFromPoint32
583 stub keybd_event
584 stub mouse_event
583 stdcall keybd_event(long long long long) keybd_event
584 stdcall mouse_event(long long long long long) mouse_event
585 varargs wsprintfA() wsprintf32A
586 varargs wsprintfW() wsprintf32W
587 stdcall wvsprintfA(ptr str ptr) wvsprintf32A
......
......@@ -14,14 +14,17 @@ C_SRCS = \
defwnd.c \
dialog.c \
dinput.c \
display.c \
driver.c \
event.c \
focus.c \
graphics.c \
hook.c \
input.c \
keyboard.c \
mdi.c \
message.c \
mouse.c \
msgbox.c \
multimon.c \
nonclient.c \
......
This diff is collapsed. Click to expand it.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment