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

user32: Set keyboard layout preload key on init.

parent 8ec1206b
...@@ -115,6 +115,25 @@ static HKL get_locale_kbd_layout(void) ...@@ -115,6 +115,25 @@ static HKL get_locale_kbd_layout(void)
/********************************************************************** /**********************************************************************
* keyboard_init
*/
void keyboard_init(void)
{
WCHAR layout[KL_NAMELENGTH];
HKEY hkey;
if (RegCreateKeyExW( HKEY_CURRENT_USER, L"Keyboard Layout\\Preload", 0, NULL, 0,
KEY_ALL_ACCESS, NULL, &hkey, NULL ))
return;
if (GetKeyboardLayoutNameW( layout ))
RegSetValueExW( hkey, L"1", 0, REG_SZ, (const BYTE *)layout, sizeof(layout) );
RegCloseKey( hkey );
}
/**********************************************************************
* set_capture_window * set_capture_window
*/ */
BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret ) BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret )
......
...@@ -331,6 +331,7 @@ static BOOL process_attach(void) ...@@ -331,6 +331,7 @@ static BOOL process_attach(void)
/* Setup palette function pointers */ /* Setup palette function pointers */
palette_init(); palette_init();
keyboard_init();
return TRUE; return TRUE;
} }
......
...@@ -242,6 +242,8 @@ struct hardware_msg_data; ...@@ -242,6 +242,8 @@ struct hardware_msg_data;
extern BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_msg_data *msg_data); extern BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_msg_data *msg_data);
extern struct rawinput_thread_data *rawinput_thread_data(void); extern struct rawinput_thread_data *rawinput_thread_data(void);
extern void keyboard_init(void) DECLSPEC_HIDDEN;
extern void CLIPBOARD_ReleaseOwner( HWND hwnd ) DECLSPEC_HIDDEN; extern void CLIPBOARD_ReleaseOwner( HWND hwnd ) DECLSPEC_HIDDEN;
extern BOOL FOCUS_MouseActivate( HWND hwnd ) DECLSPEC_HIDDEN; extern BOOL FOCUS_MouseActivate( HWND hwnd ) DECLSPEC_HIDDEN;
extern BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret ) DECLSPEC_HIDDEN; extern BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret ) DECLSPEC_HIDDEN;
......
...@@ -1563,43 +1563,6 @@ static HKL get_locale_kbd_layout(void) ...@@ -1563,43 +1563,6 @@ static HKL get_locale_kbd_layout(void)
return (HKL)layout; return (HKL)layout;
} }
/***********************************************************************
* GetKeyboardLayoutName (X11DRV.@)
*/
static BOOL CDECL X11DRV_GetKeyboardLayoutName(LPWSTR name)
{
static const WCHAR formatW[] = {'%','0','8','x',0};
DWORD layout;
layout = HandleToUlong( get_locale_kbd_layout() );
if (HIWORD(layout) == LOWORD(layout)) layout = LOWORD(layout);
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
...@@ -1634,8 +1597,6 @@ void X11DRV_InitKeyboard( Display *display ) ...@@ -1634,8 +1597,6 @@ void X11DRV_InitKeyboard( Display *display )
}; };
int vkey_range; int vkey_range;
set_kbd_layout_preload_key();
EnterCriticalSection( &kbd_section ); EnterCriticalSection( &kbd_section );
XDisplayKeycodes(display, &min_keycode, &max_keycode); XDisplayKeycodes(display, &min_keycode, &max_keycode);
if (key_mapping) XFree( key_mapping ); if (key_mapping) XFree( key_mapping );
......
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