Skip to content

macos: move SagePatch window-snap off Ctrl+1..5 to stop shadowing control groups - #23

Open
shakhob22 wants to merge 1 commit into
ammaarreshi:mainfrom
shakhob22:fix/sagepatch-ctrl-number-conflict
Open

macos: move SagePatch window-snap off Ctrl+1..5 to stop shadowing control groups#23
shakhob22 wants to merge 1 commit into
ammaarreshi:mainfrom
shakhob22:fix/sagepatch-ctrl-number-conflict

Conversation

@shakhob22

Copy link
Copy Markdown

Summary

  • SagePatch's SDL_PollEvent interposer (Patches/SagePatch/src/macos/interposers_macos.cpp) consumes every keydown event it recognizes before it reaches the game engine.
  • KeyHandler.cpp bound its window-position presets to Ctrl+1..5, which is exactly the same chord Generals' native input layer uses for control-group create/select (CREATE_TEAM0..9 / SELECT_TEAM0..9 in MetaEvent.cpp).
  • Net effect: on this macOS/SDL3 port, Ctrl+1 through Ctrl+5 never reached the game — control groups were silently unusable for half the numpad row, since SagePatch swallowed the event and returned true (handled).
  • Moved the window-snap hotkeys to Alt+1..5 (SDL_KMOD_ALT) so both features coexist: Alt+1..5 for window position, Ctrl+<number> free for the game's own control-group bindings.
  • Updated the startup hotkey log line and the file header comment to match.

Why

Found this live while playtesting a fresh macOS build — RMB drag-scrolling worked but edge-scroll and control groups didn't feel right. Edge-scroll turned out to be a local Options.ini setting (ScreenEdgeScrollEnabledInWindowedApp, not part of this PR); control groups turned out to be this repo's own SagePatch QoL layer stepping on the engine's default keybinds.

Test plan

  • Rebuilt only the sage_patch CMake target (cmake --build build/macos-vulkan --target sage_patch) and redeployed libsage_patch.dylib.
  • Relaunched Zero Hour with the patch loaded via DYLD_INSERT_LIBRARIES; confirmed Alt+1..5 still snaps the window to each preset position.
  • Confirmed Ctrl+<number> now reaches the game and creates/selects control groups as expected.

…trol groups

SagePatch's SDL_PollEvent interposer consumed Ctrl+1..5 for its window
position presets before the game engine ever saw the event, silently
breaking Generals' native Ctrl+<number> control-group hotkeys (create/
select unit groups) in windowed mode. Moved window-snap to Alt+1..5 so
both features work without conflict.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

2 participants