Skip to content

Fix for a mouse hook conflict with games which capture mouse inside their window#459

Draft
mezotaken wants to merge 3 commits into
mgth:masterfrom
mezotaken:mouse_capture_fix
Draft

Fix for a mouse hook conflict with games which capture mouse inside their window#459
mezotaken wants to merge 3 commits into
mgth:masterfrom
mezotaken:mouse_capture_fix

Conversation

@mezotaken

@mezotaken mezotaken commented Jun 14, 2026

Copy link
Copy Markdown

There have been quite a lot of issues created about this problem.
#439 #438 #411 #388 #363 #355 #327 #321 #302 #255 #221 #207 #195 #184 #163 #125 #97 #61
Whenever certain apps (mostly games) capture the mouse with their hook to prevent it from leaving the window, the LBM hook is starting to conflict with the game hook. Previously proposed solution with manually excluding processes was incredibly tedious, so i've found a way to incorporate this check into the LBM hook.

It works like this:
Any time user switches focus, an event fires in the LBM hook process. This was already present in the code, so I used it to make a deferred check (about a second later) if the focus didn't change still. So if it was stable for this second, we test if mouse was clipped by a virtual screen, which correlates with mouse capture from at least some UE games (i didn't test most of them yet, that would be great to see reports). So when we see that we have a stable window which clips your mouse area, we pause the daemon. Main reason for delay is that Windows processes the clipping slightly later than the refocus event itself, so the delay makes it much more robust.
Whenever we switch back and focus is again stable for a second, I unpause the hook, so the app can continue working.

There were difficulties with building the app completely from source, its UI project is a bit broken, but luckily anyone who wants this fixed without the merge and subsequent new release only needs LittleBigMouse.Hook.exe replaced in the installation folder.
https://github.com/mezotaken/LittleBigMouse/actions/runs/27840207182
Here's the version i've built on github actions with an artifact that contains fixed LittleBigMouse.Hook.exe file (it's in my fork since there is no permission to run workflows here for a first time contributor)

Feedback on effectiveness of this would be great. As soon as the upstream override will be fixed (HLab.Avalonia) so this repo could be built completely, this PR can be marked as ready for review.

@mezotaken mezotaken closed this Jun 14, 2026
@mezotaken mezotaken reopened this Jun 19, 2026
@mezotaken mezotaken force-pushed the mouse_capture_fix branch from a101817 to 15e8f56 Compare June 19, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant