From 23bcff3348f63c5c10c8d3034665a55b747337c2 Mon Sep 17 00:00:00 2001 From: Sebastian Keller Date: Mon, 23 Oct 2023 01:06:59 +0200 Subject: [PATCH] calendar: Emit selected-date-changed before rebuilding the calendar If the cursor was placed on one of the widgets that get removed when rebuilding the calendar due to a month change, destroying the hovered widget will trigger a repick. This repick can then trigger an allocation while not all buttons of the calendar are present. If the last allocation before selected-date-changed is emitted was from such an incomplete state, DateMenuButton will still freeze the layout in this state in its signal handler. What freezing the layout in DateMenuButton is supposed to do is to prevent size changes of the menu when changing days, but for this the layout needs to be frozen before potentially rebuilding calendar. This change ensures that by emitting the signal earlier. Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5411 Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5469 Part-of: --- js/ui/calendar.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/ui/calendar.js b/js/ui/calendar.js index 1371abf33..6de034c2c 100644 --- a/js/ui/calendar.js +++ b/js/ui/calendar.js @@ -471,11 +471,12 @@ export const Calendar = GObject.registerClass({ return; this._selectedDate = date; - this._update(); let datetime = GLib.DateTime.new_from_unix_local( this._selectedDate.getTime() / 1000); this.emit('selected-date-changed', datetime); + + this._update(); } updateTimeZone() {