Browse Source

Linux: Fix window positioning on HiDPI screens

In 6f3fb5a29f 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.
pull/22/head
attila Attila Szarvas 3 years ago
parent
commit
938c66c83d
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp

+ 4
- 4
modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp View File

@@ -1747,17 +1747,17 @@ void XWindowSystem::setBounds (::Window windowH, Rectangle<int> newBounds, bool
X11Symbols::getInstance()->xSetWMNormalHints (display, windowH, hints.get());
}
const auto windowBorder = [&]() -> BorderSize<int>
const auto nativeWindowBorder = [&]() -> BorderSize<int>
{
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());
}


Loading…
Cancel
Save