Fix positions for proximity detection

This commit is contained in:
Charles Gagnon
2018-10-13 12:59:45 -04:00
parent 7c470ac1a3
commit 67eebef177
6 changed files with 16 additions and 28 deletions

View File

@@ -1369,22 +1369,18 @@ function ItemShowLabel() {
let labelWidth = this.label.get_width();
let labelHeight = this.label.get_height();
let x, y, xOffset, yOffset;
let position = Taskbar.getPosition();
let labelOffset = node.get_length('-x-offset');
let xOffset = Math.floor((itemWidth - labelWidth) / 2);
let x = stageX + xOffset, y;
switch(position) {
case St.Side.TOP:
y = stageY + labelOffset + itemHeight;
xOffset = Math.floor((itemWidth - labelWidth) / 2);
x = stageX + xOffset;
break;
case St.Side.BOTTOM:
yOffset = labelOffset;
y = stageY - labelHeight - yOffset;
xOffset = Math.floor((itemWidth - labelWidth) / 2);
x = stageX + xOffset;
y = stageY - labelHeight - labelOffset;
break;
}

View File

@@ -68,6 +68,7 @@ var Intellihide = new Lang.Class({
this._dragging = false;
this._currentlyHeld = false;
this._hoveredOut = false;
this._windowOverlap = false;
this._panelAtTop = this._dtpSettings.get_string('panel-position') === 'TOP';
if (this._panelAtTop && this._panelBox.translation_y > 0 ||

View File

@@ -358,16 +358,6 @@ var dtpPanelWrapper = new Lang.Class({
_bindSettingsChanges: function() {
this._dtpSettingsSignalIds = [
//rebuild panel when taskar-position change
this._dtpSettings.connect('changed::taskbar-position', Lang.bind(this, function() {
this.disable();
this.enable();
})),
this._dtpSettings.connect('changed::panel-position', Lang.bind(this, function() {
this._setPanelPosition();
})),
this._dtpSettings.connect('changed::panel-size', Lang.bind(this, function() {
this._setPanelPosition();
this.taskbar.resetAppIcons();

View File

@@ -31,6 +31,7 @@ const Me = imports.misc.extensionUtils.getCurrentExtension();
const Overview = Me.imports.overview;
const Panel = Me.imports.panel;
const Proximity = Me.imports.proximity;
const Taskbar = Me.imports.taskbar;
const Utils = Me.imports.utils;
const Clutter = imports.gi.Clutter;
@@ -125,6 +126,8 @@ var dtpPanelManager = new Lang.Class({
this._dtpSettings.connect('changed::primary-monitor', () => this._reset());
this._dtpSettings.connect('changed::multi-monitors', () => this._reset());
this._dtpSettings.connect('changed::isolate-monitors', () => this._reset());
this._dtpSettings.connect('changed::taskbar-position', () => this._reset());
this._dtpSettings.connect('changed::panel-position', () => this._reset());
this._monitorsChangedListener = Utils.DisplayWrapper.getMonitorManager().connect("monitors-changed", () => this._reset());
},
@@ -236,7 +239,7 @@ function newPopupOpen(animate) {
this.isOpen = true;
let side = this._boxPointer._arrowSide;
let panelPosition = Main.layoutManager.panelBox.anchor_y == 0 ? St.Side.TOP : St.Side.BOTTOM;
let panelPosition = Taskbar.getPosition();
if(side != panelPosition) {
let actor = this.sourceActor;
@@ -276,7 +279,7 @@ function newPopupSubMenuOpen(animate) {
let workArea = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.primaryIndex);
let subMenuMaxHeight = Math.floor(workArea.height / 2);
let panelPosition = Main.layoutManager.panelBox.anchor_y == 0 ? St.Side.TOP : St.Side.BOTTOM;
let panelPosition = Taskbar.getPosition();
let isBottomPanelMenu = this._getTopMenu().actor.has_style_class_name('panel-menu') && panelPosition == St.Side.BOTTOM;
if(isBottomPanelMenu) {
@@ -387,7 +390,7 @@ function newUpdateHotCorners() {
}
let size = this.panelBox.height;
let panelPosition = Main.layoutManager.panelBox.anchor_y == 0 ? St.Side.TOP : St.Side.BOTTOM;
let panelPosition = Taskbar.getPosition();
// build new hot corners
for (let i = 0; i < this.monitors.length; i++) {

View File

@@ -55,19 +55,17 @@ var ProximityWatch = new Lang.Class({
},
_update: function() {
let [actorX, actorY] = this.actor.get_position();
this.actorX = actorX;
this.actorY = actorY;
this.monitorIndex = Main.layoutManager.findIndexForActor(this.actor);
this._updateWatchRect();
},
_updateWatchRect: function() {
let [actorX, actorY] = this.actor.get_position();
this.rect = new Meta.Rectangle({
x: this.actorX - this.threshold,
y: this.actorY - this.threshold,
x: actorX - this.threshold,
y: actorY - this.threshold,
width: this.actor.width + this.threshold * 2,
height: this.actor.height + this.threshold * 2
});

View File

@@ -56,7 +56,7 @@ var DASH_ITEM_HOVER_TIMEOUT = Dash.DASH_ITEM_HOVER_TIMEOUT;
let HFADE_WIDTH = 48;
function getPosition() {
return Main.layoutManager.panelBox.anchor_y == 0 ? St.Side.TOP : St.Side.BOTTOM;
return Main.layoutManager.panelBox.y == Main.layoutManager.primaryMonitor.y ? St.Side.TOP : St.Side.BOTTOM;
}
/**
* Extend DashItemContainer