From d2c8d93044d3834930522a6ac2683971855e7376 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 14 Aug 2021 00:55:25 +0100 Subject: [PATCH] Fix geometry constraints for embed UIs on scale factor != 1 --- dgl/src/Window.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dgl/src/Window.cpp b/dgl/src/Window.cpp index 10f77122..ea398793 100644 --- 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(pData->minWidth * scaleFactor + 0.5); + const uint minHeight = static_cast(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) {