Browse Source

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

Signed-off-by: falkTX <falktx@falktx.com>
pull/314/head
falkTX 4 years ago
parent
commit
b755b07abf
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
1 changed files with 10 additions and 5 deletions
  1. +10
    -5
      examples/EmbedExternalUI/EmbedExternalExampleUI.cpp

+ 10
- 5
examples/EmbedExternalUI/EmbedExternalExampleUI.cpp View File

@@ -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()


Loading…
Cancel
Save