From f9037de2ae1d72a0c748ebc60b66e9b2d1d19025 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 25 Jun 2001 20:01:03 +0000 Subject: [PATCH] Implemented SendInput(). --- dlls/user/user.spec | 4 +- dlls/user/user32.spec | 1 + include/winuser.h | 69 ++++++-- include/x11drv.h | 2 +- windows/input.c | 353 ++++++++++++++++++++++++----------------- windows/x11drv/event.c | 38 ++--- windows/x11drv/mouse.c | 10 +- 7 files changed, 280 insertions(+), 197 deletions(-) diff --git a/dlls/user/user.spec b/dlls/user/user.spec index 55963f646d6..6288023ec9a 100644 --- a/dlls/user/user.spec +++ b/dlls/user/user.spec @@ -298,13 +298,13 @@ rsrc resources/version16.res 286 pascal16 GetDesktopWindow() GetDesktopWindow16 287 pascal16 GetLastActivePopup(word) GetLastActivePopup16 288 pascal GetMessageExtraInfo() GetMessageExtraInfo -289 register keybd_event() WIN16_keybd_event +289 register keybd_event() keybd_event16 290 pascal16 RedrawWindow(word ptr word word) RedrawWindow16 291 pascal SetWindowsHookEx(s_word segptr word word) SetWindowsHookEx16 292 pascal16 UnhookWindowsHookEx(segptr) UnhookWindowsHookEx16 293 pascal CallNextHookEx(segptr s_word word long) CallNextHookEx16 294 pascal16 LockWindowUpdate(word) LockWindowUpdate16 -299 register mouse_event() WIN16_mouse_event +299 register mouse_event() mouse_event16 300 stub UnloadInstalledDrivers # W1.1: USER_FARFRAME 301 stub EDITWNDPROC # BOZOSLIVEHERE :-)) 302 stub STATICWNDPROC diff --git a/dlls/user/user32.spec b/dlls/user/user32.spec index 845ee91ec60..fb0215b7a11 100644 --- a/dlls/user/user32.spec +++ b/dlls/user/user32.spec @@ -662,6 +662,7 @@ debug_channels (accel caret class clipboard combo cursor dc dde ddeml dialog dri @ stdcall GetWindowModuleFileNameA(long ptr long) GetWindowModuleFileNameA @ stdcall GetWindowModuleFileNameW(long ptr long) GetWindowModuleFileNameW @ stdcall LockSetForegroundWindow (long) LockSetForegroundWindow +@ stdcall SendInput(long ptr long) SendInput ################################################################ # Wine extensions: Win16 functions that are needed by other dlls diff --git a/include/winuser.h b/include/winuser.h index c7a96d51917..0ade5f7e711 100644 --- a/include/winuser.h +++ b/include/winuser.h @@ -147,6 +147,48 @@ typedef struct #define KL_NAMELENGTH 9 +typedef struct tagMOUSEINPUT +{ + LONG dx; + LONG dy; + DWORD mouseData; + DWORD dwFlags; + DWORD time; + ULONG_PTR dwExtraInfo; +} MOUSEINPUT, *PMOUSEINPUT, *LPMOUSEINPUT; + +typedef struct tagKEYBDINPUT +{ + WORD wVk; + WORD wScan; + DWORD dwFlags; + DWORD time; + ULONG_PTR dwExtraInfo; +} KEYBDINPUT, *PKEYBDINPUT, *LPKEYBDINPUT; + +typedef struct tagHARDWAREINPUT +{ + DWORD uMsg; + WORD wParamL; + WORD wParamH; +} HARDWAREINPUT, *PHARDWAREINPUT, *LPHARDWAREINPUT; + +#define INPUT_MOUSE 0 +#define INPUT_KEYBOARD 1 +#define INPUT_HARDWARE 2 + +typedef struct tagINPUT +{ + DWORD type; + union + { + MOUSEINPUT mi; + KEYBDINPUT ki; + HARDWAREINPUT hi; + } DUMMYUNIONNAME; +} INPUT, *PINPUT, *LPINPUT; + + /***** Dialogs *****/ /* Gcc on Solaris has a version of this that we don't care about */ #undef FSHIFT @@ -3749,29 +3791,26 @@ BOOL WINAPI RemoveMenu(HMENU,UINT,UINT); HANDLE WINAPI RemovePropA(HWND,LPCSTR); HANDLE WINAPI RemovePropW(HWND,LPCWSTR); #define RemoveProp WINELIB_NAME_AW(RemoveProp) -BOOL WINAPI ReplyMessage(LRESULT); -BOOL WINAPI ScreenToClient(HWND,LPPOINT); +BOOL WINAPI ReplyMessage(LRESULT); +BOOL WINAPI ScreenToClient(HWND,LPPOINT); VOID WINAPI ScrollChildren(HWND,UINT,WPARAM,LPARAM); -BOOL WINAPI ScrollDC(HDC,INT,INT,const RECT*,const RECT*, - HRGN,LPRECT); -BOOL WINAPI ScrollWindow(HWND,INT,INT,const RECT*,const RECT*); -INT WINAPI ScrollWindowEx(HWND,INT,INT,const RECT*, - const RECT*,HRGN,LPRECT,UINT); +BOOL WINAPI ScrollDC(HDC,INT,INT,const RECT*,const RECT*,HRGN,LPRECT); +BOOL WINAPI ScrollWindow(HWND,INT,INT,const RECT*,const RECT*); +INT WINAPI ScrollWindowEx(HWND,INT,INT,const RECT*,const RECT*,HRGN,LPRECT,UINT); LRESULT WINAPI SendDlgItemMessageA(HWND,INT,UINT,WPARAM,LPARAM); LRESULT WINAPI SendDlgItemMessageW(HWND,INT,UINT,WPARAM,LPARAM); #define SendDlgItemMessage WINELIB_NAME_AW(SendDlgItemMessage) +UINT WINAPI SendInput(UINT,LPINPUT,int); LRESULT WINAPI SendMessageA(HWND,UINT,WPARAM,LPARAM); LRESULT WINAPI SendMessageW(HWND,UINT,WPARAM,LPARAM); #define SendMessage WINELIB_NAME_AW(SendMessage) -LRESULT WINAPI SendMessageTimeoutA(HWND,UINT,WPARAM,LPARAM,UINT, - UINT,LPDWORD); -LRESULT WINAPI SendMessageTimeoutW(HWND,UINT,WPARAM,LPARAM,UINT, - UINT,LPDWORD); +LRESULT WINAPI SendMessageTimeoutA(HWND,UINT,WPARAM,LPARAM,UINT,UINT,LPDWORD); +LRESULT WINAPI SendMessageTimeoutW(HWND,UINT,WPARAM,LPARAM,UINT,UINT,LPDWORD); #define SendMessageTimeout WINELIB_NAME_AW(SendMessageTimeout) -HWND WINAPI SetActiveWindow(HWND); -HWND WINAPI SetCapture(HWND); -BOOL WINAPI SetCaretBlinkTime(UINT); -BOOL WINAPI SetCaretPos(INT,INT); +HWND WINAPI SetActiveWindow(HWND); +HWND WINAPI SetCapture(HWND); +BOOL WINAPI SetCaretBlinkTime(UINT); +BOOL WINAPI SetCaretPos(INT,INT); LONG WINAPI SetClassLongA(HWND,INT,LONG); LONG WINAPI SetClassLongW(HWND,INT,LONG); #define SetClassLong WINELIB_NAME_AW(SetClassLong) diff --git a/include/x11drv.h b/include/x11drv.h index ac26a285c4a..97a73505e60 100644 --- a/include/x11drv.h +++ b/include/x11drv.h @@ -387,7 +387,7 @@ extern void X11DRV_InitMouse(LPMOUSE_EVENT_PROC); extern void X11DRV_SetCursor(struct tagCURSORICONINFO *lpCursor); extern void X11DRV_MoveCursor(WORD wAbsX, WORD wAbsY); extern void X11DRV_SendEvent( DWORD mouseStatus, DWORD posX, DWORD posY, - DWORD keyState, DWORD time, HWND hWnd ); + WORD keyState, DWORD data, DWORD time, HWND hWnd ); /* X11 windows driver */ diff --git a/windows/input.c b/windows/input.c index d16614de89f..10f04f9c15a 100644 --- a/windows/input.c +++ b/windows/input.c @@ -103,18 +103,175 @@ static void queue_raw_hardware_message( UINT message, WPARAM wParam, LPARAM lPar } +/*********************************************************************** + * queue_kbd_event + * + * Put a keyboard event into a thread queue + */ +static void queue_kbd_event( const KEYBDINPUT *ki ) +{ + UINT message; + KEYLP keylp; + + keylp.lp2 = 0; + keylp.lp1.count = 1; + keylp.lp1.code = ki->wScan; + keylp.lp1.extended = (ki->dwFlags & KEYEVENTF_EXTENDEDKEY) != 0; + keylp.lp1.win_internal = 0; /* this has something to do with dialogs, + * don't remember where I read it - AK */ + /* it's '1' under windows, when a dialog box appears + * and you press one of the underlined keys - DF*/ + + if (ki->dwFlags & KEYEVENTF_KEYUP ) + { + BOOL sysKey = ((InputKeyStateTable[VK_MENU] & 0x80) && + !(InputKeyStateTable[VK_CONTROL] & 0x80) && + !(ki->dwFlags & KEYEVENTF_WINE_FORCEEXTENDED)); /* for Alt from AltGr */ + InputKeyStateTable[ki->wVk] &= ~0x80; + keylp.lp1.previous = 1; + keylp.lp1.transition = 1; + message = sysKey ? WM_SYSKEYUP : WM_KEYUP; + } + else + { + keylp.lp1.previous = (InputKeyStateTable[ki->wVk] & 0x80) != 0; + keylp.lp1.transition = 0; + if (!(InputKeyStateTable[ki->wVk] & 0x80)) InputKeyStateTable[ki->wVk] ^= 0x01; + InputKeyStateTable[ki->wVk] |= 0x80; + AsyncKeyStateTable[ki->wVk] |= 0x80; + + message = (InputKeyStateTable[VK_MENU] & 0x80) && !(InputKeyStateTable[VK_CONTROL] & 0x80) + ? WM_SYSKEYDOWN : WM_KEYDOWN; + } + + if (message == WM_SYSKEYDOWN || message == WM_SYSKEYUP ) + keylp.lp1.context = (InputKeyStateTable[VK_MENU] & 0x80) != 0; /* 1 if alt */ + + TRACE_(key)(" wParam=%04x, lParam=%08lx, InputKeyState=%x\n", + ki->wVk, keylp.lp2, InputKeyStateTable[ki->wVk] ); + + queue_raw_hardware_message( message, ki->wVk, keylp.lp2, + PosX, PosY, ki->time, ki->dwExtraInfo ); +} + + +/*********************************************************************** + * queue_mouse_event + */ +static void queue_mouse_event( const MOUSEINPUT *mi, WORD keystate ) +{ + if (mi->dwFlags & MOUSEEVENTF_MOVE) + { + if (mi->dwFlags & MOUSEEVENTF_ABSOLUTE) + { + PosX = (mi->dx * GetSystemMetrics(SM_CXSCREEN)) >> 16; + PosY = (mi->dy * GetSystemMetrics(SM_CYSCREEN)) >> 16; + } + else + { + int width = GetSystemMetrics(SM_CXSCREEN); + int height = GetSystemMetrics(SM_CYSCREEN); + long posX = (long) PosX, posY = (long) PosY; + + /* dx and dy can be negative numbers for relative movements */ + posX += (long)mi->dx; + posY += (long)mi->dy; + + /* Clip to the current screen size */ + if (posX < 0) PosX = 0; + else if (posX >= width) PosX = width - 1; + else PosX = posX; + + if (posY < 0) PosY = 0; + else if (posY >= height) PosY = height - 1; + else PosY = posY; + } + } + + if (mi->dwFlags & MOUSEEVENTF_MOVE) + { + queue_raw_hardware_message( WM_MOUSEMOVE, keystate, 0, PosX, PosY, + mi->time, mi->dwExtraInfo ); + } + if (mi->dwFlags & (!SwappedButtons? MOUSEEVENTF_LEFTDOWN : MOUSEEVENTF_RIGHTDOWN)) + { + MouseButtonsStates[0] = AsyncMouseButtonsStates[0] = TRUE; + queue_raw_hardware_message( WM_LBUTTONDOWN, keystate, 0, PosX, PosY, + mi->time, mi->dwExtraInfo ); + } + if (mi->dwFlags & (!SwappedButtons? MOUSEEVENTF_LEFTUP : MOUSEEVENTF_RIGHTUP)) + { + MouseButtonsStates[0] = FALSE; + queue_raw_hardware_message( WM_LBUTTONUP, keystate, 0, PosX, PosY, + mi->time, mi->dwExtraInfo ); + } + if (mi->dwFlags & (!SwappedButtons? MOUSEEVENTF_RIGHTDOWN : MOUSEEVENTF_LEFTDOWN)) + { + MouseButtonsStates[2] = AsyncMouseButtonsStates[2] = TRUE; + queue_raw_hardware_message( WM_RBUTTONDOWN, keystate, 0, PosX, PosY, + mi->time, mi->dwExtraInfo ); + } + if (mi->dwFlags & (!SwappedButtons? MOUSEEVENTF_RIGHTUP : MOUSEEVENTF_LEFTUP)) + { + MouseButtonsStates[2] = FALSE; + queue_raw_hardware_message( WM_RBUTTONUP, keystate, 0, PosX, PosY, + mi->time, mi->dwExtraInfo ); + } + if (mi->dwFlags & MOUSEEVENTF_MIDDLEDOWN) + { + MouseButtonsStates[1] = AsyncMouseButtonsStates[1] = TRUE; + queue_raw_hardware_message( WM_MBUTTONDOWN, keystate, 0, PosX, PosY, + mi->time, mi->dwExtraInfo ); + } + if (mi->dwFlags & MOUSEEVENTF_MIDDLEUP) + { + MouseButtonsStates[1] = FALSE; + queue_raw_hardware_message( WM_MBUTTONUP, keystate, 0, PosX, PosY, + mi->time, mi->dwExtraInfo ); + } + if (mi->dwFlags & MOUSEEVENTF_WHEEL) + { + queue_raw_hardware_message( WM_MOUSEWHEEL, MAKELONG( keystate, mi->mouseData), 0, + PosX, PosY, mi->time, mi->dwExtraInfo ); + } +} + + +/*********************************************************************** + * SendInput (USER32.@) + */ +UINT WINAPI SendInput( UINT count, LPINPUT inputs, int size ) +{ + UINT i; + + if (!InputEnabled) return 0; + + for (i = 0; i < count; i++, inputs++) + { + switch(inputs->type) + { + case INPUT_MOUSE: + queue_mouse_event( &inputs->u.mi, GET_KEYSTATE() ); + break; + case INPUT_KEYBOARD: + queue_kbd_event( &inputs->u.ki ); + break; + case INPUT_HARDWARE: + FIXME( "INPUT_HARDWARE not supported\n" ); + break; + } + } + return count; +} + + /*********************************************************************** * keybd_event (USER32.@) */ void WINAPI keybd_event( BYTE bVk, BYTE bScan, DWORD dwFlags, DWORD dwExtraInfo ) { - DWORD time, extra; - WORD message; - KEYLP keylp; - keylp.lp2 = 0; - - if (!InputEnabled) return; + INPUT input; /* * If we are called by the Wine keyboard driver, use the additional @@ -126,64 +283,26 @@ void WINAPI keybd_event( BYTE bVk, BYTE bScan, && ((WINE_KEYBDEVENT *)dwExtraInfo)->magic == WINE_KEYBDEVENT_MAGIC ) { WINE_KEYBDEVENT *wke = (WINE_KEYBDEVENT *)dwExtraInfo; - time = wke->time; - extra = 0; + input.u.ki.time = wke->time; + input.u.ki.dwExtraInfo = 0; } else { - time = GetTickCount(); - extra = dwExtraInfo; + input.u.ki.time = GetTickCount(); + input.u.ki.dwExtraInfo = dwExtraInfo; } - - - keylp.lp1.count = 1; - keylp.lp1.code = bScan; - keylp.lp1.extended = (dwFlags & KEYEVENTF_EXTENDEDKEY) != 0; - keylp.lp1.win_internal = 0; /* this has something to do with dialogs, - * don't remember where I read it - AK */ - /* it's '1' under windows, when a dialog box appears - * and you press one of the underlined keys - DF*/ - - if ( dwFlags & KEYEVENTF_KEYUP ) - { - BOOL sysKey = (InputKeyStateTable[VK_MENU] & 0x80) - && !(InputKeyStateTable[VK_CONTROL] & 0x80) - && !(dwFlags & KEYEVENTF_WINE_FORCEEXTENDED); /* for Alt from AltGr */ - - InputKeyStateTable[bVk] &= ~0x80; - keylp.lp1.previous = 1; - keylp.lp1.transition = 1; - message = sysKey ? WM_SYSKEYUP : WM_KEYUP; - } - else - { - keylp.lp1.previous = (InputKeyStateTable[bVk] & 0x80) != 0; - keylp.lp1.transition = 0; - - if (!(InputKeyStateTable[bVk] & 0x80)) - InputKeyStateTable[bVk] ^= 0x01; - InputKeyStateTable[bVk] |= 0x80; - AsyncKeyStateTable[bVk] |= 0x80; - - message = (InputKeyStateTable[VK_MENU] & 0x80) - && !(InputKeyStateTable[VK_CONTROL] & 0x80) - ? WM_SYSKEYDOWN : WM_KEYDOWN; - } - - if ( message == WM_SYSKEYDOWN || message == WM_SYSKEYUP ) - keylp.lp1.context = (InputKeyStateTable[VK_MENU] & 0x80) != 0; /* 1 if alt */ - - - TRACE_(key)(" wParam=%04X, lParam=%08lX\n", bVk, keylp.lp2 ); - TRACE_(key)(" InputKeyState=%X\n", InputKeyStateTable[bVk] ); - - queue_raw_hardware_message( message, bVk, keylp.lp2, PosX, PosY, time, extra ); + input.type = INPUT_KEYBOARD; + input.u.ki.wVk = bVk; + input.u.ki.wScan = bScan; + input.u.ki.dwFlags = dwFlags; + SendInput( 1, &input, sizeof(input) ); } + /*********************************************************************** * keybd_event (USER.289) */ -void WINAPI WIN16_keybd_event( CONTEXT86 *context ) +void WINAPI keybd_event16( CONTEXT86 *context ) { DWORD dwFlags = 0; @@ -194,44 +313,21 @@ void WINAPI WIN16_keybd_event( CONTEXT86 *context ) dwFlags, MAKELONG(SI_reg(context), DI_reg(context)) ); } + /*********************************************************************** * mouse_event (USER32.@) */ void WINAPI mouse_event( DWORD dwFlags, DWORD dx, DWORD dy, - DWORD cButtons, DWORD dwExtraInfo ) + DWORD dwData, DWORD dwExtraInfo ) { - DWORD time, extra; - DWORD keyState; - - if (!InputEnabled) return; + INPUT input; + WORD keyState; - if ( dwFlags & MOUSEEVENTF_MOVE ) - { - if ( dwFlags & MOUSEEVENTF_ABSOLUTE ) - { - PosX = (dx * GetSystemMetrics(SM_CXSCREEN)) >> 16; - PosY = (dy * GetSystemMetrics(SM_CYSCREEN)) >> 16; - } - else - { - int width = GetSystemMetrics(SM_CXSCREEN); - int height = GetSystemMetrics(SM_CYSCREEN); - long posX = (long) PosX, posY = (long) PosY; - - /* dx and dy can be negative numbers for relative movements */ - posX += (long) dx; - posY += (long) dy; - - /* Clip to the current screen size */ - if (posX < 0) PosX = 0; - else if (posX >= width) PosX = width - 1; - else PosX = posX; - - if (posY < 0) PosY = 0; - else if (posY >= height) PosY = height - 1; - else PosY = posY; - } - } + input.type = INPUT_MOUSE; + input.u.mi.dx = dx; + input.u.mi.dy = dy; + input.u.mi.mouseData = dwData; + input.u.mi.dwFlags = dwFlags; /* * If we are called by the Wine mouse driver, use the additional @@ -243,77 +339,38 @@ void WINAPI mouse_event( DWORD dwFlags, DWORD dx, DWORD dy, && ((WINE_MOUSEEVENT *)dwExtraInfo)->magic == WINE_MOUSEEVENT_MAGIC ) { WINE_MOUSEEVENT *wme = (WINE_MOUSEEVENT *)dwExtraInfo; - time = wme->time; - extra = (DWORD)wme->hWnd; - keyState = wme->keyState; - - if (keyState != GET_KEYSTATE()) { - /* We need to update the keystate with what X provides us */ - MouseButtonsStates[SwappedButtons ? 2 : 0] = (keyState & MK_LBUTTON ? TRUE : FALSE); - MouseButtonsStates[SwappedButtons ? 0 : 2] = (keyState & MK_RBUTTON ? TRUE : FALSE); - MouseButtonsStates[1] = (keyState & MK_MBUTTON ? TRUE : FALSE); - InputKeyStateTable[VK_SHIFT] = (keyState & MK_SHIFT ? 0x80 : 0); - InputKeyStateTable[VK_CONTROL] = (keyState & MK_CONTROL ? 0x80 : 0); - } + + keyState = wme->keyState; + + if (keyState != GET_KEYSTATE()) + { + /* We need to update the keystate with what X provides us */ + MouseButtonsStates[SwappedButtons ? 2 : 0] = (keyState & MK_LBUTTON ? TRUE : FALSE); + MouseButtonsStates[SwappedButtons ? 0 : 2] = (keyState & MK_RBUTTON ? TRUE : FALSE); + MouseButtonsStates[1] = (keyState & MK_MBUTTON ? TRUE : FALSE); + InputKeyStateTable[VK_SHIFT] = (keyState & MK_SHIFT ? 0x80 : 0); + InputKeyStateTable[VK_CONTROL] = (keyState & MK_CONTROL ? 0x80 : 0); + } + input.u.mi.time = wme->time; + input.u.mi.dwExtraInfo = wme->hWnd; + queue_mouse_event( &input.u.mi, keyState ); } else { - time = GetTickCount(); - extra = dwExtraInfo; - keyState = GET_KEYSTATE(); - - if ( dwFlags & MOUSEEVENTF_MOVE ) - { - /* We have to actually move the cursor */ - SetCursorPos( PosX, PosY ); - } - } + if ( dwFlags & MOUSEEVENTF_MOVE ) /* we have to actually move the cursor */ + SetCursorPos( PosX, PosY ); - - if ( dwFlags & MOUSEEVENTF_MOVE ) - { - queue_raw_hardware_message( WM_MOUSEMOVE, keyState, 0, PosX, PosY, time, extra ); - } - if ( dwFlags & (!SwappedButtons? MOUSEEVENTF_LEFTDOWN : MOUSEEVENTF_RIGHTDOWN) ) - { - MouseButtonsStates[0] = AsyncMouseButtonsStates[0] = TRUE; - queue_raw_hardware_message( WM_LBUTTONDOWN, keyState, 0, PosX, PosY, time, extra ); - } - if ( dwFlags & (!SwappedButtons? MOUSEEVENTF_LEFTUP : MOUSEEVENTF_RIGHTUP) ) - { - MouseButtonsStates[0] = FALSE; - queue_raw_hardware_message( WM_LBUTTONUP, keyState, 0, PosX, PosY, time, extra ); - } - if ( dwFlags & (!SwappedButtons? MOUSEEVENTF_RIGHTDOWN : MOUSEEVENTF_LEFTDOWN) ) - { - MouseButtonsStates[2] = AsyncMouseButtonsStates[2] = TRUE; - queue_raw_hardware_message( WM_RBUTTONDOWN, keyState, 0, PosX, PosY, time, extra ); - } - if ( dwFlags & (!SwappedButtons? MOUSEEVENTF_RIGHTUP : MOUSEEVENTF_LEFTUP) ) - { - MouseButtonsStates[2] = FALSE; - queue_raw_hardware_message( WM_RBUTTONUP, keyState, 0, PosX, PosY, time, extra ); - } - if ( dwFlags & MOUSEEVENTF_MIDDLEDOWN ) - { - MouseButtonsStates[1] = AsyncMouseButtonsStates[1] = TRUE; - queue_raw_hardware_message( WM_MBUTTONDOWN, keyState, 0, PosX, PosY, time, extra ); - } - if ( dwFlags & MOUSEEVENTF_MIDDLEUP ) - { - MouseButtonsStates[1] = FALSE; - queue_raw_hardware_message( WM_MBUTTONUP, keyState, 0, PosX, PosY, time, extra ); - } - if ( dwFlags & MOUSEEVENTF_WHEEL ) - { - queue_raw_hardware_message( WM_MOUSEWHEEL, keyState, 0, PosX, PosY, time, extra ); + input.u.mi.time = GetCurrentTime(); + input.u.mi.dwExtraInfo = dwExtraInfo; + SendInput( 1, &input, sizeof(input) ); } } + /*********************************************************************** * mouse_event (USER.299) */ -void WINAPI WIN16_mouse_event( CONTEXT86 *context ) +void WINAPI mouse_event16( CONTEXT86 *context ) { mouse_event( AX_reg(context), BX_reg(context), CX_reg(context), DX_reg(context), MAKELONG(SI_reg(context), DI_reg(context)) ); diff --git a/windows/x11drv/event.c b/windows/x11drv/event.c index c9a81214a0c..f54e6630c75 100644 --- a/windows/x11drv/event.c +++ b/windows/x11drv/event.c @@ -31,7 +31,6 @@ #include "message.h" #include "mouse.h" #include "options.h" -#include "queue.h" #include "win.h" #include "winpos.h" #include "file.h" @@ -292,21 +291,8 @@ static void EVENT_ProcessEvent( XEvent *event ) case ButtonRelease: EVENT_ButtonRelease( hWnd, (XButtonEvent*)event ); break; - + case MotionNotify: - /* Wine between two fast machines across the overloaded campus - ethernet gets very boged down in MotionEvents. The following - simply finds the last motion event in the queue and drops - the rest. On a good link events are servered before they build - up so this doesn't take place. On a slow link this may cause - problems if the event order is important. I'm not yet seen - of any problems. Jon 7/6/96. - */ - if ((current_input_type == X11DRV_INPUT_ABSOLUTE) && - (in_transition == FALSE)) - /* Only cumulate events if in absolute mode */ - while (TSXCheckTypedWindowEvent(display,((XAnyEvent *)event)->window, - MotionNotify, event)); EVENT_MotionNotify( hWnd, (XMotionEvent*)event ); break; @@ -439,14 +425,14 @@ static void EVENT_MotionNotify( HWND hWnd, XMotionEvent *event ) { get_coords( &hWnd, event->window, event->x, event->y, &pt ); X11DRV_SendEvent( MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE, pt.x, pt.y, - X11DRV_EVENT_XStateToKeyState( event->state ), + X11DRV_EVENT_XStateToKeyState( event->state ), 0, event->time - X11DRV_server_startticks, hWnd); } else { X11DRV_SendEvent( MOUSEEVENTF_MOVE, event->x_root, event->y_root, - X11DRV_EVENT_XStateToKeyState( event->state ), + X11DRV_EVENT_XStateToKeyState( event->state ), 0, event->time - X11DRV_server_startticks, hWnd); } } @@ -495,8 +481,7 @@ static void EVENT_ButtonPress( HWND hWnd, XButtonEvent *event ) } X11DRV_SendEvent( statusCodes[buttonNum], pt.x, pt.y, - MAKEWPARAM(keystate,wData), - event->time - X11DRV_server_startticks, hWnd); + keystate, wData, event->time - X11DRV_server_startticks, hWnd); } @@ -537,7 +522,7 @@ static void EVENT_ButtonRelease( HWND hWnd, XButtonEvent *event ) return; } X11DRV_SendEvent( statusCodes[buttonNum], pt.x, pt.y, - keystate, event->time - X11DRV_server_startticks, hWnd); + keystate, 0, event->time - X11DRV_server_startticks, hWnd); } @@ -1523,10 +1508,9 @@ void X11DRV_EVENT_SetDGAStatus(HWND hwnd, int event_base) /* DGA2 event handlers */ static void EVENT_DGAMotionEvent( XDGAMotionEvent *event ) { - X11DRV_SendEvent( MOUSEEVENTF_MOVE, - event->dx, event->dy, - X11DRV_EVENT_XStateToKeyState( event->state ), - event->time - X11DRV_server_startticks, DGAhwnd ); + X11DRV_SendEvent( MOUSEEVENTF_MOVE, event->dx, event->dy, + X11DRV_EVENT_XStateToKeyState( event->state ), 0, + event->time - X11DRV_server_startticks, DGAhwnd ); } static void EVENT_DGAButtonPressEvent( XDGAButtonEvent *event ) @@ -1554,7 +1538,8 @@ static void EVENT_DGAButtonPressEvent( XDGAButtonEvent *event ) break; } - X11DRV_SendEvent( statusCodes[buttonNum], 0, 0, keystate, event->time - X11DRV_server_startticks, DGAhwnd ); + X11DRV_SendEvent( statusCodes[buttonNum], 0, 0, keystate, 0, + event->time - X11DRV_server_startticks, DGAhwnd ); } static void EVENT_DGAButtonReleaseEvent( XDGAButtonEvent *event ) @@ -1582,7 +1567,8 @@ static void EVENT_DGAButtonReleaseEvent( XDGAButtonEvent *event ) break; } - X11DRV_SendEvent( statusCodes[buttonNum], 0, 0, keystate, event->time - X11DRV_server_startticks, DGAhwnd ); + X11DRV_SendEvent( statusCodes[buttonNum], 0, 0, keystate, 0, + event->time - X11DRV_server_startticks, DGAhwnd ); } #endif diff --git a/windows/x11drv/mouse.c b/windows/x11drv/mouse.c index 211c0bb6cd0..ab8983c74b1 100644 --- a/windows/x11drv/mouse.c +++ b/windows/x11drv/mouse.c @@ -280,8 +280,8 @@ void X11DRV_InitMouse( LPMOUSE_EVENT_PROC proc ) TSXQueryPointer( thread_display(), root_window, &root, &child, &root_x, &root_y, &child_x, &child_y, &KeyState); X11DRV_SendEvent(MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE, - root_x, root_y, X11DRV_EVENT_XStateToKeyState(KeyState), - GetTickCount(), 0 ); + root_x, root_y, X11DRV_EVENT_XStateToKeyState(KeyState), + 0, GetTickCount(), 0 ); } } @@ -289,8 +289,8 @@ void X11DRV_InitMouse( LPMOUSE_EVENT_PROC proc ) /*********************************************************************** * X11DRV_SendEvent (internal) */ -void X11DRV_SendEvent( DWORD mouseStatus, DWORD posX, DWORD posY, - DWORD keyState, DWORD time, HWND hWnd ) +void X11DRV_SendEvent( DWORD mouseStatus, DWORD posX, DWORD posY, + WORD keyState, DWORD data, DWORD time, HWND hWnd ) { int width = GetSystemMetrics( SM_CXSCREEN ); int height = GetSystemMetrics( SM_CYSCREEN ); @@ -318,7 +318,7 @@ void X11DRV_SendEvent( DWORD mouseStatus, DWORD posX, DWORD posY, /* To avoid deadlocks, we have to suspend all locks on windows structures before the program control is passed to the mouse driver */ iWndsLocks = WIN_SuspendWndsLock(); - DefMouseEventProc( mouseStatus, posX, posY, 0, (DWORD)&wme ); + DefMouseEventProc( mouseStatus, posX, posY, data, (DWORD)&wme ); WIN_RestoreWndsLock(iWndsLocks); InterlockedIncrement( &X11DRV_MOUSE_WarpPointer ); }