macOS input improvements: control groups, Cmd-as-Ctrl, trackpad camera pan#22
Open
redbeard wants to merge 4 commits into
Open
macOS input improvements: control groups, Cmd-as-Ctrl, trackpad camera pan#22redbeard wants to merge 4 commits into
redbeard wants to merge 4 commits into
Conversation
SDL3 has no DirectInput-style KEY_LOST, so modifier key-up events swallowed while unfocused (Cmd-Tab, Mission Control) left Alt/Ctrl stuck down and silently broke modifier hotkeys. Mirror the Win32 device-loss path by calling resetKeys() on SDL_EVENT_WINDOW_FOCUS_GAINED, and guard refreshAltKeys() against focus events arriving before the message stream exists. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
SagePatch's SDL_PollEvent interposer consumed Ctrl+1..5 for window snapping, which silently swallowed the game's control-group assignment hotkeys on every launch that loads the patch. Cmd+Option+number is unbound in the game (Cmd now acts as Ctrl in-game, so bare Cmd+number must stay free for control groups too). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Cmd+1..0 now assigns/uses control groups just like Ctrl+1..0, and Cmd works for every other Ctrl combo (force attack, etc). The physical Ctrl key keeps working unchanged. macOS only: on Linux the GUI scancode is the desktop's Super key and stays unmapped. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Trackpad scrolls are distinguished from mouse-wheel notches by their precise fractional deltas and horizontal axis (with a 300ms latch for mid-gesture whole-number ticks), un-flipped per SDL's natural-scrolling direction flag, and carried as two extra arguments on the existing MSG_RAW_MOUSE_WHEEL message so UI listbox scrolling keeps working. LookAtXlat pans via userScrollBy using the same magnitude convention and speed options as the other scroll modes; Alt/Option + scroll zooms, since a trackpad has no discrete wheel, and real mouse wheels keep the classic zoom. Horizontal-only pan events skip the window manager so it does not misread zero vertical spin as a wheel-down. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
Four related macOS input fixes and features, found while chasing why Ctrl+number control groups were dead on Mac:
SDL_PollEventinterposer consumed Ctrl+1..5 for window snapping, silently swallowing the game's control-group hotkeys on everyrun.shlaunch (the dev run script doesn't load SagePatch, which made the bug look intermittent). Snap now lives on Cmd+Option+1..5.KEY_LOST, so modifier key-ups swallowed while Cmd-Tabbed away left Alt/Ctrl stuck down. Mirrors the Win32 device-loss reset.Testing
CREATE_TEAMmessages), trackpad pan verified in-game in all four directions, mouse-free zoom via Option+scroll, menus still scroll.GeneralsXZHandGeneralsXtargets build clean; shared Core changes keep the extra wheel-message arguments invisible to consumers that read only the first three.🤖 Generated with Claude Code