Commit 67a11c60 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

winex11.drv: Set HKCU\Keyboard Layout\Preload key.

parent ed70c76a
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include "winbase.h" #include "winbase.h"
#include "wingdi.h" #include "wingdi.h"
#include "winuser.h" #include "winuser.h"
#include "winreg.h"
#include "winnls.h" #include "winnls.h"
#include "x11drv.h" #include "x11drv.h"
#include "wine/server.h" #include "wine/server.h"
...@@ -1613,6 +1614,48 @@ static HKL get_locale_kbd_layout(void) ...@@ -1613,6 +1614,48 @@ static HKL get_locale_kbd_layout(void)
return (HKL)layout; return (HKL)layout;
} }
/***********************************************************************
* GetKeyboardLayoutName (X11DRV.@)
*/
BOOL CDECL X11DRV_GetKeyboardLayoutName(LPWSTR name)
{
static const WCHAR formatW[] = {'%','0','8','l','x',0};
DWORD layout;
LANGID langid;
layout = main_key_tab[kbd_layout].lcid;
/* see comment for get_locale_kbd_layout */
langid = PRIMARYLANGID(LANGIDFROMLCID(layout));
if (langid == LANG_CHINESE || langid == LANG_JAPANESE || langid == LANG_KOREAN)
layout |= 0xe001 << 16; /* FIXME */
sprintfW(name, formatW, layout);
TRACE("returning %s\n", debugstr_w(name));
return TRUE;
}
static void set_kbd_layout_preload_key(void)
{
static const WCHAR preload[] =
{'K','e','y','b','o','a','r','d',' ','L','a','y','o','u','t','\\','P','r','e','l','o','a','d',0};
static const WCHAR one[] = {'1',0};
HKEY hkey;
WCHAR layout[KL_NAMELENGTH];
if (RegCreateKeyExW(HKEY_CURRENT_USER, preload, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hkey, NULL))
return;
if (!RegQueryValueExW(hkey, one, NULL, NULL, NULL, NULL))
{
RegCloseKey(hkey);
return;
}
if (X11DRV_GetKeyboardLayoutName(layout))
RegSetValueExW(hkey, one, 0, REG_SZ, (const BYTE *)layout, sizeof(layout));
RegCloseKey(hkey);
}
/********************************************************************** /**********************************************************************
* X11DRV_InitKeyboard * X11DRV_InitKeyboard
...@@ -1630,6 +1673,8 @@ void X11DRV_InitKeyboard( Display *display ) ...@@ -1630,6 +1673,8 @@ void X11DRV_InitKeyboard( Display *display )
const char (*lkey)[MAIN_LEN][4]; const char (*lkey)[MAIN_LEN][4];
char vkey_used[256] = { 0 }; char vkey_used[256] = { 0 };
set_kbd_layout_preload_key();
wine_tsx11_lock(); wine_tsx11_lock();
XDisplayKeycodes(display, &min_keycode, &max_keycode); XDisplayKeycodes(display, &min_keycode, &max_keycode);
ksp = XGetKeyboardMapping(display, min_keycode, ksp = XGetKeyboardMapping(display, min_keycode,
...@@ -1901,27 +1946,6 @@ HKL CDECL X11DRV_GetKeyboardLayout(DWORD dwThreadid) ...@@ -1901,27 +1946,6 @@ HKL CDECL X11DRV_GetKeyboardLayout(DWORD dwThreadid)
/*********************************************************************** /***********************************************************************
* GetKeyboardLayoutName (X11DRV.@)
*/
BOOL CDECL X11DRV_GetKeyboardLayoutName(LPWSTR name)
{
static const WCHAR formatW[] = {'%','0','8','l','x',0};
DWORD layout;
LANGID langid;
layout = main_key_tab[kbd_layout].lcid;
/* see comment for get_locale_kbd_layout */
langid = PRIMARYLANGID(LANGIDFROMLCID(layout));
if (langid == LANG_CHINESE || langid == LANG_JAPANESE || langid == LANG_KOREAN)
layout |= 0xe001 << 16; /* FIXME */
sprintfW(name, formatW, layout);
TRACE("returning %s\n", debugstr_w(name));
return TRUE;
}
/***********************************************************************
* LoadKeyboardLayout (X11DRV.@) * LoadKeyboardLayout (X11DRV.@)
*/ */
HKL CDECL X11DRV_LoadKeyboardLayout(LPCWSTR name, UINT flags) HKL CDECL X11DRV_LoadKeyboardLayout(LPCWSTR name, UINT flags)
......
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