17 #ifndef DISTRHO_EXTERNAL_WINDOW_HPP_INCLUDED 
   18 #define DISTRHO_EXTERNAL_WINDOW_HPP_INCLUDED 
   22 #ifdef DISTRHO_OS_WINDOWS 
   23 # error Unsupported platform! 
   27 # include <sys/wait.h> 
   31 START_NAMESPACE_DISTRHO
 
   39     ExternalWindow(
const uint w = 1, 
const uint h = 1, 
const char* 
const t = 
"")
 
   49         terminateAndWaitForProcess();
 
   52     uint getWidth() 
const noexcept
 
   57     uint getHeight() 
const noexcept
 
   62     const char* getTitle() 
const noexcept
 
   67     uintptr_t getTransientWinId() 
const noexcept
 
   69         return transientWinId;
 
   72     bool isVisible() 
const noexcept
 
   77     bool isRunning() noexcept
 
   82         const pid_t p = ::waitpid(pid, 
nullptr, WNOHANG);
 
   84         if (p == pid || (p == -1 && errno == ECHILD))
 
   86             printf(
"NOTICE: Child process exited while idle\n");
 
   94     virtual void setSize(uint w, uint h)
 
  100     virtual void setTitle(
const char* 
const t)
 
  105     virtual void setTransientWinId(
const uintptr_t winId)
 
  107         transientWinId = winId;
 
  110     virtual void setVisible(
const bool yesNo)
 
  116     bool startExternalProcess(
const char* args[])
 
  118         terminateAndWaitForProcess();
 
  125             execvp(args[0], (
char**)args);
 
  130             printf(
"Could not start external ui\n");
 
  138     void terminateAndWaitForProcess()
 
  143         printf(
"Waiting for previous process to stop,,,\n");
 
  145         bool sendTerm = 
true;
 
  149             p = ::waitpid(pid, 
nullptr, WNOHANG);
 
  157                     ::kill(pid, SIGTERM);
 
  164                     printf(
"Done! (no such process)\n");
 
  173                     printf(
"Done! (clean wait)\n");
 
  189     uintptr_t transientWinId;
 
  193     friend class UIExporter;
 
  200 END_NAMESPACE_DISTRHO
 
  202 #endif // DISTRHO_EXTERNAL_WINDOW_HPP_INCLUDED