Browse Source

Allow to store window title in external windows

pull/6/head
falkTX 9 years ago
parent
commit
d1e127289c
2 changed files with 25 additions and 9 deletions
  1. +15
    -3
      distrho/extra/ExternalWindow.hpp
  2. +10
    -6
      distrho/src/DistrhoUIInternal.hpp

+ 15
- 3
distrho/extra/ExternalWindow.hpp View File

@@ -17,7 +17,7 @@
#ifndef DISTRHO_EXTERNAL_WINDOW_HPP_INCLUDED #ifndef DISTRHO_EXTERNAL_WINDOW_HPP_INCLUDED
#define DISTRHO_EXTERNAL_WINDOW_HPP_INCLUDED #define DISTRHO_EXTERNAL_WINDOW_HPP_INCLUDED


#include "../DistrhoUtils.hpp"
#include "String.hpp"


#ifdef DISTRHO_OS_UNIX #ifdef DISTRHO_OS_UNIX
# include <cerrno> # include <cerrno>
@@ -35,12 +35,13 @@ START_NAMESPACE_DISTRHO
class ExternalWindow class ExternalWindow
{ {
public: public:
ExternalWindow(const uint w = 1, const uint h = 1)
ExternalWindow(const uint w = 1, const uint h = 1, const char* const t = "")
: width(w), : width(w),
height(h), height(h),
title(t),
pid(0) {} pid(0) {}


~ExternalWindow()
virtual ~ExternalWindow()
{ {
terminateAndWaitForProcess(); terminateAndWaitForProcess();
} }
@@ -55,6 +56,16 @@ public:
return height; return height;
} }


const char* getTitle() const noexcept
{
return title;
}

void setTitle(const char* const t) noexcept
{
title = t;
}

bool isRunning() noexcept bool isRunning() noexcept
{ {
if (pid <= 0) if (pid <= 0)
@@ -98,6 +109,7 @@ protected:
private: private:
uint width; uint width;
uint height; uint height;
String title;
pid_t pid; pid_t pid;


friend class UIExporter; friend class UIExporter;


+ 10
- 6
distrho/src/DistrhoUIInternal.hpp View File

@@ -370,6 +370,16 @@ public:


// ------------------------------------------------------------------- // -------------------------------------------------------------------


void setWindowTitle(const char* const uiTitle)
{
#ifdef HAVE_DGL
glWindow.setTitle(uiTitle);
#else
DISTRHO_SAFE_ASSERT_RETURN(fUI != nullptr,);
fUI->setTitle(uiTitle);
#endif
}

#ifdef HAVE_DGL #ifdef HAVE_DGL
void setWindowSize(const uint width, const uint height, const bool updateUI = false) void setWindowSize(const uint width, const uint height, const bool updateUI = false)
{ {
@@ -386,11 +396,6 @@ public:
fChangingSize = false; fChangingSize = false;
} }


void setWindowTitle(const char* const uiTitle)
{
glWindow.setTitle(uiTitle);
}

void setWindowTransientWinId(const uintptr_t winId) void setWindowTransientWinId(const uintptr_t winId)
{ {
glWindow.setTransientWinId(winId); glWindow.setTransientWinId(winId);
@@ -404,7 +409,6 @@ public:
} }
#else #else
void setWindowSize(const uint width, const uint height, const bool updateUI = false) {} void setWindowSize(const uint width, const uint height, const bool updateUI = false) {}
void setWindowTitle(const char* const uiTitle) {}
void setWindowTransientWinId(const uintptr_t winId) {} void setWindowTransientWinId(const uintptr_t winId) {}
bool setWindowVisible(const bool yesNo) { return true; } bool setWindowVisible(const bool yesNo) { return true; }
#endif #endif


Loading…
Cancel
Save