Skip to content

Commit

Permalink
Fix window preview in Gnome 45
Browse files Browse the repository at this point in the history
When setting the middle button click as "show window preview",
the previews aren't shown. Instead, an empty rectangle appears
and a lot of errors are shown in the log.

This patch fixes this.

Fix #2202
  • Loading branch information
sergio-costas authored and 3v1n0 committed Apr 25, 2024
1 parent b9bf062 commit 6745d8c
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions windowPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ export class WindowPreviewMenu extends PopupMenu.PopupMenu {
});
this._destroyId = this._source.connect('destroy', this.destroy.bind(this));

Main.uiGroup.add_child(this.actor);
if (Main.uiGroup.add_actor)
Main.uiGroup.add_actor(this.actor);
else
Main.uiGroup.add_child(this.actor);

this.connect('destroy', this._onDestroy.bind(this));
}
Expand Down Expand Up @@ -109,7 +112,10 @@ class WindowPreviewList extends PopupMenu.PopupMenuSection {
this.isHorizontal = position === St.Side.BOTTOM || position === St.Side.TOP;
this.box.set_vertical(!this.isHorizontal);
this.box.set_name('dashtodockWindowList');
this.actor.add_child(this.box);
if (this.actor.add_actor)
this.actor.add_actor(this.box);
else
this.actor.add_child(this.box);
this.actor._delegate = this;

this._shownInitially = false;
Expand Down Expand Up @@ -359,7 +365,10 @@ class WindowPreviewMenuItem extends PopupMenu.PopupBaseMenuItem {
? Clutter.ActorAlign.START : Clutter.ActorAlign.END,
y_align: Clutter.ActorAlign.START,
});
this.closeButton.set_child(new St.Icon({icon_name: 'window-close-symbolic'}));
if (this.closeButton.add_actor)
this.closeButton.add_actor(new St.Icon({icon_name: 'window-close-symbolic'}));
else
this.closeButton.add_child(new St.Icon({icon_name: 'window-close-symbolic'}));
this.closeButton.connect('clicked', () => this._closeWindow());

const overlayGroup = new Clutter.Actor({
Expand Down Expand Up @@ -387,8 +396,13 @@ class WindowPreviewMenuItem extends PopupMenu.PopupBaseMenuItem {
x_expand: true,
});

box.add_child(overlayGroup);
box.add_child(labelBin);
if (box.add) {
box.add(overlayGroup);
box.add(labelBin);
} else {
box.add_child(overlayGroup);
box.add_child(labelBin);
}
this._box = box;
this.add_child(box);

Expand Down

0 comments on commit 6745d8c

Please sign in to comment.