Skip to content

Commit

Permalink
windowPreview: Use set_child instead of add_child
Browse files Browse the repository at this point in the history
While it's safe to use either in GNOME 46, it is not always safe to use
(clutter_actor_)add_child directly in GNOME 45. Because the notification
StBin requires to update its internal state wasn't added until
gnome-shell@ed3b8d093e introduced in 46.alpha.

At least (st_bin_)set_child remains the same in all GNOME versions, and
is what the old (clutter_container_)add_actor used to call in GNOME 45.

There may be other places where we need to change add_child to set_child
for backward compatibility with StBin, but if they exist then they're not
causing problems yet.

Closes: https://bugs.launchpad.net/bugs/2056506
Fixes: 4945dbf
  • Loading branch information
vanvugt committed Mar 12, 2024
1 parent 6ef0f5d commit 255ef10
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion windowPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ class WindowPreviewMenuItem extends PopupMenu.PopupBaseMenuItem {
? Clutter.ActorAlign.START : Clutter.ActorAlign.END,
y_align: Clutter.ActorAlign.START,
});
this.closeButton.add_child(new St.Icon({icon_name: 'window-close-symbolic'}));
this.closeButton.set_child(new St.Icon({icon_name: 'window-close-symbolic'}));
this.closeButton.connect('clicked', () => this._closeWindow());

const overlayGroup = new Clutter.Actor({
Expand Down

0 comments on commit 255ef10

Please sign in to comment.