cinder / Cinder

Cinder is a community-developed, free and open source library for professional-quality creative coding in C++.
http://libcinder.org
Other
5.27k stars 939 forks source link

Text input does not support modifier keys other than Alt,Ctrl,Shift,Meta on linux. #2270

Open godefv opened 2 years ago

godefv commented 2 years ago

I am using the UK extended keyboard layout. So, for example, typing ` then a writes à, typing AltGr+6 then a writes â. I am also using the compose key. So for example, typing Compose then o then e writes œ. See https://en.wikipedia.org/wiki/Modifier_key#Accented_characters .

None of these examples work on the TexBox sample, only the unmodified keys are taken into account. Some debugging seems to show that the modifier keys like accents and compose are not implemented. I guess it should be around this file src/cinder/app/linux/AppImplLinuxGlfw.cpp, maybe in extractKeyModifiers() and modifyChar() ?

I volunteer to contribute if needed.

totalgee commented 2 years ago

I have a somewhat related issue. My (custom) solution in one application -- in order to use an ImGui text input widget in Cinder -- is to register my own key down handler (with higher priority than the ImGui key down handler) and have it detect the special key combinations for my (Spanish) keyboard, which use the AltGr key (this is equivalent to Alt+Ctrl+something). It then remaps to the appropriate char and "injects" it to ImGui. This is not for accented characters, in my case, but required just to type regular ASCII things like []{}@#\ etc., that require AltGr on a Spanish keyboard (which, incidentally, is pretty annoying for programming :wink:).

Anyhow, this is not a general solution to your problem (or mine), but does illustrate a related "non-US" keyboard issue.

godefv commented 2 years ago

Oh, I see, the French keyboards are similar. So, this is a more serious issue than I thought. Thanks for your input !