From bc9bba1d9b48a0f0ecabd86b76ad9d985af8e1d1 Mon Sep 17 00:00:00 2001 From: Domenico Iezzi Date: Sun, 11 Feb 2024 12:01:22 +0100 Subject: [PATCH] LibGUI: Explicitly fire a resize event when toggling Calendar mode Calendar::toggle_mode function performed a call to Widget::resize with swapped width and height parameters as a quick way to trigger a resize_event (resize event is generated only when the new rect size is different from the old one, hence the swapped parameters). This method does not work when width and height are equal, such as in the DatePicker widget where width and height are fixed to 200x200. In such case, calls to Calendar::toggle_mode would not generate a resize event, leaving tiles uninitialized, therefore the widget was not able to properly paint the Month view. This commit replaces Widget::resize call with a manual triggering of the event. --- Userland/Libraries/LibGUI/Calendar.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibGUI/Calendar.cpp b/Userland/Libraries/LibGUI/Calendar.cpp index 043e65c326..696aba447e 100644 --- a/Userland/Libraries/LibGUI/Calendar.cpp +++ b/Userland/Libraries/LibGUI/Calendar.cpp @@ -80,7 +80,8 @@ void Calendar::toggle_mode() set_show_year(!m_show_year); set_show_month_and_year(!m_show_month_year); update_tiles(this->view_year(), this->view_month()); - this->resize(this->height(), this->width()); + ResizeEvent resize_evt(relative_rect().size()); + event(resize_evt); invalidate_layout(); }