I add my plugin to a track on logic, the gui opens, I move a knob on the interface then let go of the mouse button. If I then press space bar the song plays just fine, but if I then press the enter key instead of the host stopping to play it seems like the top left most button is getting a button click event. Does this sound normal? I have set flags saying I don’t want keyboard events.
Well, maybe, though if you’re using a separate TopLevelWindow, it’s pretty reasonable to assume it might want keyboard focus like any other floating window. The JucePlugin_EditorRequiresKeyboardFocus flag is really just there for handling the embedded plugin window…
I’m not using a separate top level window, I only popup new windows for text entry as this is the only reliable way to get keystrokes. For those new windows I explicitly say I want keyboard focus.
As you predicted the breakpoint was not hit. It has nothing to do with the TopLevelWindow, and everything to do with the constructor of the Button class declaring it wants keyboard input. Once I set that to false all is good. The reason for the mix up is that I think the dependencies got mixed up and I was debugging different code to what was running. I did the post build phase of copying to .vst manually and all was good.
So, the solution for no enter key stealing in Logic for me was to edit the juce::Button::Button () constructor, and change the code to:
Ok, though I’d have thought it’d be better just to call setWantsKeyboardFocus(false) on your button after you create it, rather than hacking the juce code - otherwise when you grab a new version of the code in the future you’re bound to forget to put that hack back in there…