Fix bounds getting reset when a dialog is closed (fix #3018)

This commit is contained in:
Joshua Ogunyinka 2021-11-24 11:10:57 +04:00 committed by David Capello
parent d52455b200
commit f9d41665f0

View File

@ -1490,6 +1490,19 @@ void Manager::_closeWindow(Window* window, bool redraw_background)
ASSERT(windowDisplay);
ASSERT(windowDisplay != this->display());
// Just as we've set the origin of the window bounds to (0, 0)
// when we created the native window, we have to restore the
// ui::Window bounds' origin now that we are going to remove/close
// the native window.
if (parentDisplay && windowDisplay) {
const int scale = parentDisplay->nativeWindow()->scale();
const gfx::Point parentOrigin = parentDisplay->nativeWindow()->contentRect().origin();
const gfx::Point origin = windowDisplay->nativeWindow()->contentRect().origin();
const gfx::Rect newBounds((origin - parentOrigin) / scale,
window->bounds().size());
window->setBounds(newBounds);
}
// Remove all messages for this display.
removeMessagesForDisplay(windowDisplay);