From c080bc59a4eac57756e3b1d92e33b88fc5b530c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 7 Sep 2022 23:17:22 +0200 Subject: [PATCH] quickSettings: Update bind constraint offset on idle Use Meta.LaterType.BEFORE_REDRAW to queue setting the bind constraint offset in an idle callback. This is needed since the signals that trigger updating the offset may be emitted during allocation, at which point queuing new relayouts isn't ideal, since it could result in relayout cycles. In this case, we really do want to relayout as a side effect of another actors allocation, so make this explicit. This fixes a few warnings such as: The actor '[:0x3138d70]' is currently inside an allocation cycle; calling clutter_actor_queue_relayout() is not recommended Part-of: --- js/ui/quickSettings.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/js/ui/quickSettings.js b/js/ui/quickSettings.js index 822893b78..7a31d561d 100644 --- a/js/ui/quickSettings.js +++ b/js/ui/quickSettings.js @@ -1,5 +1,5 @@ /* exported QuickToggle, QuickMenuToggle, QuickSlider, QuickSettingsMenu, SystemIndicator */ -const {Atk, Clutter, Gio, GLib, GObject, Graphene, Pango, St} = imports.gi; +const {Atk, Clutter, Gio, GLib, GObject, Graphene, Meta, Pango, St} = imports.gi; const Main = imports.ui.main; const PopupMenu = imports.ui.popupMenu; @@ -626,9 +626,12 @@ var QuickSettingsMenu = class extends PopupMenu.PopupMenu { // Pick up additional spacing from any intermediate actors const updateOffset = () => { - const offset = this._grid.apply_relative_transform_to_point( - this._boxPointer, new Graphene.Point3D()); - yConstraint.offset = offset.y; + Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => { + const offset = this._grid.apply_relative_transform_to_point( + this._boxPointer, new Graphene.Point3D()); + yConstraint.offset = offset.y; + return GLib.SOURCE_REMOVE; + }); }; this._grid.connect('notify::y', updateOffset); this.box.connect('notify::y', updateOffset);