Browse Source

Proper DGL Window::setSize() on X11, fixes Nekobi UI

tags/1.9.4
falkTX 12 years ago
parent
commit
aa2f9d32df
5 changed files with 33 additions and 20 deletions
  1. +3
    -0
      source/backend/native/distrho/DistrhoPluginCarla.cpp
  2. +1
    -1
      source/backend/native/nekobi/DistrhoUINekobi.cpp
  3. +1
    -1
      source/backend/native/nekobi/NekoWidget.hpp
  4. +21
    -12
      source/libs/distrho/dgl/src/Window.cpp
  5. +7
    -6
      source/libs/distrho/src/DistrhoUIInternal.hpp

+ 3
- 0
source/backend/native/distrho/DistrhoPluginCarla.cpp View File

@@ -62,6 +62,9 @@ public:
setWindowIcon(QIcon(":/scalable/distrho.svg")); setWindowIcon(QIcon(":/scalable/distrho.svg"));
setWindowTitle(QString("%1 (GUI)").arg(fUi.name())); setWindowTitle(QString("%1 (GUI)").arg(fUi.name()));


#ifdef DISTRHO_UI_OPENGL
fUi.fixSize();
#endif
uiResize(fUi.width(), fUi.height()); uiResize(fUi.width(), fUi.height());


{ {


+ 1
- 1
source/backend/native/nekobi/DistrhoUINekobi.cpp View File

@@ -110,7 +110,7 @@ DistrhoUINekobi::DistrhoUINekobi()
Image aboutImageNormal(DistrhoArtworkNekobi::aboutButtonNormalData, DistrhoArtworkNekobi::aboutButtonNormalWidth, DistrhoArtworkNekobi::aboutButtonNormalHeight); Image aboutImageNormal(DistrhoArtworkNekobi::aboutButtonNormalData, DistrhoArtworkNekobi::aboutButtonNormalWidth, DistrhoArtworkNekobi::aboutButtonNormalHeight);
Image aboutImageHover(DistrhoArtworkNekobi::aboutButtonHoverData, DistrhoArtworkNekobi::aboutButtonHoverWidth, DistrhoArtworkNekobi::aboutButtonHoverHeight); Image aboutImageHover(DistrhoArtworkNekobi::aboutButtonHoverData, DistrhoArtworkNekobi::aboutButtonHoverWidth, DistrhoArtworkNekobi::aboutButtonHoverHeight);
fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover); fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover);
fButtonAbout->setPos(500, 5);
fButtonAbout->setPos(505, 5);
fButtonAbout->setCallback(this); fButtonAbout->setCallback(this);
} }




+ 1
- 1
source/backend/native/nekobi/NekoWidget.hpp View File

@@ -59,7 +59,7 @@ public:


void draw() void draw()
{ {
int x = fPos+110;
int x = fPos+108;
int y = -2; int y = -2;


if (fCurImage == &fImages.claw1 || fCurImage == &fImages.claw2) if (fCurImage == &fImages.claw1 || fCurImage == &fImages.claw2)


+ 21
- 12
source/libs/distrho/dgl/src/Window.cpp View File

@@ -57,7 +57,7 @@ public:
: kApp(app), : kApp(app),
kAppPriv(appPriv), kAppPriv(appPriv),
kSelf(self), kSelf(self),
kView(puglCreate(parentId, "Window", 600, 500, false, (parentId != 0))),
kView(puglCreate(parentId, "Window", 100, 100, false, (parentId != 0))),
fParent(parent), fParent(parent),
fChildFocus(nullptr), fChildFocus(nullptr),
fVisible((parentId != 0)), fVisible((parentId != 0)),
@@ -292,6 +292,9 @@ public:


void setSize(unsigned int width, unsigned int height) void setSize(unsigned int width, unsigned int height)
{ {
kView->width = width;
kView->height = height;

#if DGL_OS_WINDOWS #if DGL_OS_WINDOWS
int winFlags = WS_POPUPWINDOW | WS_CAPTION; int winFlags = WS_POPUPWINDOW | WS_CAPTION;


@@ -304,18 +307,24 @@ public:
SetWindowPos(hwnd, 0, 0, 0, wr.right-wr.left, wr.bottom-wr.top, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOOWNERZORDER|SWP_NOZORDER); SetWindowPos(hwnd, 0, 0, 0, wr.right-wr.left, wr.bottom-wr.top, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOOWNERZORDER|SWP_NOZORDER);
UpdateWindow(hwnd); UpdateWindow(hwnd);
#elif DGL_OS_MAC #elif DGL_OS_MAC
puglImplSetSize(kView, width, height);
puglImplSetSize(kView, width, height);
#elif DGL_OS_LINUX #elif DGL_OS_LINUX
// TODO - handle fResizable
XSizeHints sizeHints;
memset(&sizeHints, 0, sizeof(sizeHints));

sizeHints.flags = PMinSize|PMaxSize;
sizeHints.min_width = width;
sizeHints.min_height = height;
sizeHints.max_width = width;
sizeHints.max_height = height;
XSetNormalHints(xDisplay, xWindow, &sizeHints);
XResizeWindow(xDisplay, xWindow, width, height);

if (! fResizable)
{
XSizeHints sizeHints;
memset(&sizeHints, 0, sizeof(sizeHints));

sizeHints.flags = PMinSize|PMaxSize;
sizeHints.min_width = width;
sizeHints.min_height = height;
sizeHints.max_width = width;
sizeHints.max_height = height;

XSetNormalHints(xDisplay, xWindow, &sizeHints);
}

XFlush(xDisplay); XFlush(xDisplay);
#endif #endif




+ 7
- 6
source/libs/distrho/src/DistrhoUIInternal.hpp View File

@@ -133,12 +133,7 @@ public:
if (kUi == nullptr) if (kUi == nullptr)
return; return;


#ifdef DISTRHO_UI_OPENGL
//assert(winId != 0);

//if (winId == 0)
// return;
#else
#ifdef DISTRHO_UI_QT
assert(winId == 0); assert(winId == 0);


if (winId != 0) if (winId != 0)
@@ -251,6 +246,12 @@ public:
{ {
return glWindow.getWindowId(); return glWindow.getWindowId();
} }

void fixSize()
{
assert(kUi != nullptr);
glWindow.setSize(kUi->d_width(), kUi->d_height());
}
#else #else
QtUI* getQtUI() const QtUI* getQtUI() const
{ {


Loading…
Cancel
Save