fix: Use typed GCController properties for macOS system button mapping#96
Open
gnarhard wants to merge 7 commits intoflame-engine:mainfrom
Open
fix: Use typed GCController properties for macOS system button mapping#96gnarhard wants to merge 7 commits intoflame-engine:mainfrom
gnarhard wants to merge 7 commits intoflame-engine:mainfrom
Conversation
spydon
reviewed
Apr 3, 2026
packages/gamepads_darwin/macos/Classes/GamepadsDarwinPlugin.swift
Outdated
Show resolved
Hide resolved
lea108
reviewed
Apr 3, 2026
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
On macOS, the DualSense (PS5) controller's Options button incorrectly maps to
GamepadButton.backinstead ofGamepadButton.start, and the touchpad clickis silently dropped.
The root cause is that the macOS native plugin identifies buttons by
GCControllerElement.sfSymbolsName, which is ambiguous across controllertypes — both DualSense system buttons report
capsule.portrait, making themindistinguishable. The iOS plugin already avoids this by using typed
GCExtendedGamepadproperties (gamepad.buttonMenu,gamepad.buttonOptions)with fixed key names.
This PR aligns the macOS plugin with the iOS approach for system buttons and
adds touchpad click support.
Changes
gamepads_darwin(Swift)getFixedKey()that matches elements against typedGCExtendedGamepadproperties (
buttonMenu,buttonOptions,buttonHome) andGCDualSenseGamepad/GCDualShockGamepadtouchpadButton, returningunambiguous key names. Falls back to SF Symbol names for all other elements.
gamepads(Dart)GamepadButton.touchpadenum variant.MacosMapping:buttonMenu→start,buttonOptions→back,buttonHome→home,touchpadButton→touchpad.Raw event log (before fix)
Options button — expected: start, got: back
GamepadButton.back = 1.0 (raw: capsule.portrait 1.0)
Touchpad click — unmapped, silently dropped
[unmapped] button: plus.rectangle = 1.0
Test plan
melos run analyze— zero issues across all 9 packagesflutter test— all 79 tests pass (including new mapping tests)flutter build macos— Swift compiles cleanly