From 938c66c83d9ee1422364d136d1c56b72a858851c Mon Sep 17 00:00:00 2001 From: attila Date: Wed, 22 Jun 2022 18:08:32 +0200 Subject: [PATCH] Linux: Fix window positioning on HiDPI screens In 6f3fb5a29f20e4cb54faf4d1a0d64b4bd6b6a88f windowBorder member of LinuxComponentPeer was changed to mean the logical size of the border that is independent of the current scale factor. This was done to fix a bug and make it consistent with the bounds member, which is also independent from the scale factor. This change wasn't taken into account in XWindowSystem::setBounds() causing a positioning bug. --- .../native/x11/juce_linux_XWindowSystem.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp b/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp index 087f881b9a..5ef06a28d0 100644 --- a/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp +++ b/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp @@ -1747,17 +1747,17 @@ void XWindowSystem::setBounds (::Window windowH, Rectangle newBounds, bool X11Symbols::getInstance()->xSetWMNormalHints (display, windowH, hints.get()); } - const auto windowBorder = [&]() -> BorderSize + const auto nativeWindowBorder = [&]() -> BorderSize { if (const auto& frameSize = peer->getFrameSizeIfPresent()) - return *frameSize; + return frameSize->multipliedBy (peer->getPlatformScaleFactor()); return {}; }(); X11Symbols::getInstance()->xMoveResizeWindow (display, windowH, - newBounds.getX() - windowBorder.getLeft(), - newBounds.getY() - windowBorder.getTop(), + newBounds.getX() - nativeWindowBorder.getLeft(), + newBounds.getY() - nativeWindowBorder.getTop(), (unsigned int) newBounds.getWidth(), (unsigned int) newBounds.getHeight()); }