Add Right Alt+C/V → Cmd+C/V mapping for Mac streaming - #573
Conversation
|
Thank you, but why not make right alt meta directly? |
Right Alt is often used with special characters in many languages, e.g., Polish R ALT+A gives ą, etc. So directly mapping it would be problematic for some. |
This is opt-in and disabled by default. The preference Right Alt as Command (Mac) must be explicitly enabled by the user. Polish and other international keyboard users are unaffected unless they choose to enable it. |
Done. Right Alt is now fully remapped to Command when the preference is enabled, not just for C/V. Any Right Alt+key combo (e.g. Right Alt+Z for Cmd+Z, Right Alt+Tab for Cmd+Tab) will work as expected. |
Summary
When streaming to a Mac via Sunshine, the Command key is not directly accessible from Android keyboards. This PR adds a preference that fully remaps the Right Alt key to Command for Mac streaming.
backAsMetapreference did not update the internal modifier state, causing subsequent keys to miss the Meta modifierHow it works
When Right Alt is pressed with the preference enabled:
handleSpecialKeys()intercepts the key event and sendsVK_LWIN(mapped to Command on macOS by Sunshine) instead ofVK_RMENUmodifierFlagsis updated withMODIFIER_METAinstead ofMODIFIER_ALTgetModifierState()is patched to suppressMODIFIER_ALTfrom Android's key event meta state when Right Alt is the only Alt held, preventing spurious Alt+Command combos from reaching the hostFiles changed
Game.java— Right Alt → Command remapping inhandleSpecialKeys(), modifier state fix ingetModifierState(),backAsMetamodifier flag fixPreferenceConfiguration.java— newrightAltAsMetapreference fieldpreferences.xml— newCheckBoxPreferenceentrystrings.xml— new preference title and summary strings