mirror of
https://github.com/debauchee/barrier.git
synced 2024-12-26 12:41:35 +03:00
Reverted change to detach threads in hook DLL. It was breaking
double clicking.
This commit is contained in:
parent
65a86cb13b
commit
f10ef9a97c
@ -121,6 +121,16 @@ int _fltused=0;
|
|||||||
|
|
||||||
static
|
static
|
||||||
void
|
void
|
||||||
|
detachThread()
|
||||||
|
{
|
||||||
|
if (g_attachedThread != 0 && g_hookThread != g_attachedThread) {
|
||||||
|
AttachThreadInput(g_hookThread, g_attachedThread, FALSE);
|
||||||
|
g_attachedThread = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
bool
|
||||||
attachThreadToForeground()
|
attachThreadToForeground()
|
||||||
{
|
{
|
||||||
// only attach threads if using low level hooks. a low level hook
|
// only attach threads if using low level hooks. a low level hook
|
||||||
@ -135,26 +145,17 @@ attachThreadToForeground()
|
|||||||
// skip if no change
|
// skip if no change
|
||||||
if (g_attachedThread != threadID) {
|
if (g_attachedThread != threadID) {
|
||||||
// detach from previous thread
|
// detach from previous thread
|
||||||
if (g_attachedThread != 0 && g_attachedThread != g_hookThread) {
|
detachThread();
|
||||||
AttachThreadInput(g_hookThread, g_attachedThread, FALSE);
|
|
||||||
}
|
|
||||||
// attach to new thread
|
|
||||||
g_attachedThread = threadID;
|
|
||||||
if (g_attachedThread != 0 && g_attachedThread != g_hookThread) {
|
|
||||||
AttachThreadInput(g_hookThread, g_attachedThread, TRUE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
// attach to new thread
|
||||||
void
|
if (threadID != 0 && threadID != g_hookThread) {
|
||||||
detachThread()
|
AttachThreadInput(g_hookThread, threadID, TRUE);
|
||||||
{
|
g_attachedThread = threadID;
|
||||||
if (g_attachedThread != 0) {
|
|
||||||
AttachThreadInput(g_hookThread, g_attachedThread, FALSE);
|
|
||||||
g_attachedThread = 0;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !NO_GRAB_KEYBOARD
|
#if !NO_GRAB_KEYBOARD
|
||||||
@ -420,9 +421,7 @@ bool
|
|||||||
keyboardHookHandler(WPARAM wParam, LPARAM lParam)
|
keyboardHookHandler(WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
attachThreadToForeground();
|
attachThreadToForeground();
|
||||||
bool result = doKeyboardHookHandler(wParam, lParam);
|
return doKeyboardHookHandler(wParam, lParam);
|
||||||
detachThread();
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -533,9 +532,7 @@ bool
|
|||||||
mouseHookHandler(WPARAM wParam, SInt32 x, SInt32 y, SInt32 data)
|
mouseHookHandler(WPARAM wParam, SInt32 x, SInt32 y, SInt32 data)
|
||||||
{
|
{
|
||||||
attachThreadToForeground();
|
attachThreadToForeground();
|
||||||
bool result = doMouseHookHandler(wParam, x, y, data);
|
return doMouseHookHandler(wParam, x, y, data);
|
||||||
detachThread();
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !NO_GRAB_KEYBOARD
|
#if !NO_GRAB_KEYBOARD
|
||||||
|
Loading…
Reference in New Issue
Block a user