1998-11-08 13:26:36 +01:00
|
|
|
/*
|
|
|
|
* USER Input processing
|
|
|
|
*
|
|
|
|
* Copyright 1993 Bob Amstadt
|
|
|
|
* Copyright 1996 Albrecht Kleine
|
|
|
|
* Copyright 1997 David Faure
|
|
|
|
* Copyright 1998 Morten Welinder
|
|
|
|
* Copyright 1998 Ulrich Weigand
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2000-02-10 20:03:02 +01:00
|
|
|
#include <stdio.h>
|
1998-11-08 13:26:36 +01:00
|
|
|
#include <ctype.h>
|
|
|
|
#include <assert.h>
|
|
|
|
|
2000-02-10 20:03:02 +01:00
|
|
|
#include "windef.h"
|
2000-11-28 23:40:56 +01:00
|
|
|
#include "winnls.h"
|
2000-12-19 05:53:20 +01:00
|
|
|
#include "winbase.h"
|
2000-02-10 20:03:02 +01:00
|
|
|
#include "wingdi.h"
|
1999-02-22 11:16:00 +01:00
|
|
|
#include "winuser.h"
|
|
|
|
#include "wine/winbase16.h"
|
|
|
|
#include "wine/winuser16.h"
|
2001-07-19 02:39:09 +02:00
|
|
|
#include "wine/server.h"
|
1998-11-08 13:26:36 +01:00
|
|
|
#include "win.h"
|
2001-10-17 19:50:02 +02:00
|
|
|
#include "hook.h"
|
1998-11-08 13:26:36 +01:00
|
|
|
#include "input.h"
|
|
|
|
#include "message.h"
|
2000-03-08 19:26:56 +01:00
|
|
|
#include "queue.h"
|
1998-11-08 13:26:36 +01:00
|
|
|
#include "debugtools.h"
|
|
|
|
#include "winerror.h"
|
|
|
|
|
2000-02-10 20:03:02 +01:00
|
|
|
DECLARE_DEBUG_CHANNEL(key);
|
|
|
|
DECLARE_DEBUG_CHANNEL(keyboard);
|
|
|
|
DECLARE_DEBUG_CHANNEL(win);
|
2001-06-19 21:16:41 +02:00
|
|
|
DEFAULT_DEBUG_CHANNEL(event);
|
1999-04-19 16:56:29 +02:00
|
|
|
|
1999-02-26 12:11:13 +01:00
|
|
|
static BOOL InputEnabled = TRUE;
|
2000-12-16 21:37:16 +01:00
|
|
|
static BOOL SwappedButtons;
|
1998-11-08 13:26:36 +01:00
|
|
|
|
|
|
|
BYTE InputKeyStateTable[256];
|
|
|
|
BYTE AsyncKeyStateTable[256];
|
|
|
|
|
1999-11-07 22:25:57 +01:00
|
|
|
/* Storage for the USER-maintained mouse positions */
|
2000-12-16 21:37:16 +01:00
|
|
|
static DWORD PosX, PosY;
|
|
|
|
|
1998-11-08 13:26:36 +01:00
|
|
|
typedef union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
unsigned long count : 16;
|
|
|
|
unsigned long code : 8;
|
|
|
|
unsigned long extended : 1;
|
|
|
|
unsigned long unused : 2;
|
|
|
|
unsigned long win_internal : 2;
|
|
|
|
unsigned long context : 1;
|
|
|
|
unsigned long previous : 1;
|
|
|
|
unsigned long transition : 1;
|
|
|
|
} lp1;
|
|
|
|
unsigned long lp2;
|
|
|
|
} KEYLP;
|
|
|
|
|
2001-06-19 21:16:41 +02:00
|
|
|
|
2001-10-18 23:38:59 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* get_key_state
|
|
|
|
*/
|
|
|
|
static WORD get_key_state(void)
|
|
|
|
{
|
|
|
|
WORD ret = 0;
|
|
|
|
|
|
|
|
if (SwappedButtons)
|
|
|
|
{
|
|
|
|
if (InputKeyStateTable[VK_RBUTTON] & 0x80) ret |= MK_LBUTTON;
|
|
|
|
if (InputKeyStateTable[VK_LBUTTON] & 0x80) ret |= MK_RBUTTON;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (InputKeyStateTable[VK_LBUTTON] & 0x80) ret |= MK_LBUTTON;
|
|
|
|
if (InputKeyStateTable[VK_RBUTTON] & 0x80) ret |= MK_RBUTTON;
|
|
|
|
}
|
|
|
|
if (InputKeyStateTable[VK_MBUTTON] & 0x80) ret |= MK_MBUTTON;
|
|
|
|
if (InputKeyStateTable[VK_SHIFT] & 0x80) ret |= MK_SHIFT;
|
|
|
|
if (InputKeyStateTable[VK_CONTROL] & 0x80) ret |= MK_CONTROL;
|
|
|
|
if (InputKeyStateTable[VK_XBUTTON1] & 0x80) ret |= MK_XBUTTON1;
|
|
|
|
if (InputKeyStateTable[VK_XBUTTON2] & 0x80) ret |= MK_XBUTTON2;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-19 21:16:41 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* queue_raw_hardware_message
|
|
|
|
*
|
|
|
|
* Add a message to the raw hardware queue.
|
|
|
|
* Note: the position is relative to the desktop window.
|
|
|
|
*/
|
|
|
|
static void queue_raw_hardware_message( UINT message, WPARAM wParam, LPARAM lParam,
|
2001-10-17 19:50:02 +02:00
|
|
|
int xPos, int yPos, DWORD time, ULONG_PTR extraInfo )
|
2001-06-19 21:16:41 +02:00
|
|
|
{
|
|
|
|
SERVER_START_REQ( send_message )
|
|
|
|
{
|
|
|
|
req->id = (void *)GetCurrentThreadId();
|
2001-08-07 21:19:08 +02:00
|
|
|
req->type = MSG_HARDWARE_RAW;
|
2001-06-19 21:16:41 +02:00
|
|
|
req->win = 0;
|
|
|
|
req->msg = message;
|
|
|
|
req->wparam = wParam;
|
|
|
|
req->lparam = lParam;
|
|
|
|
req->x = xPos;
|
|
|
|
req->y = yPos;
|
|
|
|
req->time = time;
|
|
|
|
req->info = extraInfo;
|
2001-08-07 21:19:08 +02:00
|
|
|
req->timeout = 0;
|
2001-06-19 21:16:41 +02:00
|
|
|
SERVER_CALL();
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-11-08 13:26:36 +01:00
|
|
|
/***********************************************************************
|
2001-06-25 22:01:03 +02:00
|
|
|
* queue_kbd_event
|
|
|
|
*
|
|
|
|
* Put a keyboard event into a thread queue
|
1998-11-08 13:26:36 +01:00
|
|
|
*/
|
2001-10-18 23:38:59 +02:00
|
|
|
static void queue_kbd_event( const KEYBDINPUT *ki, UINT injected_flags )
|
1998-11-08 13:26:36 +01:00
|
|
|
{
|
2001-06-25 22:01:03 +02:00
|
|
|
UINT message;
|
1998-11-08 13:26:36 +01:00
|
|
|
KEYLP keylp;
|
2001-10-17 19:50:02 +02:00
|
|
|
KBDLLHOOKSTRUCT hook;
|
1998-11-08 13:26:36 +01:00
|
|
|
|
2001-06-25 22:01:03 +02:00
|
|
|
keylp.lp2 = 0;
|
1998-11-08 13:26:36 +01:00
|
|
|
keylp.lp1.count = 1;
|
2001-06-25 22:01:03 +02:00
|
|
|
keylp.lp1.code = ki->wScan;
|
|
|
|
keylp.lp1.extended = (ki->dwFlags & KEYEVENTF_EXTENDEDKEY) != 0;
|
1998-11-08 13:26:36 +01:00
|
|
|
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*/
|
|
|
|
|
2001-06-25 22:01:03 +02:00
|
|
|
if (ki->dwFlags & KEYEVENTF_KEYUP )
|
1998-11-08 13:26:36 +01:00
|
|
|
{
|
2001-10-02 19:17:31 +02:00
|
|
|
BOOL sysKey = (InputKeyStateTable[VK_MENU] & 0x80) &&
|
|
|
|
!(InputKeyStateTable[VK_CONTROL] & 0x80);
|
2001-06-25 22:01:03 +02:00
|
|
|
InputKeyStateTable[ki->wVk] &= ~0x80;
|
1998-11-08 13:26:36 +01:00
|
|
|
keylp.lp1.previous = 1;
|
|
|
|
keylp.lp1.transition = 1;
|
|
|
|
message = sysKey ? WM_SYSKEYUP : WM_KEYUP;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-06-25 22:01:03 +02:00
|
|
|
keylp.lp1.previous = (InputKeyStateTable[ki->wVk] & 0x80) != 0;
|
1998-11-08 13:26:36 +01:00
|
|
|
keylp.lp1.transition = 0;
|
2001-06-25 22:01:03 +02:00
|
|
|
if (!(InputKeyStateTable[ki->wVk] & 0x80)) InputKeyStateTable[ki->wVk] ^= 0x01;
|
|
|
|
InputKeyStateTable[ki->wVk] |= 0x80;
|
|
|
|
AsyncKeyStateTable[ki->wVk] |= 0x80;
|
1998-11-08 13:26:36 +01:00
|
|
|
|
2001-06-25 22:01:03 +02:00
|
|
|
message = (InputKeyStateTable[VK_MENU] & 0x80) && !(InputKeyStateTable[VK_CONTROL] & 0x80)
|
1998-11-08 13:26:36 +01:00
|
|
|
? WM_SYSKEYDOWN : WM_KEYDOWN;
|
|
|
|
}
|
|
|
|
|
2001-06-25 22:01:03 +02:00
|
|
|
if (message == WM_SYSKEYDOWN || message == WM_SYSKEYUP )
|
1998-11-08 13:26:36 +01:00
|
|
|
keylp.lp1.context = (InputKeyStateTable[VK_MENU] & 0x80) != 0; /* 1 if alt */
|
|
|
|
|
2001-06-25 22:01:03 +02:00
|
|
|
TRACE_(key)(" wParam=%04x, lParam=%08lx, InputKeyState=%x\n",
|
|
|
|
ki->wVk, keylp.lp2, InputKeyStateTable[ki->wVk] );
|
|
|
|
|
2001-10-17 19:50:02 +02:00
|
|
|
hook.vkCode = ki->wVk;
|
|
|
|
hook.scanCode = ki->wScan;
|
2001-10-18 23:38:59 +02:00
|
|
|
hook.flags = (keylp.lp2 >> 24) | injected_flags;
|
2001-10-17 19:50:02 +02:00
|
|
|
hook.time = ki->time;
|
|
|
|
hook.dwExtraInfo = ki->dwExtraInfo;
|
|
|
|
if (!HOOK_CallHooksW( WH_KEYBOARD_LL, HC_ACTION, message, (LPARAM)&hook ))
|
|
|
|
queue_raw_hardware_message( message, ki->wVk, keylp.lp2,
|
|
|
|
PosX, PosY, ki->time, ki->dwExtraInfo );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* queue_raw_mouse_message
|
|
|
|
*/
|
2001-10-18 23:38:59 +02:00
|
|
|
static void queue_raw_mouse_message( UINT message, UINT flags, INT x, INT y, const MOUSEINPUT *mi )
|
2001-10-17 19:50:02 +02:00
|
|
|
{
|
|
|
|
MSLLHOOKSTRUCT hook;
|
|
|
|
|
2001-10-18 23:38:59 +02:00
|
|
|
hook.pt.x = x;
|
|
|
|
hook.pt.y = y;
|
|
|
|
hook.mouseData = MAKELONG( 0, mi->mouseData );
|
|
|
|
hook.flags = flags;
|
|
|
|
hook.time = mi->time;
|
|
|
|
hook.dwExtraInfo = mi->dwExtraInfo;
|
2001-10-17 19:50:02 +02:00
|
|
|
|
|
|
|
if (!HOOK_CallHooksW( WH_MOUSE_LL, HC_ACTION, message, (LPARAM)&hook ))
|
2001-10-18 23:38:59 +02:00
|
|
|
queue_raw_hardware_message( message, MAKEWPARAM( get_key_state(), mi->mouseData ),
|
|
|
|
0, x, y, mi->time, mi->dwExtraInfo );
|
2001-06-25 22:01:03 +02:00
|
|
|
}
|
1998-11-08 13:26:36 +01:00
|
|
|
|
|
|
|
|
2001-06-25 22:01:03 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* queue_mouse_event
|
|
|
|
*/
|
2001-10-18 23:38:59 +02:00
|
|
|
static void queue_mouse_event( const MOUSEINPUT *mi, UINT flags )
|
2001-06-25 22:01:03 +02:00
|
|
|
{
|
2001-09-20 00:41:22 +02:00
|
|
|
if (mi->dwFlags & MOUSEEVENTF_ABSOLUTE)
|
|
|
|
{
|
|
|
|
PosX = (mi->dx * GetSystemMetrics(SM_CXSCREEN)) >> 16;
|
|
|
|
PosY = (mi->dy * GetSystemMetrics(SM_CYSCREEN)) >> 16;
|
|
|
|
}
|
|
|
|
else if (mi->dwFlags & MOUSEEVENTF_MOVE)
|
2001-06-25 22:01:03 +02:00
|
|
|
{
|
2001-09-20 00:41:22 +02:00
|
|
|
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;
|
2001-06-25 22:01:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (mi->dwFlags & MOUSEEVENTF_MOVE)
|
|
|
|
{
|
2001-10-18 23:38:59 +02:00
|
|
|
queue_raw_mouse_message( WM_MOUSEMOVE, flags, PosX, PosY, mi );
|
2001-06-25 22:01:03 +02:00
|
|
|
}
|
2001-10-18 23:38:59 +02:00
|
|
|
if (mi->dwFlags & MOUSEEVENTF_LEFTDOWN)
|
2001-06-25 22:01:03 +02:00
|
|
|
{
|
2001-10-02 20:53:59 +02:00
|
|
|
InputKeyStateTable[VK_LBUTTON] |= 0x80;
|
|
|
|
AsyncKeyStateTable[VK_LBUTTON] |= 0x80;
|
2001-10-18 23:38:59 +02:00
|
|
|
queue_raw_mouse_message( SwappedButtons ? WM_RBUTTONDOWN : WM_LBUTTONDOWN,
|
|
|
|
flags, PosX, PosY, mi );
|
2001-06-25 22:01:03 +02:00
|
|
|
}
|
2001-10-18 23:38:59 +02:00
|
|
|
if (mi->dwFlags & MOUSEEVENTF_LEFTUP)
|
2001-06-25 22:01:03 +02:00
|
|
|
{
|
2001-10-17 21:36:31 +02:00
|
|
|
InputKeyStateTable[VK_LBUTTON] &= ~0x80;
|
2001-10-18 23:38:59 +02:00
|
|
|
queue_raw_mouse_message( SwappedButtons ? WM_RBUTTONUP : WM_LBUTTONUP,
|
|
|
|
flags, PosX, PosY, mi );
|
2001-06-25 22:01:03 +02:00
|
|
|
}
|
2001-10-18 23:38:59 +02:00
|
|
|
if (mi->dwFlags & MOUSEEVENTF_RIGHTDOWN)
|
2001-06-25 22:01:03 +02:00
|
|
|
{
|
2001-10-02 20:53:59 +02:00
|
|
|
InputKeyStateTable[VK_RBUTTON] |= 0x80;
|
|
|
|
AsyncKeyStateTable[VK_RBUTTON] |= 0x80;
|
2001-10-18 23:38:59 +02:00
|
|
|
queue_raw_mouse_message( SwappedButtons ? WM_LBUTTONDOWN : WM_RBUTTONDOWN,
|
|
|
|
flags, PosX, PosY, mi );
|
2001-06-25 22:01:03 +02:00
|
|
|
}
|
2001-10-18 23:38:59 +02:00
|
|
|
if (mi->dwFlags & MOUSEEVENTF_RIGHTUP)
|
2001-06-25 22:01:03 +02:00
|
|
|
{
|
2001-10-17 21:36:31 +02:00
|
|
|
InputKeyStateTable[VK_RBUTTON] &= ~0x80;
|
2001-10-18 23:38:59 +02:00
|
|
|
queue_raw_mouse_message( SwappedButtons ? WM_LBUTTONUP : WM_RBUTTONUP,
|
|
|
|
flags, PosX, PosY, mi );
|
2001-06-25 22:01:03 +02:00
|
|
|
}
|
|
|
|
if (mi->dwFlags & MOUSEEVENTF_MIDDLEDOWN)
|
|
|
|
{
|
2001-10-02 20:53:59 +02:00
|
|
|
InputKeyStateTable[VK_MBUTTON] |= 0x80;
|
|
|
|
AsyncKeyStateTable[VK_MBUTTON] |= 0x80;
|
2001-10-18 23:38:59 +02:00
|
|
|
queue_raw_mouse_message( WM_MBUTTONDOWN, flags, PosX, PosY, mi );
|
2001-06-25 22:01:03 +02:00
|
|
|
}
|
|
|
|
if (mi->dwFlags & MOUSEEVENTF_MIDDLEUP)
|
|
|
|
{
|
2001-10-17 21:36:31 +02:00
|
|
|
InputKeyStateTable[VK_MBUTTON] &= ~0x80;
|
2001-10-18 23:38:59 +02:00
|
|
|
queue_raw_mouse_message( WM_MBUTTONUP, flags, PosX, PosY, mi );
|
2001-06-25 22:01:03 +02:00
|
|
|
}
|
|
|
|
if (mi->dwFlags & MOUSEEVENTF_WHEEL)
|
|
|
|
{
|
2001-10-18 23:38:59 +02:00
|
|
|
queue_raw_mouse_message( WM_MOUSEWHEEL, flags, PosX, PosY, mi );
|
2001-06-25 22:01:03 +02:00
|
|
|
}
|
2001-10-18 23:38:59 +02:00
|
|
|
if (flags & LLMHF_INJECTED) /* we have to actually move the cursor */
|
|
|
|
SetCursorPos( PosX, PosY );
|
1998-11-08 13:26:36 +01:00
|
|
|
}
|
|
|
|
|
2001-06-25 22:01:03 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* 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:
|
2001-10-18 23:38:59 +02:00
|
|
|
queue_mouse_event( &inputs->u.mi, LLMHF_INJECTED );
|
|
|
|
break;
|
|
|
|
case WINE_INTERNAL_INPUT_MOUSE:
|
|
|
|
queue_mouse_event( &inputs->u.mi, 0 );
|
2001-06-25 22:01:03 +02:00
|
|
|
break;
|
|
|
|
case INPUT_KEYBOARD:
|
2001-10-18 23:38:59 +02:00
|
|
|
queue_kbd_event( &inputs->u.ki, LLKHF_INJECTED );
|
|
|
|
break;
|
|
|
|
case WINE_INTERNAL_INPUT_KEYBOARD:
|
|
|
|
queue_kbd_event( &inputs->u.ki, 0 );
|
2001-06-25 22:01:03 +02:00
|
|
|
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 )
|
|
|
|
{
|
|
|
|
INPUT input;
|
|
|
|
|
|
|
|
input.type = INPUT_KEYBOARD;
|
|
|
|
input.u.ki.wVk = bVk;
|
|
|
|
input.u.ki.wScan = bScan;
|
|
|
|
input.u.ki.dwFlags = dwFlags;
|
2001-10-17 19:50:02 +02:00
|
|
|
input.u.ki.time = GetTickCount();
|
|
|
|
input.u.ki.dwExtraInfo = dwExtraInfo;
|
2001-06-25 22:01:03 +02:00
|
|
|
SendInput( 1, &input, sizeof(input) );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-09-20 20:49:02 +02:00
|
|
|
/***********************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* keybd_event (USER.289)
|
1999-09-20 20:49:02 +02:00
|
|
|
*/
|
2001-06-25 22:01:03 +02:00
|
|
|
void WINAPI keybd_event16( CONTEXT86 *context )
|
1999-09-20 20:49:02 +02:00
|
|
|
{
|
|
|
|
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)) );
|
|
|
|
}
|
|
|
|
|
2001-06-25 22:01:03 +02:00
|
|
|
|
1998-11-08 13:26:36 +01:00
|
|
|
/***********************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* mouse_event (USER32.@)
|
1998-11-08 13:26:36 +01:00
|
|
|
*/
|
|
|
|
void WINAPI mouse_event( DWORD dwFlags, DWORD dx, DWORD dy,
|
2001-06-25 22:01:03 +02:00
|
|
|
DWORD dwData, DWORD dwExtraInfo )
|
1998-11-08 13:26:36 +01:00
|
|
|
{
|
2001-06-25 22:01:03 +02:00
|
|
|
INPUT input;
|
|
|
|
|
|
|
|
input.type = INPUT_MOUSE;
|
|
|
|
input.u.mi.dx = dx;
|
|
|
|
input.u.mi.dy = dy;
|
|
|
|
input.u.mi.mouseData = dwData;
|
|
|
|
input.u.mi.dwFlags = dwFlags;
|
2001-10-18 23:38:59 +02:00
|
|
|
input.u.mi.time = GetCurrentTime();
|
|
|
|
input.u.mi.dwExtraInfo = dwExtraInfo;
|
|
|
|
SendInput( 1, &input, sizeof(input) );
|
1998-11-08 13:26:36 +01:00
|
|
|
}
|
|
|
|
|
2001-06-25 22:01:03 +02:00
|
|
|
|
1999-09-20 20:49:02 +02:00
|
|
|
/***********************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* mouse_event (USER.299)
|
1999-09-20 20:49:02 +02:00
|
|
|
*/
|
2001-06-25 22:01:03 +02:00
|
|
|
void WINAPI mouse_event16( CONTEXT86 *context )
|
1999-09-20 20:49:02 +02:00
|
|
|
{
|
|
|
|
mouse_event( AX_reg(context), BX_reg(context), CX_reg(context),
|
|
|
|
DX_reg(context), MAKELONG(SI_reg(context), DI_reg(context)) );
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* GetMouseEventProc (USER.337)
|
1999-09-20 20:49:02 +02:00
|
|
|
*/
|
|
|
|
FARPROC16 WINAPI GetMouseEventProc16(void)
|
|
|
|
{
|
|
|
|
HMODULE16 hmodule = GetModuleHandle16("USER");
|
2000-12-01 22:32:55 +01:00
|
|
|
return GetProcAddress16( hmodule, "mouse_event" );
|
1999-09-20 20:49:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-11-08 13:26:36 +01:00
|
|
|
/**********************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* EnableHardwareInput (USER.331)
|
1998-11-08 13:26:36 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL16 WINAPI EnableHardwareInput16(BOOL16 bEnable)
|
1998-11-08 13:26:36 +01:00
|
|
|
{
|
|
|
|
BOOL16 bOldState = InputEnabled;
|
1999-05-02 16:32:27 +02:00
|
|
|
FIXME_(event)("(%d) - stub\n", bEnable);
|
1998-11-08 13:26:36 +01:00
|
|
|
InputEnabled = bEnable;
|
|
|
|
return bOldState;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* SwapMouseButton (USER.186)
|
1998-11-08 13:26:36 +01:00
|
|
|
*/
|
|
|
|
BOOL16 WINAPI SwapMouseButton16( BOOL16 fSwap )
|
|
|
|
{
|
|
|
|
BOOL16 ret = SwappedButtons;
|
|
|
|
SwappedButtons = fSwap;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* SwapMouseButton (USER32.@)
|
1998-11-08 13:26:36 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI SwapMouseButton( BOOL fSwap )
|
1998-11-08 13:26:36 +01:00
|
|
|
{
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL ret = SwappedButtons;
|
1998-11-08 13:26:36 +01:00
|
|
|
SwappedButtons = fSwap;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2000-12-16 21:37:16 +01:00
|
|
|
|
|
|
|
/***********************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* GetCursorPos (USER.17)
|
2000-12-16 21:37:16 +01:00
|
|
|
*/
|
|
|
|
BOOL16 WINAPI GetCursorPos16( POINT16 *pt )
|
|
|
|
{
|
2001-06-21 02:44:09 +02:00
|
|
|
POINT pos;
|
2000-12-16 21:37:16 +01:00
|
|
|
if (!pt) return 0;
|
2001-06-21 02:44:09 +02:00
|
|
|
GetCursorPos(&pos);
|
|
|
|
pt->x = pos.x;
|
|
|
|
pt->y = pos.y;
|
2000-12-16 21:37:16 +01:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* GetCursorPos (USER32.@)
|
2000-12-16 21:37:16 +01:00
|
|
|
*/
|
|
|
|
BOOL WINAPI GetCursorPos( POINT *pt )
|
|
|
|
{
|
|
|
|
if (!pt) return 0;
|
|
|
|
pt->x = PosX;
|
|
|
|
pt->y = PosY;
|
2001-06-21 02:44:09 +02:00
|
|
|
if (USER_Driver.pGetCursorPos) USER_Driver.pGetCursorPos( pt );
|
2000-12-16 21:37:16 +01:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-21 02:44:09 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* SetCursorPos (USER.70)
|
|
|
|
*/
|
|
|
|
void WINAPI SetCursorPos16( INT16 x, INT16 y )
|
|
|
|
{
|
|
|
|
SetCursorPos( x, y );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* SetCursorPos (USER32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI SetCursorPos( INT x, INT y )
|
|
|
|
{
|
|
|
|
if (USER_Driver.pSetCursorPos) USER_Driver.pSetCursorPos( x, y );
|
|
|
|
PosX = x;
|
|
|
|
PosY = y;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-11-08 13:26:36 +01:00
|
|
|
/**********************************************************************
|
|
|
|
* EVENT_Capture
|
|
|
|
*
|
|
|
|
* We need this to be able to generate double click messages
|
|
|
|
* when menu code captures mouse in the window without CS_DBLCLK style.
|
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
HWND EVENT_Capture(HWND hwnd, INT16 ht)
|
1998-11-08 13:26:36 +01:00
|
|
|
{
|
1999-02-26 12:11:13 +01:00
|
|
|
HWND capturePrev = 0, captureWnd = 0;
|
1999-02-05 11:37:53 +01:00
|
|
|
MESSAGEQUEUE *pMsgQ = 0, *pCurMsgQ = 0;
|
|
|
|
WND* wndPtr = 0;
|
|
|
|
INT16 captureHT = 0;
|
|
|
|
|
2001-06-21 01:16:34 +02:00
|
|
|
capturePrev = GetCapture();
|
1998-11-08 13:26:36 +01:00
|
|
|
|
|
|
|
if (!hwnd)
|
|
|
|
{
|
2001-06-21 01:16:34 +02:00
|
|
|
captureWnd = 0;
|
1998-11-08 13:26:36 +01:00
|
|
|
captureHT = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1999-02-05 11:37:53 +01:00
|
|
|
wndPtr = WIN_FindWndPtr( hwnd );
|
1998-11-08 13:26:36 +01:00
|
|
|
if (wndPtr)
|
|
|
|
{
|
1999-05-02 16:32:27 +02:00
|
|
|
TRACE_(win)("(0x%04x)\n", hwnd );
|
2001-09-12 19:19:13 +02:00
|
|
|
captureWnd = wndPtr->hwndSelf;
|
1998-11-08 13:26:36 +01:00
|
|
|
captureHT = ht;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-06-21 01:16:34 +02:00
|
|
|
/* Get the messageQ for the current thread */
|
2001-07-26 22:12:22 +02:00
|
|
|
if (!(pCurMsgQ = QUEUE_Current()))
|
2001-06-21 01:16:34 +02:00
|
|
|
{
|
|
|
|
WARN_(win)("\tCurrent message queue not found. Exiting!\n" );
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
|
|
|
|
1999-02-05 11:37:53 +01:00
|
|
|
/* Update the perQ capture window and send messages */
|
|
|
|
if( capturePrev != captureWnd )
|
|
|
|
{
|
|
|
|
if (wndPtr)
|
|
|
|
{
|
|
|
|
/* Retrieve the message queue associated with this window */
|
|
|
|
pMsgQ = (MESSAGEQUEUE *)QUEUE_Lock( wndPtr->hmemTaskQ );
|
|
|
|
if ( !pMsgQ )
|
|
|
|
{
|
1999-05-02 16:32:27 +02:00
|
|
|
WARN_(win)("\tMessage queue not found. Exiting!\n" );
|
1999-02-05 11:37:53 +01:00
|
|
|
goto CLEANUP;
|
|
|
|
}
|
2001-06-21 01:16:34 +02:00
|
|
|
|
1999-02-05 11:37:53 +01:00
|
|
|
/* Make sure that message queue for the window we are setting capture to
|
|
|
|
* shares the same perQ data as the current threads message queue.
|
|
|
|
*/
|
|
|
|
if ( pCurMsgQ->pQData != pMsgQ->pQData )
|
|
|
|
goto CLEANUP;
|
|
|
|
}
|
|
|
|
|
2001-06-21 01:16:34 +02:00
|
|
|
PERQDATA_SetCaptureWnd( captureWnd, captureHT );
|
2001-09-19 22:37:04 +02:00
|
|
|
if (capturePrev) SendMessageA( capturePrev, WM_CAPTURECHANGED, 0, (LPARAM)hwnd );
|
1998-11-08 13:26:36 +01:00
|
|
|
}
|
|
|
|
|
1999-02-05 11:37:53 +01:00
|
|
|
CLEANUP:
|
|
|
|
/* Unlock the queues before returning */
|
|
|
|
if ( pMsgQ )
|
|
|
|
QUEUE_Unlock( pMsgQ );
|
2001-07-26 22:12:22 +02:00
|
|
|
|
1999-03-14 18:25:32 +01:00
|
|
|
WIN_ReleaseWndPtr(wndPtr);
|
1999-02-05 11:37:53 +01:00
|
|
|
return capturePrev;
|
1998-11-08 13:26:36 +01:00
|
|
|
}
|
|
|
|
|
1999-02-05 11:37:53 +01:00
|
|
|
|
1998-11-08 13:26:36 +01:00
|
|
|
/**********************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* SetCapture (USER32.@)
|
1998-11-08 13:26:36 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
HWND WINAPI SetCapture( HWND hwnd )
|
1998-11-08 13:26:36 +01:00
|
|
|
{
|
|
|
|
return EVENT_Capture( hwnd, HTCLIENT );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2001-07-02 21:59:40 +02:00
|
|
|
* ReleaseCapture (USER32.@)
|
1998-11-08 13:26:36 +01:00
|
|
|
*/
|
1999-04-15 18:40:16 +02:00
|
|
|
BOOL WINAPI ReleaseCapture(void)
|
1998-11-08 13:26:36 +01:00
|
|
|
{
|
1999-04-15 18:40:16 +02:00
|
|
|
return (EVENT_Capture( 0, 0 ) != 0);
|
1998-11-08 13:26:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* GetCapture (USER32.@)
|
1998-11-08 13:26:36 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
HWND WINAPI GetCapture(void)
|
1998-11-08 13:26:36 +01:00
|
|
|
{
|
2001-06-21 01:16:34 +02:00
|
|
|
INT hittest;
|
|
|
|
return PERQDATA_GetCaptureWnd( &hittest );
|
1998-11-08 13:26:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* GetAsyncKeyState (USER32.@)
|
1998-11-08 13:26:36 +01:00
|
|
|
*
|
|
|
|
* Determine if a key is or was pressed. retval has high-order
|
|
|
|
* bit set to 1 if currently pressed, low-order bit set to 1 if key has
|
|
|
|
* been pressed.
|
|
|
|
*
|
|
|
|
* This uses the variable AsyncMouseButtonsStates and
|
|
|
|
* AsyncKeyStateTable (set in event.c) which have the mouse button
|
|
|
|
* number or key number (whichever is applicable) set to true if the
|
|
|
|
* mouse or key had been depressed since the last call to
|
|
|
|
* GetAsyncKeyState.
|
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
WORD WINAPI GetAsyncKeyState(INT nKey)
|
1998-11-08 13:26:36 +01:00
|
|
|
{
|
2001-10-02 20:53:59 +02:00
|
|
|
WORD retval = ((AsyncKeyStateTable[nKey] & 0x80) ? 0x0001 : 0) |
|
2001-04-18 20:05:57 +02:00
|
|
|
((InputKeyStateTable[nKey] & 0x80) ? 0x8000 : 0);
|
2001-10-02 20:53:59 +02:00
|
|
|
AsyncKeyStateTable[nKey] = 0;
|
1999-05-02 16:32:27 +02:00
|
|
|
TRACE_(key)("(%x) -> %x\n", nKey, retval);
|
1998-11-08 13:26:36 +01:00
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* GetAsyncKeyState (USER.249)
|
1998-11-08 13:26:36 +01:00
|
|
|
*/
|
|
|
|
WORD WINAPI GetAsyncKeyState16(INT16 nKey)
|
|
|
|
{
|
1999-02-26 12:11:13 +01:00
|
|
|
return GetAsyncKeyState(nKey);
|
1998-11-08 13:26:36 +01:00
|
|
|
}
|
|
|
|
|
1999-05-22 21:00:27 +02:00
|
|
|
/***********************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* IsUserIdle (USER.333)
|
1999-05-22 21:00:27 +02:00
|
|
|
*/
|
|
|
|
BOOL16 WINAPI IsUserIdle16(void)
|
|
|
|
{
|
|
|
|
if ( GetAsyncKeyState( VK_LBUTTON ) & 0x8000 )
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if ( GetAsyncKeyState( VK_RBUTTON ) & 0x8000 )
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if ( GetAsyncKeyState( VK_MBUTTON ) & 0x8000 )
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* Should check for screen saver activation here ... */
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1998-11-08 13:26:36 +01:00
|
|
|
/**********************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* VkKeyScanA (USER32.@)
|
2001-10-17 19:50:02 +02:00
|
|
|
*
|
|
|
|
* VkKeyScan translates an ANSI character to a virtual-key and shift code
|
|
|
|
* for the current keyboard.
|
|
|
|
* high-order byte yields :
|
|
|
|
* 0 Unshifted
|
|
|
|
* 1 Shift
|
|
|
|
* 2 Ctrl
|
|
|
|
* 3-5 Shift-key combinations that are not used for characters
|
|
|
|
* 6 Ctrl-Alt
|
|
|
|
* 7 Ctrl-Alt-Shift
|
|
|
|
* I.e. : Shift = 1, Ctrl = 2, Alt = 4.
|
|
|
|
* FIXME : works ok except for dead chars :
|
|
|
|
* VkKeyScan '^'(0x5e, 94) ... got keycode 00 ... returning 00
|
|
|
|
* VkKeyScan '`'(0x60, 96) ... got keycode 00 ... returning 00
|
1998-11-08 13:26:36 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
WORD WINAPI VkKeyScanA(CHAR cChar)
|
1998-11-08 13:26:36 +01:00
|
|
|
{
|
2001-10-17 19:50:02 +02:00
|
|
|
return USER_Driver.pVkKeyScan( cChar );
|
1998-11-08 13:26:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* VkKeyScanW (USER32.@)
|
1998-11-08 13:26:36 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
WORD WINAPI VkKeyScanW(WCHAR cChar)
|
1998-11-08 13:26:36 +01:00
|
|
|
{
|
1999-02-26 12:11:13 +01:00
|
|
|
return VkKeyScanA((CHAR)cChar); /* FIXME: check unicode */
|
1998-11-08 13:26:36 +01:00
|
|
|
}
|
|
|
|
|
1999-03-28 15:15:40 +02:00
|
|
|
/**********************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* VkKeyScanExA (USER32.@)
|
1999-03-28 15:15:40 +02:00
|
|
|
*/
|
|
|
|
WORD WINAPI VkKeyScanExA(CHAR cChar, HKL dwhkl)
|
|
|
|
{
|
2001-10-17 19:50:02 +02:00
|
|
|
/* FIXME: complete workaround this is */
|
|
|
|
return VkKeyScanA(cChar);
|
1999-03-28 15:15:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* VkKeyScanExW (USER32.@)
|
1999-03-28 15:15:40 +02:00
|
|
|
*/
|
|
|
|
WORD WINAPI VkKeyScanExW(WCHAR cChar, HKL dwhkl)
|
|
|
|
{
|
2001-10-17 19:50:02 +02:00
|
|
|
/* FIXME: complete workaround this is */
|
|
|
|
return VkKeyScanA((CHAR)cChar); /* FIXME: check unicode */
|
1999-03-28 15:15:40 +02:00
|
|
|
}
|
2001-10-17 19:50:02 +02:00
|
|
|
|
1998-11-08 13:26:36 +01:00
|
|
|
/******************************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* GetKeyboardType (USER32.@)
|
1998-11-08 13:26:36 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
INT WINAPI GetKeyboardType(INT nTypeFlag)
|
1998-11-08 13:26:36 +01:00
|
|
|
{
|
2001-10-17 19:50:02 +02:00
|
|
|
TRACE_(keyboard)("(%d)\n", nTypeFlag);
|
|
|
|
switch(nTypeFlag)
|
|
|
|
{
|
|
|
|
case 0: /* Keyboard type */
|
|
|
|
return 4; /* AT-101 */
|
|
|
|
case 1: /* Keyboard Subtype */
|
|
|
|
return 0; /* There are no defined subtypes */
|
|
|
|
case 2: /* Number of F-keys */
|
|
|
|
return 12; /* We're doing an 101 for now, so return 12 F-keys */
|
|
|
|
default:
|
|
|
|
WARN_(keyboard)("Unknown type\n");
|
|
|
|
return 0; /* The book says 0 here, so 0 */
|
|
|
|
}
|
1998-11-08 13:26:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* MapVirtualKeyA (USER32.@)
|
1998-11-08 13:26:36 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
UINT WINAPI MapVirtualKeyA(UINT code, UINT maptype)
|
1998-11-08 13:26:36 +01:00
|
|
|
{
|
2001-10-17 19:50:02 +02:00
|
|
|
return USER_Driver.pMapVirtualKey( code, maptype );
|
1998-11-08 13:26:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* MapVirtualKeyW (USER32.@)
|
1998-11-08 13:26:36 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
UINT WINAPI MapVirtualKeyW(UINT code, UINT maptype)
|
1998-11-08 13:26:36 +01:00
|
|
|
{
|
2001-10-17 19:50:02 +02:00
|
|
|
return MapVirtualKeyA(code,maptype);
|
1998-11-08 13:26:36 +01:00
|
|
|
}
|
|
|
|
|
1999-02-13 09:53:22 +01:00
|
|
|
/******************************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* MapVirtualKeyExA (USER32.@)
|
1999-02-13 09:53:22 +01:00
|
|
|
*/
|
2000-03-28 21:31:18 +02:00
|
|
|
UINT WINAPI MapVirtualKeyExA(UINT code, UINT maptype, HKL hkl)
|
1999-02-13 09:53:22 +01:00
|
|
|
{
|
|
|
|
if (hkl)
|
1999-05-02 16:32:27 +02:00
|
|
|
FIXME_(keyboard)("(%d,%d,0x%08lx), hkl unhandled!\n",code,maptype,(DWORD)hkl);
|
2001-10-17 19:50:02 +02:00
|
|
|
return MapVirtualKeyA(code,maptype);
|
1999-02-13 09:53:22 +01:00
|
|
|
}
|
|
|
|
|
2000-12-05 04:56:56 +01:00
|
|
|
/******************************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* MapVirtualKeyExW (USER32.@)
|
2000-12-05 04:56:56 +01:00
|
|
|
*/
|
|
|
|
UINT WINAPI MapVirtualKeyExW(UINT code, UINT maptype, HKL hkl)
|
|
|
|
{
|
|
|
|
if (hkl)
|
|
|
|
FIXME_(keyboard)("(%d,%d,0x%08lx), hkl unhandled!\n",code,maptype,(DWORD)hkl);
|
2001-10-17 19:50:02 +02:00
|
|
|
return MapVirtualKeyA(code,maptype);
|
2000-12-05 04:56:56 +01:00
|
|
|
}
|
|
|
|
|
1998-11-08 13:26:36 +01:00
|
|
|
/****************************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* GetKBCodePage (USER32.@)
|
1998-11-08 13:26:36 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
UINT WINAPI GetKBCodePage(void)
|
1998-11-08 13:26:36 +01:00
|
|
|
{
|
2000-12-29 20:47:53 +01:00
|
|
|
return GetOEMCP();
|
1998-11-08 13:26:36 +01:00
|
|
|
}
|
|
|
|
|
1998-11-14 19:26:59 +01:00
|
|
|
/****************************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* GetKeyboardLayoutName (USER.477)
|
1998-11-14 19:26:59 +01:00
|
|
|
*/
|
|
|
|
INT16 WINAPI GetKeyboardLayoutName16(LPSTR pwszKLID)
|
|
|
|
{
|
1999-02-26 12:11:13 +01:00
|
|
|
return GetKeyboardLayoutNameA(pwszKLID);
|
1998-11-14 19:26:59 +01:00
|
|
|
}
|
|
|
|
|
1999-02-28 12:13:16 +01:00
|
|
|
/***********************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* GetKeyboardLayout (USER32.@)
|
1999-02-28 12:13:16 +01:00
|
|
|
*
|
|
|
|
* FIXME: - device handle for keyboard layout defaulted to
|
|
|
|
* the language id. This is the way Windows default works.
|
|
|
|
* - the thread identifier (dwLayout) is also ignored.
|
|
|
|
*/
|
|
|
|
HKL WINAPI GetKeyboardLayout(DWORD dwLayout)
|
|
|
|
{
|
|
|
|
HKL layout;
|
|
|
|
layout = GetSystemDefaultLCID(); /* FIXME */
|
|
|
|
layout |= (layout<<16); /* FIXME */
|
1999-05-02 16:32:27 +02:00
|
|
|
TRACE_(keyboard)("returning %08x\n",layout);
|
1999-02-28 12:13:16 +01:00
|
|
|
return layout;
|
|
|
|
}
|
|
|
|
|
1998-11-08 13:26:36 +01:00
|
|
|
/****************************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* GetKeyboardLayoutNameA (USER32.@)
|
1998-11-08 13:26:36 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
INT WINAPI GetKeyboardLayoutNameA(LPSTR pwszKLID)
|
1998-11-08 13:26:36 +01:00
|
|
|
{
|
1999-02-28 12:13:16 +01:00
|
|
|
sprintf(pwszKLID, "%08x",GetKeyboardLayout(0));
|
1998-11-14 19:26:59 +01:00
|
|
|
return 1;
|
1998-11-08 13:26:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* GetKeyboardLayoutNameW (USER32.@)
|
1998-11-08 13:26:36 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
INT WINAPI GetKeyboardLayoutNameW(LPWSTR pwszKLID)
|
1998-11-08 13:26:36 +01:00
|
|
|
{
|
2000-11-28 23:40:56 +01:00
|
|
|
char buf[KL_NAMELENGTH];
|
1999-02-26 12:11:13 +01:00
|
|
|
int res = GetKeyboardLayoutNameA(buf);
|
2000-11-28 23:40:56 +01:00
|
|
|
MultiByteToWideChar( CP_ACP, 0, buf, -1, pwszKLID, KL_NAMELENGTH );
|
1998-11-08 13:26:36 +01:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* GetKeyNameTextA (USER32.@)
|
1998-11-08 13:26:36 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
INT WINAPI GetKeyNameTextA(LONG lParam, LPSTR lpBuffer, INT nSize)
|
1998-11-08 13:26:36 +01:00
|
|
|
{
|
2001-10-17 19:50:02 +02:00
|
|
|
return USER_Driver.pGetKeyNameText( lParam, lpBuffer, nSize );
|
1998-11-08 13:26:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* GetKeyNameTextW (USER32.@)
|
1998-11-08 13:26:36 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
INT WINAPI GetKeyNameTextW(LONG lParam, LPWSTR lpBuffer, INT nSize)
|
1998-11-08 13:26:36 +01:00
|
|
|
{
|
2000-04-30 14:22:18 +02:00
|
|
|
int res;
|
|
|
|
LPSTR buf = HeapAlloc( GetProcessHeap(), 0, nSize );
|
|
|
|
if(buf == NULL) return 0; /* FIXME: is this the correct failure value?*/
|
|
|
|
res = GetKeyNameTextA(lParam,buf,nSize);
|
1998-11-08 13:26:36 +01:00
|
|
|
|
2000-11-28 23:40:56 +01:00
|
|
|
if (nSize > 0 && !MultiByteToWideChar( CP_ACP, 0, buf, -1, lpBuffer, nSize ))
|
|
|
|
lpBuffer[nSize-1] = 0;
|
1998-11-08 13:26:36 +01:00
|
|
|
HeapFree( GetProcessHeap(), 0, buf );
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2000-10-25 23:34:31 +02:00
|
|
|
/****************************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* ToUnicode (USER32.@)
|
2000-10-25 23:34:31 +02:00
|
|
|
*/
|
|
|
|
INT WINAPI ToUnicode(UINT virtKey, UINT scanCode, LPBYTE lpKeyState,
|
|
|
|
LPWSTR lpwStr, int size, UINT flags)
|
|
|
|
{
|
|
|
|
return USER_Driver.pToUnicode(virtKey, scanCode, lpKeyState, lpwStr, size, flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* ToUnicodeEx (USER32.@)
|
2000-10-25 23:34:31 +02:00
|
|
|
*/
|
|
|
|
INT WINAPI ToUnicodeEx(UINT virtKey, UINT scanCode, LPBYTE lpKeyState,
|
|
|
|
LPWSTR lpwStr, int size, UINT flags, HKL hkl)
|
|
|
|
{
|
|
|
|
/* FIXME: need true implementation */
|
|
|
|
return ToUnicode(virtKey, scanCode, lpKeyState, lpwStr, size, flags);
|
|
|
|
}
|
|
|
|
|
1998-11-08 13:26:36 +01:00
|
|
|
/****************************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* ToAscii (USER32.@)
|
1998-11-08 13:26:36 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
INT WINAPI ToAscii( UINT virtKey,UINT scanCode,LPBYTE lpKeyState,
|
|
|
|
LPWORD lpChar,UINT flags )
|
1998-11-08 13:26:36 +01:00
|
|
|
{
|
2000-10-25 23:34:31 +02:00
|
|
|
WCHAR uni_chars[2];
|
|
|
|
INT ret, n_ret;
|
|
|
|
|
|
|
|
ret = ToUnicode(virtKey, scanCode, lpKeyState, uni_chars, 2, flags);
|
|
|
|
if(ret < 0) n_ret = 1; /* FIXME: make ToUnicode return 2 for dead chars */
|
|
|
|
else n_ret = ret;
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, uni_chars, n_ret, (LPSTR)lpChar, 2, NULL, NULL);
|
|
|
|
return ret;
|
1998-11-08 13:26:36 +01:00
|
|
|
}
|
|
|
|
|
1999-03-28 15:15:40 +02:00
|
|
|
/****************************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* ToAsciiEx (USER32.@)
|
1999-03-28 15:15:40 +02:00
|
|
|
*/
|
|
|
|
INT WINAPI ToAsciiEx( UINT virtKey, UINT scanCode, LPBYTE lpKeyState,
|
|
|
|
LPWORD lpChar, UINT flags, HKL dwhkl )
|
|
|
|
{
|
2000-10-25 23:34:31 +02:00
|
|
|
/* FIXME: need true implementation */
|
|
|
|
return ToAscii(virtKey, scanCode, lpKeyState, lpChar, flags);
|
1999-03-28 15:15:40 +02:00
|
|
|
}
|
|
|
|
|
1998-12-10 16:49:22 +01:00
|
|
|
/**********************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* ActivateKeyboardLayout (USER32.@)
|
1999-02-28 12:13:16 +01:00
|
|
|
*
|
|
|
|
* Call ignored. WINE supports only system default keyboard layout.
|
1998-12-10 16:49:22 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
HKL WINAPI ActivateKeyboardLayout(HKL hLayout, UINT flags)
|
1998-12-10 16:49:22 +01:00
|
|
|
{
|
1999-05-02 16:32:27 +02:00
|
|
|
TRACE_(keyboard)("(%d, %d)\n", hLayout, flags);
|
|
|
|
ERR_(keyboard)("Only default system keyboard layout supported. Call ignored.\n");
|
1998-12-10 16:49:22 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-11-08 13:26:36 +01:00
|
|
|
/***********************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* GetKeyboardLayoutList (USER32.@)
|
1999-02-28 12:13:16 +01:00
|
|
|
*
|
|
|
|
* FIXME: Supports only the system default language and layout and
|
|
|
|
* returns only 1 value.
|
|
|
|
*
|
|
|
|
* Return number of values available if either input parm is
|
|
|
|
* 0, per MS documentation.
|
|
|
|
*
|
1998-11-08 13:26:36 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
INT WINAPI GetKeyboardLayoutList(INT nBuff,HKL *layouts)
|
1998-11-08 13:26:36 +01:00
|
|
|
{
|
1999-05-02 16:32:27 +02:00
|
|
|
TRACE_(keyboard)("(%d,%p)\n",nBuff,layouts);
|
1999-02-28 12:13:16 +01:00
|
|
|
if (!nBuff || !layouts)
|
|
|
|
return 1;
|
1998-11-08 13:26:36 +01:00
|
|
|
if (layouts)
|
|
|
|
layouts[0] = GetKeyboardLayout(0);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* RegisterHotKey (USER32.@)
|
1998-11-08 13:26:36 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI RegisterHotKey(HWND hwnd,INT id,UINT modifiers,UINT vk) {
|
1999-05-02 16:32:27 +02:00
|
|
|
FIXME_(keyboard)("(0x%08x,%d,0x%08x,%d): stub\n",hwnd,id,modifiers,vk);
|
1998-11-08 13:26:36 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* UnregisterHotKey (USER32.@)
|
1998-11-08 13:26:36 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
BOOL WINAPI UnregisterHotKey(HWND hwnd,INT id) {
|
1999-05-02 16:32:27 +02:00
|
|
|
FIXME_(keyboard)("(0x%08x,%d): stub\n",hwnd,id);
|
1998-11-08 13:26:36 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1998-12-10 16:49:22 +01:00
|
|
|
/***********************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* LoadKeyboardLayoutA (USER32.@)
|
1999-02-28 12:13:16 +01:00
|
|
|
* Call ignored. WINE supports only system default keyboard layout.
|
1998-12-10 16:49:22 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
HKL WINAPI LoadKeyboardLayoutA(LPCSTR pwszKLID, UINT Flags)
|
1998-12-10 16:49:22 +01:00
|
|
|
{
|
1999-05-02 16:32:27 +02:00
|
|
|
TRACE_(keyboard)("(%s, %d)\n", pwszKLID, Flags);
|
|
|
|
ERR_(keyboard)("Only default system keyboard layout supported. Call ignored.\n");
|
1998-12-10 16:49:22 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2000-12-22 02:38:01 +01:00
|
|
|
* LoadKeyboardLayoutW (USER32.@)
|
1998-12-10 16:49:22 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01:00
|
|
|
HKL WINAPI LoadKeyboardLayoutW(LPCWSTR pwszKLID, UINT Flags)
|
1998-12-10 16:49:22 +01:00
|
|
|
{
|
2000-04-30 14:22:18 +02:00
|
|
|
char buf[9];
|
|
|
|
|
2000-11-28 23:40:56 +01:00
|
|
|
WideCharToMultiByte( CP_ACP, 0, pwszKLID, -1, buf, sizeof(buf), NULL, NULL );
|
1999-02-28 12:13:16 +01:00
|
|
|
buf[8] = 0;
|
2000-04-30 14:22:18 +02:00
|
|
|
return LoadKeyboardLayoutA(buf, Flags);
|
1998-12-10 16:49:22 +01:00
|
|
|
}
|