mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 01:24:38 +00:00
- Support for window-less hotkeys.
- Send hotkeys even if there's no focus window. svn path=/trunk/; revision=9488
This commit is contained in:
parent
e58206820b
commit
6368fbd7a8
2 changed files with 51 additions and 49 deletions
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: hotkey.c,v 1.9 2004/05/10 17:07:18 weiden Exp $
|
||||
/* $Id: hotkey.c,v 1.10 2004/05/25 15:52:44 navaraf Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -210,20 +210,30 @@ NtUserRegisterHotKey(HWND hWnd,
|
|||
PHOT_KEY_ITEM HotKeyItem;
|
||||
PWINDOW_OBJECT Window;
|
||||
PWINSTATION_OBJECT WinStaObject = NULL;
|
||||
PETHREAD HotKeyThread;
|
||||
|
||||
Window = IntGetWindowObject(hWnd);
|
||||
if(!Window)
|
||||
if (hWnd == NULL)
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
|
||||
return FALSE;
|
||||
HotKeyThread = PsGetCurrentThread();
|
||||
}
|
||||
else
|
||||
{
|
||||
Window = IntGetWindowObject(hWnd);
|
||||
if(!Window)
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
HotKeyThread = Window->OwnerThread;
|
||||
IntReleaseWindowObject(Window);
|
||||
}
|
||||
|
||||
|
||||
if(Window->OwnerThread->ThreadsProcess && Window->OwnerThread->ThreadsProcess->Win32Process)
|
||||
WinStaObject = Window->OwnerThread->ThreadsProcess->Win32Process->WindowStation;
|
||||
if(HotKeyThread->ThreadsProcess && HotKeyThread->ThreadsProcess->Win32Process)
|
||||
WinStaObject = HotKeyThread->ThreadsProcess->Win32Process->WindowStation;
|
||||
|
||||
if(!WinStaObject)
|
||||
{
|
||||
IntReleaseWindowObject(Window);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -233,7 +243,6 @@ NtUserRegisterHotKey(HWND hWnd,
|
|||
if (IsHotKey (WinStaObject, fsModifiers, vk))
|
||||
{
|
||||
IntUnLockHotKeys(WinStaObject);
|
||||
IntReleaseWindowObject(Window);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -241,11 +250,10 @@ NtUserRegisterHotKey(HWND hWnd,
|
|||
if (HotKeyItem == NULL)
|
||||
{
|
||||
IntUnLockHotKeys(WinStaObject);
|
||||
IntReleaseWindowObject(Window);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
HotKeyItem->Thread = PsGetCurrentThread();
|
||||
HotKeyItem->Thread = HotKeyThread;
|
||||
HotKeyItem->hWnd = hWnd;
|
||||
HotKeyItem->id = id;
|
||||
HotKeyItem->fsModifiers = fsModifiers;
|
||||
|
@ -256,7 +264,6 @@ NtUserRegisterHotKey(HWND hWnd,
|
|||
|
||||
IntUnLockHotKeys(WinStaObject);
|
||||
|
||||
IntReleaseWindowObject(Window);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: input.c,v 1.33 2004/05/14 23:57:32 weiden Exp $
|
||||
/* $Id: input.c,v 1.34 2004/05/25 15:52:45 navaraf Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -30,12 +30,8 @@
|
|||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <w32k.h>
|
||||
|
||||
#include <rosrtl/string.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
||||
#define ENABLEMOUSEGDICALLBACK 1
|
||||
|
@ -238,14 +234,24 @@ KeyboardThreadMain(PVOID StartContext)
|
|||
lParam |= (1 << 29);
|
||||
}
|
||||
|
||||
if(KeyEvent.bKeyDown && (fsModifiers & MOD_ALT))
|
||||
msg.message = WM_SYSKEYDOWN;
|
||||
else if(KeyEvent.bKeyDown)
|
||||
msg.message = WM_KEYDOWN;
|
||||
else if(fsModifiers & MOD_ALT)
|
||||
msg.message = WM_SYSKEYUP;
|
||||
else
|
||||
msg.message = WM_KEYUP;
|
||||
if (GetHotKey(InputWindowStation,
|
||||
fsModifiers,
|
||||
KeyEvent.wVirtualKeyCode,
|
||||
&Thread,
|
||||
&hWnd,
|
||||
&id))
|
||||
{
|
||||
if (KeyEvent.bKeyDown)
|
||||
{
|
||||
DPRINT("Hot key pressed (hWnd %lx, id %d)\n", hWnd, id);
|
||||
MsqPostHotKeyMessage (Thread,
|
||||
hWnd,
|
||||
(WPARAM)id,
|
||||
MAKELPARAM((WORD)fsModifiers,
|
||||
(WORD)msg.wParam));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Find the target thread whose locale is in effect */
|
||||
if (!IntGetScreenDC())
|
||||
|
@ -259,6 +265,15 @@ KeyboardThreadMain(PVOID StartContext)
|
|||
|
||||
if (!FocusQueue) continue;
|
||||
|
||||
if(KeyEvent.bKeyDown && (fsModifiers & MOD_ALT))
|
||||
msg.message = WM_SYSKEYDOWN;
|
||||
else if(KeyEvent.bKeyDown)
|
||||
msg.message = WM_KEYDOWN;
|
||||
else if(fsModifiers & MOD_ALT)
|
||||
msg.message = WM_SYSKEYUP;
|
||||
else
|
||||
msg.message = WM_KEYUP;
|
||||
|
||||
msg.wParam = KeyEvent.wVirtualKeyCode;
|
||||
msg.lParam = lParam;
|
||||
msg.hwnd = FocusQueue->FocusWindow;
|
||||
|
@ -274,30 +289,10 @@ KeyboardThreadMain(PVOID StartContext)
|
|||
else
|
||||
continue;
|
||||
|
||||
if (GetHotKey(InputWindowStation,
|
||||
fsModifiers,
|
||||
msg.wParam,
|
||||
&Thread,
|
||||
&hWnd,
|
||||
&id))
|
||||
{
|
||||
if (KeyEvent.bKeyDown)
|
||||
{
|
||||
DPRINT("Hot key pressed (hWnd %lx, id %d)\n", hWnd, id);
|
||||
MsqPostHotKeyMessage (Thread,
|
||||
hWnd,
|
||||
(WPARAM)id,
|
||||
MAKELPARAM((WORD)fsModifiers,
|
||||
(WORD)msg.wParam));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Post a keyboard message.
|
||||
*/
|
||||
MsqPostKeyboardMessage(msg.message,msg.wParam,msg.lParam);
|
||||
}
|
||||
/*
|
||||
* Post a keyboard message.
|
||||
*/
|
||||
MsqPostKeyboardMessage(msg.message,msg.wParam,msg.lParam);
|
||||
}
|
||||
DPRINT( "KeyboardInput Thread Stopped...\n" );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue