Some JUCE applications don’t get keyboard focus on start-up. When double-clicking in explorer, the JUCE window will pop up behind the explorer window, and the taskbar icon will flash, but the window will not be focused. This is reproducible with the JUCE demo, but not with ProJucer.
It can be reproduced with the Hello World example by modifying the constructor of the
HelloWorldWindow as follows:
// And show it! setUsingNativeTitleBar(true); setResizable(true, true); setVisible(true);
It will no longer happen if you change the order:
// And show it! setUsingNativeTitleBar(true); setVisible(true); setResizable(true, true); // ← move down
But this will cause the window to appear twice (which gives a very noticeable stutter in the “fade in” animation, if you have those enabled).
Finally, this order works as expected
// And show it! setResizable(true, true); // ← move up setUsingNativeTitleBar(true); setVisible(true);
With the Demo app, moving those calls in that order in
MainAppWindow::MainAppWindow() solves the problem. As to why, I have no idea. Anyone knows what’s happening here?