commit d2c8d93044d3834930522a6ac2683971855e7376 parent c6e3ea5b9d1fe6ed4f40fa677fe5b25f91259c65 Author: falkTX <falktx@falktx.com> Date: Sat, 14 Aug 2021 00:54:58 +0100 Fix geometry constraints for embed UIs on scale factor != 1 Diffstat:
M | dgl/src/Window.cpp | | | 12 | ++++++++---- |
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/dgl/src/Window.cpp b/dgl/src/Window.cpp @@ -156,12 +156,16 @@ void Window::setSize(uint width, uint height) if (pData->isEmbed) { + const double scaleFactor = pData->scaleFactor; + const uint minWidth = static_cast<uint>(pData->minWidth * scaleFactor + 0.5); + const uint minHeight = static_cast<uint>(pData->minHeight * scaleFactor + 0.5); + // handle geometry constraints here - if (width < pData->minWidth) - width = pData->minWidth; + if (width < minWidth) + width = minWidth; - if (height < pData->minHeight) - height = pData->minHeight; + if (height < minHeight) + height = minHeight; if (pData->keepAspectRatio) {