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 =
"")
47 terminateAndWaitForProcess();
50 uint getWidth()
const noexcept
55 uint getHeight()
const noexcept
60 const char* getTitle()
const noexcept
65 void setTitle(
const char*
const t) noexcept
70 bool isRunning() noexcept
75 const pid_t p = ::waitpid(pid,
nullptr, WNOHANG);
77 if (p == pid || (p == -1 && errno == ECHILD))
79 printf(
"NOTICE: Child process exited while idle\n");
88 bool startExternalProcess(
const char* args[])
90 terminateAndWaitForProcess();
97 execvp(args[0], (
char**)args);
102 printf(
"Could not start external ui\n");
116 friend class UIExporter;
118 void terminateAndWaitForProcess()
123 printf(
"Waiting for previous process to stop,,,\n");
125 bool sendTerm =
true;
129 p = ::waitpid(pid,
nullptr, WNOHANG);
137 ::kill(pid, SIGTERM);
144 printf(
"Done! (no such process)\n");
153 printf(
"Done! (clean wait)\n");
170 END_NAMESPACE_DISTRHO
172 #endif // DISTRHO_EXTERNAL_WINDOW_HPP_INCLUDED Definition: ExternalWindow.hpp:36
Definition: String.hpp:29