1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Linux: Fix restoreWindowFromStateString() when the peer already exists

This commit is contained in:
attila 2021-11-26 17:43:23 +01:00
parent ea92834845
commit a7811661c5
11 changed files with 121 additions and 21 deletions

View file

@ -566,10 +566,12 @@ bool ResizableWindow::restoreWindowStateFromString (const String& s)
if (peer != nullptr)
{
peer->getFrameSize().addTo (newPos);
if (const auto frameSize = peer->getFrameSizeIfPresent())
frameSize->addTo (newPos);
}
#if JUCE_LINUX
else
if (peer == nullptr || ! peer->getFrameSizeIfPresent())
{
// We need to adjust for the frame size before we create a peer, as X11
// doesn't provide this information at construction time.
@ -580,7 +582,9 @@ bool ResizableWindow::restoreWindowStateFromString (const String& s)
tokens[firstCoord + 7].getIntValue(),
tokens[firstCoord + 8].getIntValue() };
frame.addTo (newPos);
newPos.setX (newPos.getX() - frame.getLeft());
newPos.setY (newPos.getY() - frame.getTop());
setBounds (newPos);
}
}