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