Commit d99f61dd authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move NtUserGetKeyState implementation from user32.

parent 94e06293
......@@ -507,11 +507,11 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
}
else if( wParam == VK_F10 )
{
if (GetKeyState(VK_SHIFT) & 0x8000)
if (NtUserGetKeyState(VK_SHIFT) & 0x8000)
SendMessageW( hwnd, WM_CONTEXTMENU, (WPARAM)hwnd, -1 );
iF10Key = 1;
}
else if( wParam == VK_ESCAPE && (GetKeyState(VK_SHIFT) & 0x8000))
else if (wParam == VK_ESCAPE && (NtUserGetKeyState(VK_SHIFT) & 0x8000))
SendMessageW( hwnd, WM_SYSCOMMAND, SC_KEYMENU, ' ' );
break;
......
......@@ -1198,7 +1198,7 @@ BOOL WINAPI IsDialogMessageW( HWND hwndDlg, LPMSG msg )
* do so but I presume someone has)
*/
if (fIsDialog)
SendMessageW( hwndDlg, WM_NEXTDLGCTL, (GetKeyState(VK_SHIFT) & 0x8000), 0 );
SendMessageW( hwndDlg, WM_NEXTDLGCTL, (NtUserGetKeyState(VK_SHIFT) & 0x8000), 0 );
else
{
/* It would appear that GetNextDlgTabItem can handle being
......@@ -1208,7 +1208,7 @@ BOOL WINAPI IsDialogMessageW( HWND hwndDlg, LPMSG msg )
HWND hwndFocus = GetFocus();
HWND hwndNext = GetNextDlgTabItem (hwndDlg,
hwndFocus == hwndDlg ? NULL : hwndFocus,
GetKeyState (VK_SHIFT) & 0x8000);
NtUserGetKeyState (VK_SHIFT) & 0x8000);
if (hwndNext)
{
dlgCode = SendMessageW (hwndNext, WM_GETDLGCODE,
......
......@@ -3176,7 +3176,7 @@ static LRESULT EDIT_WM_Char(EDITSTATE *es, WCHAR c)
{
BOOL control;
control = GetKeyState(VK_CONTROL) & 0x8000;
control = NtUserGetKeyState(VK_CONTROL) & 0x8000;
switch (c) {
case '\r':
......@@ -3436,11 +3436,11 @@ static LRESULT EDIT_WM_KeyDown(EDITSTATE *es, INT key)
BOOL shift;
BOOL control;
if (GetKeyState(VK_MENU) & 0x8000)
if (NtUserGetKeyState(VK_MENU) & 0x8000)
return 0;
shift = GetKeyState(VK_SHIFT) & 0x8000;
control = GetKeyState(VK_CONTROL) & 0x8000;
shift = NtUserGetKeyState(VK_SHIFT) & 0x8000;
control = NtUserGetKeyState(VK_CONTROL) & 0x8000;
switch (key) {
case VK_F4:
......
......@@ -594,28 +594,6 @@ BOOL WINAPI GetLastInputInfo(PLASTINPUTINFO plii)
/**********************************************************************
* 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 DECLSPEC_HOTPATCH GetKeyState(INT vkey)
{
SHORT retval = 0;
SERVER_START_REQ( get_key_state )
{
req->key = vkey;
if (!wine_server_call( req )) retval = (signed char)(reply->state & 0x81);
}
SERVER_END_REQ;
TRACE("key (0x%x) -> %x\n", vkey, retval);
return retval;
}
/**********************************************************************
* GetKeyboardState (USER32.@)
*/
BOOL WINAPI DECLSPEC_HOTPATCH GetKeyboardState( LPBYTE state )
......
......@@ -2508,7 +2508,7 @@ static LRESULT LISTBOX_HandleKeyDown( LB_DESCR *descr, DWORD key )
if (caret >= 0)
{
if (((descr->style & LBS_EXTENDEDSEL) &&
!(GetKeyState( VK_SHIFT ) & 0x8000)) ||
!(NtUserGetKeyState( VK_SHIFT ) & 0x8000)) ||
!IS_MULTISELECT(descr))
descr->anchor_item = caret;
LISTBOX_MoveCaret( descr, caret, TRUE );
......
......@@ -1649,13 +1649,13 @@ BOOL WINAPI TranslateMDISysAccel( HWND hwndClient, LPMSG msg )
/* translate if the Ctrl key is down and Alt not. */
if( (GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_MENU) & 0x8000))
if( (NtUserGetKeyState(VK_CONTROL) & 0x8000) && !(NtUserGetKeyState(VK_MENU) & 0x8000))
{
switch( msg->wParam )
{
case VK_F6:
case VK_TAB:
wParam = ( GetKeyState(VK_SHIFT) & 0x8000 ) ? SC_NEXTWINDOW : SC_PREVWINDOW;
wParam = ( NtUserGetKeyState(VK_SHIFT) & 0x8000 ) ? SC_NEXTWINDOW : SC_PREVWINDOW;
break;
case VK_F4:
case VK_RBUTTON:
......
......@@ -5505,9 +5505,9 @@ static BOOL translate_accelerator( HWND hWnd, UINT message, WPARAM wParam, LPARA
if (wParam != key) return FALSE;
if (GetKeyState(VK_CONTROL) & 0x8000) mask |= FCONTROL;
if (GetKeyState(VK_MENU) & 0x8000) mask |= FALT;
if (GetKeyState(VK_SHIFT) & 0x8000) mask |= FSHIFT;
if (NtUserGetKeyState(VK_CONTROL) & 0x8000) mask |= FCONTROL;
if (NtUserGetKeyState(VK_MENU) & 0x8000) mask |= FALT;
if (NtUserGetKeyState(VK_SHIFT) & 0x8000) mask |= FSHIFT;
if (message == WM_CHAR || message == WM_SYSCHAR)
{
......
......@@ -316,7 +316,7 @@
@ stdcall GetKBCodePage()
@ stdcall GetKeyNameTextA(long ptr long)
@ stdcall GetKeyNameTextW(long ptr long)
@ stdcall GetKeyState(long)
@ stdcall -import GetKeyState(long) NtUserGetKeyState
@ stdcall GetKeyboardLayout(long)
@ stdcall GetKeyboardLayoutList(long ptr)
@ stdcall GetKeyboardLayoutNameA(ptr)
......
......@@ -3893,7 +3893,7 @@ BOOL WINAPI DragDetect( HWND hWnd, POINT pt )
TRACE( "%p,%s\n", hWnd, wine_dbgstr_point( &pt ) );
if (!(GetKeyState( VK_LBUTTON ) & 0x8000))
if (!(NtUserGetKeyState( VK_LBUTTON ) & 0x8000))
return FALSE;
wDragWidth = GetSystemMetrics(SM_CXDRAG);
......
......@@ -28,6 +28,9 @@
#include "win32u_private.h"
#include "wine/server.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(win);
/**********************************************************************
......@@ -47,3 +50,24 @@ BOOL WINAPI NtUserAttachThreadInput( DWORD from, DWORD to, BOOL attach )
SERVER_END_REQ;
return ret;
}
/**********************************************************************
* NtUserGetKeyState (win32u.@)
*
* 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 NtUserGetKeyState( INT vkey )
{
SHORT retval = 0;
SERVER_START_REQ( get_key_state )
{
req->key = vkey;
if (!wine_server_call( req )) retval = (signed char)(reply->state & 0x81);
}
SERVER_END_REQ;
TRACE("key (0x%x) -> %x\n", vkey, retval);
return retval;
}
......@@ -111,6 +111,7 @@ static void * const syscalls[] =
NtUserGetClipboardOwner,
NtUserGetClipboardSequenceNumber,
NtUserGetClipboardViewer,
NtUserGetKeyState,
NtUserGetLayeredWindowAttributes,
NtUserGetObjectInformation,
NtUserGetProcessWindowStation,
......
......@@ -945,7 +945,7 @@
@ stub NtUserGetInteractiveCtrlSupportedWaveforms
@ stub NtUserGetInternalWindowPos
@ stub NtUserGetKeyNameText
@ stub NtUserGetKeyState
@ stdcall -syscall NtUserGetKeyState(long)
@ stub NtUserGetKeyboardLayout
@ stub NtUserGetKeyboardLayoutList
@ stub NtUserGetKeyboardLayoutName
......
......@@ -98,6 +98,7 @@
SYSCALL_ENTRY( NtUserGetClipboardOwner ) \
SYSCALL_ENTRY( NtUserGetClipboardSequenceNumber ) \
SYSCALL_ENTRY( NtUserGetClipboardViewer ) \
SYSCALL_ENTRY( NtUserGetKeyState ) \
SYSCALL_ENTRY( NtUserGetLayeredWindowAttributes ) \
SYSCALL_ENTRY( NtUserGetObjectInformation ) \
SYSCALL_ENTRY( NtUserGetProcessWindowStation ) \
......
......@@ -237,3 +237,10 @@ NTSTATUS WINAPI wow64_NtUserAttachThreadInput( UINT *args )
return NtUserAttachThreadInput( from, to, attach );
}
NTSTATUS WINAPI wow64_NtUserGetKeyState( UINT *args )
{
INT vkey = get_ulong( &args );
return NtUserGetKeyState( vkey );
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment