Jacek Caban : win32u: Move NtUserActivateKeyboardLayout implementation from user32.
Alexandre Julliard
julliard at winehq.org
Wed Nov 17 16:27:57 CST 2021
Module: wine
Branch: master
Commit: a32f044154db8f81509cbabbe885fcac85ec0130
URL: https://source.winehq.org/git/wine.git/?a=commit;h=a32f044154db8f81509cbabbe885fcac85ec0130
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed Nov 17 12:47:04 2021 +0100
win32u: Move NtUserActivateKeyboardLayout implementation from user32.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/defwnd.c | 2 +-
dlls/user32/driver.c | 7 +------
dlls/user32/input.c | 32 +-------------------------------
dlls/user32/user32.spec | 2 +-
dlls/win32u/driver.c | 6 ++++++
dlls/win32u/gdiobj.c | 1 +
dlls/win32u/input.c | 30 ++++++++++++++++++++++++++++++
dlls/win32u/win32u.spec | 2 +-
dlls/win32u/win32u_private.h | 1 +
dlls/win32u/wrappers.c | 5 +++++
10 files changed, 48 insertions(+), 40 deletions(-)
diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c
index 916029c2579..8cd9047f02b 100644
--- a/dlls/user32/defwnd.c
+++ b/dlls/user32/defwnd.c
@@ -734,7 +734,7 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
}
case WM_INPUTLANGCHANGEREQUEST:
- ActivateKeyboardLayout( (HKL)lParam, 0 );
+ NtUserActivateKeyboardLayout( (HKL)lParam, 0 );
break;
case WM_INPUTLANGCHANGE:
diff --git a/dlls/user32/driver.c b/dlls/user32/driver.c
index b92d74443f3..fb0ed54bc80 100644
--- a/dlls/user32/driver.c
+++ b/dlls/user32/driver.c
@@ -233,11 +233,6 @@ static void CDECL nulldrv_ThreadDetach( void )
* 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)
{
load_driver()->pBeep();
@@ -345,7 +340,7 @@ static struct user_driver_funcs lazy_load_driver =
{
{ NULL },
/* keyboard functions */
- loaderdrv_ActivateKeyboardLayout,
+ NULL,
loaderdrv_Beep,
NULL,
loaderdrv_GetKeyboardLayoutList,
diff --git a/dlls/user32/input.c b/dlls/user32/input.c
index 3f41f09d4e2..369c024a1d4 100644
--- a/dlls/user32/input.c
+++ b/dlls/user32/input.c
@@ -872,36 +872,6 @@ INT WINAPI ToAsciiEx( UINT virtKey, UINT scanCode, const BYTE *lpKeyState,
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.@)
*/
@@ -1056,7 +1026,7 @@ HKL WINAPI LoadKeyboardLayoutW( const WCHAR *name, UINT flags )
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 */
return get_locale_kbd_layout();
diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec
index 71830f41574..7d88bd14c99 100644
--- a/dlls/user32/user32.spec
+++ b/dlls/user32/user32.spec
@@ -1,4 +1,4 @@
-@ stdcall ActivateKeyboardLayout(long long)
+@ stdcall ActivateKeyboardLayout(long long) NtUserActivateKeyboardLayout
@ stdcall AddClipboardFormatListener(long) NtUserAddClipboardFormatListener
@ stdcall AdjustWindowRect(ptr long long)
@ stdcall AdjustWindowRectEx(ptr long long long)
diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c
index f7f3f3cf5f7..6e7a5c715c8 100644
--- a/dlls/win32u/driver.c
+++ b/dlls/win32u/driver.c
@@ -1003,6 +1003,11 @@ static const struct user_driver_funcs *load_driver(void)
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 )
{
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 =
{
+ .pActivateKeyboardLayout = loaderdrv_ActivateKeyboardLayout,
.pGetKeyNameText = loaderdrv_GetKeyNameText,
.pMapVirtualKeyEx = loaderdrv_MapVirtualKeyEx,
.pToUnicodeEx = loaderdrv_ToUnicodeEx,
diff --git a/dlls/win32u/gdiobj.c b/dlls/win32u/gdiobj.c
index 82d94435bf1..29750c6bbf7 100644
--- a/dlls/win32u/gdiobj.c
+++ b/dlls/win32u/gdiobj.c
@@ -1167,6 +1167,7 @@ static struct unix_funcs unix_funcs =
NtGdiUnrealizeObject,
NtGdiUpdateColors,
NtGdiWidenPath,
+ NtUserActivateKeyboardLayout,
NtUserCountClipboardFormats,
NtUserGetKeyNameText,
NtUserGetPriorityClipboardFormat,
diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c
index 0f41dbb46ad..9af1a81492d 100644
--- a/dlls/win32u/input.c
+++ b/dlls/win32u/input.c
@@ -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) );
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;
+}
diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec
index 9439aa21a29..df5f4fb843f 100644
--- a/dlls/win32u/win32u.spec
+++ b/dlls/win32u/win32u.spec
@@ -749,7 +749,7 @@
@ stub NtUpdateInputSinkTransforms
@ stub NtUserAcquireIAMKey
@ stub NtUserAcquireInteractiveControlBackgroundAccess
-@ stub NtUserActivateKeyboardLayout
+@ stdcall NtUserActivateKeyboardLayout(long long)
@ stdcall -syscall NtUserAddClipboardFormatListener(long)
@ stub NtUserAddVisualIdentifier
@ stub NtUserAlterWindowStyle
diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h
index 4219ffa5bbc..c2b35fc53b1 100644
--- a/dlls/win32u/win32u_private.h
+++ b/dlls/win32u/win32u_private.h
@@ -194,6 +194,7 @@ struct unix_funcs
BOOL (WINAPI *pNtGdiUnrealizeObject)( HGDIOBJ obj );
BOOL (WINAPI *pNtGdiUpdateColors)( HDC hdc );
BOOL (WINAPI *pNtGdiWidenPath)( HDC hdc );
+ HKL (WINAPI *pNtUserActivateKeyboardLayout)( HKL layout, UINT flags );
INT (WINAPI *pNtUserCountClipboardFormats)(void);
INT (WINAPI *pNtUserGetKeyNameText)( LONG lparam, WCHAR *buffer, INT size );
INT (WINAPI *pNtUserGetPriorityClipboardFormat)( UINT *list, INT count );
diff --git a/dlls/win32u/wrappers.c b/dlls/win32u/wrappers.c
index 04019de036b..b8bd5ec225e 100644
--- a/dlls/win32u/wrappers.c
+++ b/dlls/win32u/wrappers.c
@@ -596,6 +596,11 @@ NTSTATUS WINAPI NtGdiDdDDISetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNER
return unix_funcs->pNtGdiDdDDISetVidPnSourceOwner( desc );
}
+HKL WINAPI NtUserActivateKeyboardLayout( HKL layout, UINT flags )
+{
+ return unix_funcs->pNtUserActivateKeyboardLayout( layout, flags );
+}
+
INT WINAPI NtUserCountClipboardFormats(void)
{
return unix_funcs->pNtUserCountClipboardFormats();
More information about the wine-cvs
mailing list