sokol icon indicating copy to clipboard operation
sokol copied to clipboard

Manage AltGr key combinations in windows backends

Open rcases opened this issue 1 year ago • 2 comments

On my keyboard, the '#' character is generated by the combination 'AltGr'+'3' in the same way that on many European keyboards the '€' symbol is generated by 'AltGr'+'e' For the reason explained in a previous comment in the code, this combination is prohibited in sokol_imgui.h, line 3132.

image

Commenting out that line makes the problem disappear, although I think a better solution would be to put some mask on the key modifiers in the Windows backend to prevent the "AltGr" modifier from being sent in the SAPP_EVENTTYPE_CHAR event.

rcases avatar Aug 04 '24 16:08 rcases

Hmm, I don't have an immediate idea for a robust solution, but there's a related recent ticket here:

https://github.com/floooh/sokol/issues/1079

...the code almost certainly exists because of combinations like Ctrl+X/C/P, so maybe we can just remove the ALT modifier from the mask.

floooh avatar Aug 05 '24 11:08 floooh

Modifiers could be removed when ALT and Ctrl are used together. Look at your WebGL imgui example in Inputs & Focus. Key events that generate characters (WM_CHAR ) do not transmit modifiers. Ctrl+X/C/P combinations are supposed to be managed through KeyDown

rcases avatar Aug 05 '24 12:08 rcases