Skip to content

Commit 714b3d2

Browse files
committed
Better method.
1 parent 5588ec5 commit 714b3d2

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

js/ui/layout.js

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,12 @@ Chrome.prototype = {
775775
},
776776

777777
_updateVisibility: function() {
778+
const monitorsInFullscreen = [];
779+
this._monitors.forEach( monitor => {
780+
const topWindow = this.getTopWindowOnMonitor(monitor.index)
781+
monitorsInFullscreen[monitor.index] = topWindow && topWindow.is_fullscreen();
782+
});
783+
778784
this._trackedActors.forEach( actorData => {
779785
const monitor = this.findMonitorForActor(actorData.actor);
780786
let visible = false;
@@ -795,14 +801,7 @@ Chrome.prototype = {
795801
} else if (this._inOverview)
796802
visible = true;
797803
else {
798-
const focusedWindow = global.display.get_focus_window();
799-
if (!actorData.visibleInFullscreen && focusedWindow && focusedWindow.is_fullscreen()
800-
&& focusedWindow.get_monitor() === monitor.index) {
801-
visible = false;
802-
} else if (!actorData.visibleInFullscreen && monitor.inFullscreen
803-
&& focusedWindow && focusedWindow.get_monitor() != monitor.index) {
804-
visible = false;
805-
} else {
804+
if (actorData.visibleInFullscreen || !monitorsInFullscreen[monitor.index]) {
806805
visible = true;
807806
}
808807
}
@@ -812,6 +811,23 @@ Chrome.prototype = {
812811
this._queueUpdateRegions();
813812
},
814813

814+
getTopWindowOnMonitor: function(monitorIndex) {
815+
let topWindow = null, topWindowTime = 0;
816+
global.get_window_actors().forEach(actor=> {
817+
const window = actor.meta_window;
818+
if (!window || window.get_monitor() !== monitorIndex ||
819+
window.minimized || !window.showing_on_its_workspace() ||
820+
window.get_workspace() !== global.workspace_manager.get_active_workspace())
821+
return;
822+
if (window.get_user_time() > topWindowTime) {
823+
topWindowTime = window.get_user_time();
824+
topWindow = window;
825+
}
826+
});
827+
828+
return topWindow;
829+
},
830+
815831
_overviewShowing: function() {
816832
this._inOverview = true;
817833
this._updateVisibility();

js/ui/panel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,7 @@ PanelDummy.prototype = {
12931293

12941294
this.actor = new Cinnamon.GenericContainer({style_class: "panel-dummy", reactive: true, track_hover: true, important: true});
12951295

1296-
Main.layoutManager.addChrome(this.actor, { addToWindowgroup: false });
1296+
Main.layoutManager.addChrome(this.actor, { addToWindowgroup: false, visibleInFullscreen: true });
12971297
//
12981298
// layouts set to be full width horizontal panels, and vertical panels set to use as much available space as is left
12991299
//

0 commit comments

Comments
 (0)