Browse Source

Trying to fix transient windows on windows and mac

tags/1.9.8
falkTX 7 years ago
parent
commit
a1aa0965cc
2 changed files with 9 additions and 21 deletions
  1. +6
    -11
      source/modules/dgl/src/Window.cpp
  2. +3
    -10
      source/utils/CarlaPluginUI.cpp

+ 6
- 11
source/modules/dgl/src/Window.cpp View File

@@ -129,17 +129,15 @@ struct Window::PrivateData {
init();

const PuglInternals* const parentImpl(parent.pData->fView->impl);

// NOTE: almost a 1:1 copy of setTransientWinId()
#if defined(DISTRHO_OS_WINDOWS)
// TODO
SetWindowLongPtr(hwnd, GWLP_HWNDPARENT, (LONG_PTR)parentImpl->hwnd);
#elif defined(DISTRHO_OS_MAC)
[parentImpl->window orderWindow:NSWindowBelow relativeTo:[[mView window] windowNumber]];
[mWindow orderWindow:NSWindowBelow relativeTo:parentImpl->window];
#else
XSetTransientForHint(xDisplay, xWindow, parentImpl->win);
#endif
return;

// maybe unused
(void)parentImpl;
}

PrivateData(Application& app, Window* const self, const intptr_t parentId)
@@ -626,14 +624,11 @@ struct Window::PrivateData {
DISTRHO_SAFE_ASSERT_RETURN(winId != 0,);

#if defined(DISTRHO_OS_WINDOWS)
// TODO
SetWindowLongPtr(hwnd, GWLP_HWNDPARENT, (LONG_PTR)winId);
#elif defined(DISTRHO_OS_MAC)
NSWindow* const window = [NSApp windowWithWindowNumber:winId];
DISTRHO_SAFE_ASSERT_RETURN(window != nullptr,);

[window addChildWindow:mWindow
ordered:NSWindowAbove];
[mWindow makeKeyWindow];
[mWindow orderWindow:NSWindowBelow relativeTo:window];
#else
XSetTransientForHint(xDisplay, xWindow, static_cast< ::Window>(winId));
#endif


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

@@ -443,8 +443,7 @@ public:
CocoaPluginUI(Callback* const cb, const uintptr_t parentId, const bool isResizable) noexcept
: CarlaPluginUI(cb, isResizable),
fView(nullptr),
fWindow(0),
fParentId(parentId)
fWindow(0)
{
[NSAutoreleasePool new];
[NSApplication sharedApplication];
@@ -495,9 +494,6 @@ public:

[fView setHidden:NO];
[fWindow setIsVisible:YES];

if (fParentId != 0)
setTransientWinId(fParentId);
}

void hide() override
@@ -562,9 +558,7 @@ public:
NSWindow* window = [NSApp windowWithWindowNumber:winId];
CARLA_SAFE_ASSERT_RETURN(window != nullptr,);

[window addChildWindow:fWindow
ordered:NSWindowAbove];
[fWindow makeKeyWindow];
[fWindow orderWindow:NSWindowBelow relativeTo:window];
}

void setChildWindow(void* const winId) override
@@ -585,7 +579,6 @@ public:
private:
NSView* fView;
id fWindow;
uintptr_t fParentId;

CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CocoaPluginUI)
};
@@ -769,7 +762,7 @@ public:
{
CARLA_SAFE_ASSERT_RETURN(fWindow != 0,);

// TODO
SetWindowLongPtr(fWindow, GWLP_HWNDPARENT, (LONG_PTR)winId);
}

void setChildWindow(void* const winId) override


Loading…
Cancel
Save