From 7f65db5dd30ffd11525c5e1e15d6b3bb3e72f85c Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 28 May 2022 15:17:01 +0100 Subject: [PATCH] Bring back Window::setTransientParent, used in Carla Signed-off-by: falkTX --- dgl/Window.hpp | 8 ++++++++ dgl/src/Window.cpp | 12 +++++------- distrho/src/DistrhoUIInternal.hpp | 8 +++----- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/dgl/Window.hpp b/dgl/Window.hpp index 2d5804f4..c32ba0fd 100644 --- a/dgl/Window.hpp +++ b/dgl/Window.hpp @@ -442,6 +442,14 @@ public: bool automaticallyScale = false, bool resizeNowIfAutoScaling = true); + /** + Set the transient parent of the window. + + Set this for transient children like dialogs, to have them properly associated with their parent window. + This should be not be called for embed windows, or after making the window visible. + */ + void setTransientParent(uintptr_t transientParentWindowHandle); + /** DEPRECATED Use isIgnoringKeyRepeat(). */ DISTRHO_DEPRECATED_BY("isIgnoringKeyRepeat()") inline bool getIgnoringKeyRepeat() const noexcept { return isIgnoringKeyRepeat(); } diff --git a/dgl/src/Window.cpp b/dgl/src/Window.cpp index b65261ff..a068038e 100644 --- a/dgl/src/Window.cpp +++ b/dgl/src/Window.cpp @@ -465,6 +465,11 @@ void Window::setGeometryConstraints(uint minimumWidth, } } +void Window::setTransientParent(const uintptr_t transientParentWindowHandle) +{ + puglSetTransientParent(pData->view, transientParentWindowHandle); +} + std::vector Window::getClipboardDataOfferTypes() { std::vector offerTypes; @@ -521,13 +526,6 @@ void Window::onFileSelected(const char*) } #endif -#if 0 -void Window::setTransientWinId(const uintptr_t winId) -{ - puglSetTransientFor(pData->view, winId); -} -#endif - // ----------------------------------------------------------------------- END_NAMESPACE_DGL diff --git a/distrho/src/DistrhoUIInternal.hpp b/distrho/src/DistrhoUIInternal.hpp index fb36f6e3..4c1c877d 100644 --- a/distrho/src/DistrhoUIInternal.hpp +++ b/distrho/src/DistrhoUIInternal.hpp @@ -312,14 +312,12 @@ public: uiData->window->setTitle(uiTitle); } - void setWindowTransientWinId(const uintptr_t winId) + void setWindowTransientWinId(const uintptr_t transientParentWindowHandle) { #if DISTRHO_PLUGIN_HAS_EXTERNAL_UI - ui->setTransientWindowId(winId); -#elif 0 /* TODO */ - glWindow.setTransientWinId(winId); + ui->setTransientWindowId(transientParentWindowHandle); #else - (void)winId; + uiData->window->setTransientParent(transientParentWindowHandle); #endif }