17 #ifndef DISTRHO_EXTERNAL_WINDOW_HPP_INCLUDED 
   18 #define DISTRHO_EXTERNAL_WINDOW_HPP_INCLUDED 
   22 #ifndef DISTRHO_OS_WINDOWS 
   25 # include <sys/wait.h> 
   94         DISTRHO_SAFE_ASSERT(!pData.visible);
 
  107 #ifndef DISTRHO_OS_WINDOWS 
  109             return ext.isRunning();
 
  121 #ifndef DISTRHO_OS_WINDOWS 
  122         return ext.inUse ? ext.isQuitting : pData.isQuitting;
 
  124         return pData.isQuitting;
 
  155 #if DISTRHO_PLUGIN_HAS_EMBED_UI 
  161         return pData.parentWindowHandle != 0;
 
  171         return pData.visible;
 
  180         return pData.isStandalone;
 
  207         return pData.scaleFactor;
 
  219 #if DISTRHO_PLUGIN_HAS_EMBED_UI 
  230         return pData.parentWindowHandle;
 
  240         return pData.transientWinId;
 
  263         pData.isQuitting = 
true;
 
  265 #ifndef DISTRHO_OS_WINDOWS 
  267             terminateAndWaitForExternalProcess();
 
  298         DISTRHO_SAFE_ASSERT_UINT_RETURN(width > 1, width,);
 
  299         DISTRHO_SAFE_ASSERT_UINT_RETURN(height > 1, height,);
 
  301         if (pData.width == width && pData.height == height)
 
  305         pData.height = height;
 
  316         if (pData.title == title)
 
  328         DISTRHO_SAFE_ASSERT_UINT_RETURN(minimumWidth > 0, minimumWidth,);
 
  329         DISTRHO_SAFE_ASSERT_UINT_RETURN(minimumHeight > 0, minimumHeight,);
 
  331         pData.minWidth = minimumWidth;
 
  332         pData.minHeight = minimumHeight;
 
  333         pData.keepAspectRatio = keepAspectRatio;
 
  355         if (pData.visible == visible)
 
  358         pData.visible = visible;
 
  368         if (pData.transientWinId == winId)
 
  371         pData.transientWinId = winId;
 
  379     bool startExternalProcess(
const char* args[])
 
  381 #ifndef DISTRHO_OS_WINDOWS 
  384         return ext.start(args);
 
  391     void terminateAndWaitForExternalProcess()
 
  393 #ifndef DISTRHO_OS_WINDOWS 
  394         ext.isQuitting = 
true;
 
  395         ext.terminateAndWait();
 
  440     friend class PluginWindow;
 
  443 #ifndef DISTRHO_OS_WINDOWS 
  444     struct ExternalProcess {
 
  459             const pid_t p = ::waitpid(pid, 
nullptr, WNOHANG);
 
  461             if (p == pid || (p == -1 && errno == ECHILD))
 
  463                 d_stdout(
"NOTICE: Child process exited while idle");
 
  471         bool start(
const char* args[])
 
  480                 execvp(args[0], (
char**)args);
 
  485                 d_stderr(
"Could not start external ui");
 
  493         void terminateAndWait()
 
  498             d_stdout(
"Waiting for external process to stop,,,");
 
  500             bool sendTerm = 
true;
 
  504                 p = ::waitpid(pid, 
nullptr, WNOHANG);
 
  512                         ::kill(pid, SIGTERM);
 
  519                         d_stdout(
"Done! (no such process)");
 
  543         uintptr_t parentWindowHandle;
 
  544         uintptr_t transientWinId;
 
  551         bool keepAspectRatio;
 
  557             : parentWindowHandle(0),
 
  565               keepAspectRatio(false),
 
Definition: ExternalWindow.hpp:73
 
double getScaleFactor() const noexcept
Definition: ExternalWindow.hpp:205
 
uint getWidth() const noexcept
Definition: ExternalWindow.hpp:187
 
void setGeometryConstraints(uint minimumWidth, uint minimumHeight, bool keepAspectRatio=false)
Definition: ExternalWindow.hpp:326
 
bool isEmbed() const noexcept
Definition: ExternalWindow.hpp:159
 
void setVisible(bool visible)
Definition: ExternalWindow.hpp:353
 
bool isVisible() const noexcept
Definition: ExternalWindow.hpp:169
 
void show()
Definition: ExternalWindow.hpp:344
 
void setWidth(uint width)
Definition: ExternalWindow.hpp:276
 
ExternalWindow(const PrivateData &data)
Definition: ExternalWindow.hpp:86
 
virtual void transientParentWindowChanged(uintptr_t)
Definition: ExternalWindow.hpp:434
 
void setSize(uint width, uint height)
Definition: ExternalWindow.hpp:296
 
uintptr_t getParentWindowHandle() const noexcept
Definition: ExternalWindow.hpp:228
 
bool isStandalone() const noexcept
Definition: ExternalWindow.hpp:178
 
virtual void visibilityChanged(bool)
Definition: ExternalWindow.hpp:426
 
uint getHeight() const noexcept
Definition: ExternalWindow.hpp:196
 
virtual void focus()
Definition: ExternalWindow.hpp:150
 
virtual bool isQuitting() const
Definition: ExternalWindow.hpp:119
 
void setTitle(const char *title)
Definition: ExternalWindow.hpp:314
 
virtual uintptr_t getNativeWindowHandle() const noexcept
Definition: ExternalWindow.hpp:140
 
virtual ~ExternalWindow()
Definition: ExternalWindow.hpp:92
 
void hide()
Definition: ExternalWindow.hpp:252
 
virtual void sizeChanged(uint, uint)
Definition: ExternalWindow.hpp:408
 
virtual void close()
Definition: ExternalWindow.hpp:261
 
const char * getTitle() const noexcept
Definition: ExternalWindow.hpp:214
 
uintptr_t getTransientWindowId() const noexcept
Definition: ExternalWindow.hpp:238
 
void setHeight(uint height)
Definition: ExternalWindow.hpp:286
 
virtual bool isRunning() const
Definition: ExternalWindow.hpp:105
 
ExternalWindow()
Definition: ExternalWindow.hpp:80
 
virtual void titleChanged(const char *)
Definition: ExternalWindow.hpp:417
 
void setTransientWindowId(uintptr_t winId)
Definition: ExternalWindow.hpp:366
 
Definition: String.hpp:31
 
Definition: DistrhoUI.hpp:74
 
#define END_NAMESPACE_DISTRHO
Definition: DistrhoInfo.hpp:834
 
#define START_NAMESPACE_DISTRHO
Definition: DistrhoInfo.hpp:828
 
static void d_stderr(const char *const fmt,...) noexcept
Definition: DistrhoUtils.hpp:146
 
static void d_stdout(const char *const fmt,...) noexcept
Definition: DistrhoUtils.hpp:131