Repository navigation
feat: let shortcuts use the middle and side mouse buttons and the scroll wheel - #41
Merged
Merged
Conversation
…oll wheel Middle click, Mouse 4, Mouse 5, scroll up and scroll down can be recorded for any shortcut, with or without Ctrl, Alt or Shift. Windows cannot register a mouse button as a hotkey, so these are observed through raw input like plain keys: the click or scroll still reaches the game. They only act while a FourFold window is in front, and the mouse is only listened to while a mouse shortcut is bound. Left and right click stay unavailable.
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.
Shortcuts can now be bound to mouse input as well as keys, in Settings → Shortcuts and in the Timer plugin's settings.
What you can record
Shift+Scroll downorCtrl+Middle click.How they behave
How it is stored
Mouse inputs reuse the existing shortcut fields. The buttons use their Windows virtual-key codes (0x04 to 0x06) and the wheel directions sit just past the keyboard range (0x100, 0x101), so the settings format, duplicate detection and the registration code need no structural change. An older version reading such a file treats the value as invalid and falls back to that shortcut's default.
Changes
GlobalHotkeyChord: accepts the five mouse inputs.IsPlainKeybecomesIsObserved, which is also true for a mouse input with modifiers.PlainKeyShortcutMatcher: an exact match fires when it is an observed shortcut; otherwise a shortcut bound without modifiers fires as before.RawKeyboardListeneris renamedRawInputListener. It now also decodes raw mouse buttons and the wheel, switches the mouse on and off on request, and reports each input through a callback.MainWindow: routes mouse inputs through the same matcher, with the foreground check.ShortcutCapture,ShortcutText,SettingsDialog,TimerSettingsPage: record and display the new inputs.F5 stays reserved for reloading a game panel; the key rules are unchanged.
Tests
dotnet test src/FourFoldAccountManager.Core.Tests: 323 passed.dotnet test src/FourFoldAccountManager.Desktop.Tests: 37 passed.Also checked with a one-off probe that injected a real wheel notch each way into a window using the listener: nothing arrived with the mouse switched off, and both directions decoded correctly once it was on. Recording and live firing over a game panel were then tried by hand in a build of this branch.
Worth knowing
Ctrl+Scrollas a shortcut also zooms the game panel, because the scroll still reaches the browser view. Alt or Shift with the wheel avoids that.Merging publishes a client release, since this touches
src/.