Now detaching hook thread after event processing. This may fix

problems with the Alt key being synthetically down when using
the back and forward bindings on a mouse with extra buttons.
This commit is contained in:
crs 2004-10-27 21:38:05 +00:00
parent 4d7d2c618f
commit 0ff6cdf5b1
1 changed files with 22 additions and 6 deletions

View File

@ -185,10 +185,8 @@ keyboardGetState(BYTE keys[256])
static static
bool bool
keyboardHookHandler(WPARAM wParam, LPARAM lParam) doKeyboardHookHandler(WPARAM wParam, LPARAM lParam)
{ {
attachThreadToForeground();
// check for dead keys. we don't forward those to our window. // check for dead keys. we don't forward those to our window.
// instead we'll leave the key in the keyboard layout (a buffer // instead we'll leave the key in the keyboard layout (a buffer
// internal to the system) for translation when the next key is // internal to the system) for translation when the next key is
@ -416,14 +414,22 @@ keyboardHookHandler(WPARAM wParam, LPARAM lParam)
return false; return false;
} }
static
bool
keyboardHookHandler(WPARAM wParam, LPARAM lParam)
{
attachThreadToForeground();
bool result = doKeyboardHookHandler(wParam, lParam);
detachThread();
return result;
}
#endif #endif
static static
bool bool
mouseHookHandler(WPARAM wParam, SInt32 x, SInt32 y, SInt32 data) doMouseHookHandler(WPARAM wParam, SInt32 x, SInt32 y, SInt32 data)
{ {
attachThreadToForeground();
switch (wParam) { switch (wParam) {
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
case WM_MBUTTONDOWN: case WM_MBUTTONDOWN:
@ -522,6 +528,16 @@ mouseHookHandler(WPARAM wParam, SInt32 x, SInt32 y, SInt32 data)
return false; return false;
} }
static
bool
mouseHookHandler(WPARAM wParam, SInt32 x, SInt32 y, SInt32 data)
{
attachThreadToForeground();
bool result = doMouseHookHandler(wParam, x, y, data);
detachThread();
return result;
}
#if !NO_GRAB_KEYBOARD #if !NO_GRAB_KEYBOARD
static static
LRESULT CALLBACK LRESULT CALLBACK