From 7cf311dac024db84f660729b34b7b081b6b34807 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Wed, 23 Feb 2011 15:17:25 +0100 Subject: [PATCH] Put a hot corner on each monitor https://bugzilla.gnome.org/show_bug.cgi?id=642881 --- js/ui/main.js | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/js/ui/main.js b/js/ui/main.js index f0b7e26eb..a1b4a3bb4 100644 --- a/js/ui/main.js +++ b/js/ui/main.js @@ -48,7 +48,7 @@ DEFAULT_BACKGROUND_COLOR.from_pixel(0x2266bbff); let chrome = null; let panel = null; -let hotCorner = null; +let hotCorners = []; let placesManager = null; let overview = null; let runDialog = null; @@ -390,12 +390,33 @@ function _getAndClearErrorStack() { } 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(); - if (St.Widget.get_default_direction() == St.TextDirection.RTL) - hotCorner.actor.set_position(primary.x + primary.width, primary.y); - else - hotCorner.actor.set_position(primary.x, primary.y); - panel.setHotCorner(hotCorner); + for (let i = 0; i < monitors.length; i++) { + let monitor = monitors[i]; + let corner = hotCorners[i]; + let isPrimary = (monitor.x == primary.x && + 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_size(primary.width, Panel.PANEL_HEIGHT); overview.relayout();