fix: set fullscreen-compatible behavior BEFORE making window visible
Browse filesPrevious fix set collection behavior after setVisible(true) which is
too late — macOS has already assigned the window to a Space.
Now sets canJoinAllSpaces + fullScreenAuxiliary + stationary (1<<4)
BEFORE the window becomes visible. Also uses NSPanel-level behavior
and moves window to active Space explicitly via orderWindow:relativeTo:.
If this still fails in fullscreen, the only remaining option is to
render the plugin GUI in-process (framebuffer sharing).
8 unmodified lines910111213141213141516171819202122232425212223242526272829293030313233333435363738363940414243444546474849504251525354239 unmodified lines2942952962972982992893003013023034 unmodified lines3083093103113123133143153163173023033183193203213228 unmodified lines#include <objc/message.h>#endif
// Show window as floating panel without activating this app or stealing focus// Works in BOTH windowed and fullscreen modestatic void showAsFloatingPanel(juce::Component* window)// Configure window for floating-panel behavior that works in fullscreen// MUST be called BEFORE the window is made visiblestatic void configureAsOverlayPanel(juce::Component* window){#if JUCE_MAC if (auto* peer = window->getPeer()) { auto* nsWindow = (id)peer->getNativeHandle();
// --- COLLECTION BEHAVIOR (critical for fullscreen) --- // canJoinAllSpaces = 1 << 0 (window appears on ALL Spaces/desktops) // fullScreenAuxiliary = 1 << 8 (window can float over fullscreen apps) // Combined = 257 long behavior = (1 << 0) | (1 << 8); // --- COLLECTION BEHAVIOR (MUST be set before visible) --- // canJoinAllSpaces = 1 << 0 (appear on all desktops/spaces) // fullScreenAuxiliary = 1 << 8 (can appear over fullscreen apps) // stationary = 1 << 4 (don't move with space switches) // ignoresCycle = 1 << 6 (skip in Cmd+` cycling) long behavior = (1 << 0) | (1 << 8) | (1 << 4) | (1 << 6); ((void(*)(id, SEL, long))objc_msgSend)(nsWindow, sel_registerName("setCollectionBehavior:"), behavior);
// --- WINDOW LEVEL --- // NSStatusWindowLevel = 25 (above fullscreen apps) // NSFloatingWindowLevel = 3 is NOT enough — fullscreen apps are higher // Level 25 = NSStatusWindowLevel (above fullscreen apps) ((void(*)(id, SEL, long))objc_msgSend)(nsWindow, sel_registerName("setLevel:"), 25);
// Don't hide on deactivate (stay visible when helper loses focus) // Don't hide when the helper app loses focus ((void(*)(id, SEL, int))objc_msgSend)(nsWindow, sel_registerName("setHidesOnDeactivate:"), 0); }#endif}
// Show without activating this app// Make the window appear without stealing focus (call AFTER visible)static void showWithoutFocusSteal(juce::Component* window){#if JUCE_MAC if (auto* peer = window->getPeer()) { auto* nsWindow = (id)peer->getNativeHandle(); ((void(*)(id, SEL))objc_msgSend)(nsWindow, sel_registerName("orderFrontRegardless")); }#endif}
// Custom window// Custom window — no native title bar close issues with accessory policyclass PluginGuiWindow : public juce::DocumentWindow{public:239 unmodified lines // If window exists but hidden, just show it if (guiWindow) { // Re-apply overlay config before showing (in case Space changed) configureAsOverlayPanel(guiWindow.get()); guiWindow->setVisible(true); showAsFloatingPanel(guiWindow.get()); showWithoutFocusSteal(guiWindow.get()); return; }
4 unmodified lines guiWindow->setContentOwned(editor, true); guiWindow->setResizable(true, true); guiWindow->centreWithSize(editor->getWidth(), editor->getHeight());
// CRITICAL: configure overlay behavior BEFORE making visible configureAsOverlayPanel(guiWindow.get());
// NOW make visible guiWindow->setVisible(true);
// Make it float without stealing focus — works in windowed AND fullscreen showAsFloatingPanel(guiWindow.get()); // Show without stealing focus from Ableton showWithoutFocusSteal(guiWindow.get()); });}
Source/Helper/HelperPluginHost.cpp+32-16