boxpointer: Don't constrain box pointer to primary monitor
A boxPointer should be able to be attached to any actor, not just ones on the primary monitor. Assume that the sourceActor doesn't straddle monitors, and constrain the boxPointer to the monitor the sourceActor is on. https://bugzilla.gnome.org/show_bug.cgi?id=659861
This commit is contained in:
parent
6aa411fecc
commit
7a8a189c48
@ -329,7 +329,7 @@ BoxPointer.prototype = {
|
|||||||
// We also want to keep it onscreen, and separated from the
|
// We also want to keep it onscreen, and separated from the
|
||||||
// edge by the same distance as the main part of the box is
|
// edge by the same distance as the main part of the box is
|
||||||
// separated from its sourceActor
|
// separated from its sourceActor
|
||||||
let primary = Main.layoutManager.primaryMonitor;
|
let monitor = Main.layoutManager.findMonitorForActor(sourceActor);
|
||||||
let themeNode = this.actor.get_theme_node();
|
let themeNode = this.actor.get_theme_node();
|
||||||
let borderWidth = themeNode.get_length('-arrow-border-width');
|
let borderWidth = themeNode.get_length('-arrow-border-width');
|
||||||
let arrowBase = themeNode.get_length('-arrow-base');
|
let arrowBase = themeNode.get_length('-arrow-base');
|
||||||
@ -364,8 +364,8 @@ BoxPointer.prototype = {
|
|||||||
case St.Side.BOTTOM:
|
case St.Side.BOTTOM:
|
||||||
resX = sourceCenterX - (halfMargin + (natWidth - margin) * alignment);
|
resX = sourceCenterX - (halfMargin + (natWidth - margin) * alignment);
|
||||||
|
|
||||||
resX = Math.max(resX, primary.x + 10);
|
resX = Math.max(resX, monitor.x + 10);
|
||||||
resX = Math.min(resX, primary.x + primary.width - (10 + natWidth));
|
resX = Math.min(resX, monitor.x + monitor.width - (10 + natWidth));
|
||||||
this.setArrowOrigin(sourceCenterX - resX);
|
this.setArrowOrigin(sourceCenterX - resX);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -373,8 +373,8 @@ BoxPointer.prototype = {
|
|||||||
case St.Side.RIGHT:
|
case St.Side.RIGHT:
|
||||||
resY = sourceCenterY - (halfMargin + (natHeight - margin) * alignment);
|
resY = sourceCenterY - (halfMargin + (natHeight - margin) * alignment);
|
||||||
|
|
||||||
resY = Math.max(resY, primary.y + 10);
|
resY = Math.max(resY, monitor.y + 10);
|
||||||
resY = Math.min(resY, primary.y + primary.height - (10 + natHeight));
|
resY = Math.min(resY, monitor.y + monitor.height - (10 + natHeight));
|
||||||
|
|
||||||
this.setArrowOrigin(sourceCenterY - resY);
|
this.setArrowOrigin(sourceCenterY - resY);
|
||||||
break;
|
break;
|
||||||
|
@ -369,6 +369,10 @@ LayoutManager.prototype = {
|
|||||||
// Removes @actor from the chrome
|
// Removes @actor from the chrome
|
||||||
removeChrome: function(actor) {
|
removeChrome: function(actor) {
|
||||||
this._chrome.removeActor(actor);
|
this._chrome.removeActor(actor);
|
||||||
|
},
|
||||||
|
|
||||||
|
findMonitorForActor: function(actor) {
|
||||||
|
return this._chrome.findMonitorForActor(actor);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Signals.addSignalMethods(LayoutManager.prototype);
|
Signals.addSignalMethods(LayoutManager.prototype);
|
||||||
@ -700,7 +704,7 @@ Chrome.prototype = {
|
|||||||
else if (this._inOverview)
|
else if (this._inOverview)
|
||||||
visible = true;
|
visible = true;
|
||||||
else if (!actorData.visibleInFullscreen &&
|
else if (!actorData.visibleInFullscreen &&
|
||||||
this._findMonitorForActor(actorData.actor).inFullscreen)
|
this.findMonitorForActor(actorData.actor).inFullscreen)
|
||||||
visible = false;
|
visible = false;
|
||||||
else
|
else
|
||||||
visible = true;
|
visible = true;
|
||||||
@ -762,7 +766,7 @@ Chrome.prototype = {
|
|||||||
|
|
||||||
// This call guarantees that we return some monitor to simplify usage of it
|
// This call guarantees that we return some monitor to simplify usage of it
|
||||||
// In practice all tracked actors should be visible on some monitor anyway
|
// In practice all tracked actors should be visible on some monitor anyway
|
||||||
_findMonitorForActor: function(actor) {
|
findMonitorForActor: function(actor) {
|
||||||
let [x, y] = actor.get_transformed_position();
|
let [x, y] = actor.get_transformed_position();
|
||||||
let [w, h] = actor.get_transformed_size();
|
let [w, h] = actor.get_transformed_size();
|
||||||
let monitor = this._findMonitorForRect(x, y, w, h);
|
let monitor = this._findMonitorForRect(x, y, w, h);
|
||||||
|
Loading…
Reference in New Issue
Block a user