Add clipping container to panelbox

This commit is contained in:
Charles Gagnon
2019-06-23 23:56:49 -04:00
parent dd5b3f6d64
commit a349beff32
3 changed files with 33 additions and 8 deletions

View File

@@ -89,7 +89,7 @@ var Intellihide = Utils.defineClass({
if (this._dtpSettings.get_boolean('intellihide-hide-from-windows')) {
this._proximityWatchId = this._proximityManager.createWatch(
this._panelBox,
this._clipContainer,
Proximity.Mode[this._dtpSettings.get_string('intellihide-behaviour')],
0, 0,
overlap => {
@@ -123,7 +123,10 @@ var Intellihide = Utils.defineClass({
destroy: function() {
this._dtpSettings.disconnect(this._intellihideChangedId);
this._dtpSettings.disconnect(this._intellihideOnlySecondaryChangedId);
this.disable();
if (this._enabled) {
this.disable();
}
},
toggle: function() {
@@ -213,8 +216,25 @@ var Intellihide = Utils.defineClass({
_setTrackPanel: function(reset, enable) {
if (!reset) {
Main.layoutManager._untrackActor(this._panelBox);
Main.layoutManager._trackActor(this._panelBox, { affectsStruts: !enable, trackFullscreen: !enable });
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.uiGroup.remove_actor(this._panelBox);
this._clipContainer.add_child(this._panelBox);
this._panelBox.set_position(0, 0);
Main.layoutManager.addChrome(this._clipContainer, { affectsInputRegion: false });
Main.layoutManager.trackChrome(this._panelBox, { affectsInputRegion: true, affectsStruts: false, trackFullscreen: false });
} 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;
@@ -274,7 +294,8 @@ var Intellihide = Utils.defineClass({
if (!this._panelBox.hover && !Main.overview.visible &&
((this._panelAtTop && y <= this._monitor.y + 1) ||
(!this._panelAtTop && y >= this._monitor.y + this._monitor.height - 1)) &&
(x > this._monitor.x && x < this._monitor.x + this._monitor.width)) {
((x > this._monitor.x && x < this._monitor.x + this._monitor.width) &&
(y > this._monitor.y && y < this._monitor.y + this._monitor.height))) {
this._queueUpdatePanelPosition(true);
}
},

View File

@@ -334,6 +334,12 @@ var wrapActor = function(actor) {
}
};
var setClip = function(actor, x, y, width, height) {
actor.set_clip(0, 0, width, height);
actor.set_position(x, y);
actor.set_size(width, height);
};
var addKeybinding = function(key, settings, handler, modes) {
if (!Main.wm._allowedKeybindings[key]) {
Main.wm.addKeybinding(

View File

@@ -441,9 +441,7 @@ var PreviewMenu = Utils.defineClass({
y = this._panelWrapper.monitor.y + this._panelWrapper.monitor.height - (panelSize + panelBoxTheme.get_padding(St.Side.BOTTOM) + previewSize + headerHeight);
}
this.set_clip(0, 0, w, h);
this.set_position(x, y);
this.set_size(w, h);
Utils.setClip(this, x, y, w, h);
},
_updatePosition: function() {