Commit 8c0d568c authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

user32: Notify the user driver of hotkey changes.

parent f78af0e0
...@@ -80,8 +80,10 @@ static const USER_DRIVER *load_driver(void) ...@@ -80,8 +80,10 @@ static const USER_DRIVER *load_driver(void)
GET_USER_FUNC(GetKeyboardLayoutName); GET_USER_FUNC(GetKeyboardLayoutName);
GET_USER_FUNC(LoadKeyboardLayout); GET_USER_FUNC(LoadKeyboardLayout);
GET_USER_FUNC(MapVirtualKeyEx); GET_USER_FUNC(MapVirtualKeyEx);
GET_USER_FUNC(RegisterHotKey);
GET_USER_FUNC(ToUnicodeEx); GET_USER_FUNC(ToUnicodeEx);
GET_USER_FUNC(UnloadKeyboardLayout); GET_USER_FUNC(UnloadKeyboardLayout);
GET_USER_FUNC(UnregisterHotKey);
GET_USER_FUNC(VkKeyScanEx); GET_USER_FUNC(VkKeyScanEx);
GET_USER_FUNC(CreateCursorIcon); GET_USER_FUNC(CreateCursorIcon);
GET_USER_FUNC(DestroyCursorIcon); GET_USER_FUNC(DestroyCursorIcon);
...@@ -193,6 +195,11 @@ static UINT CDECL nulldrv_MapVirtualKeyEx( UINT code, UINT type, HKL layout ) ...@@ -193,6 +195,11 @@ static UINT CDECL nulldrv_MapVirtualKeyEx( UINT code, UINT type, HKL layout )
return 0; 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, static INT CDECL nulldrv_ToUnicodeEx( UINT virt, UINT scan, const BYTE *state, LPWSTR str,
int size, UINT flags, HKL layout ) int size, UINT flags, HKL layout )
{ {
...@@ -204,6 +211,10 @@ static BOOL CDECL nulldrv_UnloadKeyboardLayout( HKL layout ) ...@@ -204,6 +211,10 @@ static BOOL CDECL nulldrv_UnloadKeyboardLayout( HKL layout )
return 0; return 0;
} }
static void CDECL nulldrv_UnregisterHotKey( HWND hwnd, UINT modifiers, UINT vk )
{
}
static SHORT CDECL nulldrv_VkKeyScanEx( WCHAR ch, HKL layout ) static SHORT CDECL nulldrv_VkKeyScanEx( WCHAR ch, HKL layout )
{ {
return -1; return -1;
...@@ -430,8 +441,10 @@ static USER_DRIVER null_driver = ...@@ -430,8 +441,10 @@ static USER_DRIVER null_driver =
nulldrv_GetKeyboardLayoutName, nulldrv_GetKeyboardLayoutName,
nulldrv_LoadKeyboardLayout, nulldrv_LoadKeyboardLayout,
nulldrv_MapVirtualKeyEx, nulldrv_MapVirtualKeyEx,
nulldrv_RegisterHotKey,
nulldrv_ToUnicodeEx, nulldrv_ToUnicodeEx,
nulldrv_UnloadKeyboardLayout, nulldrv_UnloadKeyboardLayout,
nulldrv_UnregisterHotKey,
nulldrv_VkKeyScanEx, nulldrv_VkKeyScanEx,
/* cursor/icon functions */ /* cursor/icon functions */
nulldrv_CreateCursorIcon, nulldrv_CreateCursorIcon,
...@@ -528,6 +541,11 @@ static UINT CDECL loaderdrv_MapVirtualKeyEx( UINT code, UINT type, HKL layout ) ...@@ -528,6 +541,11 @@ static UINT CDECL loaderdrv_MapVirtualKeyEx( UINT code, UINT type, HKL layout )
return load_driver()->pMapVirtualKeyEx( code, type, 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, static INT CDECL loaderdrv_ToUnicodeEx( UINT virt, UINT scan, const BYTE *state, LPWSTR str,
int size, UINT flags, HKL layout ) int size, UINT flags, HKL layout )
{ {
...@@ -539,6 +557,11 @@ static BOOL CDECL loaderdrv_UnloadKeyboardLayout( HKL layout ) ...@@ -539,6 +557,11 @@ static BOOL CDECL loaderdrv_UnloadKeyboardLayout( HKL layout )
return load_driver()->pUnloadKeyboardLayout( 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 ) static SHORT CDECL loaderdrv_VkKeyScanEx( WCHAR ch, HKL layout )
{ {
return load_driver()->pVkKeyScanEx( ch, layout ); return load_driver()->pVkKeyScanEx( ch, layout );
...@@ -765,8 +788,10 @@ static USER_DRIVER lazy_load_driver = ...@@ -765,8 +788,10 @@ static USER_DRIVER lazy_load_driver =
loaderdrv_GetKeyboardLayoutName, loaderdrv_GetKeyboardLayoutName,
loaderdrv_LoadKeyboardLayout, loaderdrv_LoadKeyboardLayout,
loaderdrv_MapVirtualKeyEx, loaderdrv_MapVirtualKeyEx,
loaderdrv_RegisterHotKey,
loaderdrv_ToUnicodeEx, loaderdrv_ToUnicodeEx,
loaderdrv_UnloadKeyboardLayout, loaderdrv_UnloadKeyboardLayout,
loaderdrv_UnregisterHotKey,
loaderdrv_VkKeyScanEx, loaderdrv_VkKeyScanEx,
/* cursor/icon functions */ /* cursor/icon functions */
loaderdrv_CreateCursorIcon, loaderdrv_CreateCursorIcon,
......
...@@ -984,10 +984,13 @@ UINT WINAPI GetKeyboardLayoutList(INT nBuff, HKL *layouts) ...@@ -984,10 +984,13 @@ UINT WINAPI GetKeyboardLayoutList(INT nBuff, HKL *layouts)
BOOL WINAPI RegisterHotKey(HWND hwnd,INT id,UINT modifiers,UINT vk) BOOL WINAPI RegisterHotKey(HWND hwnd,INT id,UINT modifiers,UINT vk)
{ {
BOOL ret; BOOL ret;
int replaced=0;
TRACE_(keyboard)("(%p,%d,0x%08x,%X)\n",hwnd,id,modifiers,vk); 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 ) SERVER_START_REQ( register_hotkey )
{ {
...@@ -995,11 +998,17 @@ BOOL WINAPI RegisterHotKey(HWND hwnd,INT id,UINT modifiers,UINT vk) ...@@ -995,11 +998,17 @@ BOOL WINAPI RegisterHotKey(HWND hwnd,INT id,UINT modifiers,UINT vk)
req->id = id; req->id = id;
req->flags = modifiers; req->flags = modifiers;
req->vkey = vk; 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; 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; return ret;
} }
...@@ -1010,6 +1019,7 @@ BOOL WINAPI RegisterHotKey(HWND hwnd,INT id,UINT modifiers,UINT vk) ...@@ -1010,6 +1019,7 @@ BOOL WINAPI RegisterHotKey(HWND hwnd,INT id,UINT modifiers,UINT vk)
BOOL WINAPI UnregisterHotKey(HWND hwnd,INT id) BOOL WINAPI UnregisterHotKey(HWND hwnd,INT id)
{ {
BOOL ret; BOOL ret;
UINT modifiers, vk;
TRACE_(keyboard)("(%p,%d)\n",hwnd,id); TRACE_(keyboard)("(%p,%d)\n",hwnd,id);
...@@ -1017,11 +1027,16 @@ BOOL WINAPI UnregisterHotKey(HWND hwnd,INT id) ...@@ -1017,11 +1027,16 @@ BOOL WINAPI UnregisterHotKey(HWND hwnd,INT id)
{ {
req->window = wine_server_user_handle( hwnd ); req->window = wine_server_user_handle( hwnd );
req->id = id; 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; SERVER_END_REQ;
/* FIXME: Unregister hotkey with user driver if necessary. */ if (ret)
USER_Driver->pUnregisterHotKey(hwnd, modifiers, vk);
return ret; return ret;
} }
......
...@@ -62,8 +62,10 @@ typedef struct tagUSER_DRIVER { ...@@ -62,8 +62,10 @@ typedef struct tagUSER_DRIVER {
BOOL (CDECL *pGetKeyboardLayoutName)(LPWSTR); BOOL (CDECL *pGetKeyboardLayoutName)(LPWSTR);
HKL (CDECL *pLoadKeyboardLayout)(LPCWSTR, UINT); HKL (CDECL *pLoadKeyboardLayout)(LPCWSTR, UINT);
UINT (CDECL *pMapVirtualKeyEx)(UINT, UINT, HKL); UINT (CDECL *pMapVirtualKeyEx)(UINT, UINT, HKL);
BOOL (CDECL *pRegisterHotKey)(HWND, UINT, UINT);
INT (CDECL *pToUnicodeEx)(UINT, UINT, const BYTE *, LPWSTR, int, UINT, HKL); INT (CDECL *pToUnicodeEx)(UINT, UINT, const BYTE *, LPWSTR, int, UINT, HKL);
BOOL (CDECL *pUnloadKeyboardLayout)(HKL); BOOL (CDECL *pUnloadKeyboardLayout)(HKL);
void (CDECL *pUnregisterHotKey)(HWND, UINT, UINT);
SHORT (CDECL *pVkKeyScanEx)(WCHAR, HKL); SHORT (CDECL *pVkKeyScanEx)(WCHAR, HKL);
/* cursor/icon functions */ /* cursor/icon functions */
void (CDECL *pCreateCursorIcon)(HCURSOR); void (CDECL *pCreateCursorIcon)(HCURSOR);
......
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