Add keyboard layout support

This adds a keyboard layout switch callback and a query for the
human-readable name of the current layout.

Fixes #1201.
This commit is contained in:
Camilla Löwy
2020-05-11 21:50:56 +02:00
parent d7ae90a790
commit 761d7e7c4e
20 changed files with 387 additions and 39 deletions
+26
View File
@@ -230,6 +230,32 @@ specified key is `GLFW_KEY_UNKNOWN` then the scancode is used, otherwise it is
ignored. This matches the behavior of the key callback, meaning the callback
arguments can always be passed unmodified to this function.
The name of a key will not change unless the keyboard layout changes.
@subsection keyboard_layout Keyboard layout
The human-readable name of the current keyboard layout is returned by @ref
glfwGetKeyboardLayoutName.
If you wish to be notified when the keyboard layout changes, set a keyboard
layout callback.
@code
glfwSetKeyboardLayoutCallback(keyboard_layout_callback);
@endcode
The callback is called when the new layout takes effect for the application,
which on some platforms may not happen until one of its windows gets input
focus.
@code
void keyboard_layout_callback(void)
{
update_keyboard_layout_name(glfwGetKeyboardLayoutName());
}
@endcode
@section input_mouse Mouse input
+9
View File
@@ -9,6 +9,15 @@
@subsection features_34 New features in version 3.4
@subsubsection keyboard_layout_34 Keyboard layouts
GLFW can now notify when the keyboard layout has changed with @ref
glfwSetKeyboardLayoutCallback and provides the human-readable name of the
current layout with @ref glfwGetKeyboardLayoutName.
For more information, see @ref keyboard_layout.
@subsubsection standard_cursors_34 More standard cursors
GLFW now provides the standard cursor shapes @ref GLFW_RESIZE_NWSE_CURSOR and