It’s been a couple of months since I pulled from the tip, after pulling today I found that the AlertWindow is showing behind the plug-in window in OSX.
I found this thread viewtopic.php?f=2&t=9838 when Jules is considering changing the AOT behavior but I did not find any related commit message in the logs.
I found some commit logs about changes in the OSX modal behavior, but I don’t know if those are the relevant changes.
Can anybody point me to the relevant commit/change?
AlertWindow::AlertWindow (const String& title,
const String& message,
AlertIconType iconType,
Component* comp)
: TopLevelWindow (title, true),
alertIconType (iconType),
associatedComponent (comp),
escapeKeyCancels (true)
{
if (message.isEmpty())
text = " "; // to force an update if the message is empty
setMessage (message);
Desktop& desktop = Desktop::getInstance();
for (int i = desktop.getNumComponents(); --i >= 0;)
{
if (Component* const c = desktop.getComponent (i))
{
if (c->isAlwaysOnTop() && c->isShowing())
{
setAlwaysOnTop (true);
break;
}
}
}
//SHLOMI: I restored that after Jules removed it in commit 06e2a667fb8fd1fbd4071a0c5fb873b47009bd79 cause In OSX the alert windows are shown behind the plug-in
if (! JUCEApplication::isStandaloneApp())
setAlwaysOnTop (true); // for a plugin, make it always-on-top because the host windows are often top-level
//ENDSHLOMI
AlertWindow::lookAndFeelChanged();
constrainer.setMinimumOnscreenAmounts (0x10000, 0x10000, 0x10000, 0x10000);
}
I’ve reverted the same change and added some comments in the other parts of JUCE where it does similar things, so that I should get a conflict in case I merge a version where jules has changed something in that area.
I think it’d need to be a bit smarter, e.g. if it checked all the app’s windows to see if there are any other always-on-top windows present before using that mode itself.
Would it be possible to put something simple in there right now (for example always completely on top again) and make it smarter afterwards? Or perhaps just supply something in the messagebox that allows us to put them on top of everything?
We only use dialog boxes when the user does something directly on the plugin UI, like click a button to activate. The “your activation was successful” messages appear below the plugin on osx where you basically can’t see them -if you are unlucky-. Some kind of way to force them to the front would be awesome.
the AlertWindow is not the only one that should be affected by this change: there are other places (CallOutBox, DialogWindow) where the older rule “put the window on top if we are not an application (i.e. we are a plug-in, so there may be host windows on top)” was used. I think the same new logic should be applied there, too. Jules, do you think is a sensible idea?
But it is still not a good practice to use modal windows in plugins.
How do you guys deal with closing the windows?
If you got a modal window opened and quit the host/ destroy your plugin, it will surely crash.
You 've got a workaround for that ?