GLFW not registering release events

I’ve got a graphical program that receives input from dmenu. When trying to collect an answer from the user, I create a pipe via popen so that I can re-direct the command’s standard output to my program.

The forking and unfocusing formed by the pipe creating a separate dmenu window seems to confuse GLFW. So, if Ctrl-W triggers the original popen call, neither the control nor the w keys will ever be registered as released when the pipe gets closed and dmenu terminates. GLFW behaves like they’re still being pressed and it only marks them as released if I press and release each individual key again. Is there any way in forcing a key to be released, without having to create a key manager and state abstraction on top of GLFW? Please don’t criticize my use of popen, I know it’s weird! Basically, I’m looking for a way to manually mark keys as released, whenever I want.

Thank you! And thanks to all contributors creating such a wonderful and lightweight library

This is advanced use and beyond the design of GLFWs API, so you’ll likely need to either alter GLFW or try a workaround.

GLFW resets the keyboard state when the application looses keyboard focus. So one workaround might be to do something to loose the window focus, for example create a new small temporary window, perhaps saying “Connecting to dmenu”.