Map input key codes to lower case (#163)

This commit is contained in:
Max Risuhin 2019-01-24 14:57:45 +02:00 committed by Liam Galvin
parent 16ea4133cb
commit 27424d40dc
1 changed files with 2 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package gui
import ( import (
"fmt" "fmt"
"strings"
"github.com/go-gl/glfw/v3.2/glfw" "github.com/go-gl/glfw/v3.2/glfw"
) )
@ -56,7 +57,7 @@ func (gui *GUI) key(w *glfw.Window, key glfw.Key, scancode int, action glfw.Acti
// get key name to handle alternative keyboard layouts // get key name to handle alternative keyboard layouts
name := glfw.GetKeyName(key, scancode) name := glfw.GetKeyName(key, scancode)
if len(name) == 1 { if len(name) == 1 {
r := rune(name[0]) r := rune(strings.ToLower(name)[0])
for userAction, shortcut := range gui.keyboardShortcuts { for userAction, shortcut := range gui.keyboardShortcuts {
if shortcut.Match(mods, r) { if shortcut.Match(mods, r) {
f, ok := actionMap[userAction] f, ok := actionMap[userAction]