Skip to content

Commit

Permalink
Fix thumbnails not appearing for windows created while menu is open (#…
Browse files Browse the repository at this point in the history
…11759)

With this change, I don't have #11106 happen anymore.

For me, the bug happened whenever a window is created while the hover
menu is open.

Thumbnails objects were being created and added to the list of
thumbnails in the AppThumbnailHoverMenu. However, then refreshThumbnail
is called, which calls getThumbnail. In getThumbnail, metaWindowActor
is still null and metaWindow.get_compositor_private returned null,
causing it to remove the thumbnail again before it was ever visible.

With the setTimeout(..., 0), getThumbnail is called on the next
event loop turn, so that the actor will be returned by
get_compositor_private.

If the menu isn't open when the window is created, then the window is
added to the queuedWindows array and added later on when the actor is
available.
  • Loading branch information
jminer authored Jul 20, 2023
1 parent 70297d2 commit 2faa38d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion files/usr/share/cinnamon/applets/[email protected]/menus.js
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,9 @@ class WindowThumbnail {
}

this.labelContainer.child.text = this.metaWindow.title || '';
this.getThumbnail(thumbnailWidth, thumbnailHeight);
setTimeout(() => {
this.getThumbnail(thumbnailWidth, thumbnailHeight);
}, 0);
}

hoverPeek(opacity) {
Expand Down

1 comment on commit 2faa38d

@dvs-111
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this be available in LM 21.2? (Ubuntu-based)

Please sign in to comment.