Hi, I’m doing my first juce standalone app on OS X, and the app is not receiving keyboard input.
Not only it doesn’t respond to my key presses, it seems to be completely ignored by the computer:
the key presses go to whatever app is on the background. I’m sure there’s something simple that I’m missing.
I’m using CMake as a biul system and here’s my juceAPP, my MainWindow and my MainComponent files:
I tried your code - and with a few modifications to get it to compile (what’s up with getManager()) - it all works fine for me.
I think this is probably related to your non-standard setup with cmake (and including module headers directly etc.). Maybe you are missing some juce cpp files which contain some important static initialisers?
Hi Fabian,
getManager() gets a pointer to my ApplicationCommandManager, which is declared as a global variable in
another .cpp file (I didn’t include the whole code because it’s too big and I’ve removed most of the other files
for testing). I’ve removed the other files from my build and compiled the code you sent having the same result.
The Juce Application never seems to gain focus completly (I’m starting to wonder if it’s a bug on my computer…) as you can see here
My cmake build is based on Kiwi’s one https://github.com/Musicoll/Kiwi and they don’t experience a similar issue.
I’m starting to wonder if the bug is related to my computer somehow
Obviously, when you are debugging your app, the debugger usually steals the initial focus request. But if you run the app without the debugger (i.e. launching it from the Finder or explorer) it should work fine. Alternatively, put the app in the background and bring it to the foreground again.
Sorry, I was not being that good a programmer, I was doing “printf” debugging.
I changed my cmake file to make an OS X .app bundle which… fixed the problem.
I’ll never understand the witchcraft that goes on with .app bundles, but I guess I’ve learned my lesson
regarding always making one to have things working fine on OS X…