Browse Source

Fix an assertion and invalid window sizes

Signed-off-by: falkTX <falktx@falktx.com>
pull/272/head
falkTX 4 years ago
parent
commit
aa897a365a
3 changed files with 15 additions and 3 deletions
  1. +6
    -2
      dgl/src/ImageWidgets.cpp
  2. +4
    -0
      dgl/src/Window.cpp
  3. +5
    -1
      distrho/src/DistrhoUI.cpp

+ 6
- 2
dgl/src/ImageWidgets.cpp View File

@@ -31,8 +31,10 @@ ImageAboutWindow::ImageAboutWindow(Window& parentWindow, const Image& image)
{
// TODO set transient
Window::setResizable(false);
Window::setSize(image.getSize());
Window::setTitle("About");

if (image.isValid())
Window::setSize(image.getSize());
}

ImageAboutWindow::ImageAboutWindow(TopLevelWidget* const parentTopLevelWidget, const Image& image)
@@ -41,8 +43,10 @@ ImageAboutWindow::ImageAboutWindow(TopLevelWidget* const parentTopLevelWidget, c
{
// TODO set transient
Window::setResizable(false);
Window::setSize(image.getSize());
Window::setTitle("About");

if (image.isValid())
Window::setSize(image.getSize());
}

void ImageAboutWindow::setImage(const Image& image)


+ 4
- 0
dgl/src/Window.cpp View File

@@ -121,6 +121,10 @@ void Window::setSize(const uint width, const uint height)
{
DISTRHO_SAFE_ASSERT_UINT2_RETURN(width > 1 && height > 1, width, height,);

// FIXME add default and min props for this
if (pData->minWidth == 0 && pData->minHeight == 0)
puglSetDefaultSize(pData->view, width, height);

puglSetWindowSize(pData->view, width, height);
}



+ 5
- 1
distrho/src/DistrhoUI.cpp View File

@@ -196,7 +196,11 @@ void UI::onResize(const ResizeEvent& ev)
if (uiData->resizeInProgress)
return;

uiData->setSizeCallback(ev.size.getWidth(), ev.size.getHeight());
const uint width = ev.size.getWidth();
const uint height = ev.size.getHeight();

pData->window.setSize(width, height);
uiData->setSizeCallback(width, height);
}
#endif // !DISTRHO_PLUGIN_HAS_EXTERNAL_UI



Loading…
Cancel
Save