Put a hot corner on each monitor

https://bugzilla.gnome.org/show_bug.cgi?id=642881
This commit is contained in:
Alexander Larsson 2011-02-23 15:17:25 +01:00
parent 259c84ed9a
commit 7cf311dac0

View File

@ -48,7 +48,7 @@ DEFAULT_BACKGROUND_COLOR.from_pixel(0x2266bbff);
let chrome = null; let chrome = null;
let panel = null; let panel = null;
let hotCorner = null; let hotCorners = [];
let placesManager = null; let placesManager = null;
let overview = null; let overview = null;
let runDialog = null; let runDialog = null;
@ -390,12 +390,33 @@ function _getAndClearErrorStack() {
} }
function _relayout() { function _relayout() {
let monitors = global.get_monitors();
if (monitors.length != hotCorners.length) {
// destroy old corners
for (let i = 0; i < hotCorners.length; i++)
hotCorners[i].destroy();
hotCorners = [];
for (let i = 0; i < monitors.length; i++)
hotCorners[i] = new Panel.HotCorner();
}
let primary = global.get_primary_monitor(); let primary = global.get_primary_monitor();
if (St.Widget.get_default_direction() == St.TextDirection.RTL) for (let i = 0; i < monitors.length; i++) {
hotCorner.actor.set_position(primary.x + primary.width, primary.y); let monitor = monitors[i];
else let corner = hotCorners[i];
hotCorner.actor.set_position(primary.x, primary.y); let isPrimary = (monitor.x == primary.x &&
panel.setHotCorner(hotCorner); monitor.y == primary.y &&
monitor.width == primary.width &&
monitor.height == primary.height);
if (St.Widget.get_default_direction() == St.TextDirection.RTL)
corner.actor.set_position(monitor.x + monitor.width, monitor.y);
else
corner.actor.set_position(monitor.x, monitor.y);
if (isPrimary)
panel.setHotCorner(corner);
}
panel.actor.set_position(primary.x, primary.y); panel.actor.set_position(primary.x, primary.y);
panel.actor.set_size(primary.width, Panel.PANEL_HEIGHT); panel.actor.set_size(primary.width, Panel.PANEL_HEIGHT);
overview.relayout(); overview.relayout();