commit 1d80bc8b8c989dca2dece2acf4225dc3b8993a7a parent 79274a3da02792479f747fad38742b3cc4230b23 Author: falkTX <falktx@falktx.com> Date: Sun, 22 Aug 2021 22:37:56 +0100 Add ExternalWindow::isEmbed() Signed-off-by: falkTX <falktx@falktx.com> Diffstat:
M | distrho/extra/ExternalWindow.hpp | | | 8 | ++++++++ |
M | examples/EmbedExternalUI/EmbedExternalExampleUI.cpp | | | 2 | +- |
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/distrho/extra/ExternalWindow.hpp b/distrho/extra/ExternalWindow.hpp @@ -115,6 +115,14 @@ public: #if DISTRHO_PLUGIN_HAS_EMBED_UI /** + Whether this Window is embed into another (usually not DGL-controlled) Window. + */ + bool isEmbed() const noexcept + { + return pData.parentWindowHandle != 0; + } + + /** Get the "native" window handle. This can be reimplemented in order to pass the child window to hosts that can use such informaton. diff --git a/examples/EmbedExternalUI/EmbedExternalExampleUI.cpp b/examples/EmbedExternalUI/EmbedExternalExampleUI.cpp @@ -57,7 +57,7 @@ public: const int screen = DefaultScreen(fDisplay); const ::Window root = RootWindow(fDisplay, screen); - const ::Window parent = getParentWindowHandle() != 0 ? (::Window)getParentWindowHandle() : root; + const ::Window parent = isEmbed() ? (::Window)getParentWindowHandle() : root; XSetWindowAttributes attr = {}; attr.event_mask = KeyPressMask|KeyReleaseMask;