Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/user32/driver.c | 6 +++--- dlls/user32/input.c | 13 +++++++------ dlls/user32/user_private.h | 2 +- dlls/winemac.drv/keyboard.c | 10 +++++----- dlls/winex11.drv/keyboard.c | 13 ++++--------- 5 files changed, 20 insertions(+), 24 deletions(-)
diff --git a/dlls/user32/driver.c b/dlls/user32/driver.c index efaa04db096..daba4bb7c01 100644 --- a/dlls/user32/driver.c +++ b/dlls/user32/driver.c @@ -187,9 +187,9 @@ void USER_unload_driver(void) * These are fallbacks for entry points that are not implemented in the real driver. */
-static HKL CDECL nulldrv_ActivateKeyboardLayout( HKL layout, UINT flags ) +static BOOL CDECL nulldrv_ActivateKeyboardLayout( HKL layout, UINT flags ) { - return (HKL)~0; /* use default implementation */ + return TRUE; }
static void CDECL nulldrv_Beep(void) @@ -487,7 +487,7 @@ static USER_DRIVER null_driver = * Each entry point simply loads the real driver and chains to it. */
-static HKL CDECL loaderdrv_ActivateKeyboardLayout( HKL layout, UINT flags ) +static BOOL CDECL loaderdrv_ActivateKeyboardLayout( HKL layout, UINT flags ) { return load_driver()->pActivateKeyboardLayout( layout, flags ); } diff --git a/dlls/user32/input.c b/dlls/user32/input.c index 8e5ab91baf3..8436347b0b0 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -1330,13 +1330,14 @@ HKL WINAPI ActivateKeyboardLayout( HKL layout, UINT flags ) return 0; }
- if ((old_layout = USER_Driver->pActivateKeyboardLayout( layout, flags )) != (HKL)~0) - { - if (old_layout) info->kbd_layout = layout; - return old_layout; - } + if (!USER_Driver->pActivateKeyboardLayout( layout, flags )) + return 0;
- return get_locale_kbd_layout(); + old_layout = info->kbd_layout; + info->kbd_layout = layout; + + if (!old_layout) return get_locale_kbd_layout(); + return old_layout; }
/********************************************************************** diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index 7ac65a34db3..e568054165a 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -62,7 +62,7 @@ enum wine_internal_message
typedef struct tagUSER_DRIVER { /* keyboard functions */ - HKL (CDECL *pActivateKeyboardLayout)(HKL, UINT); + BOOL (CDECL *pActivateKeyboardLayout)(HKL, UINT); void (CDECL *pBeep)(void); INT (CDECL *pGetKeyNameText)(LONG, LPWSTR, INT); HKL (CDECL *pGetKeyboardLayout)(DWORD); diff --git a/dlls/winemac.drv/keyboard.c b/dlls/winemac.drv/keyboard.c index 0648b00a4f1..300bc84d664 100644 --- a/dlls/winemac.drv/keyboard.c +++ b/dlls/winemac.drv/keyboard.c @@ -1163,16 +1163,16 @@ void macdrv_process_text_input(UINT vkey, UINT scan, UINT repeat, const BYTE *ke /*********************************************************************** * ActivateKeyboardLayout (MACDRV.@) */ -HKL CDECL macdrv_ActivateKeyboardLayout(HKL hkl, UINT flags) +BOOL CDECL macdrv_ActivateKeyboardLayout(HKL hkl, UINT flags) { - HKL oldHkl = 0; + BOOL ret = FALSE; struct macdrv_thread_data *thread_data = macdrv_init_thread_data(); struct layout *layout;
TRACE("hkl %p flags %04x\n", hkl, flags);
if (hkl == thread_data->active_keyboard_layout) - return hkl; + return TRUE;
EnterCriticalSection(&layout_list_section); update_layout_list(); @@ -1183,7 +1183,7 @@ HKL CDECL macdrv_ActivateKeyboardLayout(HKL hkl, UINT flags) { if (macdrv_select_input_source(layout->input_source)) { - oldHkl = thread_data->active_keyboard_layout; + ret = TRUE; if (thread_data->keyboard_layout_uchr) CFRelease(thread_data->keyboard_layout_uchr);
@@ -1199,7 +1199,7 @@ HKL CDECL macdrv_ActivateKeyboardLayout(HKL hkl, UINT flags) } LeaveCriticalSection(&layout_list_section);
- return oldHkl; + return ret; }
diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c index d583c8588cd..228dba0f8b2 100644 --- a/dlls/winex11.drv/keyboard.c +++ b/dlls/winex11.drv/keyboard.c @@ -1930,9 +1930,8 @@ BOOL CDECL X11DRV_UnloadKeyboardLayout(HKL hkl) /*********************************************************************** * ActivateKeyboardLayout (X11DRV.@) */ -HKL CDECL X11DRV_ActivateKeyboardLayout(HKL hkl, UINT flags) +BOOL CDECL X11DRV_ActivateKeyboardLayout(HKL hkl, UINT flags) { - HKL oldHkl = 0; struct x11drv_thread_data *thread_data = x11drv_init_thread_data();
FIXME("%p, %04x: semi-stub!\n", hkl, flags); @@ -1940,22 +1939,18 @@ HKL CDECL X11DRV_ActivateKeyboardLayout(HKL hkl, UINT flags) { SetLastError(ERROR_CALL_NOT_IMPLEMENTED); FIXME("KLF_SETFORPROCESS not supported\n"); - return 0; + return FALSE; }
if (!match_x11_keyboard_layout(hkl)) { SetLastError(ERROR_CALL_NOT_IMPLEMENTED); FIXME("setting keyboard of different locales not supported\n"); - return 0; + return FALSE; }
- oldHkl = thread_data->kbd_layout; - if (!oldHkl) oldHkl = get_locale_kbd_layout(); - thread_data->kbd_layout = hkl; - - return oldHkl; + return TRUE; }