diff --git a/distrho/extra/ExternalWindow.hpp b/distrho/extra/ExternalWindow.hpp index 06f5937d..dd21ad1f 100644 --- a/distrho/extra/ExternalWindow.hpp +++ b/distrho/extra/ExternalWindow.hpp @@ -114,6 +114,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 index 7b7af0ae..1b5f1cf5 100644 --- 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;