user32: Factor ActivateKeyboardLayout previous layout logic.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
db901b91ef
commit
da9fc41814
|
@ -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 );
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue