Commit 5c779bfa authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

user32: Remove the driver call for GetKeyboardLayoutList and instead populate from the registry.

parent b3d308b9
...@@ -77,7 +77,6 @@ static const USER_DRIVER *load_driver(void) ...@@ -77,7 +77,6 @@ static const USER_DRIVER *load_driver(void)
GET_USER_FUNC(GetAsyncKeyState); GET_USER_FUNC(GetAsyncKeyState);
GET_USER_FUNC(GetKeyNameText); GET_USER_FUNC(GetKeyNameText);
GET_USER_FUNC(GetKeyboardLayout); GET_USER_FUNC(GetKeyboardLayout);
GET_USER_FUNC(GetKeyboardLayoutList);
GET_USER_FUNC(GetKeyboardLayoutName); GET_USER_FUNC(GetKeyboardLayoutName);
GET_USER_FUNC(LoadKeyboardLayout); GET_USER_FUNC(LoadKeyboardLayout);
GET_USER_FUNC(MapVirtualKeyEx); GET_USER_FUNC(MapVirtualKeyEx);
...@@ -177,11 +176,6 @@ static HKL nulldrv_GetKeyboardLayout( DWORD layout ) ...@@ -177,11 +176,6 @@ static HKL nulldrv_GetKeyboardLayout( DWORD layout )
return 0; return 0;
} }
static UINT nulldrv_GetKeyboardLayoutList( INT count, HKL *layouts )
{
return 0;
}
static BOOL nulldrv_GetKeyboardLayoutName( LPWSTR name ) static BOOL nulldrv_GetKeyboardLayoutName( LPWSTR name )
{ {
return FALSE; return FALSE;
...@@ -436,7 +430,6 @@ static USER_DRIVER null_driver = ...@@ -436,7 +430,6 @@ static USER_DRIVER null_driver =
nulldrv_GetAsyncKeyState, nulldrv_GetAsyncKeyState,
nulldrv_GetKeyNameText, nulldrv_GetKeyNameText,
nulldrv_GetKeyboardLayout, nulldrv_GetKeyboardLayout,
nulldrv_GetKeyboardLayoutList,
nulldrv_GetKeyboardLayoutName, nulldrv_GetKeyboardLayoutName,
nulldrv_LoadKeyboardLayout, nulldrv_LoadKeyboardLayout,
nulldrv_MapVirtualKeyEx, nulldrv_MapVirtualKeyEx,
...@@ -524,11 +517,6 @@ static HKL loaderdrv_GetKeyboardLayout( DWORD layout ) ...@@ -524,11 +517,6 @@ static HKL loaderdrv_GetKeyboardLayout( DWORD layout )
return load_driver()->pGetKeyboardLayout( layout ); return load_driver()->pGetKeyboardLayout( layout );
} }
static UINT loaderdrv_GetKeyboardLayoutList( INT count, HKL *layouts )
{
return load_driver()->pGetKeyboardLayoutList( count, layouts );
}
static BOOL loaderdrv_GetKeyboardLayoutName( LPWSTR name ) static BOOL loaderdrv_GetKeyboardLayoutName( LPWSTR name )
{ {
return load_driver()->pGetKeyboardLayoutName( name ); return load_driver()->pGetKeyboardLayoutName( name );
...@@ -783,7 +771,6 @@ static USER_DRIVER lazy_load_driver = ...@@ -783,7 +771,6 @@ static USER_DRIVER lazy_load_driver =
loaderdrv_GetAsyncKeyState, loaderdrv_GetAsyncKeyState,
loaderdrv_GetKeyNameText, loaderdrv_GetKeyNameText,
loaderdrv_GetKeyboardLayout, loaderdrv_GetKeyboardLayout,
loaderdrv_GetKeyboardLayoutList,
loaderdrv_GetKeyboardLayoutName, loaderdrv_GetKeyboardLayoutName,
loaderdrv_LoadKeyboardLayout, loaderdrv_LoadKeyboardLayout,
loaderdrv_MapVirtualKeyEx, loaderdrv_MapVirtualKeyEx,
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include "user_private.h" #include "user_private.h"
#include "wine/server.h" #include "wine/server.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(win); WINE_DEFAULT_DEBUG_CHANNEL(win);
WINE_DECLARE_DEBUG_CHANNEL(keyboard); WINE_DECLARE_DEBUG_CHANNEL(keyboard);
...@@ -800,9 +801,62 @@ BOOL WINAPI BlockInput(BOOL fBlockIt) ...@@ -800,9 +801,62 @@ BOOL WINAPI BlockInput(BOOL fBlockIt)
*/ */
UINT WINAPI GetKeyboardLayoutList(INT nBuff, HKL *layouts) UINT WINAPI GetKeyboardLayoutList(INT nBuff, HKL *layouts)
{ {
HKEY hKeyKeyboard;
DWORD rc;
INT count = 0;
ULONG_PTR baselayout;
LANGID langid;
static const WCHAR szKeyboardReg[] = {'S','y','s','t','e','m','\\','C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\','C','o','n','t','r','o','l','\\','K','e','y','b','o','a','r','d',' ','L','a','y','o','u','t','s',0};
TRACE_(keyboard)("(%d,%p)\n",nBuff,layouts); TRACE_(keyboard)("(%d,%p)\n",nBuff,layouts);
return USER_Driver->pGetKeyboardLayoutList(nBuff, layouts); baselayout = GetUserDefaultLCID();
langid = PRIMARYLANGID(LANGIDFROMLCID(baselayout));
if (langid == LANG_CHINESE || langid == LANG_JAPANESE || langid == LANG_KOREAN)
baselayout |= 0xe001 << 16; /* IME */
else
baselayout |= baselayout << 16;
/* Enumerate the Registry */
rc = RegOpenKeyW(HKEY_LOCAL_MACHINE,szKeyboardReg,&hKeyKeyboard);
if (rc == ERROR_SUCCESS)
{
do {
WCHAR szKeyName[9];
HKL layout;
rc = RegEnumKeyW(hKeyKeyboard, count, szKeyName, 9);
if (rc == ERROR_SUCCESS)
{
layout = (HKL)strtoulW(szKeyName,NULL,16);
if (baselayout != 0 && layout == (HKL)baselayout)
baselayout = 0; /* found in the registry do not add again */
if (nBuff && layouts)
{
if (count >= nBuff ) break;
layouts[count] = layout;
}
count ++;
}
} while (rc == ERROR_SUCCESS);
RegCloseKey(hKeyKeyboard);
}
/* make sure our base layout is on the list */
if (baselayout != 0)
{
if (nBuff && layouts)
{
if (count < nBuff)
{
layouts[count] = (HKL)baselayout;
count++;
}
}
else
count++;
}
return count;
} }
......
...@@ -109,7 +109,6 @@ typedef struct tagUSER_DRIVER { ...@@ -109,7 +109,6 @@ typedef struct tagUSER_DRIVER {
SHORT (*pGetAsyncKeyState)(INT); SHORT (*pGetAsyncKeyState)(INT);
INT (*pGetKeyNameText)(LONG, LPWSTR, INT); INT (*pGetKeyNameText)(LONG, LPWSTR, INT);
HKL (*pGetKeyboardLayout)(DWORD); HKL (*pGetKeyboardLayout)(DWORD);
UINT (*pGetKeyboardLayoutList)(INT, HKL *);
BOOL (*pGetKeyboardLayoutName)(LPWSTR); BOOL (*pGetKeyboardLayoutName)(LPWSTR);
HKL (*pLoadKeyboardLayout)(LPCWSTR, UINT); HKL (*pLoadKeyboardLayout)(LPCWSTR, UINT);
UINT (*pMapVirtualKeyEx)(UINT, UINT, HKL); UINT (*pMapVirtualKeyEx)(UINT, UINT, HKL);
......
...@@ -1903,42 +1903,6 @@ SHORT X11DRV_GetAsyncKeyState(INT key) ...@@ -1903,42 +1903,6 @@ SHORT X11DRV_GetAsyncKeyState(INT key)
/*********************************************************************** /***********************************************************************
* GetKeyboardLayoutList (X11DRV.@)
*/
UINT X11DRV_GetKeyboardLayoutList(INT size, HKL *hkl)
{
INT i;
TRACE("%d, %p\n", size, hkl);
if (!size)
{
size = 4096; /* hope we will never have that many */
hkl = NULL;
}
for (i = 0; main_key_tab[i].comment && (i < size); i++)
{
if (hkl)
{
ULONG_PTR layout = main_key_tab[i].lcid;
LANGID langid;
/* see comment for GetKeyboardLayout */
langid = PRIMARYLANGID(LANGIDFROMLCID(layout));
if (langid == LANG_CHINESE || langid == LANG_JAPANESE || langid == LANG_KOREAN)
layout |= 0xe001 << 16; /* FIXME */
else
layout |= layout << 16;
hkl[i] = (HKL)layout;
}
}
return i;
}
/***********************************************************************
* GetKeyboardLayout (X11DRV.@) * GetKeyboardLayout (X11DRV.@)
*/ */
HKL X11DRV_GetKeyboardLayout(DWORD dwThreadid) HKL X11DRV_GetKeyboardLayout(DWORD dwThreadid)
......
...@@ -69,7 +69,6 @@ ...@@ -69,7 +69,6 @@
@ cdecl GetAsyncKeyState(long) X11DRV_GetAsyncKeyState @ cdecl GetAsyncKeyState(long) X11DRV_GetAsyncKeyState
@ cdecl GetKeyNameText(long ptr long) X11DRV_GetKeyNameText @ cdecl GetKeyNameText(long ptr long) X11DRV_GetKeyNameText
@ cdecl GetKeyboardLayout(long) X11DRV_GetKeyboardLayout @ cdecl GetKeyboardLayout(long) X11DRV_GetKeyboardLayout
@ cdecl GetKeyboardLayoutList(long ptr) X11DRV_GetKeyboardLayoutList
@ cdecl GetKeyboardLayoutName(ptr) X11DRV_GetKeyboardLayoutName @ cdecl GetKeyboardLayoutName(ptr) X11DRV_GetKeyboardLayoutName
@ cdecl LoadKeyboardLayout(wstr long) X11DRV_LoadKeyboardLayout @ cdecl LoadKeyboardLayout(wstr long) X11DRV_LoadKeyboardLayout
@ cdecl MapVirtualKeyEx(long long long) X11DRV_MapVirtualKeyEx @ cdecl MapVirtualKeyEx(long long long) X11DRV_MapVirtualKeyEx
......
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