Add mouse button (M3/M4/M5) support for client cycling and minimize-all - #135
Open
SiegEPS wants to merge 3 commits into
Open
Add mouse button (M3/M4/M5) support for client cycling and minimize-all#135SiegEPS wants to merge 3 commits into
SiegEPS wants to merge 3 commits into
Conversation
Cycle hotkeys previously used RegisterHotKey, which is keyboard-only. Add a shared low-level mouse hook (WH_MOUSE_LL) so the middle button and side buttons M4/M5 - with optional Control/Shift/Alt modifiers - can trigger the cycle groups and minimize-all. Mouse buttons share the existing CycleGroupNForward/BackwardHotkeys and MinimizeAllClientsHotkeys config lists; tokens like M5 or Control+M4 are routed to the hook while keyboard tokens still use RegisterHotKey. Only bound buttons are swallowed, so unbound clicks pass through.
Windows refuses SetForegroundWindow from a process that did not receive the last input event, so cycling triggered by the global mouse hook only flashed the target's taskbar button instead of activating it. Attach to the foreground window's input thread before SetForegroundWindow to gain the right to change the foreground, then detach. Paths that already hold that right (thumbnail click, keyboard hotkey) are unaffected.
The mouse hook invoked the cycle action (CycleNextClient -> ForceSetForegroundWindow: AttachThreadInput + SetForegroundWindow) directly inside the WH_MOUSE_LL callback, which runs on the system input path. Doing the foreground switch there could wedge the target window's input queue, leaving the EVE client unresponsive until the foreground state was reset by other means. Capture the UI SynchronizationContext when the hook is installed and post the cycle action to it, so the work runs in the normal message pump - exactly like the keyboard hotkey (WM_HOTKEY) path, which never exhibited the hang. The hook now returns immediately after swallowing the bound button.
Collaborator
|
@SiegEPS not ignoring this! |
Author
|
Sure, you are having that problem even after the most recent commit? I haven't seen it but can test more. |
Collaborator
|
OOo will pull that in and see :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds the middle mouse button (M3) and side buttons M4/M5 - with optional
Control/Shift/Alt modifiers - as triggers for the cycle groups and
Minimize-All, alongside the existing keyboard hotkeys.
How
MouseHookHandler/MouseHookNativeMethods: a single sharedlow-level mouse hook (
WH_MOUSE_LL) with a small binding registry,exact-modifier matching, and bound-button swallowing (unbound buttons
pass through).
ThumbnailManagerroutes mouse tokens to the hook and keyboard tokensto
RegisterHotKey, reusing the existingCycleGroupNForward/Backwardand
MinimizeAllClientsconfig lists (tokens likeM5,Control+M4).WindowManager.ActivateWindowusesAttachThreadInputso hook-triggeredactivation can change the foreground window (Windows otherwise refuses it
from a background context).
Config
Mouse tokens go in the existing hotkey lists, e.g.:
"CycleGroup1ForwardHotkeys": [ "F14", "M5", "Control+M5" ]Accepts
M3/Middle/MButton,M4/Mouse4/XButton1,M5/Mouse5/XButton2.Testing
Builds clean on both Windows and Linux targets. Verified live with real
EVE clients and in isolation (forward/back cycling switches the actual
foreground window; unbound buttons pass through). README docs added.