I have interface freezes with the implementation of this solution in the AU wrapper.
The problem happpens in Live 6 or Live 7, but it works ok in Live 8 and Logic 8.
I have a plug-in that wants keyboard focus (in order to enter text into TextEditors), but the plug-in editor component does not handle keyPressed events.
If I load the plug in, then click on the main component giving it the focus, and then press a key (the spacebar, for example), the plug-in interface freezes and the following method in juce_AU_wrapper.cpp gets called repeatedly:
bool keyPressed (const KeyPress& kp)
if (! kp.getModifiers().isCommandDown())
// If we have an unused keypress, move the key-focus to a host window
// and re-inject the event..
[[hostWindow parentWindow] makeKeyWindow];
[NSApp postEvent: [NSApp currentEvent] atStart: YES];
I think that the re-injected event causes another call to this method, which re-injects the event and so on in an endless loop.
Returning true instead of false at the end of the function does not break the cycle, but commenting out the if and its body does.
As I’ve said, the problem exists for Live 6 and 7, but not for Live 8 or Logic 8, so I think this may be related to hosts that use Carbon… but I’m not expert there, so I leave to you further considerations…