user32: Notify the user driver of hotkey changes.

This commit is contained in:
Vincent Povirk 2011-06-23 12:34:26 -05:00 committed by Alexandre Julliard
parent f78af0e046
commit 8c0d568c32
3 changed files with 47 additions and 5 deletions

View File

@ -80,8 +80,10 @@ static const USER_DRIVER *load_driver(void)
GET_USER_FUNC(GetKeyboardLayoutName);
GET_USER_FUNC(LoadKeyboardLayout);
GET_USER_FUNC(MapVirtualKeyEx);
GET_USER_FUNC(RegisterHotKey);
GET_USER_FUNC(ToUnicodeEx);
GET_USER_FUNC(UnloadKeyboardLayout);
GET_USER_FUNC(UnregisterHotKey);
GET_USER_FUNC(VkKeyScanEx);
GET_USER_FUNC(CreateCursorIcon);
GET_USER_FUNC(DestroyCursorIcon);
@ -193,6 +195,11 @@ static UINT CDECL nulldrv_MapVirtualKeyEx( UINT code, UINT type, HKL layout )
return 0;
}
static BOOL CDECL nulldrv_RegisterHotKey( HWND hwnd, UINT modifiers, UINT vk )
{
return TRUE;
}
static INT CDECL nulldrv_ToUnicodeEx( UINT virt, UINT scan, const BYTE *state, LPWSTR str,
int size, UINT flags, HKL layout )
{
@ -204,6 +211,10 @@ static BOOL CDECL nulldrv_UnloadKeyboardLayout( HKL layout )
return 0;
}
static void CDECL nulldrv_UnregisterHotKey( HWND hwnd, UINT modifiers, UINT vk )
{
}
static SHORT CDECL nulldrv_VkKeyScanEx( WCHAR ch, HKL layout )
{
return -1;
@ -430,8 +441,10 @@ static USER_DRIVER null_driver =
nulldrv_GetKeyboardLayoutName,
nulldrv_LoadKeyboardLayout,
nulldrv_MapVirtualKeyEx,
nulldrv_RegisterHotKey,
nulldrv_ToUnicodeEx,
nulldrv_UnloadKeyboardLayout,
nulldrv_UnregisterHotKey,
nulldrv_VkKeyScanEx,
/* cursor/icon functions */
nulldrv_CreateCursorIcon,
@ -528,6 +541,11 @@ static UINT CDECL loaderdrv_MapVirtualKeyEx( UINT code, UINT type, HKL layout )
return load_driver()->pMapVirtualKeyEx( code, type, layout );
}
static BOOL CDECL loaderdrv_RegisterHotKey( HWND hwnd, UINT modifiers, UINT vk )
{
return load_driver()->pRegisterHotKey( hwnd, modifiers, vk );
}
static INT CDECL loaderdrv_ToUnicodeEx( UINT virt, UINT scan, const BYTE *state, LPWSTR str,
int size, UINT flags, HKL layout )
{
@ -539,6 +557,11 @@ static BOOL CDECL loaderdrv_UnloadKeyboardLayout( HKL layout )
return load_driver()->pUnloadKeyboardLayout( layout );
}
static void CDECL loaderdrv_UnregisterHotKey( HWND hwnd, UINT modifiers, UINT vk )
{
load_driver()->pUnregisterHotKey( hwnd, modifiers, vk );
}
static SHORT CDECL loaderdrv_VkKeyScanEx( WCHAR ch, HKL layout )
{
return load_driver()->pVkKeyScanEx( ch, layout );
@ -765,8 +788,10 @@ static USER_DRIVER lazy_load_driver =
loaderdrv_GetKeyboardLayoutName,
loaderdrv_LoadKeyboardLayout,
loaderdrv_MapVirtualKeyEx,
loaderdrv_RegisterHotKey,
loaderdrv_ToUnicodeEx,
loaderdrv_UnloadKeyboardLayout,
loaderdrv_UnregisterHotKey,
loaderdrv_VkKeyScanEx,
/* cursor/icon functions */
loaderdrv_CreateCursorIcon,

View File

@ -984,10 +984,13 @@ UINT WINAPI GetKeyboardLayoutList(INT nBuff, HKL *layouts)
BOOL WINAPI RegisterHotKey(HWND hwnd,INT id,UINT modifiers,UINT vk)
{
BOOL ret;
int replaced=0;
TRACE_(keyboard)("(%p,%d,0x%08x,%X)\n",hwnd,id,modifiers,vk);
/* FIXME: Register hotkey with user driver. */
if ((hwnd == NULL || WIN_IsCurrentThread(hwnd)) &&
!USER_Driver->pRegisterHotKey(hwnd, modifiers, vk))
return FALSE;
SERVER_START_REQ( register_hotkey )
{
@ -995,11 +998,17 @@ BOOL WINAPI RegisterHotKey(HWND hwnd,INT id,UINT modifiers,UINT vk)
req->id = id;
req->flags = modifiers;
req->vkey = vk;
ret = !wine_server_call_err( req );
if ((ret = !wine_server_call_err( req )))
{
replaced = reply->replaced;
modifiers = reply->flags;
vk = reply->vkey;
}
}
SERVER_END_REQ;
/* FIXME: Unregister new or replaced hotkey with user driver if necessary. */
if (ret && replaced)
USER_Driver->pUnregisterHotKey(hwnd, modifiers, vk);
return ret;
}
@ -1010,6 +1019,7 @@ BOOL WINAPI RegisterHotKey(HWND hwnd,INT id,UINT modifiers,UINT vk)
BOOL WINAPI UnregisterHotKey(HWND hwnd,INT id)
{
BOOL ret;
UINT modifiers, vk;
TRACE_(keyboard)("(%p,%d)\n",hwnd,id);
@ -1017,11 +1027,16 @@ BOOL WINAPI UnregisterHotKey(HWND hwnd,INT id)
{
req->window = wine_server_user_handle( hwnd );
req->id = id;
ret = !wine_server_call_err( req );
if ((ret = !wine_server_call_err( req )))
{
modifiers = reply->flags;
vk = reply->vkey;
}
}
SERVER_END_REQ;
/* FIXME: Unregister hotkey with user driver if necessary. */
if (ret)
USER_Driver->pUnregisterHotKey(hwnd, modifiers, vk);
return ret;
}

View File

@ -62,8 +62,10 @@ typedef struct tagUSER_DRIVER {
BOOL (CDECL *pGetKeyboardLayoutName)(LPWSTR);
HKL (CDECL *pLoadKeyboardLayout)(LPCWSTR, UINT);
UINT (CDECL *pMapVirtualKeyEx)(UINT, UINT, HKL);
BOOL (CDECL *pRegisterHotKey)(HWND, UINT, UINT);
INT (CDECL *pToUnicodeEx)(UINT, UINT, const BYTE *, LPWSTR, int, UINT, HKL);
BOOL (CDECL *pUnloadKeyboardLayout)(HKL);
void (CDECL *pUnregisterHotKey)(HWND, UINT, UINT);
SHORT (CDECL *pVkKeyScanEx)(WCHAR, HKL);
/* cursor/icon functions */
void (CDECL *pCreateCursorIcon)(HCURSOR);