DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit b755b07abf79e4541cafda14fd6d9e4677669062
parent beb179ac09de57be68afc8a5789546cfffbcbcc6
Author: falkTX <falktx@falktx.com>
Date:   Thu, 26 Aug 2021 15:22:44 +0100

Fix embed-external-ui x11 version crash on close, missing map

Signed-off-by: falkTX <falktx@falktx.com>

Diffstat:
Mexamples/EmbedExternalUI/EmbedExternalExampleUI.cpp | 15++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/examples/EmbedExternalUI/EmbedExternalExampleUI.cpp b/examples/EmbedExternalUI/EmbedExternalExampleUI.cpp @@ -131,7 +131,6 @@ public: [fWindow setContentSize:NSMakeSize(getWidth(), getHeight())]; [fWindow makeFirstResponder:fView]; [fWindow makeKeyAndOrderFront:fWindow]; - d_stdout("created window with size %u %u", getWidth(), getHeight()); } [pool release]; @@ -140,9 +139,9 @@ public: fDisplay = XOpenDisplay(nullptr); DISTRHO_SAFE_ASSERT_RETURN(fDisplay != nullptr,); - const int screen = DefaultScreen(fDisplay); - const ::Window root = RootWindow(fDisplay, screen); - const ::Window parent = isEmbed() ? (::Window)getParentWindowHandle() : root; + const ::Window parent = isEmbed() + ? (::Window)getParentWindowHandle() + : RootWindow(fDisplay, DefaultScreen(fDisplay)); fWindow = XCreateSimpleWindow(fDisplay, parent, 0, 0, getWidth(), getHeight(), 0, 0, 0); DISTRHO_SAFE_ASSERT_RETURN(fWindow != 0,); @@ -154,7 +153,12 @@ public: XSetNormalHints(fDisplay, fWindow, &sizeHints); XStoreName(fDisplay, fWindow, getTitle()); - if (parent == root) + if (isEmbed()) + { + // start with window mapped, so host can access it + XMapWindow(fDisplay, fWindow); + } + else { // grab Esc key for auto-close XGrabKey(fDisplay, X11Key_Escape, AnyModifier, fWindow, 1, GrabModeAsync, GrabModeAsync); @@ -178,6 +182,7 @@ public: XChangeProperty(fDisplay, fWindow, _wt, XA_ATOM, 32, PropModeReplace, (const uchar*)&_wts, 2); } #endif + d_stdout("created external window with size %u %u", getWidth(), getHeight()); } ~EmbedExternalExampleUI()