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>
This commit is contained in:
parent
990eb92bd9
commit
c080bc59a4
@ -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 = () => {
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user