Skip to content

Commit

Permalink
Fix embed external ui closing too early
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <[email protected]>
  • Loading branch information
falkTX committed Aug 25, 2021
1 parent f7c4fd4 commit 44ea88d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
8 changes: 4 additions & 4 deletions distrho/extra/ExternalWindow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,15 @@ class ExternalWindow

virtual bool isQuitting() const
{
if (ext.inUse)
return ext.isQuitting;

return !isVisible();
return ext.inUse ? ext.isQuitting : pData.isQuitting;
}

/**
Hide the UI and gracefully terminate.
*/
virtual void close()
{
pData.isQuitting = true;
hide();

if (ext.inUse)
Expand Down Expand Up @@ -436,6 +434,7 @@ class ExternalWindow
uint height;
double scaleFactor;
String title;
bool isQuitting;
bool visible;

PrivateData()
Expand All @@ -445,6 +444,7 @@ class ExternalWindow
height(1),
scaleFactor(1.0),
title(),
isQuitting(false),
visible(false) {}
} pData;

Expand Down
10 changes: 10 additions & 0 deletions examples/EmbedExternalUI/EmbedExternalExampleUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,16 @@ class EmbedExternalExampleUI : public UI
/* --------------------------------------------------------------------------------------------------------
* External Window overrides */

uintptr_t getNativeWindowHandle() const noexcept override
{
#if defined(DISTRHO_OS_MAC)
#elif defined(DISTRHO_OS_WINDOWS)
#else
return (uintptr_t)fWindow;
#endif
return 0;
}

void titleChanged(const char* const title) override
{
d_stdout("visibilityChanged %s", title);
Expand Down

0 comments on commit 44ea88d

Please sign in to comment.