My Windows/Mac application hosts VST/AU plugins.
My used Component hierarchy is this, listed from parent to child order:
#1: juce::DocumentWindow (setContentNonOwned() is used to give the below Component to it)
#2: juce::Component (parent for the VST/AU GUI)
#3: AudioProcessorEditor (the VST/AU plugin GUI)
In the Component #2 (the parent for the VST/AU GUI) I use the following to get the VST/AU GUI:
AudioProcessorEditor* AudioProcessor::createEditorIfNeeded()
Then I use addAndMakeVisible() to make that AudioProcessorEditor a child of this component (Component #2).
Component #2 has the following settings:
setInterceptsMouseClicks(true, true);
setWantsKeyboardFocus(true);
setMouseClickGrabsKeyboardFocus(true);
Component #1 has a keyboard listener added to it, which monitors computer keyboard key presses.
On Mac everything works correctly:
I can click any part of the DocumentWindow, including the VST/AU GUI area and all keyboard presses are recorded properly by the keyboard listener.
On Windows things get buggy:
If I click any part of the window or its child components but not the actual VST GUI itself, key presses are recorded correctly. But if I click the VST GUI area, nothing gets recorded by the keyboard listener.
This doesn’t seem to get fixed by adding keyboard listener also to the VST plugin GUI itself.
Also things don’t get better if I use setWantsKeyboardFocus() and/or setMouseClickGrabsKeyboardFocus() for the plugin GUI component, regardless of what settings I use for them.
Also setting setWantsKeyboardFocus(false) and setMouseClickGrabsKeyboardFocus(false) for the Component #2 doesn’t seem to fix this issue.
On Mac everything works fine for both VST and AU plugins.
The bug happens only on Windows.