mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-10 03:44:16 +00:00
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:
parent
a5b41d2630
commit
7f56db58b7
2
laf
2
laf
@ -1 +1 @@
|
|||||||
Subproject commit 67daddc2801975328f3665c49e1f03344ab85d22
|
Subproject commit 9957462b8833bd9dcdd642b7fa15b5d0f46de397
|
@ -1334,14 +1334,17 @@ void Manager::_openWindow(Window* window, bool center)
|
|||||||
|
|
||||||
os::WindowSpec spec;
|
os::WindowSpec spec;
|
||||||
gfx::Rect frame;
|
gfx::Rect frame;
|
||||||
|
bool changeFrame;
|
||||||
if (!window->lastNativeFrame().isEmpty()) {
|
if (!window->lastNativeFrame().isEmpty()) {
|
||||||
frame = window->lastNativeFrame();
|
frame = window->lastNativeFrame();
|
||||||
|
changeFrame = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
gfx::Rect relativeToFrame = parentDisplay->nativeWindow()->contentRect();
|
gfx::Rect relativeToFrame = parentDisplay->nativeWindow()->contentRect();
|
||||||
frame = window->bounds();
|
frame = window->bounds();
|
||||||
frame *= scale;
|
frame *= scale;
|
||||||
frame.offset(relativeToFrame.origin());
|
frame.offset(relativeToFrame.origin());
|
||||||
|
changeFrame = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
limit_with_workarea(parentDisplay, frame);
|
limit_with_workarea(parentDisplay, frame);
|
||||||
@ -1382,7 +1385,12 @@ void Manager::_openWindow(Window* window, bool center)
|
|||||||
m_display.nativeWindow()->activate();
|
m_display.nativeWindow()->activate();
|
||||||
|
|
||||||
// Move all widgets to the os::Display origin (0,0)
|
// 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
|
// Handle native hit testing. Required to be able to move/resize
|
||||||
// a window with a non-mouse pointer (e.g. stylus) on Windows.
|
// a window with a non-mouse pointer (e.g. stylus) on Windows.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user