winkeybd.h

winkeyhook.c
Make keyhook feature work in multiwindowmode too Hook windows keys
This commit is contained in:
Alexander Gottwald 2005-01-10 13:13:08 +00:00
parent f417159e51
commit 57387e115c
4 changed files with 15 additions and 8 deletions

View File

@ -1,3 +1,11 @@
2005-01-10 Alexander Gottwald <ago at freedesktop dot org>
* winkeybd.h
* winkeyhook.c
* winwndproc.c:
Make keyhook feature work in multiwindowmode too
Hook windows keys
2005-01-08 Alexander Gottwald <ago at freedesktop dot org> 2005-01-08 Alexander Gottwald <ago at freedesktop dot org>
* winblock.c: * winblock.c:

View File

@ -140,9 +140,9 @@ g_iKeyMap [] = {
/* 88 */ 0, 0, 0, /* 88 */ 0, 0, 0,
/* 89 */ 0, 0, 0, /* 89 */ 0, 0, 0,
/* 90 */ 0, 0, 0, /* 90 */ 0, 0, 0,
/* 91 */ 0, 0, 0, /* 91 */ VK_LWIN, KEY_LMeta, 0,
/* 92 */ 0, 0, 0, /* 92 */ VK_RWIN, KEY_RMeta, 0,
/* 93 */ 0, 0, 0, /* 93 */ VK_APPS, KEY_Menu, 0,
/* 94 */ 0, 0, 0, /* 94 */ 0, 0, 0,
/* 95 */ 0, 0, 0, /* 95 */ 0, 0, 0,
/* 96 */ 0, 0, 0, /* 96 */ 0, 0, 0,

View File

@ -65,6 +65,7 @@ winKeyboardMessageHookLL (int iCode, WPARAM wParam, LPARAM lParam)
{ {
BOOL fPassKeystroke = FALSE; BOOL fPassKeystroke = FALSE;
PKBDLLHOOKSTRUCT p = (PKBDLLHOOKSTRUCT) lParam; PKBDLLHOOKSTRUCT p = (PKBDLLHOOKSTRUCT) lParam;
HWND hwnd = GetActiveWindow();
/* Pass keystrokes on to our main message loop */ /* Pass keystrokes on to our main message loop */
if (iCode == HC_ACTION) if (iCode == HC_ACTION)
@ -79,9 +80,7 @@ winKeyboardMessageHookLL (int iCode, WPARAM wParam, LPARAM lParam)
case WM_KEYUP: case WM_SYSKEYUP: case WM_KEYUP: case WM_SYSKEYUP:
fPassKeystroke = fPassKeystroke =
((p->vkCode == VK_TAB) && ((p->flags & LLKHF_ALTDOWN) != 0)) ((p->vkCode == VK_TAB) && ((p->flags & LLKHF_ALTDOWN) != 0))
#if 0
|| (p->vkCode == VK_LWIN) || (p->vkCode == VK_RWIN) || (p->vkCode == VK_LWIN) || (p->vkCode == VK_RWIN)
#endif
; ;
break; break;
} }
@ -107,7 +106,7 @@ winKeyboardMessageHookLL (int iCode, WPARAM wParam, LPARAM lParam)
lParamKey = lParamKey | (0x80000000 & ((p->flags & LLKHF_UP) << 24)); lParamKey = lParamKey | (0x80000000 & ((p->flags & LLKHF_UP) << 24));
/* Send message to our main window that has the keyboard focus */ /* Send message to our main window that has the keyboard focus */
PostMessage (g_hwndKeyboardFocus, PostMessage (hwnd,
(UINT) wParam, (UINT) wParam,
(WPARAM) p->vkCode, (WPARAM) p->vkCode,
lParamKey); lParamKey);

View File

@ -1013,7 +1013,7 @@ winWindowProc (HWND hwnd, UINT message,
* be returned to Windows. We may be able to trap the Windows keys, * be returned to Windows. We may be able to trap the Windows keys,
* but we should determine if that is desirable before doing so. * but we should determine if that is desirable before doing so.
*/ */
if (wParam == VK_LWIN || wParam == VK_RWIN) if ((wParam == VK_LWIN || wParam == VK_RWIN) && !g_fKeyboardHookLL)
break; break;
#ifdef XKB #ifdef XKB
@ -1054,7 +1054,7 @@ winWindowProc (HWND hwnd, UINT message,
* be returned to Windows. We may be able to trap the Windows keys, * be returned to Windows. We may be able to trap the Windows keys,
* but we should determine if that is desirable before doing so. * but we should determine if that is desirable before doing so.
*/ */
if (wParam == VK_LWIN || wParam == VK_RWIN) if ((wParam == VK_LWIN || wParam == VK_RWIN) && !g_fKeyboardHookLL)
break; break;
/* Ignore the fake Ctrl_L that follows an AltGr release */ /* Ignore the fake Ctrl_L that follows an AltGr release */