keyPressed() event not triggered in my application

My environment: Ubuntu 16.04, GCC 6.1.1, VirtualBox 5.0.24. openFrameworks@master.

For example, when I run examples/input_output/clipboardExample, it does work and key events seem to be triggered properly.

But when I copy & paste the examples/input_output/clipboardExample code into my project with the same exact content, the key events are somehow disabled. (Why??)

Although events like mousePressed() are still working. (Why??) (2)

Could someone help me with this issue?

Hmm… I checked the linker flags between my application and the example project and it seems like there’s no much difference.


ofAddListener(ofEvents().keyPressed, this, &MyApp::on_key_pressed);

does not work, too.

@theo @arturo Sorry for asking the core members, but do you have any ideas what’s going on?

@arturo - I think I’m starting to realize what’s going on…


ofEvents().notifyKeyPressed(0, 0, 0, 0);


ofAddListener(ofEvents().keyPressed, this, &MyApp::on_key_pressed);

DOES triggers the event.

And also this behavior seems not be present in 0.9.4 branch but it happens in master.

So I’m suggesting that something has changed in the master and somehow notifyKeyPressed() is not being triggerd properly. Am I correct? I’m going into further investigation…

Seems like there’s a bug in GLFW. Continuing investigation…

So I’ve finally found out the problem: keycode is mistakenly passed to the action param of _glfwInputKey.

This issue seems to be fixed in the latest GLFW master, so oF’s libglfw3.a must be updated. (It’s not been updated for the last 2 years…)