This is the current code for the function:
bool juce_areThereAnyAlwaysOnTopWindows() { NSArray* windows = [NSApp windows]; for (unsigned int i = 0; i < [windows count]; ++i) { const NSInteger level = [((NSWindow*) [windows objectAtIndex: i]) level]; if (level == NSFloatingWindowLevel || level == NSStatusWindowLevel || level == NSModalPanelWindowLevel) return true; } return false; }
When I open an AlertWindow inside my plug-in in Reaper, it falls behind the current plug-in window, meaning that the function above returns false while it should have returned true.
Digging a little further, I have found that the "level" value for the plug-in windows in Reaper is "1", which does not match any of the values tested in the if (and, as long as I have been able to find, does not match any of the "official" values for the level property either)
Anyway, since the level property is meant to represent the z-axis stacking of windows, what do you think about replacing the condition in the if above with a much simpler "level > NSNormalWindowLevel"
if (level > NSNormalWindowLevel) return true;
After all, from the JUCE point of view, any window that's above the "normal" level should be considered always on top