{"action":"created","issue":{"url":"https://api.github.com/repos/go-gl/glfw/issues/178","repository_url":"https://api.github.com/repos/go-gl/glfw","labels_url":"https://api.github.com/repos/go-gl/glfw/issues/178/labels{/name}","comments_url":"https://api.github.com/repos/go-gl/glfw/issues/178/comments","events_url":"https://api.github.com/repos/go-gl/glfw/issues/178/events","html_url":"https://github.com/go-gl/glfw/issues/178","id":196992203,"number":178,"title":"Key callback called twice when holding a key","user":{"login":"faiface","id":3924105,"avatar_url":"https://avatars.githubusercontent.com/u/3924105?v=3","gravatar_id":"","url":"https://api.github.com/users/faiface","html_url":"https://github.com/faiface","followers_url":"https://api.github.com/users/faiface/followers","following_url":"https://api.github.com/users/faiface/following{/other_user}","gists_url":"https://api.github.com/users/faiface/gists{/gist_id}","starred_url":"https://api.github.com/users/faiface/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/faiface/subscriptions","organizations_url":"https://api.github.com/users/faiface/orgs","repos_url":"https://api.github.com/users/faiface/repos","events_url":"https://api.github.com/users/faiface/events{/privacy}","received_events_url":"https://api.github.com/users/faiface/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-12-21T17:42:53Z","updated_at":"2017-02-07T15:59:27Z","closed_at":"2017-02-07T15:08:55Z","body":"Hello,\r\n\r\nI'm using GLFW for Go on 64-bit Linux, Fedora 24, and I've encountered this issue. Here's my code:\r\n\r\n```\r\nfunc main() {\r\n\terr := glfw.Init()\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\r\n\tglfw.WindowHint(glfw.ContextVersionMajor, 3)\r\n\tglfw.WindowHint(glfw.ContextVersionMinor, 3)\r\n\tglfw.WindowHint(glfw.OpenGLProfile, glfw.OpenGLCoreProfile)\r\n\tglfw.WindowHint(glfw.OpenGLForwardCompatible, glfw.True)\r\n\tglfw.WindowHint(glfw.Resizable, glfw.False)\r\n\r\n\twindow, err := glfw.CreateWindow(1024, 768, \"GLTest\", nil, nil)\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\r\n\twindow.SetKeyCallback(func(_ *glfw.Window, key glfw.Key, scancode int, action glfw.Action, mods glfw.ModifierKey) {\r\n\t\tswitch action {\r\n\t\tcase glfw.Press:\r\n\t\t\tfmt.Println(\"v\")\r\n\t\tcase glfw.Release:\r\n\t\t\tfmt.Println(\"^\")\r\n\t\t}\r\n\t})\r\n\r\n\twindow.MakeContextCurrent()\r\n\r\n\terr = gl.Init()\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\r\n\tfor !window.ShouldClose() {\r\n\t\tgl.ClearColor(0.2, 0.3, 0.3, 1.0)\r\n\t\tgl.Clear(gl.COLOR_BUFFER_BIT)\r\n\r\n\t\twindow.SwapBuffers()\r\n\t\tglfw.PollEvents()\r\n\t}\r\n}\r\n```\r\n\r\nWhat it's basically doing is that it prints 'v' when a key is pressed down and it prints '^' when a key is released.\r\n\r\nWith short presses, everything works as expected, but when I press a key for a longer time (such that glfw.Repeat events are triggered also), after releasing a key, additional Press and Release events are triggered. The output of a program then looks like this:\r\n```\r\nv\r\n^\r\nv\r\n^\r\n```\r\n\r\nHowever, that was a single long key press.\r\n\r\nThis issue is not present when working with GLFW in C, I've tested it.\r\n\r\nAlso, I have a locked main thread and so on, so the problem's not there. Any ideas?"},"comment":{"url":"https://api.github.com/repos/go-gl/glfw/issues/comments/278044017","html_url":"https://github.com/go-gl/glfw/issues/178#issuecomment-278044017","issue_url":"https://api.github.com/repos/go-gl/glfw/issues/178","id":278044017,"user":{"login":"elmindreda","id":133714,"avatar_url":"https://avatars.githubusercontent.com/u/133714?v=3","gravatar_id":"","url":"https://api.github.com/users/elmindreda","html_url":"https://github.com/elmindreda","followers_url":"https://api.github.com/users/elmindreda/followers","following_url":"https://api.github.com/users/elmindreda/following{/other_user}","gists_url":"https://api.github.com/users/elmindreda/gists{/gist_id}","starred_url":"https://api.github.com/users/elmindreda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elmindreda/subscriptions","organizations_url":"https://api.github.com/users/elmindreda/orgs","repos_url":"https://api.github.com/users/elmindreda/repos","events_url":"https://api.github.com/users/elmindreda/events{/privacy}","received_events_url":"https://api.github.com/users/elmindreda/received_events","type":"User","site_admin":false},"created_at":"2017-02-07T15:59:27Z","updated_at":"2017-02-07T15:59:27Z","body":"It may be related to glfw/glfw#747."}}
{"actor":{"display_login":"elmindreda"}}