Browse Source

DPT: Fix mingw build; add getApp() method

tags/1.9.4
falkTX 12 years ago
parent
commit
f72c8010c8
5 changed files with 35 additions and 9 deletions
  1. +2
    -0
      source/libs/distrho/dgl/ImageAboutWindow.hpp
  2. +4
    -0
      source/libs/distrho/dgl/Widget.hpp
  3. +1
    -0
      source/libs/distrho/dgl/Window.hpp
  4. +5
    -0
      source/libs/distrho/dgl/src/Widget.cpp
  5. +23
    -9
      source/libs/distrho/dgl/src/Window.cpp

+ 2
- 0
source/libs/distrho/dgl/ImageAboutWindow.hpp View File

@@ -21,6 +21,8 @@
#include "Widget.hpp" #include "Widget.hpp"
#include "Window.hpp" #include "Window.hpp"


#include <cstdint>

START_NAMESPACE_DISTRHO START_NAMESPACE_DISTRHO


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


+ 4
- 0
source/libs/distrho/dgl/Widget.hpp View File

@@ -19,10 +19,13 @@


#include "Geometry.hpp" #include "Geometry.hpp"


#include <cstdint>

START_NAMESPACE_DISTRHO START_NAMESPACE_DISTRHO


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


class App;
class Window; class Window;


class Widget class Widget
@@ -69,6 +72,7 @@ public:


int getModifiers(); int getModifiers();


App* getApp() const;
Window* getParent() const; Window* getParent() const;
void repaint(); void repaint();




+ 1
- 0
source/libs/distrho/dgl/Window.hpp View File

@@ -44,6 +44,7 @@ public:
void setSize(unsigned int width, unsigned int height); void setSize(unsigned int width, unsigned int height);
void setWindowTitle(const char* title); void setWindowTitle(const char* title);


App* getApp() const;
int getModifiers(); int getModifiers();
intptr_t getWindowId(); intptr_t getWindowId();




+ 5
- 0
source/libs/distrho/dgl/src/Widget.cpp View File

@@ -166,6 +166,11 @@ int Widget::getModifiers()
return fParent->getModifiers(); return fParent->getModifiers();
} }


App* Widget::getApp() const
{
return fParent->getApp();
}

Window* Widget::getParent() const Window* Widget::getParent() const
{ {
return fParent; return fParent;


+ 23
- 9
source/libs/distrho/dgl/src/Window.cpp View File

@@ -44,8 +44,9 @@ START_NAMESPACE_DISTRHO
class Window::Private class Window::Private
{ {
public: public:
Private(Window* self, App::Private* app, Private* parent, intptr_t parentId = 0)
Private(Window* self, App* app, App::Private* appPriv, Private* parent, intptr_t parentId = 0)
: kApp(app), : kApp(app),
kAppPriv(appPriv),
kSelf(self), kSelf(self),
kView(puglCreate(parentId, "Window", 600, 500, false, false)), kView(puglCreate(parentId, "Window", 600, 500, false, false)),
fParent(parent), fParent(parent),
@@ -80,9 +81,11 @@ public:
puglSetReshapeFunc(kView, onReshapeCallback); puglSetReshapeFunc(kView, onReshapeCallback);
puglSetCloseFunc(kView, onCloseCallback); puglSetCloseFunc(kView, onCloseCallback);


#if DISTRHO_OS_LINUX
PuglInternals* impl = kView->impl; PuglInternals* impl = kView->impl;


#if DISTRHO_OS_WINDOWS
hwnd = impl->hwnd;
#elif DISTRHO_OS_LINUX
xDisplay = impl->display; xDisplay = impl->display;
xWindow = impl->win; xWindow = impl->win;


@@ -95,7 +98,7 @@ public:
} }
#endif #endif


kApp->addWindow(kSelf);
kAppPriv->addWindow(kSelf);
} }


~Private() ~Private()
@@ -104,7 +107,7 @@ public:


if (kView != nullptr) if (kView != nullptr)
{ {
kApp->removeWindow(kSelf);
kAppPriv->removeWindow(kSelf);
puglDestroy(kView); puglDestroy(kView);
} }
} }
@@ -212,9 +215,9 @@ public:
#endif #endif


if (yesNo) if (yesNo)
kApp->oneShown();
kAppPriv->oneShown();
else else
kApp->oneHidden();
kAppPriv->oneHidden();
} }


void setSize(unsigned int width, unsigned int height) void setSize(unsigned int width, unsigned int height)
@@ -245,6 +248,11 @@ public:
#endif #endif
} }


App* getApp() const
{
return kApp;
}

int getModifiers() int getModifiers()
{ {
return puglGetModifiers(kView); return puglGetModifiers(kView);
@@ -384,7 +392,8 @@ protected:
} }


private: private:
App::Private* const kApp;
App* const kApp;
App::Private* const kAppPriv;
Window* const kSelf; Window* const kSelf;
PuglView* const kView; PuglView* const kView;


@@ -454,12 +463,12 @@ private:
// Window // Window


Window::Window(App* app, Window* parent) Window::Window(App* app, Window* parent)
: kPrivate(new Private(this, app->kPrivate, (parent != nullptr) ? parent->kPrivate : nullptr))
: kPrivate(new Private(this, app, app->kPrivate, (parent != nullptr) ? parent->kPrivate : nullptr))
{ {
} }


Window::Window(App* app, intptr_t parentId) Window::Window(App* app, intptr_t parentId)
: kPrivate(new Private(this, app->kPrivate, nullptr, parentId))
: kPrivate(new Private(this, app, app->kPrivate, nullptr, parentId))
{ {
} }


@@ -508,6 +517,11 @@ void Window::setWindowTitle(const char* title)
kPrivate->setWindowTitle(title); kPrivate->setWindowTitle(title);
} }


App* Window::getApp() const
{
return kPrivate->getApp();
}

int Window::getModifiers() int Window::getModifiers()
{ {
return kPrivate->getModifiers(); return kPrivate->getModifiers();


Loading…
Cancel
Save