Browse Source

Fix bridged plugin UIs appearing behind main carla window on macOS

tags/v2.3.1
falkTX 3 years ago
parent
commit
a79c1928d7
2 changed files with 27 additions and 4 deletions
  1. +3
    -2
      source/utils/CarlaPluginUI.cpp
  2. +24
    -2
      source/utils/JucePluginWindow.hpp

+ 3
- 2
source/utils/CarlaPluginUI.cpp View File

@@ -476,7 +476,7 @@ private:
- (void) setCallback:(CarlaPluginUI::Callback*)cb;
- (BOOL) acceptsFirstResponder;
- (BOOL) canBecomeKeyWindow;
- (BOOL) canBecomeMainWindow;
- (BOOL) canBecomeMain;
- (BOOL) windowShouldClose:(id)sender;
- (NSSize) windowWillResize:(NSWindow*)sender toSize:(NSSize)frameSize;
@end
@@ -518,7 +518,7 @@ private:
return YES;
}

- (BOOL)canBecomeMainWindow
- (BOOL)canBecomeMain
{
return NO;
}
@@ -652,6 +652,7 @@ public:
CARLA_SAFE_ASSERT_RETURN(fWindow != nullptr,);

[fWindow makeKeyAndOrderFront:fWindow];
[fWindow orderFrontRegardless];
[NSApp activateIgnoringOtherApps:YES];
}



+ 24
- 2
source/utils/JucePluginWindow.hpp View File

@@ -45,10 +45,10 @@ public:
JucePluginWindow(const uintptr_t parentId)
: DialogWindow("JucePluginWindow", Colour(50, 50, 200), true, false),
fClosed(false),
fShown(false),
fTransientId(parentId)
{
setVisible(false);
//setAlwaysOnTop(true);
setOpaque(true);
setResizable(false, false);
setUsingNativeTitleBar(true);
@@ -57,6 +57,7 @@ public:
void show(Component* const comp)
{
fClosed = false;
fShown = true;

centreWithSize(comp->getWidth(), comp->getHeight());
setContentNonOwned(comp, true);
@@ -64,8 +65,12 @@ public:
if (! isOnDesktop())
addToDesktop();

setVisible(true);
setAlwaysOnTop(true);
setTransient();
setVisible(true);
toFront(true);

postCommandMessage(0);
}

void hide()
@@ -95,8 +100,25 @@ protected:
return true;
}

int getDesktopWindowStyleFlags() const override
{
return ComponentPeer::windowHasDropShadow | ComponentPeer::windowHasTitleBar | ComponentPeer::windowHasCloseButton;
}

void handleCommandMessage(const int comamndId) override
{
CARLA_SAFE_ASSERT_RETURN(comamndId == 0,);

if (fShown)
{
fShown = false;
setAlwaysOnTop(false);
}
}

private:
volatile bool fClosed;
bool fShown;
const uintptr_t fTransientId;

void setTransient()


Loading…
Cancel
Save