Avoid dialog's window relayout during an ongoing window's size change

This commit is contained in:
Martín Capello 2023-03-23 08:34:07 -03:00 committed by David Capello
parent 5fb0b72c73
commit 961dc46066
4 changed files with 14 additions and 2 deletions

2
laf

@ -1 +1 @@
Subproject commit 75c52a0e025ce3cd6977241139c2974b01896237
Subproject commit 7d31b6b2497c51add6ca9d8286aa8143706bc167

View File

@ -1362,7 +1362,11 @@ int Dialog_modify(lua_State* L)
// TODO shades mode? file title / open / save / filetypes? on* events?
if (relayout) {
// Relayout only if the the dialog window is not being resized.
// This is due to the possibility of a script calling a method
// to modify dialog's properties (which might generate a relayout)
// during an ongoing resize event.
if (relayout && !dlg->window.isResizing()) {
dlg->window.layout();
gfx::Rect bounds(dlg->window.bounds().w,

View File

@ -735,6 +735,8 @@ void Window::onBuildTitleLabel()
void Window::windowSetPosition(const gfx::Rect& rect)
{
m_isResizing = (bounds().size() != rect.size());
// Copy the new position rectangle
setBoundsQuietly(rect);
Rect cpos = childrenBounds();
@ -748,6 +750,7 @@ void Window::windowSetPosition(const gfx::Rect& rect)
}
onWindowResize();
m_isResizing = false;
}
void Window::limitSize(int* w, int* h)

View File

@ -66,6 +66,10 @@ namespace ui {
bool isSizeable() const { return m_isSizeable; }
bool isMoveable() const { return m_isMoveable; }
// Returns true only inside onWindowResize() when the window size
// changed.
bool isResizing() const { return m_isResizing; }
bool shouldCreateNativeWindow() const {
return !isDesktop();
}
@ -128,6 +132,7 @@ namespace ui {
bool m_isWantFocus : 1;
bool m_isForeground : 1;
bool m_isAutoRemap : 1;
bool m_isResizing : 1;
int m_hitTest;
gfx::Rect m_lastFrame;
};