mirror of
https://github.com/glfw/glfw.git
synced 2026-09-22 00:49:48 +00:00
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:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user