win32u: Move NtUserActivateKeyboardLayout implementation from user32.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-11-17 12:47:04 +01:00 committed by Alexandre Julliard
parent 8932c8678c
commit a32f044154
10 changed files with 48 additions and 40 deletions

View File

@ -734,7 +734,7 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
} }
case WM_INPUTLANGCHANGEREQUEST: case WM_INPUTLANGCHANGEREQUEST:
ActivateKeyboardLayout( (HKL)lParam, 0 ); NtUserActivateKeyboardLayout( (HKL)lParam, 0 );
break; break;
case WM_INPUTLANGCHANGE: case WM_INPUTLANGCHANGE:

View File

@ -233,11 +233,6 @@ static void CDECL nulldrv_ThreadDetach( void )
* Each entry point simply loads the real driver and chains to it. * Each entry point simply loads the real driver and chains to it.
*/ */
static BOOL CDECL loaderdrv_ActivateKeyboardLayout( HKL layout, UINT flags )
{
return load_driver()->pActivateKeyboardLayout( layout, flags );
}
static void CDECL loaderdrv_Beep(void) static void CDECL loaderdrv_Beep(void)
{ {
load_driver()->pBeep(); load_driver()->pBeep();
@ -345,7 +340,7 @@ static struct user_driver_funcs lazy_load_driver =
{ {
{ NULL }, { NULL },
/* keyboard functions */ /* keyboard functions */
loaderdrv_ActivateKeyboardLayout, NULL,
loaderdrv_Beep, loaderdrv_Beep,
NULL, NULL,
loaderdrv_GetKeyboardLayoutList, loaderdrv_GetKeyboardLayoutList,

View File

@ -872,36 +872,6 @@ INT WINAPI ToAsciiEx( UINT virtKey, UINT scanCode, const BYTE *lpKeyState,
return ret; return ret;
} }
/**********************************************************************
* ActivateKeyboardLayout (USER32.@)
*/
HKL WINAPI ActivateKeyboardLayout( HKL layout, UINT flags )
{
struct user_thread_info *info = get_user_thread_info();
HKL old_layout;
TRACE_(keyboard)( "layout %p, flags %x\n", layout, flags );
if (flags) FIXME_(keyboard)( "flags %x not supported\n", flags );
if (layout == (HKL)HKL_NEXT || layout == (HKL)HKL_PREV)
{
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
FIXME_(keyboard)( "HKL_NEXT and HKL_PREV not supported\n" );
return 0;
}
if (!USER_Driver->pActivateKeyboardLayout( layout, flags ))
return 0;
old_layout = info->kbd_layout;
info->kbd_layout = layout;
if (old_layout != layout) info->kbd_layout_id = 0;
if (!old_layout) return get_locale_kbd_layout();
return old_layout;
}
/********************************************************************** /**********************************************************************
* BlockInput (USER32.@) * BlockInput (USER32.@)
*/ */
@ -1056,7 +1026,7 @@ HKL WINAPI LoadKeyboardLayoutW( const WCHAR *name, UINT flags )
RegCloseKey( hkey ); RegCloseKey( hkey );
} }
if ((flags & KLF_ACTIVATE) && ActivateKeyboardLayout( layout, 0 )) return layout; if ((flags & KLF_ACTIVATE) && NtUserActivateKeyboardLayout( layout, 0 )) return layout;
/* FIXME: semi-stub: returning default layout */ /* FIXME: semi-stub: returning default layout */
return get_locale_kbd_layout(); return get_locale_kbd_layout();

View File

@ -1,4 +1,4 @@
@ stdcall ActivateKeyboardLayout(long long) @ stdcall ActivateKeyboardLayout(long long) NtUserActivateKeyboardLayout
@ stdcall AddClipboardFormatListener(long) NtUserAddClipboardFormatListener @ stdcall AddClipboardFormatListener(long) NtUserAddClipboardFormatListener
@ stdcall AdjustWindowRect(ptr long long) @ stdcall AdjustWindowRect(ptr long long)
@ stdcall AdjustWindowRectEx(ptr long long long) @ stdcall AdjustWindowRectEx(ptr long long long)

View File

@ -1003,6 +1003,11 @@ static const struct user_driver_funcs *load_driver(void)
return user_driver; return user_driver;
} }
static BOOL CDECL loaderdrv_ActivateKeyboardLayout( HKL layout, UINT flags )
{
return load_driver()->pActivateKeyboardLayout( layout, flags );
}
static INT CDECL loaderdrv_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size ) static INT CDECL loaderdrv_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size )
{ {
return load_driver()->pGetKeyNameText( lparam, buffer, size ); return load_driver()->pGetKeyNameText( lparam, buffer, size );
@ -1031,6 +1036,7 @@ static void CDECL loaderdrv_UpdateClipboard(void)
static const struct user_driver_funcs lazy_load_driver = static const struct user_driver_funcs lazy_load_driver =
{ {
.pActivateKeyboardLayout = loaderdrv_ActivateKeyboardLayout,
.pGetKeyNameText = loaderdrv_GetKeyNameText, .pGetKeyNameText = loaderdrv_GetKeyNameText,
.pMapVirtualKeyEx = loaderdrv_MapVirtualKeyEx, .pMapVirtualKeyEx = loaderdrv_MapVirtualKeyEx,
.pToUnicodeEx = loaderdrv_ToUnicodeEx, .pToUnicodeEx = loaderdrv_ToUnicodeEx,

View File

@ -1167,6 +1167,7 @@ static struct unix_funcs unix_funcs =
NtGdiUnrealizeObject, NtGdiUnrealizeObject,
NtGdiUpdateColors, NtGdiUpdateColors,
NtGdiWidenPath, NtGdiWidenPath,
NtUserActivateKeyboardLayout,
NtUserCountClipboardFormats, NtUserCountClipboardFormats,
NtUserGetKeyNameText, NtUserGetKeyNameText,
NtUserGetPriorityClipboardFormat, NtUserGetPriorityClipboardFormat,

View File

@ -570,3 +570,33 @@ INT WINAPI NtUserToUnicodeEx( UINT virt, UINT scan, const BYTE *state,
TRACE_(keyboard)( "ret %d, str %s.\n", len, debugstr_w(str) ); TRACE_(keyboard)( "ret %d, str %s.\n", len, debugstr_w(str) );
return len; return len;
} }
/**********************************************************************
* NtUserActivateKeyboardLayout (win32u.@)
*/
HKL WINAPI NtUserActivateKeyboardLayout( HKL layout, UINT flags )
{
struct user_thread_info *info = get_user_thread_info();
HKL old_layout;
TRACE_(keyboard)( "layout %p, flags %x\n", layout, flags );
if (flags) FIXME_(keyboard)( "flags %x not supported\n", flags );
if (layout == (HKL)HKL_NEXT || layout == (HKL)HKL_PREV)
{
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
FIXME_(keyboard)( "HKL_NEXT and HKL_PREV not supported\n" );
return 0;
}
if (!user_driver->pActivateKeyboardLayout( layout, flags ))
return 0;
old_layout = info->kbd_layout;
info->kbd_layout = layout;
if (old_layout != layout) info->kbd_layout_id = 0;
if (!old_layout) return get_locale_kbd_layout();
return old_layout;
}

View File

@ -749,7 +749,7 @@
@ stub NtUpdateInputSinkTransforms @ stub NtUpdateInputSinkTransforms
@ stub NtUserAcquireIAMKey @ stub NtUserAcquireIAMKey
@ stub NtUserAcquireInteractiveControlBackgroundAccess @ stub NtUserAcquireInteractiveControlBackgroundAccess
@ stub NtUserActivateKeyboardLayout @ stdcall NtUserActivateKeyboardLayout(long long)
@ stdcall -syscall NtUserAddClipboardFormatListener(long) @ stdcall -syscall NtUserAddClipboardFormatListener(long)
@ stub NtUserAddVisualIdentifier @ stub NtUserAddVisualIdentifier
@ stub NtUserAlterWindowStyle @ stub NtUserAlterWindowStyle

View File

@ -194,6 +194,7 @@ struct unix_funcs
BOOL (WINAPI *pNtGdiUnrealizeObject)( HGDIOBJ obj ); BOOL (WINAPI *pNtGdiUnrealizeObject)( HGDIOBJ obj );
BOOL (WINAPI *pNtGdiUpdateColors)( HDC hdc ); BOOL (WINAPI *pNtGdiUpdateColors)( HDC hdc );
BOOL (WINAPI *pNtGdiWidenPath)( HDC hdc ); BOOL (WINAPI *pNtGdiWidenPath)( HDC hdc );
HKL (WINAPI *pNtUserActivateKeyboardLayout)( HKL layout, UINT flags );
INT (WINAPI *pNtUserCountClipboardFormats)(void); INT (WINAPI *pNtUserCountClipboardFormats)(void);
INT (WINAPI *pNtUserGetKeyNameText)( LONG lparam, WCHAR *buffer, INT size ); INT (WINAPI *pNtUserGetKeyNameText)( LONG lparam, WCHAR *buffer, INT size );
INT (WINAPI *pNtUserGetPriorityClipboardFormat)( UINT *list, INT count ); INT (WINAPI *pNtUserGetPriorityClipboardFormat)( UINT *list, INT count );

View File

@ -596,6 +596,11 @@ NTSTATUS WINAPI NtGdiDdDDISetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNER
return unix_funcs->pNtGdiDdDDISetVidPnSourceOwner( desc ); return unix_funcs->pNtGdiDdDDISetVidPnSourceOwner( desc );
} }
HKL WINAPI NtUserActivateKeyboardLayout( HKL layout, UINT flags )
{
return unix_funcs->pNtUserActivateKeyboardLayout( layout, flags );
}
INT WINAPI NtUserCountClipboardFormats(void) INT WINAPI NtUserCountClipboardFormats(void)
{ {
return unix_funcs->pNtUserCountClipboardFormats(); return unix_funcs->pNtUserCountClipboardFormats();