user32: Factor GetKeyboardLayoutNameW implementations.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7a94687f46
commit
c4e6d16271
|
@ -109,7 +109,6 @@ static const USER_DRIVER *load_driver(void)
|
|||
GET_USER_FUNC(Beep);
|
||||
GET_USER_FUNC(GetKeyNameText);
|
||||
GET_USER_FUNC(GetKeyboardLayoutList);
|
||||
GET_USER_FUNC(GetKeyboardLayoutName);
|
||||
GET_USER_FUNC(LoadKeyboardLayout);
|
||||
GET_USER_FUNC(MapVirtualKeyEx);
|
||||
GET_USER_FUNC(RegisterHotKey);
|
||||
|
@ -205,11 +204,6 @@ static INT CDECL nulldrv_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size )
|
|||
return -1; /* use default implementation */
|
||||
}
|
||||
|
||||
static BOOL CDECL nulldrv_GetKeyboardLayoutName( LPWSTR name )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static HKL CDECL nulldrv_LoadKeyboardLayout( LPCWSTR name, UINT flags )
|
||||
{
|
||||
return 0;
|
||||
|
@ -422,7 +416,6 @@ static USER_DRIVER null_driver =
|
|||
nulldrv_Beep,
|
||||
nulldrv_GetKeyNameText,
|
||||
nulldrv_GetKeyboardLayoutList,
|
||||
nulldrv_GetKeyboardLayoutName,
|
||||
nulldrv_LoadKeyboardLayout,
|
||||
nulldrv_MapVirtualKeyEx,
|
||||
nulldrv_RegisterHotKey,
|
||||
|
@ -500,11 +493,6 @@ static UINT CDECL loaderdrv_GetKeyboardLayoutList( INT size, HKL *layouts )
|
|||
return load_driver()->pGetKeyboardLayoutList( size, layouts );
|
||||
}
|
||||
|
||||
static BOOL CDECL loaderdrv_GetKeyboardLayoutName( LPWSTR name )
|
||||
{
|
||||
return load_driver()->pGetKeyboardLayoutName( name );
|
||||
}
|
||||
|
||||
static HKL CDECL loaderdrv_LoadKeyboardLayout( LPCWSTR name, UINT flags )
|
||||
{
|
||||
return load_driver()->pLoadKeyboardLayout( name, flags );
|
||||
|
@ -631,7 +619,6 @@ static USER_DRIVER lazy_load_driver =
|
|||
loaderdrv_Beep,
|
||||
loaderdrv_GetKeyNameText,
|
||||
loaderdrv_GetKeyboardLayoutList,
|
||||
loaderdrv_GetKeyboardLayoutName,
|
||||
loaderdrv_LoadKeyboardLayout,
|
||||
loaderdrv_MapVirtualKeyEx,
|
||||
loaderdrv_RegisterHotKey,
|
||||
|
|
|
@ -1108,14 +1108,26 @@ BOOL WINAPI GetKeyboardLayoutNameA(LPSTR pszKLID)
|
|||
/****************************************************************************
|
||||
* GetKeyboardLayoutNameW (USER32.@)
|
||||
*/
|
||||
BOOL WINAPI GetKeyboardLayoutNameW(LPWSTR pwszKLID)
|
||||
BOOL WINAPI GetKeyboardLayoutNameW( WCHAR *name )
|
||||
{
|
||||
if (!pwszKLID)
|
||||
DWORD tmp;
|
||||
HKL layout;
|
||||
|
||||
TRACE_(keyboard)( "name %p\n", name );
|
||||
|
||||
if (!name)
|
||||
{
|
||||
SetLastError(ERROR_NOACCESS);
|
||||
SetLastError( ERROR_NOACCESS );
|
||||
return FALSE;
|
||||
}
|
||||
return USER_Driver->pGetKeyboardLayoutName(pwszKLID);
|
||||
|
||||
layout = GetKeyboardLayout( 0 );
|
||||
tmp = HandleToUlong( layout );
|
||||
if (HIWORD( tmp ) == LOWORD( tmp )) tmp = LOWORD( tmp );
|
||||
swprintf( name, KL_NAMELENGTH, L"%08X", tmp );
|
||||
|
||||
TRACE_(keyboard)( "ret %s\n", debugstr_w( name ) );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -66,7 +66,6 @@ typedef struct tagUSER_DRIVER {
|
|||
void (CDECL *pBeep)(void);
|
||||
INT (CDECL *pGetKeyNameText)(LONG, LPWSTR, INT);
|
||||
UINT (CDECL *pGetKeyboardLayoutList)(INT, HKL *);
|
||||
BOOL (CDECL *pGetKeyboardLayoutName)(LPWSTR);
|
||||
HKL (CDECL *pLoadKeyboardLayout)(LPCWSTR, UINT);
|
||||
UINT (CDECL *pMapVirtualKeyEx)(UINT, UINT, HKL);
|
||||
BOOL (CDECL *pRegisterHotKey)(HWND, UINT, UINT);
|
||||
|
|
|
@ -1327,21 +1327,6 @@ UINT CDECL macdrv_GetKeyboardLayoutList(INT size, HKL *list)
|
|||
return count;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetKeyboardLayoutName (MACDRV.@)
|
||||
*/
|
||||
BOOL CDECL macdrv_GetKeyboardLayoutName(LPWSTR name)
|
||||
{
|
||||
static const WCHAR formatW[] = {'%','0','8','x',0};
|
||||
DWORD layout;
|
||||
|
||||
layout = HandleToUlong(GetKeyboardLayout(0));
|
||||
if (HIWORD(layout) == LOWORD(layout)) layout = LOWORD(layout);
|
||||
sprintfW(name, formatW, layout);
|
||||
TRACE("returning %s\n", debugstr_w(name));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* MapVirtualKeyEx (MACDRV.@)
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
@ cdecl EnumDisplaySettingsEx(ptr long ptr long) macdrv_EnumDisplaySettingsEx
|
||||
@ cdecl GetCursorPos(ptr) macdrv_GetCursorPos
|
||||
@ cdecl GetKeyboardLayoutList(long ptr) macdrv_GetKeyboardLayoutList
|
||||
@ cdecl GetKeyboardLayoutName(ptr) macdrv_GetKeyboardLayoutName
|
||||
@ cdecl GetKeyNameText(long ptr long) macdrv_GetKeyNameText
|
||||
@ cdecl MapVirtualKeyEx(long long long) macdrv_MapVirtualKeyEx
|
||||
@ cdecl MsgWaitForMultipleObjectsEx(long ptr long long long) macdrv_MsgWaitForMultipleObjectsEx
|
||||
|
|
|
@ -1566,7 +1566,7 @@ static HKL get_locale_kbd_layout(void)
|
|||
/***********************************************************************
|
||||
* GetKeyboardLayoutName (X11DRV.@)
|
||||
*/
|
||||
BOOL CDECL X11DRV_GetKeyboardLayoutName(LPWSTR name)
|
||||
static BOOL CDECL X11DRV_GetKeyboardLayoutName(LPWSTR name)
|
||||
{
|
||||
static const WCHAR formatW[] = {'%','0','8','x',0};
|
||||
DWORD layout;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
@ cdecl ActivateKeyboardLayout(long long) X11DRV_ActivateKeyboardLayout
|
||||
@ cdecl Beep() X11DRV_Beep
|
||||
@ cdecl GetKeyNameText(long ptr long) X11DRV_GetKeyNameText
|
||||
@ cdecl GetKeyboardLayoutName(ptr) X11DRV_GetKeyboardLayoutName
|
||||
@ cdecl LoadKeyboardLayout(wstr long) X11DRV_LoadKeyboardLayout
|
||||
@ cdecl MapVirtualKeyEx(long long long) X11DRV_MapVirtualKeyEx
|
||||
@ cdecl ToUnicodeEx(long long ptr ptr long long long) X11DRV_ToUnicodeEx
|
||||
|
|
Loading…
Reference in New Issue