Fix vertical allocation of invisible panelmenu buttons

This commit is contained in:
Charles Gagnon
2019-12-31 15:33:26 -05:00
parent 96f7d7a1dd
commit 9b81aec08b
2 changed files with 75 additions and 51 deletions

View File

@@ -73,7 +73,7 @@ var Intellihide = Utils.defineClass({
this._changeEnabledStatus();
},
enable: function(reset) {
enable: function() {
this.enabled = true;
this._monitor = this._dtpPanel.monitor;
this._animationDestination = -1;
@@ -85,7 +85,7 @@ var Intellihide = Utils.defineClass({
this._panelBox.translation_y = 0;
this._panelBox.translation_x = 0;
this._setTrackPanel(reset, true);
this._setTrackPanel(true);
this._bindGeneralSignals();
if (Me.settings.get_boolean('intellihide-hide-from-windows')) {
@@ -109,7 +109,7 @@ var Intellihide = Utils.defineClass({
this._proximityManager.removeWatch(this._proximityWatchId);
}
this._setTrackPanel(reset, false);
this._setTrackPanel(false);
this._signalsHandler.destroy();
this._timeoutsHandler.destroy();
@@ -150,9 +150,9 @@ var Intellihide = Utils.defineClass({
}
},
_reset: function() {
reset: function() {
this.disable(true);
this.enable(true);
this.enable();
},
_changeEnabledStatus: function() {
@@ -175,18 +175,11 @@ var Intellihide = Utils.defineClass({
[
Me.settings,
[
'changed::panel-position',
'changed::panel-size',
'changed::intellihide-use-pressure',
'changed::intellihide-hide-from-windows',
'changed::intellihide-behaviour'
],
() => this._reset()
],
[
Main.layoutManager,
'monitors-changed',
() => this._reset()
() => this.reset()
],
[
this._panelBox,
@@ -214,33 +207,31 @@ var Intellihide = Utils.defineClass({
this._queueUpdatePanelPosition();
},
_setTrackPanel: function(reset, enable) {
if (!reset) {
Main.layoutManager._untrackActor(this._panelBox);
_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 });
if (enable) {
this._clipContainer = new Clutter.Actor();
Utils.setClip(this._clipContainer, this._panelBox.x, this._panelBox.y, this._panelBox.width, this._panelBox.height);
this._clipContainer.add_child(this._panelBox);
Main.layoutManager.trackChrome(this._panelBox, { affectsInputRegion: true });
Main.layoutManager.removeChrome(this._panelBox);
Main.layoutManager.addChrome(this._clipContainer, { affectsInputRegion: false });
this._clipContainer.add_child(this._panelBox);
Main.layoutManager.trackChrome(this._panelBox, { affectsInputRegion: true });
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._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;
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;
},
_setRevealMechanism: function() {

View File

@@ -130,6 +130,7 @@ var dtpPanel = Utils.defineClass({
this.panelBox = panelBox;
this.isSecondary = isSecondary;
this._sessionStyle = null;
this._unmappedButtons = [];
if (isSecondary) {
this.panel = new St.Widget({ name: 'panel', reactive: true });
@@ -208,7 +209,6 @@ var dtpPanel = Utils.defineClass({
enable : function() {
let taskbarPosition = Me.settings.get_string('taskbar-position');
let isVertical = checkIfVertical();
if (taskbarPosition == 'CENTEREDCONTENT' || taskbarPosition == 'CENTEREDMONITOR') {
this.container = this._centerBox;
@@ -381,15 +381,27 @@ var dtpPanel = Utils.defineClass({
this.panelStyle.enable(this);
if (this.statusArea.dateMenu && isVertical) {
this.statusArea.dateMenu._clock.time_only = true;
this._formatVerticalClock();
if (checkIfVertical()) {
this._signalsHandler.add([
this.statusArea.dateMenu._clock,
'notify::clock',
() => this._formatVerticalClock()
this.panelBox,
'notify::visible',
() => {
if (this.panelBox.visible) {
this._refreshVerticalAlloc();
}
}
]);
if (this.statusArea.dateMenu) {
this.statusArea.dateMenu._clock.time_only = true;
this._formatVerticalClock();
this._signalsHandler.add([
this.statusArea.dateMenu._clock,
'notify::clock',
() => this._formatVerticalClock()
]);
}
}
// Since we are usually visible but not usually changing, make sure
@@ -429,6 +441,7 @@ var dtpPanel = Utils.defineClass({
this._myPanelGhost.get_parent().remove_actor(this._myPanelGhost);
panelBoxes.forEach(b => delete this[b].allocate);
this._unmappedButtons.forEach(a => this._disconnectVisibleId(a));
if (!this.isSecondary) {
this._setVertical(this.panel.actor, false);
@@ -597,6 +610,10 @@ var dtpPanel = Utils.defineClass({
this._setPanelPosition();
this.taskbar.resetAppIcons();
if (this.intellihide && this.intellihide.enabled) {
this.intellihide.reset();
}
if (checkIfVertical()) {
this._refreshVerticalAlloc();
}
@@ -821,16 +838,16 @@ var dtpPanel = Utils.defineClass({
_onBoxActorAdded: function(box) {
this._setClockLocation(Me.settings.get_string('location-clock'));
if (checkIfVertical()) {
this._setVertical(box, true);
}
},
_refreshVerticalAlloc: function() {
if (!this._timeoutsHandler.getId(T3)) {
this._timeoutsHandler.add([T3, 200, () => {
this._setVertical(this._centerBox, true);
this._setVertical(this._rightBox, true);
this._formatVerticalClock();
}]);
}
this._setVertical(this._centerBox, true);
this._setVertical(this._rightBox, true);
this._formatVerticalClock();
},
_setVertical: function(actor, isVertical) {
@@ -844,6 +861,14 @@ var dtpPanel = Utils.defineClass({
} else if ((actor._delegate || actor) instanceof PanelMenu.ButtonBox && actor != this.statusArea.appMenu) {
let child = actor.get_first_child();
if (isVertical && !actor.visible && !actor._dtpVisibleId) {
this._unmappedButtons.push(actor);
actor._dtpVisibleId = actor.connect('notify::visible', () => {
this._disconnectVisibleId(actor);
this._refreshVerticalAlloc();
});
}
if (child) {
let [, natWidth] = actor.get_preferred_width(-1);
@@ -861,6 +886,14 @@ var dtpPanel = Utils.defineClass({
_set(actor, isVertical);
},
_disconnectVisibleId: function(actor) {
if (actor._dtpVisibleId) {
actor.disconnect(actor._dtpVisibleId);
delete actor._dtpVisibleId;
this._unmappedButtons.splice(this._unmappedButtons.indexOf(actor), 1);
}
},
_setActivitiesButtonVisible: function(isVisible) {
if(this.statusArea.activities)
isVisible ? this.statusArea.activities.container.show() :