GLFW character text input with modifier keys (control, meta, alt)

Hi,

glfwSetKeyCallback and glfwSetCharCallback are indeed intended for different purposes.

glfwSetCharCallback is for text input, and is the direct text input provided by the operating system as native UTF-32 codepoints.

glfwSetKeyCallback is for physical key presses. The keys are identified by a platform specific scancode and mapped to a US layout virtual key code.

You can get hold of the Key names for keys and scancodes using glfwGetKeyName, which will give an identifiable name (if possible) for a key, such as Z for GLFW_KEY_W on an AZERTY keyboard.

Typically programs use specific key callbacks to generate program events, such as CTRL+C to quit, and char callbacks to input text when in a text input field. If you want to use the C rather than virtual GLFW_KEY_C key you can call glfwGetKeyName to check the key name (it’s possible that some keyboards may not have a C key so it might be useful to have a fallback if you want to support these).

Cheers,

Doug.