Skip to content

wxBackend: AltGr (Right Alt) character input on macOS and Linux#3384

Open
stpork wants to merge 3 commits into
elfmz:masterfrom
stpork:feature-alt-gr
Open

wxBackend: AltGr (Right Alt) character input on macOS and Linux#3384
stpork wants to merge 3 commits into
elfmz:masterfrom
stpork:feature-alt-gr

Conversation

@stpork

@stpork stpork commented May 6, 2026

Copy link
Copy Markdown
Contributor

Adds a "Use Right Alt as AltGr" toggle in System Settings -> Input settings. Default off preserves existing Right-Alt-as-Alt-modifier behavior. When on, Right Alt produces the keyboard layout's AltGr glyphs (e.g. R-Alt+2 = '@' on Finnish/Swedish layouts).

Engages composing mode in KeyTracker on Right Alt (raw kVK_RightOption on Mac; ISO_Level3_Shift / XF86 ALTGR on X11/Wayland). In OnKeyDown, printable keys are routed to OnChar so the layout can translate; in OnChar, the Alt (and on Linux also Ctrl, synthesized by X11 from AltGr) modifier bits are stripped so far2l types the character instead of firing an Alt+key binding. Non-printable keys keep Alt+key behavior.

Setting is plumbed through Opt.UseRightAltAsAltGr and the existing ConfigOpt machinery; the runtime flag lives in WinPort (APIOther.cpp) with default-visibility exports so the dynamically-loaded backend resolves the symbol against the bundle_loader executable.

Bugs:

image

Adds a "Use Right Alt as AltGr" toggle in System Settings -> Input
settings. Default off preserves existing Right-Alt-as-Alt-modifier
behavior. When on, Right Alt produces the keyboard layout's AltGr
glyphs (e.g. R-Alt+2 = '@' on Finnish/Swedish layouts).

Engages composing mode in KeyTracker on Right Alt (raw kVK_RightOption
on Mac; ISO_Level3_Shift / XF86 ALTGR on X11/Wayland). In OnKeyDown,
printable keys are routed to OnChar so the layout can translate; in
OnChar, the Alt (and on Linux also Ctrl, synthesized by X11 from
AltGr) modifier bits are stripped so far2l types the character
instead of firing an Alt+key binding. Non-printable keys keep
Alt+key behavior.

Setting is plumbed through Opt.UseRightAltAsAltGr and the existing
ConfigOpt machinery; the runtime flag lives in WinPort (APIOther.cpp)
with default-visibility exports so the dynamically-loaded backend
resolves the symbol against the bundle_loader executable.
Comment thread far2l/src/cfg/config.hpp Outdated
int NoBoxes;
int ConsolePaintSharp, ExclusiveCtrlLeft, ExclusiveCtrlRight, ExclusiveAltLeft, ExclusiveAltRight,
ExclusiveWinLeft, ExclusiveWinRight;
int UseRightAltAsAltGr;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be use type bool: bool UseRightAltAsAltGr;?

@stpork stpork May 8, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i kept int to match AddCheckbox(..., BOOL Value) and the ConfigOpt table, which registers all the neighbours as int*. Happy to switch to bool if you'd prefer.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 0d15c73

Comment thread far2l/src/cfg/config.cpp Outdated
}
ApplyConsoleTweaks();
XlatReinit();
WinPortSetUseRightAltAsAltGr(Opt.UseRightAltAsAltGr ? TRUE : FALSE);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if type Opt.UseRightAltAsAltGr change to bool here we can use variable without conditional operator.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

happy to switch this and previous to bool if you'd prefer — just say the word.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in. 0d15c73

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