Commit e2aa30f2 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

user32: Factor GetKeyboardLayout and remove driver call.

parent da9fc418
......@@ -108,7 +108,6 @@ static const USER_DRIVER *load_driver(void)
GET_USER_FUNC(ActivateKeyboardLayout);
GET_USER_FUNC(Beep);
GET_USER_FUNC(GetKeyNameText);
GET_USER_FUNC(GetKeyboardLayout);
GET_USER_FUNC(GetKeyboardLayoutList);
GET_USER_FUNC(GetKeyboardLayoutName);
GET_USER_FUNC(LoadKeyboardLayout);
......@@ -206,11 +205,6 @@ static INT CDECL nulldrv_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size )
return -1; /* use default implementation */
}
static HKL CDECL nulldrv_GetKeyboardLayout( DWORD thread_id )
{
return (HKL)~0; /* use default implementation */
}
static BOOL CDECL nulldrv_GetKeyboardLayoutName( LPWSTR name )
{
return FALSE;
......@@ -427,7 +421,6 @@ static USER_DRIVER null_driver =
nulldrv_ActivateKeyboardLayout,
nulldrv_Beep,
nulldrv_GetKeyNameText,
nulldrv_GetKeyboardLayout,
nulldrv_GetKeyboardLayoutList,
nulldrv_GetKeyboardLayoutName,
nulldrv_LoadKeyboardLayout,
......@@ -502,11 +495,6 @@ static INT CDECL loaderdrv_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size
return load_driver()->pGetKeyNameText( lparam, buffer, size );
}
static HKL CDECL loaderdrv_GetKeyboardLayout( DWORD thread_id )
{
return load_driver()->pGetKeyboardLayout( thread_id );
}
static UINT CDECL loaderdrv_GetKeyboardLayoutList( INT size, HKL *layouts )
{
return load_driver()->pGetKeyboardLayoutList( size, layouts );
......@@ -642,7 +630,6 @@ static USER_DRIVER lazy_load_driver =
loaderdrv_ActivateKeyboardLayout,
loaderdrv_Beep,
loaderdrv_GetKeyNameText,
loaderdrv_GetKeyboardLayout,
loaderdrv_GetKeyboardLayoutList,
loaderdrv_GetKeyboardLayoutName,
loaderdrv_LoadKeyboardLayout,
......
......@@ -1083,11 +1083,14 @@ UINT WINAPI GetKBCodePage(void)
*/
HKL WINAPI GetKeyboardLayout(DWORD thread_id)
{
HKL layout;
struct user_thread_info *thread = get_user_thread_info();
HKL layout = thread->kbd_layout;
if ((layout = USER_Driver->pGetKeyboardLayout( thread_id )) != (HKL)~0) return layout;
if (thread_id && thread_id != GetCurrentThreadId())
FIXME( "couldn't return keyboard layout for thread %04x\n", thread_id );
return get_locale_kbd_layout();
if (!layout) return get_locale_kbd_layout();
return layout;
}
/****************************************************************************
......
......@@ -65,7 +65,6 @@ typedef struct tagUSER_DRIVER {
BOOL (CDECL *pActivateKeyboardLayout)(HKL, UINT);
void (CDECL *pBeep)(void);
INT (CDECL *pGetKeyNameText)(LONG, LPWSTR, INT);
HKL (CDECL *pGetKeyboardLayout)(DWORD);
UINT (CDECL *pGetKeyboardLayoutList)(INT, HKL *);
BOOL (CDECL *pGetKeyboardLayoutName)(LPWSTR);
HKL (CDECL *pLoadKeyboardLayout)(LPCWSTR, UINT);
......
......@@ -395,8 +395,6 @@ static const struct {
{ VK_VOLUME_UP | 0x100, "Volume Up" },
};
HKL CDECL macdrv_GetKeyboardLayout(DWORD);
static BOOL char_matches_string(WCHAR wchar, UniChar *string, BOOL ignore_diacritics)
{
BOOL ret;
......@@ -1299,18 +1297,6 @@ INT CDECL macdrv_GetKeyNameText(LONG lparam, LPWSTR buffer, INT size)
/***********************************************************************
* GetKeyboardLayout (MACDRV.@)
*/
HKL CDECL macdrv_GetKeyboardLayout(DWORD thread_id)
{
if (thread_id && thread_id != GetCurrentThreadId())
FIXME("couldn't return keyboard layout for thread %04x\n", thread_id);
return macdrv_init_thread_data()->active_keyboard_layout;
}
/***********************************************************************
* GetKeyboardLayoutList (MACDRV.@)
*/
UINT CDECL macdrv_GetKeyboardLayoutList(INT size, HKL *list)
......@@ -1349,7 +1335,7 @@ BOOL CDECL macdrv_GetKeyboardLayoutName(LPWSTR name)
static const WCHAR formatW[] = {'%','0','8','x',0};
DWORD layout;
layout = HandleToUlong(macdrv_GetKeyboardLayout(0));
layout = HandleToUlong(GetKeyboardLayout(0));
if (HIWORD(layout) == LOWORD(layout)) layout = LOWORD(layout);
sprintfW(name, formatW, layout);
TRACE("returning %s\n", debugstr_w(name));
......
......@@ -14,7 +14,6 @@
@ cdecl DestroyWindow(long) macdrv_DestroyWindow
@ cdecl EnumDisplaySettingsEx(ptr long ptr long) macdrv_EnumDisplaySettingsEx
@ cdecl GetCursorPos(ptr) macdrv_GetCursorPos
@ cdecl GetKeyboardLayout(long) macdrv_GetKeyboardLayout
@ cdecl GetKeyboardLayoutList(long ptr) macdrv_GetKeyboardLayoutList
@ cdecl GetKeyboardLayoutName(ptr) macdrv_GetKeyboardLayoutName
@ cdecl GetKeyNameText(long ptr long) macdrv_GetKeyNameText
......
......@@ -1890,23 +1890,6 @@ static BOOL match_x11_keyboard_layout(HKL hkl)
/***********************************************************************
* GetKeyboardLayout (X11DRV.@)
*/
HKL CDECL X11DRV_GetKeyboardLayout(DWORD dwThreadid)
{
if (!dwThreadid || dwThreadid == GetCurrentThreadId())
{
struct x11drv_thread_data *thread_data = x11drv_thread_data();
if (thread_data && thread_data->kbd_layout) return thread_data->kbd_layout;
}
else
FIXME("couldn't return keyboard layout for thread %04x\n", dwThreadid);
return get_locale_kbd_layout();
}
/***********************************************************************
* LoadKeyboardLayout (X11DRV.@)
*/
HKL CDECL X11DRV_LoadKeyboardLayout(LPCWSTR name, UINT flags)
......@@ -1932,9 +1915,8 @@ BOOL CDECL X11DRV_UnloadKeyboardLayout(HKL hkl)
*/
BOOL CDECL X11DRV_ActivateKeyboardLayout(HKL hkl, UINT flags)
{
struct x11drv_thread_data *thread_data = x11drv_init_thread_data();
FIXME("%p, %04x: semi-stub!\n", hkl, flags);
if (flags & KLF_SETFORPROCESS)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
......@@ -1949,7 +1931,6 @@ BOOL CDECL X11DRV_ActivateKeyboardLayout(HKL hkl, UINT flags)
return FALSE;
}
thread_data->kbd_layout = hkl;
return TRUE;
}
......@@ -1967,7 +1948,7 @@ BOOL X11DRV_MappingNotify( HWND dummy, XEvent *event )
hwnd = GetFocus();
if (!hwnd) hwnd = GetActiveWindow();
PostMessageW(hwnd, WM_INPUTLANGCHANGEREQUEST,
0 /*FIXME*/, (LPARAM)X11DRV_GetKeyboardLayout(0));
0 /*FIXME*/, (LPARAM)GetKeyboardLayout(0));
return TRUE;
}
......@@ -2215,7 +2196,7 @@ INT CDECL X11DRV_GetKeyNameText(LONG lParam, LPWSTR lpBuffer, INT nSize)
scanCode = lParam >> 16;
scanCode &= 0x1ff; /* keep "extended-key" flag with code */
vkey = X11DRV_MapVirtualKeyEx(scanCode, MAPVK_VSC_TO_VK_EX, X11DRV_GetKeyboardLayout(0));
vkey = X11DRV_MapVirtualKeyEx(scanCode, MAPVK_VSC_TO_VK_EX, GetKeyboardLayout(0));
/* handle "don't care" bit (0x02000000) */
if (!(lParam & 0x02000000)) {
......@@ -2238,7 +2219,7 @@ INT CDECL X11DRV_GetKeyNameText(LONG lParam, LPWSTR lpBuffer, INT nSize)
}
}
ansi = X11DRV_MapVirtualKeyEx(vkey, MAPVK_VK_TO_CHAR, X11DRV_GetKeyboardLayout(0));
ansi = X11DRV_MapVirtualKeyEx(vkey, MAPVK_VK_TO_CHAR, GetKeyboardLayout(0));
TRACE("scan 0x%04x, vkey 0x%04X, ANSI 0x%04x\n", scanCode, vkey, ansi);
/* first get the name of the "regular" keys which is the Upper case
......
......@@ -7,7 +7,6 @@
@ cdecl ActivateKeyboardLayout(long long) X11DRV_ActivateKeyboardLayout
@ cdecl Beep() X11DRV_Beep
@ cdecl GetKeyNameText(long ptr long) X11DRV_GetKeyNameText
@ cdecl GetKeyboardLayout(long) X11DRV_GetKeyboardLayout
@ cdecl GetKeyboardLayoutName(ptr) X11DRV_GetKeyboardLayoutName
@ cdecl LoadKeyboardLayout(wstr long) X11DRV_LoadKeyboardLayout
@ cdecl MapVirtualKeyEx(long long long) X11DRV_MapVirtualKeyEx
......
......@@ -337,7 +337,6 @@ struct x11drv_thread_data
Window clip_window; /* window used for cursor clipping */
HWND clip_hwnd; /* message window stored in desktop while clipping is active */
DWORD clip_reset; /* time when clipping was last reset */
HKL kbd_layout; /* active keyboard layout */
enum { xi_unavailable = -1, xi_unknown, xi_disabled, xi_enabled } xi2_state; /* XInput2 state */
void *xi2_devices; /* list of XInput2 devices (valid when state is enabled) */
int xi2_device_count;
......
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