Restore ui::Window bounds correctly after loading its lastNativeFrame()

Without this fix windows were missing a last re-layout/setBounds to
the new frame size, so they showed up with an incorrect size given the
available area of the native window.
This commit is contained in:
David Capello 2021-08-19 11:47:17 -03:00
parent a5b41d2630
commit 7f56db58b7
2 changed files with 10 additions and 2 deletions

2
laf

@ -1 +1 @@
Subproject commit 67daddc2801975328f3665c49e1f03344ab85d22
Subproject commit 9957462b8833bd9dcdd642b7fa15b5d0f46de397

View File

@ -1334,14 +1334,17 @@ void Manager::_openWindow(Window* window, bool center)
os::WindowSpec spec;
gfx::Rect frame;
bool changeFrame;
if (!window->lastNativeFrame().isEmpty()) {
frame = window->lastNativeFrame();
changeFrame = true;
}
else {
gfx::Rect relativeToFrame = parentDisplay->nativeWindow()->contentRect();
frame = window->bounds();
frame *= scale;
frame.offset(relativeToFrame.origin());
changeFrame = false;
}
limit_with_workarea(parentDisplay, frame);
@ -1382,7 +1385,12 @@ void Manager::_openWindow(Window* window, bool center)
m_display.nativeWindow()->activate();
// Move all widgets to the os::Display origin (0,0)
window->offsetWidgets(-window->origin().x, -window->origin().y);
if (changeFrame) {
window->setBounds(newNativeWindow->bounds() / scale);
}
else {
window->offsetWidgets(-window->origin().x, -window->origin().y);
}
// Handle native hit testing. Required to be able to move/resize
// a window with a non-mouse pointer (e.g. stylus) on Windows.