1998-11-08 12:26:36 +00:00
|
|
|
/*
|
|
|
|
* USER Input processing
|
|
|
|
*
|
|
|
|
* Copyright 1993 Bob Amstadt
|
2002-05-31 23:06:46 +00:00
|
|
|
* Copyright 1996 Albrecht Kleine
|
1998-11-08 12:26:36 +00:00
|
|
|
* Copyright 1997 David Faure
|
|
|
|
* Copyright 1998 Morten Welinder
|
|
|
|
* Copyright 1998 Ulrich Weigand
|
|
|
|
*
|
2002-03-09 23:29:33 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 12:49:52 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
1998-11-08 12:26:36 +00:00
|
|
|
*/
|
|
|
|
|
2003-11-26 22:29:30 +00:00
|
|
|
#include "config.h"
|
|
|
|
#include "wine/port.h"
|
|
|
|
|
1998-11-08 12:26:36 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2003-09-05 23:08:26 +00:00
|
|
|
#include <stdarg.h>
|
2000-02-10 19:03:02 +00:00
|
|
|
#include <stdio.h>
|
1998-11-08 12:26:36 +00:00
|
|
|
#include <ctype.h>
|
|
|
|
#include <assert.h>
|
|
|
|
|
2003-01-07 20:36:20 +00:00
|
|
|
#define NONAMELESSUNION
|
|
|
|
#define NONAMELESSSTRUCT
|
2000-02-10 19:03:02 +00:00
|
|
|
#include "windef.h"
|
2000-12-19 04:53:20 +00:00
|
|
|
#include "winbase.h"
|
2000-02-10 19:03:02 +00:00
|
|
|
#include "wingdi.h"
|
1999-02-22 10:16:00 +00:00
|
|
|
#include "winuser.h"
|
2003-08-20 18:22:31 +00:00
|
|
|
#include "winnls.h"
|
2002-11-18 19:47:20 +00:00
|
|
|
#include "winternl.h"
|
1998-11-08 12:26:36 +00:00
|
|
|
#include "winerror.h"
|
2006-07-24 12:13:53 +00:00
|
|
|
#include "win.h"
|
|
|
|
#include "user_private.h"
|
|
|
|
#include "wine/server.h"
|
|
|
|
#include "wine/debug.h"
|
1998-11-08 12:26:36 +00:00
|
|
|
|
2006-07-24 12:13:53 +00:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(win);
|
2002-03-09 23:29:33 +00:00
|
|
|
WINE_DECLARE_DEBUG_CHANNEL(keyboard);
|
1998-11-08 12:26:36 +00:00
|
|
|
|
2001-06-19 19:16:41 +00:00
|
|
|
|
2001-10-18 21:38:59 +00:00
|
|
|
/***********************************************************************
|
|
|
|
* get_key_state
|
|
|
|
*/
|
|
|
|
static WORD get_key_state(void)
|
|
|
|
{
|
|
|
|
WORD ret = 0;
|
|
|
|
|
2005-03-09 11:51:31 +00:00
|
|
|
if (GetSystemMetrics( SM_SWAPBUTTON ))
|
2001-10-18 21:38:59 +00:00
|
|
|
{
|
2005-03-09 16:45:23 +00:00
|
|
|
if (GetAsyncKeyState(VK_RBUTTON) & 0x80) ret |= MK_LBUTTON;
|
|
|
|
if (GetAsyncKeyState(VK_LBUTTON) & 0x80) ret |= MK_RBUTTON;
|
2001-10-18 21:38:59 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-03-09 16:45:23 +00:00
|
|
|
if (GetAsyncKeyState(VK_LBUTTON) & 0x80) ret |= MK_LBUTTON;
|
|
|
|
if (GetAsyncKeyState(VK_RBUTTON) & 0x80) ret |= MK_RBUTTON;
|
2001-10-18 21:38:59 +00:00
|
|
|
}
|
2005-03-09 16:45:23 +00:00
|
|
|
if (GetAsyncKeyState(VK_MBUTTON) & 0x80) ret |= MK_MBUTTON;
|
|
|
|
if (GetAsyncKeyState(VK_SHIFT) & 0x80) ret |= MK_SHIFT;
|
|
|
|
if (GetAsyncKeyState(VK_CONTROL) & 0x80) ret |= MK_CONTROL;
|
|
|
|
if (GetAsyncKeyState(VK_XBUTTON1) & 0x80) ret |= MK_XBUTTON1;
|
|
|
|
if (GetAsyncKeyState(VK_XBUTTON2) & 0x80) ret |= MK_XBUTTON2;
|
2001-10-18 21:38:59 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-03-12 13:54:03 +00:00
|
|
|
/**********************************************************************
|
|
|
|
* set_capture_window
|
|
|
|
*/
|
|
|
|
BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret )
|
|
|
|
{
|
|
|
|
HWND previous = 0;
|
|
|
|
UINT flags = 0;
|
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
if (gui_flags & GUI_INMENUMODE) flags |= CAPTURE_MENU;
|
|
|
|
if (gui_flags & GUI_INMOVESIZE) flags |= CAPTURE_MOVESIZE;
|
|
|
|
|
|
|
|
SERVER_START_REQ( set_capture_window )
|
|
|
|
{
|
|
|
|
req->handle = hwnd;
|
|
|
|
req->flags = flags;
|
|
|
|
if ((ret = !wine_server_call_err( req )))
|
|
|
|
{
|
|
|
|
previous = reply->previous;
|
|
|
|
hwnd = reply->full_handle;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
|
2008-03-12 13:55:28 +00:00
|
|
|
USER_Driver->pSetCapture( hwnd, gui_flags );
|
|
|
|
|
2008-03-12 13:54:03 +00:00
|
|
|
if (previous && previous != hwnd)
|
|
|
|
SendMessageW( previous, WM_CAPTURECHANGED, 0, (LPARAM)hwnd );
|
|
|
|
|
|
|
|
if (prev_ret) *prev_ret = previous;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-25 20:01:03 +00:00
|
|
|
/***********************************************************************
|
|
|
|
* SendInput (USER32.@)
|
|
|
|
*/
|
|
|
|
UINT WINAPI SendInput( UINT count, LPINPUT inputs, int size )
|
|
|
|
{
|
2006-07-24 12:13:53 +00:00
|
|
|
if (TRACE_ON(win))
|
|
|
|
{
|
|
|
|
UINT i;
|
|
|
|
|
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
{
|
|
|
|
switch(inputs[i].type)
|
|
|
|
{
|
|
|
|
case INPUT_MOUSE:
|
2006-09-29 22:25:15 +00:00
|
|
|
TRACE("mouse: dx %d, dy %d, data %x, flags %x, time %u, info %lx\n",
|
2006-07-24 12:13:53 +00:00
|
|
|
inputs[i].u.mi.dx, inputs[i].u.mi.dy, inputs[i].u.mi.mouseData,
|
|
|
|
inputs[i].u.mi.dwFlags, inputs[i].u.mi.time, inputs[i].u.mi.dwExtraInfo);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case INPUT_KEYBOARD:
|
2006-09-29 22:25:15 +00:00
|
|
|
TRACE("keyboard: vk %x, scan %x, flags %x, time %u, info %lx\n",
|
2006-07-24 12:13:53 +00:00
|
|
|
inputs[i].u.ki.wVk, inputs[i].u.ki.wScan, inputs[i].u.ki.dwFlags,
|
|
|
|
inputs[i].u.ki.time, inputs[i].u.ki.dwExtraInfo);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case INPUT_HARDWARE:
|
2006-09-29 22:25:15 +00:00
|
|
|
TRACE("hardware: msg %d, wParamL %x, wParamH %x\n",
|
2006-07-24 12:13:53 +00:00
|
|
|
inputs[i].u.hi.uMsg, inputs[i].u.hi.wParamL, inputs[i].u.hi.wParamH);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2006-09-29 22:25:15 +00:00
|
|
|
FIXME("unknown input type %u\n", inputs[i].type);
|
2006-07-24 12:13:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-07-18 15:14:56 +00:00
|
|
|
return USER_Driver->pSendInput( count, inputs, size );
|
2001-06-25 20:01:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* keybd_event (USER32.@)
|
|
|
|
*/
|
|
|
|
void WINAPI keybd_event( BYTE bVk, BYTE bScan,
|
2002-10-31 01:04:39 +00:00
|
|
|
DWORD dwFlags, ULONG_PTR dwExtraInfo )
|
2001-06-25 20:01:03 +00:00
|
|
|
{
|
|
|
|
INPUT input;
|
|
|
|
|
|
|
|
input.type = INPUT_KEYBOARD;
|
|
|
|
input.u.ki.wVk = bVk;
|
|
|
|
input.u.ki.wScan = bScan;
|
|
|
|
input.u.ki.dwFlags = dwFlags;
|
2001-10-17 17:50:02 +00:00
|
|
|
input.u.ki.time = GetTickCount();
|
|
|
|
input.u.ki.dwExtraInfo = dwExtraInfo;
|
2001-06-25 20:01:03 +00:00
|
|
|
SendInput( 1, &input, sizeof(input) );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-11-08 12:26:36 +00:00
|
|
|
/***********************************************************************
|
2000-12-22 01:38:01 +00:00
|
|
|
* mouse_event (USER32.@)
|
1998-11-08 12:26:36 +00:00
|
|
|
*/
|
|
|
|
void WINAPI mouse_event( DWORD dwFlags, DWORD dx, DWORD dy,
|
2002-10-31 01:04:39 +00:00
|
|
|
DWORD dwData, ULONG_PTR dwExtraInfo )
|
1998-11-08 12:26:36 +00:00
|
|
|
{
|
2001-06-25 20:01:03 +00: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 21:38:59 +00:00
|
|
|
input.u.mi.time = GetCurrentTime();
|
|
|
|
input.u.mi.dwExtraInfo = dwExtraInfo;
|
|
|
|
SendInput( 1, &input, sizeof(input) );
|
1998-11-08 12:26:36 +00:00
|
|
|
}
|
|
|
|
|
2001-06-25 20:01:03 +00:00
|
|
|
|
2000-12-16 20:37:16 +00:00
|
|
|
/***********************************************************************
|
2000-12-22 01:38:01 +00:00
|
|
|
* GetCursorPos (USER32.@)
|
2000-12-16 20:37:16 +00:00
|
|
|
*/
|
|
|
|
BOOL WINAPI GetCursorPos( POINT *pt )
|
|
|
|
{
|
2005-07-18 15:14:56 +00:00
|
|
|
if (!pt) return FALSE;
|
|
|
|
return USER_Driver->pGetCursorPos( pt );
|
2000-12-16 20:37:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-08-28 23:38:10 +00:00
|
|
|
/***********************************************************************
|
|
|
|
* GetCursorInfo (USER32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI GetCursorInfo( PCURSORINFO pci )
|
|
|
|
{
|
|
|
|
if (!pci) return 0;
|
2005-04-27 08:18:20 +00:00
|
|
|
if (get_user_thread_info()->cursor_count >= 0) pci->flags = CURSOR_SHOWING;
|
2002-08-29 23:59:17 +00:00
|
|
|
else pci->flags = 0;
|
2002-08-28 23:38:10 +00:00
|
|
|
GetCursorPos(&pci->ptScreenPos);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-21 00:44:09 +00:00
|
|
|
/***********************************************************************
|
|
|
|
* SetCursorPos (USER32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI SetCursorPos( INT x, INT y )
|
|
|
|
{
|
2005-07-18 15:14:56 +00:00
|
|
|
return USER_Driver->pSetCursorPos( x, y );
|
2001-06-21 00:44:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-11-08 12:26:36 +00:00
|
|
|
/**********************************************************************
|
2002-10-12 01:24:37 +00:00
|
|
|
* SetCapture (USER32.@)
|
1998-11-08 12:26:36 +00:00
|
|
|
*/
|
2002-10-12 01:24:37 +00:00
|
|
|
HWND WINAPI SetCapture( HWND hwnd )
|
1998-11-08 12:26:36 +00:00
|
|
|
{
|
2008-03-12 13:54:03 +00:00
|
|
|
HWND previous;
|
1998-11-08 12:26:36 +00:00
|
|
|
|
2008-03-12 13:54:03 +00:00
|
|
|
set_capture_window( hwnd, 0, &previous );
|
2002-10-12 01:24:37 +00:00
|
|
|
return previous;
|
1998-11-08 12:26:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2001-07-02 19:59:40 +00:00
|
|
|
* ReleaseCapture (USER32.@)
|
1998-11-08 12:26:36 +00:00
|
|
|
*/
|
1999-04-15 16:40:16 +00:00
|
|
|
BOOL WINAPI ReleaseCapture(void)
|
1998-11-08 12:26:36 +00:00
|
|
|
{
|
2008-03-12 13:54:03 +00:00
|
|
|
BOOL ret = set_capture_window( 0, 0, NULL );
|
2006-03-27 12:23:17 +00:00
|
|
|
|
|
|
|
/* Somebody may have missed some mouse movements */
|
|
|
|
mouse_event( MOUSEEVENTF_MOVE, 0, 0, 0, 0 );
|
|
|
|
|
2005-10-03 11:06:14 +00:00
|
|
|
return ret;
|
1998-11-08 12:26:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2000-12-22 01:38:01 +00:00
|
|
|
* GetCapture (USER32.@)
|
1998-11-08 12:26:36 +00:00
|
|
|
*/
|
1999-02-26 11:11:13 +00:00
|
|
|
HWND WINAPI GetCapture(void)
|
1998-11-08 12:26:36 +00:00
|
|
|
{
|
2002-10-12 01:24:37 +00:00
|
|
|
HWND ret = 0;
|
|
|
|
|
|
|
|
SERVER_START_REQ( get_thread_input )
|
|
|
|
{
|
|
|
|
req->tid = GetCurrentThreadId();
|
|
|
|
if (!wine_server_call_err( req )) ret = reply->capture;
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
return ret;
|
1998-11-08 12:26:36 +00:00
|
|
|
}
|
|
|
|
|
2002-10-12 01:24:37 +00:00
|
|
|
|
1998-11-08 12:26:36 +00:00
|
|
|
/**********************************************************************
|
2000-12-22 01:38:01 +00:00
|
|
|
* GetAsyncKeyState (USER32.@)
|
1998-11-08 12:26:36 +00:00
|
|
|
*
|
2002-05-31 23:06:46 +00:00
|
|
|
* Determine if a key is or was pressed. retval has high-order
|
1998-11-08 12:26:36 +00:00
|
|
|
* bit set to 1 if currently pressed, low-order bit set to 1 if key has
|
|
|
|
* been pressed.
|
|
|
|
*/
|
2002-02-22 21:24:25 +00:00
|
|
|
SHORT WINAPI GetAsyncKeyState(INT nKey)
|
1998-11-08 12:26:36 +00:00
|
|
|
{
|
2005-07-18 15:14:56 +00:00
|
|
|
return USER_Driver->pGetAsyncKeyState( nKey );
|
1998-11-08 12:26:36 +00:00
|
|
|
}
|
|
|
|
|
1999-05-22 19:00:27 +00:00
|
|
|
|
2005-04-26 08:18:47 +00:00
|
|
|
/***********************************************************************
|
|
|
|
* GetQueueStatus (USER32.@)
|
|
|
|
*/
|
|
|
|
DWORD WINAPI GetQueueStatus( UINT flags )
|
|
|
|
{
|
|
|
|
DWORD ret = 0;
|
|
|
|
|
2005-11-14 15:17:09 +00:00
|
|
|
if (flags & ~(QS_ALLINPUT | QS_ALLPOSTMESSAGE | QS_SMRESULT))
|
|
|
|
{
|
|
|
|
SetLastError( ERROR_INVALID_FLAGS );
|
|
|
|
return 0;
|
|
|
|
}
|
2005-10-27 18:28:23 +00:00
|
|
|
|
2005-04-26 08:18:47 +00:00
|
|
|
/* check for pending X events */
|
2005-11-14 15:17:09 +00:00
|
|
|
USER_Driver->pMsgWaitForMultipleObjectsEx( 0, NULL, 0, flags, 0 );
|
2005-04-26 08:18:47 +00:00
|
|
|
|
|
|
|
SERVER_START_REQ( get_queue_status )
|
|
|
|
{
|
|
|
|
req->clear = 1;
|
|
|
|
wine_server_call( req );
|
|
|
|
ret = MAKELONG( reply->changed_bits & flags, reply->wake_bits & flags );
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetInputState (USER32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI GetInputState(void)
|
|
|
|
{
|
|
|
|
DWORD ret = 0;
|
|
|
|
|
|
|
|
/* check for pending X events */
|
2005-07-18 15:14:56 +00:00
|
|
|
USER_Driver->pMsgWaitForMultipleObjectsEx( 0, NULL, 0, QS_INPUT, 0 );
|
2005-04-26 08:18:47 +00:00
|
|
|
|
|
|
|
SERVER_START_REQ( get_queue_status )
|
|
|
|
{
|
|
|
|
req->clear = 0;
|
|
|
|
wine_server_call( req );
|
|
|
|
ret = reply->wake_bits & (QS_KEY | QS_MOUSEBUTTON);
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-28 12:04:14 +00:00
|
|
|
/******************************************************************
|
|
|
|
* GetLastInputInfo (USER32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI GetLastInputInfo(PLASTINPUTINFO plii)
|
|
|
|
{
|
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
TRACE("%p\n", plii);
|
|
|
|
|
|
|
|
if (plii->cbSize != sizeof (*plii) )
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
SERVER_START_REQ( get_last_input_time )
|
|
|
|
{
|
|
|
|
ret = !wine_server_call_err( req );
|
|
|
|
if (ret)
|
|
|
|
plii->dwTime = reply->time;
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-24 22:22:19 +00:00
|
|
|
/******************************************************************
|
|
|
|
* GetRawInputDeviceList (USER32.@)
|
|
|
|
*/
|
|
|
|
UINT WINAPI GetRawInputDeviceList(PRAWINPUTDEVICELIST pRawInputDeviceList, PUINT puiNumDevices, UINT cbSize)
|
|
|
|
{
|
|
|
|
FIXME("(pRawInputDeviceList=%p, puiNumDevices=%p, cbSize=%d) stub!\n", pRawInputDeviceList, puiNumDevices, cbSize);
|
|
|
|
|
|
|
|
if(pRawInputDeviceList)
|
|
|
|
memset(pRawInputDeviceList, 0, sizeof *pRawInputDeviceList);
|
|
|
|
*puiNumDevices = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* RegisterRawInputDevices (USER32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI RegisterRawInputDevices(PRAWINPUTDEVICE pRawInputDevices, UINT uiNumDevices, UINT cbSize)
|
|
|
|
{
|
|
|
|
FIXME("(pRawInputDevices=%p, uiNumDevices=%d, cbSize=%d) stub!\n", pRawInputDevices, uiNumDevices, cbSize);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* GetRawInputData (USER32.@)
|
|
|
|
*/
|
2007-10-14 12:36:08 +00:00
|
|
|
UINT WINAPI GetRawInputData(HRAWINPUT hRawInput, UINT uiCommand, LPVOID pData, PUINT pcbSize, UINT cbSizeHeader)
|
2007-09-24 22:22:19 +00:00
|
|
|
{
|
|
|
|
FIXME("(hRawInput=%p, uiCommand=%d, pData=%p, pcbSize=%p, cbSizeHeader=%d) stub!\n",
|
|
|
|
hRawInput, uiCommand, pData, pcbSize, cbSizeHeader);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* GetRawInputBuffer (USER32.@)
|
|
|
|
*/
|
|
|
|
UINT WINAPI GetRawInputBuffer(PRAWINPUT pData, PUINT pcbSize, UINT cbSizeHeader)
|
|
|
|
{
|
|
|
|
FIXME("(pData=%p, pcbSize=%p, cbSizeHeader=%d) stub!\n", pData, pcbSize, cbSizeHeader);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* GetRawInputDeviceInfoA (USER32.@)
|
|
|
|
*/
|
|
|
|
UINT WINAPI GetRawInputDeviceInfoA(HANDLE hDevice, UINT uiCommand, LPVOID pData, PUINT pcbSize)
|
|
|
|
{
|
|
|
|
FIXME("(hDevice=%p, uiCommand=%d, pData=%p, pcbSize=%p) stub!\n", hDevice, uiCommand, pData, pcbSize);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* GetRawInputDeviceInfoW (USER32.@)
|
|
|
|
*/
|
|
|
|
UINT WINAPI GetRawInputDeviceInfoW(HANDLE hDevice, UINT uiCommand, LPVOID pData, PUINT pcbSize)
|
|
|
|
{
|
|
|
|
FIXME("(hDevice=%p, uiCommand=%d, pData=%p, pcbSize=%p) stub!\n", hDevice, uiCommand, pData, pcbSize);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* GetRegisteredRawInputDevices (USER32.@)
|
|
|
|
*/
|
|
|
|
UINT WINAPI GetRegisteredRawInputDevices(PRAWINPUTDEVICE pRawInputDevices, PUINT puiNumDevices, UINT cbSize)
|
|
|
|
{
|
|
|
|
FIXME("(pRawInputDevices=%p, puiNumDevices=%p, cbSize=%d) stub!\n", pRawInputDevices, puiNumDevices, cbSize);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* DefRawInputProc (USER32.@)
|
|
|
|
*/
|
|
|
|
LRESULT WINAPI DefRawInputProc(PRAWINPUT *paRawInput, INT nInput, UINT cbSizeHeader)
|
|
|
|
{
|
|
|
|
FIXME("(paRawInput=%p, nInput=%d, cbSizeHeader=%d) stub!\n", *paRawInput, nInput, cbSizeHeader);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-26 08:18:47 +00:00
|
|
|
/**********************************************************************
|
|
|
|
* AttachThreadInput (USER32.@)
|
|
|
|
*
|
|
|
|
* Attaches the input processing mechanism of one thread to that of
|
|
|
|
* another thread.
|
|
|
|
*/
|
|
|
|
BOOL WINAPI AttachThreadInput( DWORD from, DWORD to, BOOL attach )
|
|
|
|
{
|
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
SERVER_START_REQ( attach_thread_input )
|
|
|
|
{
|
|
|
|
req->tid_from = from;
|
|
|
|
req->tid_to = to;
|
|
|
|
req->attach = attach;
|
|
|
|
ret = !wine_server_call_err( req );
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* GetKeyState (USER32.@)
|
|
|
|
*
|
|
|
|
* An application calls the GetKeyState function in response to a
|
|
|
|
* keyboard-input message. This function retrieves the state of the key
|
|
|
|
* at the time the input message was generated.
|
|
|
|
*/
|
|
|
|
SHORT WINAPI GetKeyState(INT vkey)
|
|
|
|
{
|
|
|
|
SHORT retval = 0;
|
|
|
|
|
|
|
|
SERVER_START_REQ( get_key_state )
|
|
|
|
{
|
|
|
|
req->tid = GetCurrentThreadId();
|
|
|
|
req->key = vkey;
|
|
|
|
if (!wine_server_call( req )) retval = (signed char)reply->state;
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
TRACE("key (0x%x) -> %x\n", vkey, retval);
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* GetKeyboardState (USER32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI GetKeyboardState( LPBYTE state )
|
|
|
|
{
|
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
TRACE("(%p)\n", state);
|
|
|
|
|
|
|
|
memset( state, 0, 256 );
|
|
|
|
SERVER_START_REQ( get_key_state )
|
|
|
|
{
|
|
|
|
req->tid = GetCurrentThreadId();
|
|
|
|
req->key = -1;
|
|
|
|
wine_server_set_reply( req, state, 256 );
|
|
|
|
ret = !wine_server_call_err( req );
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* SetKeyboardState (USER32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI SetKeyboardState( LPBYTE state )
|
|
|
|
{
|
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
SERVER_START_REQ( set_key_state )
|
|
|
|
{
|
|
|
|
req->tid = GetCurrentThreadId();
|
|
|
|
wine_server_add_data( req, state, 256 );
|
|
|
|
ret = !wine_server_call_err( req );
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-11-08 12:26:36 +00:00
|
|
|
/**********************************************************************
|
2000-12-22 01:38:01 +00:00
|
|
|
* VkKeyScanA (USER32.@)
|
2001-10-17 17:50:02 +00: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 12:26:36 +00:00
|
|
|
*/
|
2003-11-14 03:32:43 +00:00
|
|
|
SHORT WINAPI VkKeyScanA(CHAR cChar)
|
1998-11-08 12:26:36 +00:00
|
|
|
{
|
2003-11-14 03:32:43 +00:00
|
|
|
WCHAR wChar;
|
|
|
|
|
|
|
|
if (IsDBCSLeadByte(cChar)) return -1;
|
|
|
|
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, &cChar, 1, &wChar, 1);
|
|
|
|
return VkKeyScanW(wChar);
|
1998-11-08 12:26:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2000-12-22 01:38:01 +00:00
|
|
|
* VkKeyScanW (USER32.@)
|
1998-11-08 12:26:36 +00:00
|
|
|
*/
|
2003-11-14 03:32:43 +00:00
|
|
|
SHORT WINAPI VkKeyScanW(WCHAR cChar)
|
1998-11-08 12:26:36 +00:00
|
|
|
{
|
2003-11-14 03:32:43 +00:00
|
|
|
return VkKeyScanExW(cChar, GetKeyboardLayout(0));
|
1998-11-08 12:26:36 +00:00
|
|
|
}
|
|
|
|
|
1999-03-28 13:15:40 +00:00
|
|
|
/**********************************************************************
|
2000-12-22 01:38:01 +00:00
|
|
|
* VkKeyScanExA (USER32.@)
|
1999-03-28 13:15:40 +00:00
|
|
|
*/
|
|
|
|
WORD WINAPI VkKeyScanExA(CHAR cChar, HKL dwhkl)
|
|
|
|
{
|
2003-11-14 03:32:43 +00:00
|
|
|
WCHAR wChar;
|
|
|
|
|
|
|
|
if (IsDBCSLeadByte(cChar)) return -1;
|
|
|
|
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, &cChar, 1, &wChar, 1);
|
|
|
|
return VkKeyScanExW(wChar, dwhkl);
|
1999-03-28 13:15:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2000-12-22 01:38:01 +00:00
|
|
|
* VkKeyScanExW (USER32.@)
|
1999-03-28 13:15:40 +00:00
|
|
|
*/
|
|
|
|
WORD WINAPI VkKeyScanExW(WCHAR cChar, HKL dwhkl)
|
|
|
|
{
|
2005-07-18 15:14:56 +00:00
|
|
|
return USER_Driver->pVkKeyScanEx(cChar, dwhkl);
|
1999-03-28 13:15:40 +00:00
|
|
|
}
|
2001-10-17 17:50:02 +00:00
|
|
|
|
2004-09-01 22:47:48 +00:00
|
|
|
/**********************************************************************
|
|
|
|
* OemKeyScan (USER32.@)
|
|
|
|
*/
|
|
|
|
DWORD WINAPI OemKeyScan(WORD wOemChar)
|
|
|
|
{
|
|
|
|
return wOemChar;
|
|
|
|
}
|
|
|
|
|
1998-11-08 12:26:36 +00:00
|
|
|
/******************************************************************************
|
2000-12-22 01:38:01 +00:00
|
|
|
* GetKeyboardType (USER32.@)
|
1998-11-08 12:26:36 +00:00
|
|
|
*/
|
1999-02-26 11:11:13 +00:00
|
|
|
INT WINAPI GetKeyboardType(INT nTypeFlag)
|
1998-11-08 12:26:36 +00:00
|
|
|
{
|
2001-10-17 17:50:02 +00: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 12:26:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2000-12-22 01:38:01 +00:00
|
|
|
* MapVirtualKeyA (USER32.@)
|
1998-11-08 12:26:36 +00:00
|
|
|
*/
|
1999-02-26 11:11:13 +00:00
|
|
|
UINT WINAPI MapVirtualKeyA(UINT code, UINT maptype)
|
1998-11-08 12:26:36 +00:00
|
|
|
{
|
2003-11-14 03:32:43 +00:00
|
|
|
return MapVirtualKeyExA( code, maptype, GetKeyboardLayout(0) );
|
1998-11-08 12:26:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2000-12-22 01:38:01 +00:00
|
|
|
* MapVirtualKeyW (USER32.@)
|
1998-11-08 12:26:36 +00:00
|
|
|
*/
|
1999-02-26 11:11:13 +00:00
|
|
|
UINT WINAPI MapVirtualKeyW(UINT code, UINT maptype)
|
1998-11-08 12:26:36 +00:00
|
|
|
{
|
2003-11-14 03:32:43 +00:00
|
|
|
return MapVirtualKeyExW(code, maptype, GetKeyboardLayout(0));
|
1998-11-08 12:26:36 +00:00
|
|
|
}
|
|
|
|
|
1999-02-13 08:53:22 +00:00
|
|
|
/******************************************************************************
|
2000-12-22 01:38:01 +00:00
|
|
|
* MapVirtualKeyExA (USER32.@)
|
1999-02-13 08:53:22 +00:00
|
|
|
*/
|
2000-03-28 19:31:18 +00:00
|
|
|
UINT WINAPI MapVirtualKeyExA(UINT code, UINT maptype, HKL hkl)
|
1999-02-13 08:53:22 +00:00
|
|
|
{
|
2008-01-23 12:26:57 +00:00
|
|
|
UINT ret;
|
|
|
|
|
|
|
|
ret = MapVirtualKeyExW( code, maptype, hkl );
|
|
|
|
if (maptype == MAPVK_VK_TO_CHAR)
|
|
|
|
{
|
|
|
|
BYTE ch = 0;
|
|
|
|
WCHAR wch = ret;
|
|
|
|
|
|
|
|
WideCharToMultiByte( CP_ACP, 0, &wch, 1, (LPSTR)&ch, 1, NULL, NULL );
|
|
|
|
ret = ch;
|
|
|
|
}
|
|
|
|
return ret;
|
1999-02-13 08:53:22 +00:00
|
|
|
}
|
|
|
|
|
2000-12-05 03:56:56 +00:00
|
|
|
/******************************************************************************
|
2000-12-22 01:38:01 +00:00
|
|
|
* MapVirtualKeyExW (USER32.@)
|
2000-12-05 03:56:56 +00:00
|
|
|
*/
|
|
|
|
UINT WINAPI MapVirtualKeyExW(UINT code, UINT maptype, HKL hkl)
|
|
|
|
{
|
2003-11-14 03:32:43 +00:00
|
|
|
TRACE_(keyboard)("(%d, %d, %p)\n", code, maptype, hkl);
|
|
|
|
|
2005-07-18 15:14:56 +00:00
|
|
|
return USER_Driver->pMapVirtualKeyEx(code, maptype, hkl);
|
2000-12-05 03:56:56 +00:00
|
|
|
}
|
|
|
|
|
1998-11-08 12:26:36 +00:00
|
|
|
/****************************************************************************
|
2000-12-22 01:38:01 +00:00
|
|
|
* GetKBCodePage (USER32.@)
|
1998-11-08 12:26:36 +00:00
|
|
|
*/
|
1999-02-26 11:11:13 +00:00
|
|
|
UINT WINAPI GetKBCodePage(void)
|
1998-11-08 12:26:36 +00:00
|
|
|
{
|
2000-12-29 19:47:53 +00:00
|
|
|
return GetOEMCP();
|
1998-11-08 12:26:36 +00:00
|
|
|
}
|
|
|
|
|
1999-02-28 11:13:16 +00:00
|
|
|
/***********************************************************************
|
2000-12-22 01:38:01 +00:00
|
|
|
* GetKeyboardLayout (USER32.@)
|
1999-02-28 11:13:16 +00:00
|
|
|
*
|
2003-11-14 03:32:43 +00:00
|
|
|
* - device handle for keyboard layout defaulted to
|
1999-02-28 11:13:16 +00:00
|
|
|
* the language id. This is the way Windows default works.
|
|
|
|
* - the thread identifier (dwLayout) is also ignored.
|
|
|
|
*/
|
|
|
|
HKL WINAPI GetKeyboardLayout(DWORD dwLayout)
|
|
|
|
{
|
2005-07-18 15:14:56 +00:00
|
|
|
return USER_Driver->pGetKeyboardLayout(dwLayout);
|
1999-02-28 11:13:16 +00:00
|
|
|
}
|
|
|
|
|
1998-11-08 12:26:36 +00:00
|
|
|
/****************************************************************************
|
2000-12-22 01:38:01 +00:00
|
|
|
* GetKeyboardLayoutNameA (USER32.@)
|
1998-11-08 12:26:36 +00:00
|
|
|
*/
|
2003-11-14 03:32:43 +00:00
|
|
|
BOOL WINAPI GetKeyboardLayoutNameA(LPSTR pszKLID)
|
1998-11-08 12:26:36 +00:00
|
|
|
{
|
2003-11-14 03:32:43 +00:00
|
|
|
WCHAR buf[KL_NAMELENGTH];
|
|
|
|
|
|
|
|
if (GetKeyboardLayoutNameW(buf))
|
|
|
|
return WideCharToMultiByte( CP_ACP, 0, buf, -1, pszKLID, KL_NAMELENGTH, NULL, NULL ) != 0;
|
|
|
|
return FALSE;
|
1998-11-08 12:26:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
2000-12-22 01:38:01 +00:00
|
|
|
* GetKeyboardLayoutNameW (USER32.@)
|
1998-11-08 12:26:36 +00:00
|
|
|
*/
|
2003-11-14 03:32:43 +00:00
|
|
|
BOOL WINAPI GetKeyboardLayoutNameW(LPWSTR pwszKLID)
|
1998-11-08 12:26:36 +00:00
|
|
|
{
|
2005-07-18 15:14:56 +00:00
|
|
|
return USER_Driver->pGetKeyboardLayoutName(pwszKLID);
|
1998-11-08 12:26:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
2000-12-22 01:38:01 +00:00
|
|
|
* GetKeyNameTextA (USER32.@)
|
1998-11-08 12:26:36 +00:00
|
|
|
*/
|
1999-02-26 11:11:13 +00:00
|
|
|
INT WINAPI GetKeyNameTextA(LONG lParam, LPSTR lpBuffer, INT nSize)
|
1998-11-08 12:26:36 +00:00
|
|
|
{
|
2003-11-14 03:32:43 +00:00
|
|
|
WCHAR buf[256];
|
|
|
|
INT ret;
|
|
|
|
|
|
|
|
if (!GetKeyNameTextW(lParam, buf, 256))
|
2006-07-30 01:28:26 +00:00
|
|
|
{
|
|
|
|
lpBuffer[0] = 0;
|
2003-11-14 03:32:43 +00:00
|
|
|
return 0;
|
2006-07-30 01:28:26 +00:00
|
|
|
}
|
2003-11-14 03:32:43 +00:00
|
|
|
ret = WideCharToMultiByte(CP_ACP, 0, buf, -1, lpBuffer, nSize, NULL, NULL);
|
|
|
|
if (!ret && nSize)
|
|
|
|
{
|
|
|
|
ret = nSize - 1;
|
|
|
|
lpBuffer[ret] = 0;
|
|
|
|
}
|
|
|
|
return ret;
|
1998-11-08 12:26:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
2000-12-22 01:38:01 +00:00
|
|
|
* GetKeyNameTextW (USER32.@)
|
1998-11-08 12:26:36 +00:00
|
|
|
*/
|
1999-02-26 11:11:13 +00:00
|
|
|
INT WINAPI GetKeyNameTextW(LONG lParam, LPWSTR lpBuffer, INT nSize)
|
1998-11-08 12:26:36 +00:00
|
|
|
{
|
2005-07-18 15:14:56 +00:00
|
|
|
return USER_Driver->pGetKeyNameText( lParam, lpBuffer, nSize );
|
1998-11-08 12:26:36 +00:00
|
|
|
}
|
|
|
|
|
2000-10-25 21:34:31 +00:00
|
|
|
/****************************************************************************
|
2000-12-22 01:38:01 +00:00
|
|
|
* ToUnicode (USER32.@)
|
2000-10-25 21:34:31 +00:00
|
|
|
*/
|
|
|
|
INT WINAPI ToUnicode(UINT virtKey, UINT scanCode, LPBYTE lpKeyState,
|
|
|
|
LPWSTR lpwStr, int size, UINT flags)
|
|
|
|
{
|
2003-11-14 03:32:43 +00:00
|
|
|
return ToUnicodeEx(virtKey, scanCode, lpKeyState, lpwStr, size, flags, GetKeyboardLayout(0));
|
2000-10-25 21:34:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
2000-12-22 01:38:01 +00:00
|
|
|
* ToUnicodeEx (USER32.@)
|
2000-10-25 21:34:31 +00:00
|
|
|
*/
|
|
|
|
INT WINAPI ToUnicodeEx(UINT virtKey, UINT scanCode, LPBYTE lpKeyState,
|
|
|
|
LPWSTR lpwStr, int size, UINT flags, HKL hkl)
|
|
|
|
{
|
2005-07-18 15:14:56 +00:00
|
|
|
return USER_Driver->pToUnicodeEx(virtKey, scanCode, lpKeyState, lpwStr, size, flags, hkl);
|
2000-10-25 21:34:31 +00:00
|
|
|
}
|
|
|
|
|
1998-11-08 12:26:36 +00:00
|
|
|
/****************************************************************************
|
2000-12-22 01:38:01 +00:00
|
|
|
* ToAscii (USER32.@)
|
1998-11-08 12:26:36 +00:00
|
|
|
*/
|
2003-11-14 03:32:43 +00:00
|
|
|
INT WINAPI ToAscii( UINT virtKey, UINT scanCode, LPBYTE lpKeyState,
|
|
|
|
LPWORD lpChar, UINT flags )
|
1998-11-08 12:26:36 +00:00
|
|
|
{
|
2003-11-14 03:32:43 +00:00
|
|
|
return ToAsciiEx(virtKey, scanCode, lpKeyState, lpChar, flags, GetKeyboardLayout(0));
|
1998-11-08 12:26:36 +00:00
|
|
|
}
|
|
|
|
|
1999-03-28 13:15:40 +00:00
|
|
|
/****************************************************************************
|
2000-12-22 01:38:01 +00:00
|
|
|
* ToAsciiEx (USER32.@)
|
1999-03-28 13:15:40 +00:00
|
|
|
*/
|
|
|
|
INT WINAPI ToAsciiEx( UINT virtKey, UINT scanCode, LPBYTE lpKeyState,
|
|
|
|
LPWORD lpChar, UINT flags, HKL dwhkl )
|
|
|
|
{
|
2003-11-14 03:32:43 +00:00
|
|
|
WCHAR uni_chars[2];
|
|
|
|
INT ret, n_ret;
|
|
|
|
|
|
|
|
ret = ToUnicodeEx(virtKey, scanCode, lpKeyState, uni_chars, 2, flags, dwhkl);
|
|
|
|
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;
|
1999-03-28 13:15:40 +00:00
|
|
|
}
|
|
|
|
|
1998-12-10 15:49:22 +00:00
|
|
|
/**********************************************************************
|
2000-12-22 01:38:01 +00:00
|
|
|
* ActivateKeyboardLayout (USER32.@)
|
1998-12-10 15:49:22 +00:00
|
|
|
*/
|
1999-02-26 11:11:13 +00:00
|
|
|
HKL WINAPI ActivateKeyboardLayout(HKL hLayout, UINT flags)
|
1998-12-10 15:49:22 +00:00
|
|
|
{
|
2002-11-22 21:22:14 +00:00
|
|
|
TRACE_(keyboard)("(%p, %d)\n", hLayout, flags);
|
2003-11-14 03:32:43 +00:00
|
|
|
|
2005-07-18 15:14:56 +00:00
|
|
|
return USER_Driver->pActivateKeyboardLayout(hLayout, flags);
|
1998-12-10 15:49:22 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 16:59:11 +00:00
|
|
|
/**********************************************************************
|
|
|
|
* BlockInput (USER32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI BlockInput(BOOL fBlockIt)
|
|
|
|
{
|
|
|
|
FIXME_(keyboard)("(%d): stub\n", fBlockIt);
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
1998-12-10 15:49:22 +00:00
|
|
|
|
1998-11-08 12:26:36 +00:00
|
|
|
/***********************************************************************
|
2000-12-22 01:38:01 +00:00
|
|
|
* GetKeyboardLayoutList (USER32.@)
|
1999-02-28 11:13:16 +00:00
|
|
|
*
|
2002-05-31 23:06:46 +00:00
|
|
|
* Return number of values available if either input parm is
|
1999-02-28 11:13:16 +00:00
|
|
|
* 0, per MS documentation.
|
1998-11-08 12:26:36 +00:00
|
|
|
*/
|
2003-11-14 03:32:43 +00:00
|
|
|
UINT WINAPI GetKeyboardLayoutList(INT nBuff, HKL *layouts)
|
1998-11-08 12:26:36 +00:00
|
|
|
{
|
2003-11-14 03:32:43 +00:00
|
|
|
TRACE_(keyboard)("(%d,%p)\n",nBuff,layouts);
|
|
|
|
|
2005-07-18 15:14:56 +00:00
|
|
|
return USER_Driver->pGetKeyboardLayoutList(nBuff, layouts);
|
1998-11-08 12:26:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
2000-12-22 01:38:01 +00:00
|
|
|
* RegisterHotKey (USER32.@)
|
1998-11-08 12:26:36 +00:00
|
|
|
*/
|
2005-04-25 11:33:34 +00:00
|
|
|
BOOL WINAPI RegisterHotKey(HWND hwnd,INT id,UINT modifiers,UINT vk)
|
|
|
|
{
|
2007-12-13 13:33:35 +00:00
|
|
|
static int once;
|
|
|
|
if (!once++) FIXME_(keyboard)("(%p,%d,0x%08x,%d): stub\n",hwnd,id,modifiers,vk);
|
2005-04-25 11:33:34 +00:00
|
|
|
return TRUE;
|
1998-11-08 12:26:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2000-12-22 01:38:01 +00:00
|
|
|
* UnregisterHotKey (USER32.@)
|
1998-11-08 12:26:36 +00:00
|
|
|
*/
|
2005-04-25 11:33:34 +00:00
|
|
|
BOOL WINAPI UnregisterHotKey(HWND hwnd,INT id)
|
|
|
|
{
|
2007-12-13 13:33:35 +00:00
|
|
|
static int once;
|
|
|
|
if (!once++) FIXME_(keyboard)("(%p,%d): stub\n",hwnd,id);
|
2005-04-25 11:33:34 +00:00
|
|
|
return TRUE;
|
1998-11-08 12:26:36 +00:00
|
|
|
}
|
|
|
|
|
1998-12-10 15:49:22 +00:00
|
|
|
/***********************************************************************
|
2002-11-18 19:47:20 +00:00
|
|
|
* LoadKeyboardLayoutW (USER32.@)
|
1998-12-10 15:49:22 +00:00
|
|
|
*/
|
2002-11-18 19:47:20 +00:00
|
|
|
HKL WINAPI LoadKeyboardLayoutW(LPCWSTR pwszKLID, UINT Flags)
|
1998-12-10 15:49:22 +00:00
|
|
|
{
|
2002-11-18 19:47:20 +00:00
|
|
|
TRACE_(keyboard)("(%s, %d)\n", debugstr_w(pwszKLID), Flags);
|
2003-11-14 03:32:43 +00:00
|
|
|
|
2005-07-18 15:14:56 +00:00
|
|
|
return USER_Driver->pLoadKeyboardLayout(pwszKLID, Flags);
|
1998-12-10 15:49:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2002-11-18 19:47:20 +00:00
|
|
|
* LoadKeyboardLayoutA (USER32.@)
|
1998-12-10 15:49:22 +00:00
|
|
|
*/
|
2002-11-18 19:47:20 +00:00
|
|
|
HKL WINAPI LoadKeyboardLayoutA(LPCSTR pwszKLID, UINT Flags)
|
1998-12-10 15:49:22 +00:00
|
|
|
{
|
2002-11-18 19:47:20 +00:00
|
|
|
HKL ret;
|
|
|
|
UNICODE_STRING pwszKLIDW;
|
2002-05-31 23:06:46 +00:00
|
|
|
|
2002-11-18 19:47:20 +00:00
|
|
|
if (pwszKLID) RtlCreateUnicodeStringFromAsciiz(&pwszKLIDW, pwszKLID);
|
|
|
|
else pwszKLIDW.Buffer = NULL;
|
|
|
|
|
|
|
|
ret = LoadKeyboardLayoutW(pwszKLIDW.Buffer, Flags);
|
|
|
|
RtlFreeUnicodeString(&pwszKLIDW);
|
|
|
|
return ret;
|
1998-12-10 15:49:22 +00:00
|
|
|
}
|
2002-01-15 20:41:41 +00:00
|
|
|
|
|
|
|
|
2003-11-14 03:32:43 +00:00
|
|
|
/***********************************************************************
|
|
|
|
* UnloadKeyboardLayout (USER32.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI UnloadKeyboardLayout(HKL hkl)
|
|
|
|
{
|
|
|
|
TRACE_(keyboard)("(%p)\n", hkl);
|
|
|
|
|
2005-07-18 15:14:56 +00:00
|
|
|
return USER_Driver->pUnloadKeyboardLayout(hkl);
|
2003-11-14 03:32:43 +00:00
|
|
|
}
|
|
|
|
|
2002-01-15 20:41:41 +00:00
|
|
|
typedef struct __TRACKINGLIST {
|
|
|
|
TRACKMOUSEEVENT tme;
|
|
|
|
POINT pos; /* center of hover rectangle */
|
2002-05-31 23:06:46 +00:00
|
|
|
} _TRACKINGLIST;
|
2002-01-15 20:41:41 +00:00
|
|
|
|
2006-07-20 13:27:29 +00:00
|
|
|
/* FIXME: move tracking stuff into a per thread data */
|
|
|
|
static _TRACKINGLIST tracking_info;
|
2002-01-15 20:41:41 +00:00
|
|
|
static UINT_PTR timer;
|
|
|
|
|
2006-10-16 15:37:40 +00:00
|
|
|
static void check_mouse_leave(HWND hwnd, int hittest)
|
|
|
|
{
|
|
|
|
if (tracking_info.tme.hwndTrack != hwnd)
|
|
|
|
{
|
|
|
|
if (tracking_info.tme.dwFlags & TME_NONCLIENT)
|
|
|
|
PostMessageW(tracking_info.tme.hwndTrack, WM_NCMOUSELEAVE, 0, 0);
|
|
|
|
else
|
|
|
|
PostMessageW(tracking_info.tme.hwndTrack, WM_MOUSELEAVE, 0, 0);
|
|
|
|
|
|
|
|
/* remove the TME_LEAVE flag */
|
|
|
|
tracking_info.tme.dwFlags &= ~TME_LEAVE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (hittest == HTCLIENT)
|
|
|
|
{
|
|
|
|
if (tracking_info.tme.dwFlags & TME_NONCLIENT)
|
|
|
|
{
|
|
|
|
PostMessageW(tracking_info.tme.hwndTrack, WM_NCMOUSELEAVE, 0, 0);
|
|
|
|
/* remove the TME_LEAVE flag */
|
|
|
|
tracking_info.tme.dwFlags &= ~TME_LEAVE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!(tracking_info.tme.dwFlags & TME_NONCLIENT))
|
|
|
|
{
|
|
|
|
PostMessageW(tracking_info.tme.hwndTrack, WM_MOUSELEAVE, 0, 0);
|
|
|
|
/* remove the TME_LEAVE flag */
|
|
|
|
tracking_info.tme.dwFlags &= ~TME_LEAVE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-07-24 12:19:25 +00:00
|
|
|
static void CALLBACK TrackMouseEventProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent,
|
|
|
|
DWORD dwTime)
|
2002-01-15 20:41:41 +00:00
|
|
|
{
|
|
|
|
POINT pos;
|
2006-07-24 12:19:25 +00:00
|
|
|
INT hoverwidth = 0, hoverheight = 0, hittest;
|
|
|
|
|
2007-05-24 14:41:17 +00:00
|
|
|
TRACE("hwnd %p, msg %04x, id %04lx, time %u\n", hwnd, uMsg, idEvent, dwTime);
|
2002-01-15 20:41:41 +00:00
|
|
|
|
|
|
|
GetCursorPos(&pos);
|
2006-07-24 12:19:25 +00:00
|
|
|
hwnd = WINPOS_WindowFromPoint(hwnd, pos, &hittest);
|
|
|
|
|
|
|
|
TRACE("point %s hwnd %p hittest %d\n", wine_dbgstr_point(&pos), hwnd, hittest);
|
2002-01-15 20:41:41 +00:00
|
|
|
|
2006-07-20 13:27:29 +00:00
|
|
|
SystemParametersInfoW(SPI_GETMOUSEHOVERWIDTH, 0, &hoverwidth, 0);
|
|
|
|
SystemParametersInfoW(SPI_GETMOUSEHOVERHEIGHT, 0, &hoverheight, 0);
|
2002-01-15 20:41:41 +00:00
|
|
|
|
2006-07-24 12:19:25 +00:00
|
|
|
TRACE("tracked pos %s, current pos %s, hover width %d, hover height %d\n",
|
|
|
|
wine_dbgstr_point(&tracking_info.pos), wine_dbgstr_point(&pos),
|
|
|
|
hoverwidth, hoverheight);
|
|
|
|
|
2006-07-20 13:27:29 +00:00
|
|
|
/* see if this tracking event is looking for TME_LEAVE and that the */
|
|
|
|
/* mouse has left the window */
|
|
|
|
if (tracking_info.tme.dwFlags & TME_LEAVE)
|
|
|
|
{
|
2006-10-16 15:37:40 +00:00
|
|
|
check_mouse_leave(hwnd, hittest);
|
2006-07-20 13:27:29 +00:00
|
|
|
}
|
2002-01-15 20:41:41 +00:00
|
|
|
|
2006-07-24 12:19:25 +00:00
|
|
|
if (tracking_info.tme.hwndTrack != hwnd)
|
|
|
|
{
|
|
|
|
/* mouse is gone, stop tracking mouse hover */
|
|
|
|
tracking_info.tme.dwFlags &= ~TME_HOVER;
|
|
|
|
}
|
|
|
|
|
2006-07-20 13:27:29 +00:00
|
|
|
/* see if we are tracking hovering for this hwnd */
|
|
|
|
if (tracking_info.tme.dwFlags & TME_HOVER)
|
|
|
|
{
|
|
|
|
/* has the cursor moved outside the rectangle centered around pos? */
|
2006-07-24 12:19:25 +00:00
|
|
|
if ((abs(pos.x - tracking_info.pos.x) > (hoverwidth / 2)) ||
|
|
|
|
(abs(pos.y - tracking_info.pos.y) > (hoverheight / 2)))
|
2006-07-20 13:27:29 +00:00
|
|
|
{
|
2006-07-24 12:19:25 +00:00
|
|
|
/* record this new position as the current position */
|
2006-07-20 13:27:29 +00:00
|
|
|
tracking_info.pos = pos;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-07-24 12:19:25 +00:00
|
|
|
if (hittest == HTCLIENT)
|
|
|
|
{
|
|
|
|
ScreenToClient(hwnd, &pos);
|
|
|
|
TRACE("client cursor pos %s\n", wine_dbgstr_point(&pos));
|
2006-07-20 13:27:29 +00:00
|
|
|
|
|
|
|
PostMessageW(tracking_info.tme.hwndTrack, WM_MOUSEHOVER,
|
2006-07-24 12:19:25 +00:00
|
|
|
get_key_state(), MAKELPARAM( pos.x, pos.y ));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (tracking_info.tme.dwFlags & TME_NONCLIENT)
|
|
|
|
PostMessageW(tracking_info.tme.hwndTrack, WM_NCMOUSEHOVER,
|
|
|
|
hittest, MAKELPARAM( pos.x, pos.y ));
|
|
|
|
}
|
2006-07-20 13:27:29 +00:00
|
|
|
|
|
|
|
/* stop tracking mouse hover */
|
|
|
|
tracking_info.tme.dwFlags &= ~TME_HOVER;
|
2002-01-15 20:41:41 +00:00
|
|
|
}
|
|
|
|
}
|
2002-05-31 23:06:46 +00:00
|
|
|
|
2002-01-15 20:41:41 +00:00
|
|
|
/* stop the timer if the tracking list is empty */
|
2006-07-20 13:27:29 +00:00
|
|
|
if (!(tracking_info.tme.dwFlags & (TME_HOVER | TME_LEAVE)))
|
|
|
|
{
|
2006-07-24 12:19:25 +00:00
|
|
|
KillSystemTimer(tracking_info.tme.hwndTrack, timer);
|
2002-01-15 20:41:41 +00:00
|
|
|
timer = 0;
|
2006-07-24 12:19:25 +00:00
|
|
|
tracking_info.tme.hwndTrack = 0;
|
|
|
|
tracking_info.tme.dwFlags = 0;
|
|
|
|
tracking_info.tme.dwHoverTime = 0;
|
2002-01-15 20:41:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* TrackMouseEvent [USER32]
|
|
|
|
*
|
|
|
|
* Requests notification of mouse events
|
|
|
|
*
|
|
|
|
* During mouse tracking WM_MOUSEHOVER or WM_MOUSELEAVE events are posted
|
|
|
|
* to the hwnd specified in the ptme structure. After the event message
|
|
|
|
* is posted to the hwnd, the entry in the queue is removed.
|
|
|
|
*
|
|
|
|
* If the current hwnd isn't ptme->hwndTrack the TME_HOVER flag is completely
|
|
|
|
* ignored. The TME_LEAVE flag results in a WM_MOUSELEAVE message being posted
|
|
|
|
* immediately and the TME_LEAVE flag being ignored.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* ptme [I,O] pointer to TRACKMOUSEEVENT information structure.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: non-zero
|
|
|
|
* Failure: zero
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
BOOL WINAPI
|
|
|
|
TrackMouseEvent (TRACKMOUSEEVENT *ptme)
|
|
|
|
{
|
|
|
|
HWND hwnd;
|
|
|
|
POINT pos;
|
2006-07-20 13:27:29 +00:00
|
|
|
DWORD hover_time;
|
2006-07-24 12:19:25 +00:00
|
|
|
INT hittest;
|
2002-01-15 20:41:41 +00:00
|
|
|
|
2006-09-29 22:25:15 +00:00
|
|
|
TRACE("%x, %x, %p, %u\n", ptme->cbSize, ptme->dwFlags, ptme->hwndTrack, ptme->dwHoverTime);
|
2002-01-15 20:41:41 +00:00
|
|
|
|
|
|
|
if (ptme->cbSize != sizeof(TRACKMOUSEEVENT)) {
|
|
|
|
WARN("wrong TRACKMOUSEEVENT size from app\n");
|
2006-07-20 13:27:29 +00:00
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
2002-01-15 20:41:41 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2006-07-20 13:27:29 +00:00
|
|
|
/* fill the TRACKMOUSEEVENT struct with the current tracking for the given hwnd */
|
|
|
|
if (ptme->dwFlags & TME_QUERY )
|
|
|
|
{
|
|
|
|
*ptme = tracking_info.tme;
|
2006-07-24 15:45:30 +00:00
|
|
|
/* set cbSize in the case it's not initialized yet */
|
|
|
|
ptme->cbSize = sizeof(TRACKMOUSEEVENT);
|
2002-05-31 23:06:46 +00:00
|
|
|
|
2006-07-20 13:27:29 +00:00
|
|
|
return TRUE; /* return here, TME_QUERY is retrieving information */
|
2002-01-15 20:41:41 +00:00
|
|
|
}
|
|
|
|
|
2006-07-20 13:27:29 +00:00
|
|
|
if (!IsWindow(ptme->hwndTrack))
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
|
|
|
return FALSE;
|
2003-11-26 05:06:59 +00:00
|
|
|
}
|
|
|
|
|
2006-07-20 13:27:29 +00:00
|
|
|
hover_time = ptme->dwHoverTime;
|
2002-01-15 20:41:41 +00:00
|
|
|
|
2006-10-14 18:16:30 +00:00
|
|
|
/* if HOVER_DEFAULT was specified replace this with the systems current value.
|
|
|
|
* TME_LEAVE doesn't need to specify hover time so use default */
|
|
|
|
if (hover_time == HOVER_DEFAULT || hover_time == 0 || !(ptme->dwHoverTime&TME_HOVER))
|
2006-07-20 13:27:29 +00:00
|
|
|
SystemParametersInfoW(SPI_GETMOUSEHOVERTIME, 0, &hover_time, 0);
|
2002-01-15 20:41:41 +00:00
|
|
|
|
2006-07-20 13:27:29 +00:00
|
|
|
GetCursorPos(&pos);
|
2006-07-24 12:19:25 +00:00
|
|
|
hwnd = WINPOS_WindowFromPoint(ptme->hwndTrack, pos, &hittest);
|
|
|
|
TRACE("point %s hwnd %p hittest %d\n", wine_dbgstr_point(&pos), hwnd, hittest);
|
2002-01-15 20:41:41 +00:00
|
|
|
|
2006-07-20 13:27:29 +00:00
|
|
|
if (ptme->dwFlags & ~(TME_CANCEL | TME_HOVER | TME_LEAVE | TME_NONCLIENT))
|
2006-09-29 22:25:15 +00:00
|
|
|
FIXME("Unknown flag(s) %08x\n", ptme->dwFlags & ~(TME_CANCEL | TME_HOVER | TME_LEAVE | TME_NONCLIENT));
|
2002-01-15 20:41:41 +00:00
|
|
|
|
2006-07-20 13:27:29 +00:00
|
|
|
if (ptme->dwFlags & TME_CANCEL)
|
|
|
|
{
|
|
|
|
if (tracking_info.tme.hwndTrack == ptme->hwndTrack)
|
|
|
|
{
|
|
|
|
tracking_info.tme.dwFlags &= ~(ptme->dwFlags & ~TME_CANCEL);
|
2002-01-15 20:41:41 +00:00
|
|
|
|
|
|
|
/* if we aren't tracking on hover or leave remove this entry */
|
2006-07-20 13:27:29 +00:00
|
|
|
if (!(tracking_info.tme.dwFlags & (TME_HOVER | TME_LEAVE)))
|
2002-01-15 20:41:41 +00:00
|
|
|
{
|
2006-07-24 12:19:25 +00:00
|
|
|
KillSystemTimer(tracking_info.tme.hwndTrack, timer);
|
2006-07-20 13:27:29 +00:00
|
|
|
timer = 0;
|
2006-07-24 12:19:25 +00:00
|
|
|
tracking_info.tme.hwndTrack = 0;
|
|
|
|
tracking_info.tme.dwFlags = 0;
|
|
|
|
tracking_info.tme.dwHoverTime = 0;
|
2002-01-15 20:41:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2006-10-16 15:37:40 +00:00
|
|
|
/* In our implementation it's possible that another window will receive a
|
|
|
|
* WM_MOUSEMOVE and call TrackMouseEvent before TrackMouseEventProc is
|
|
|
|
* called. In such a situation post the WM_MOUSELEAVE now */
|
|
|
|
if (tracking_info.tme.dwFlags & TME_LEAVE && tracking_info.tme.hwndTrack != NULL)
|
|
|
|
check_mouse_leave(hwnd, hittest);
|
|
|
|
|
2006-07-24 12:19:25 +00:00
|
|
|
if (timer)
|
|
|
|
{
|
|
|
|
KillSystemTimer(tracking_info.tme.hwndTrack, timer);
|
|
|
|
timer = 0;
|
|
|
|
tracking_info.tme.hwndTrack = 0;
|
|
|
|
tracking_info.tme.dwFlags = 0;
|
|
|
|
tracking_info.tme.dwHoverTime = 0;
|
|
|
|
}
|
|
|
|
|
2006-07-20 13:27:29 +00:00
|
|
|
if (ptme->hwndTrack == hwnd)
|
|
|
|
{
|
2002-01-15 20:41:41 +00:00
|
|
|
/* Adding new mouse event to the tracking list */
|
2006-07-20 13:27:29 +00:00
|
|
|
tracking_info.tme = *ptme;
|
|
|
|
tracking_info.tme.dwHoverTime = hover_time;
|
2002-01-15 20:41:41 +00:00
|
|
|
|
|
|
|
/* Initialize HoverInfo variables even if not hover tracking */
|
2006-07-20 13:27:29 +00:00
|
|
|
tracking_info.pos = pos;
|
2002-01-15 20:41:41 +00:00
|
|
|
|
2006-10-14 18:04:53 +00:00
|
|
|
timer = SetSystemTimer(tracking_info.tme.hwndTrack, (UINT_PTR)&tracking_info.tme, hover_time, TrackMouseEventProc);
|
2002-01-15 20:41:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
2008-02-23 08:44:02 +00:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GetMouseMovePointsEx [USER32]
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: count of point set in the buffer
|
|
|
|
* Failure: -1
|
|
|
|
*/
|
|
|
|
int WINAPI GetMouseMovePointsEx(UINT size, LPMOUSEMOVEPOINT ptin, LPMOUSEMOVEPOINT ptout, int count, DWORD res) {
|
|
|
|
|
|
|
|
if((size != sizeof(MOUSEMOVEPOINT)) || (count < 0) || (count > 64)) {
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!ptin || !ptout) {
|
|
|
|
SetLastError(ERROR_NOACCESS);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
FIXME("(%d %p %p %d %d) stub\n", size, ptin, ptout, count, res);
|
|
|
|
|
|
|
|
SetLastError(ERROR_POINT_NOT_FOUND);
|
|
|
|
return -1;
|
|
|
|
}
|