From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winex11.drv/keyboard.c | 21 +++++++++++++++++++++ dlls/winex11.drv/x11drv.h | 4 ++++ dlls/winex11.drv/x11drv_main.c | 17 +++++++++++++++++ 3 files changed, 42 insertions(+)
diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c index f1ad4b01669..187979c4494 100644 --- a/dlls/winex11.drv/keyboard.c +++ b/dlls/winex11.drv/keyboard.c @@ -1089,6 +1089,27 @@ static const WORD xfree86_vendor_key_vkey[256] = 0, 0, 0, 0, 0, 0, 0, 0 /* 1008FFF8 */ };
+WCHAR *x11drv_get_keyboard_layout_list( DWORD *length ) +{ + WCHAR *tmp, *layouts = calloc( 1, sizeof(WCHAR) ); + int i; + + for (i = 0, *length = 1; main_key_tab[i].comment; i++) + { + const char *name = main_key_tab[i].comment; + int len = strlen( name ) + 1; + + if (!(tmp = realloc( layouts, (*length + len) * sizeof(WCHAR) ))) return layouts; + layouts = tmp; + + asciiz_to_unicode( layouts + *length - 1, name ); + layouts[*length + len - 1] = 0; + (*length) += len; + } + + return layouts; +} + static inline KeySym keycode_to_keysym( Display *display, KeyCode keycode, int index ) { #ifdef HAVE_XKB diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 4997367ce9a..21fd16a5393 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -709,6 +709,10 @@ extern BOOL xinerama_get_fullscreen_monitors( const RECT *rect, long *indices ) extern void xinerama_init( unsigned int width, unsigned int height ) DECLSPEC_HIDDEN; extern void init_recursive_mutex( pthread_mutex_t *mutex ) DECLSPEC_HIDDEN;
+/* keyboard.c */ + +extern WCHAR *x11drv_get_keyboard_layout_list( DWORD *size ) DECLSPEC_HIDDEN; + #define DEPTH_COUNT 3 extern const unsigned int *depths DECLSPEC_HIDDEN;
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index e04bdedd43a..66dbc3c8270 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -449,6 +449,19 @@ static HKEY create_hkcu_key( const char *name ) return reg_open_hkcu_key( name, TRUE ); }
+static BOOL set_reg_value( HKEY hkey, const WCHAR *name, UINT type, const void *value, DWORD count ) +{ + unsigned int name_size = name ? lstrlenW( name ) * sizeof(WCHAR) : 0; + UNICODE_STRING nameW = { name_size, name_size, (WCHAR *)name }; + return !NtSetValueKey( hkey, &nameW, 0, type, value, count ); +} + +static void set_reg_string_value( HKEY hkey, const char *name, const WCHAR *value, DWORD count ) +{ + WCHAR nameW[64]; + asciiz_to_unicode( nameW, name ); + set_reg_value( hkey, nameW, REG_MULTI_SZ, value, count ); +}
ULONG query_reg_value( HKEY hkey, const WCHAR *name, KEY_VALUE_PARTIAL_INFORMATION *info, ULONG size ) { @@ -567,6 +580,10 @@ static void setup_options(void) if (!get_config_key( hkey, appkey, "GrabFullscreen", buffer, sizeof(buffer) )) grab_fullscreen = IS_OPTION_TRUE( buffer[0] );
+ p = x11drv_get_keyboard_layout_list( &len ); + if (p) set_reg_string_value( hkey, "KeyboardLayoutList", p, len * sizeof(WCHAR) ); + free( p ); + if (!get_config_key( hkey, appkey, "ScreenDepth", buffer, sizeof(buffer) )) default_visual.depth = wcstol( buffer, NULL, 0 );