[gnome-shell] panel: center date entry with workarea
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] panel: center date entry with workarea
- Date: Tue, 6 Feb 2018 10:36:44 +0000 (UTC)
commit cd0af33947f8eb73a163ecef975728988ab51549
Author: Didier Roche <didrocks ubuntu com>
Date: Tue Jan 9 09:39:06 2018 +0100
panel: center date entry with workarea
Align and center the date entry with the workspace's workarea.
This way, maximized applications have their window aligned with the top date
entry.
This doesn't change anything for desktops with no docks or when left/right
workareas are aligned with the monitor.
The offset is leftOffset - rightOffset:
(workArea.x - monitor.x) - (monitor.width - ((workArea.x - monitor.x) +
workArea.width))
https://bugzilla.gnome.org/show_bug.cgi?id=792354
js/ui/panel.js | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/panel.js b/js/ui/panel.js
index 3eeb12622..afae2a435 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -821,6 +821,7 @@ var Panel = new Lang.Class({
global.window_group.connect('actor-removed', Lang.bind(this, this._onWindowActorRemoved));
global.window_manager.connect('switch-workspace', Lang.bind(this, this._updateSolidStyle));
+ global.screen.connect('workareas-changed', () => { this.actor.queue_relayout(); });
this._updatePanel();
},
@@ -867,7 +868,16 @@ var Panel = new Lang.Class({
let sideWidth, centerWidth;
centerWidth = centerNaturalWidth;
- sideWidth = Math.max(0, (allocWidth - centerWidth) / 2);
+
+ // get workspace area and center date entry relative to it
+ let monitor = Main.layoutManager.findMonitorForActor(actor);
+ let centerOffset = 0;
+ if (monitor) {
+ let workArea = Main.layoutManager.getWorkAreaForMonitor(monitor.index);
+ centerOffset = 2 * (workArea.x - monitor.x) + workArea.width - monitor.width;
+ }
+
+ sideWidth = Math.max(0, (allocWidth - centerWidth + centerOffset) / 2);
let childBox = new Clutter.ActorBox();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]