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
+7
View File
@@ -465,6 +465,12 @@ static void drop_callback(GLFWwindow* window, int count, const char* paths[])
printf(" %i: \"%s\"\n", i, paths[i]);
}
static void keyboard_layout_callback(void)
{
printf("%08x at %0.3f: Keyboard layout changed to \'%s\'\n",
counter++, glfwGetTime(), glfwGetKeyboardLayoutName());
}
static void monitor_callback(GLFWmonitor* monitor, int event)
{
if (event == GLFW_CONNECTED)
@@ -546,6 +552,7 @@ int main(int argc, char** argv)
glfwSetMonitorCallback(monitor_callback);
glfwSetJoystickCallback(joystick_callback);
glfwSetKeyboardLayoutCallback(keyboard_layout_callback);
while ((ch = getopt(argc, argv, "hfn:")) != -1)
{