Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions C#/AutoHotInterception/Manager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -672,8 +672,15 @@ private void DoPoll(object sender, EventArgs e)
// Pass the key through to the OS.
ManagedWrapper.Send(_deviceContext, i, ref stroke, 1);

// If we are processing Context Mode, then Unset the context variable after sending the key
if (!hasSubscription && hasContext) _contextCallbacks[i](0);
if (!hasSubscription && hasContext)
{
// Wait for polling. This is a fix for context mode failing sometimes.
// There is a race condition for the Context Mode state, this fixes that.
Thread.Sleep(1);

// If we are processing Context Mode, then Unset the context variable after sending the key
_contextCallbacks[i](0);
}
}
}

Expand Down Expand Up @@ -889,6 +896,7 @@ private void DoPoll(object sender, EventArgs e)
// Context Mode - forward stroke with context wrapping
_contextCallbacks[i](1);
ManagedWrapper.Send(_deviceContext, i, ref stroke, 1);
Thread.Sleep(1);
_contextCallbacks[i](0);
}
else
Expand Down
1 change: 0 additions & 1 deletion Lib/AutoHotInterception.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ class AutoHotInterception {
}

OnContextCallback(state) {
Sleep 0
this.IsActive := state
}
}
Expand Down