Skip to content

Commit

Permalink
Bring back Window::setTransientParent, used in Carla
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <falktx@falktx.com>
  • Loading branch information
falkTX committed May 28, 2022
1 parent a106c2b commit 7f65db5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
8 changes: 8 additions & 0 deletions dgl/Window.hpp
Expand Up @@ -442,6 +442,14 @@ class DISTRHO_API Window
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(); }
Expand Down
12 changes: 5 additions & 7 deletions dgl/src/Window.cpp
Expand Up @@ -465,6 +465,11 @@ void Window::setGeometryConstraints(uint minimumWidth,
}
}

void Window::setTransientParent(const uintptr_t transientParentWindowHandle)
{
puglSetTransientParent(pData->view, transientParentWindowHandle);
}

std::vector<ClipboardDataOffer> Window::getClipboardDataOfferTypes()
{
std::vector<ClipboardDataOffer> offerTypes;
Expand Down Expand Up @@ -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
8 changes: 3 additions & 5 deletions distrho/src/DistrhoUIInternal.hpp
Expand Up @@ -312,14 +312,12 @@ class UIExporter
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
}

Expand Down

0 comments on commit 7f65db5

Please sign in to comment.