[gnome-shell] quickSettings: Update bind constraint offset on idle
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] quickSettings: Update bind constraint offset on idle
- Date: Sat, 17 Sep 2022 18:18:06 +0000 (UTC)
commit c080bc59a4eac57756e3b1d92e33b88fc5b530c7
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Wed Sep 7 23:17:22 2022 +0200
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 '<unnamed>[<StBoxLayout>:0x3138d70]' is currently inside an
allocation cycle; calling clutter_actor_queue_relayout() is not recommended
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2476>
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 822893b782..7a31d561d4 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]