RAM2118 commited on
Commit
fea5c5f
·
verified ·
1 Parent(s): c199580

fix: GUI now floats over Ableton in fullscreen mode

Browse files

Root cause: NSWindow needs collection behavior flags to appear in
fullscreen Spaces. Without them, macOS puts the window in a separate
Space (different desktop), causing the 'opens in new window' behavior.

Fix adds to showAsFloatingPanel():
- canJoinAllSpaces (1 << 0) — window can appear on any Space
- fullScreenAuxiliary (1 << 8) — window can overlay fullscreen apps
- Window level raised to 25 (NSStatusWindowLevel) which is above
fullscreen app level

This means the plugin GUI will float over Ableton whether Ableton
is windowed OR fullscreen.

Files changed (1) hide show
  1. Source/Helper/HelperPluginHost.cpp +13 -4
Source/Helper/HelperPluginHost.cpp CHANGED
@@ -10,6 +10,7 @@
10
  #endif
11
 
12
  // Show window as floating panel without activating this app or stealing focus
 
13
  static void showAsFloatingPanel(juce::Component* window)
14
  {
15
  #if JUCE_MAC
@@ -17,9 +18,17 @@ static void showAsFloatingPanel(juce::Component* window)
17
  {
18
  auto* nsWindow = (id)peer->getNativeHandle();
19
 
20
- // Set window level to floating (above normal windows)
21
- // NSFloatingWindowLevel = 3
22
- ((void(*)(id, SEL, long))objc_msgSend)(nsWindow, sel_registerName("setLevel:"), 3);
 
 
 
 
 
 
 
 
23
 
24
  // Don't hide on deactivate (stay visible when helper loses focus)
25
  ((void(*)(id, SEL, int))objc_msgSend)(nsWindow, sel_registerName("setHidesOnDeactivate:"), 0);
@@ -290,7 +299,7 @@ void HelperPluginHost::showGui()
290
  guiWindow->centreWithSize(editor->getWidth(), editor->getHeight());
291
  guiWindow->setVisible(true);
292
 
293
- // Make it float without stealing focus
294
  showAsFloatingPanel(guiWindow.get());
295
  });
296
  }
 
10
  #endif
11
 
12
  // Show window as floating panel without activating this app or stealing focus
13
+ // Works in BOTH windowed and fullscreen mode
14
  static void showAsFloatingPanel(juce::Component* window)
15
  {
16
  #if JUCE_MAC
 
18
  {
19
  auto* nsWindow = (id)peer->getNativeHandle();
20
 
21
+ // --- COLLECTION BEHAVIOR (critical for fullscreen) ---
22
+ // canJoinAllSpaces = 1 << 0 (window appears on ALL Spaces/desktops)
23
+ // fullScreenAuxiliary = 1 << 8 (window can float over fullscreen apps)
24
+ // Combined = 257
25
+ long behavior = (1 << 0) | (1 << 8);
26
+ ((void(*)(id, SEL, long))objc_msgSend)(nsWindow, sel_registerName("setCollectionBehavior:"), behavior);
27
+
28
+ // --- WINDOW LEVEL ---
29
+ // NSStatusWindowLevel = 25 (above fullscreen apps)
30
+ // NSFloatingWindowLevel = 3 is NOT enough — fullscreen apps are higher
31
+ ((void(*)(id, SEL, long))objc_msgSend)(nsWindow, sel_registerName("setLevel:"), 25);
32
 
33
  // Don't hide on deactivate (stay visible when helper loses focus)
34
  ((void(*)(id, SEL, int))objc_msgSend)(nsWindow, sel_registerName("setHidesOnDeactivate:"), 0);
 
299
  guiWindow->centreWithSize(editor->getWidth(), editor->getHeight());
300
  guiWindow->setVisible(true);
301
 
302
+ // Make it float without stealing focus — works in windowed AND fullscreen
303
  showAsFloatingPanel(guiWindow.get());
304
  });
305
  }