From c99b07c4c998dee8dbb8c15ff2f52817b8404b0e Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Tue, 31 Mar 2020 10:02:58 -0400 Subject: [PATCH] Set clipping container on panel creation --- intellihide.js | 27 +++++++-------------------- panel.js | 2 +- panelManager.js | 26 ++++++++++++++++++++++---- transparency.js | 2 +- 4 files changed, 31 insertions(+), 26 deletions(-) diff --git a/intellihide.js b/intellihide.js index 0a8a5df..8f594f1 100644 --- a/intellihide.js +++ b/intellihide.js @@ -90,7 +90,7 @@ var Intellihide = Utils.defineClass({ if (Me.settings.get_boolean('intellihide-hide-from-windows')) { this._proximityWatchId = this._proximityManager.createWatch( - this._clipContainer, + this._panelBox.get_parent(), Proximity.Mode[Me.settings.get_string('intellihide-behaviour')], 0, 0, overlap => { @@ -208,30 +208,17 @@ var Intellihide = Utils.defineClass({ }, _setTrackPanel: function(enable) { - Main.layoutManager._untrackActor(this._panelBox); - - if (enable) { - this._clipContainer = new Clutter.Actor(); - Utils.setClip(this._clipContainer, this._panelBox.x, this._panelBox.y, this._panelBox.width, this._panelBox.height); - - Main.layoutManager.removeChrome(this._panelBox); - Main.layoutManager.addChrome(this._clipContainer, { affectsInputRegion: false }); + let trackedIndex = Main.layoutManager._findActor(this._panelBox); + let actorData = Main.layoutManager._trackedActors[trackedIndex] - this._clipContainer.add_child(this._panelBox); - Main.layoutManager.trackChrome(this._panelBox, { affectsInputRegion: true }); + actorData.affectsStruts = !enable; + actorData.trackFullscreen = !enable; - this._timeoutsHandler.add([T4, 0, () => this._panelBox.set_position(0, 0)]); - } else { - this._panelBox.set_position(this._clipContainer.x, this._clipContainer.y); - Main.layoutManager.removeChrome(this._clipContainer); - - this._clipContainer.remove_child(this._panelBox); - Main.layoutManager.addChrome(this._panelBox, { affectsStruts: true, trackFullscreen: true }); - } - this._panelBox.track_hover = enable; this._panelBox.reactive = enable; this._panelBox.visible = enable ? enable : this._panelBox.visible; + + Main.layoutManager._queueUpdateRegions(); }, _setRevealMechanism: function() { diff --git a/panel.js b/panel.js index 76ddebd..c8c4060 100644 --- a/panel.js +++ b/panel.js @@ -776,7 +776,7 @@ var dtpPanel = Utils.defineClass({ }, _setPanelPosition: function() { - let container = this.intellihide && this.intellihide.enabled ? this.panelBox.get_parent() : this.panelBox; + let container = this.panelBox.get_parent(); this.set_size(this.geom.w, this.geom.h); container.set_position(this.geom.x, this.geom.y); diff --git a/panelManager.js b/panelManager.js index 5b7134f..fbd645d 100755 --- a/panelManager.js +++ b/panelManager.js @@ -235,13 +235,22 @@ var dtpPanelManager = Utils.defineClass({ p.disable(); + let clipContainer = p.panelBox.get_parent(); + + Main.layoutManager._untrackActor(p.panelBox); + Main.layoutManager.removeChrome(clipContainer); + if (p.isSecondary) { - Main.layoutManager.removeChrome(p.panelBox); p.panelBox.destroy(); } else { p.panelBox.remove_child(p); p.remove_child(p.panel.actor); p.panelBox.add(p.panel.actor); + + p.panelBox.set_position(clipContainer.x, clipContainer.y); + + clipContainer.remove_child(p.panelBox); + Main.layoutManager.addChrome(p.panelBox, { affectsStruts: true, trackFullscreen: true }); } }); @@ -319,20 +328,29 @@ var dtpPanelManager = Utils.defineClass({ _createPanel: function(monitor, isSecondary) { let panelBox; let panel; - + let clipContainer = new Clutter.Actor(); + if (isSecondary) { panelBox = new St.BoxLayout({ name: 'panelBox' }); - Main.layoutManager.addChrome(panelBox, { affectsStruts: true, trackFullscreen: true }); } else { panelBox = Main.layoutManager.panelBox; + Main.layoutManager._untrackActor(panelBox); panelBox.remove_child(Main.panel.actor); + Main.layoutManager.removeChrome(panelBox); } + Main.layoutManager.addChrome(clipContainer, { affectsInputRegion: false }); + clipContainer.add_child(panelBox); + Main.layoutManager.trackChrome(panelBox, { trackFullscreen: true, affectsStruts: true, affectsInputRegion: true }); + panel = new Panel.dtpPanel(this, monitor, panelBox, isSecondary); panelBox.add(panel); - panel.enable(); + panelBox.visible = !monitor.inFullscreen; + panelBox.set_position(0, 0); + + Utils.setClip(clipContainer, clipContainer.x, clipContainer.y, panelBox.width, panelBox.height); return panel; }, diff --git a/transparency.js b/transparency.js index c46562c..1fdb044 100644 --- a/transparency.js +++ b/transparency.js @@ -133,7 +133,7 @@ var DynamicTransparency = Utils.defineClass({ let threshold = Me.settings.get_int('trans-dynamic-distance'); this._proximityWatchId = this._proximityManager.createWatch( - this._dtpPanel.panelBox, + this._dtpPanel.panelBox.get_parent(), Proximity.Mode[Me.settings.get_string('trans-dynamic-behavior')], isVertical ? threshold : 0, isVertical ? 0 : threshold,