MacOS: GlfwApplication.cpp::currentGlfwModifiers wrongly detects modifiers in mouseMoveEvent
DavidPeicho opened this issue · 7 comments
Hi,
It looks like GlfwApplication.cpp::currentGlfwModifiers
returns the wrong modifiers after opening the MacOS screenshot panel and cancelling it.
The problem comes from glfwGetKey
that will return true at:
if(glfwGetKey(window, GLFW_KEY_LEFT_SHIFT) ||
glfwGetKey(window, GLFW_KEY_RIGHT_SHIFT))
Reproduction
- Open a GLFW application
- Press
cmd+shift+5
to open the MacOS screenshot dialog - Close it using escape
- Check the value of
GlfwApplication.cpp::currentGlfwModifiers
while not holding any key
Fix
I guess one way to fix it would be to only use the glfwSetKeyCallback
method instead of using glfwGetKey
Definitely a bug with glfw and I don't think there is a way around it: glfw/glfw#2189
Hi!
Hmm, I have a vague feeling that this wasn't limited to just GLFW and macOS, but happened to me with SDL on Linux and other apps as well. So maybe not a GLFW-specific bug but rather a general event handling "wart"?
Is it possible for you to try the same with the SDL application? I wonder how it handles that.
I can give it a try yes. I will do that tomorrow.
The exact bug though comes from this process:
- I press cmd + shift + 5 so glfw registers this as pressed
- It opens the screenshot manager and glfw do not produce a release even for shift
So I would assume it should be specific to GLFW.
Does the same happen e.g. for Cmd+Space that opens the application launcher?
I tried on Linux (with Alt+F2, which opens the Plasm application launcher) and got a release event for Alt right before the window went out of focus. So that's how it should behave, I guess :)
Spotlight works fine. I will have to find a SDL example to try with
Easiest could be if you build Magnum with MAGNUM_BUILD_TESTS
enabled, then there's a PlatformSdl2ApplicationTest
executable that prints a message to the console on each input event (and same with GLFW).
But I kinda suspect SDL will work, so maybe let's just wait for a response from GLFW devs :)
Possibly related to: glfw/glfw#1011