apps-menu: don't store the hot corner at creation

HotCorners become invalid when the xrandr configuration changes,
so instead of storing it fetch it directly from layoutManager when
needed.

https://bugzilla.gnome.org/show_bug.cgi?id=702038
This commit is contained in:
Giovanni Campagna
2013-07-04 15:45:04 +02:00
parent e03343d4a8
commit a2f14c57c5
+12 -10
View File
@@ -227,24 +227,23 @@ const ApplicationsMenu = new Lang.Class({
Name: 'ApplicationsMenu',
Extends: PopupMenu.PopupMenu,
_init: function(sourceActor, arrowAlignment, arrowSide, button, hotCorner) {
_init: function(sourceActor, arrowAlignment, arrowSide, button) {
this.parent(sourceActor, arrowAlignment, arrowSide);
this._button = button;
this._hotCorner = hotCorner;
},
open: function(animate) {
this._hotCorner.setBarrierSize(0);
if (this._hotCorner.actor) // fallback corner
this._hotCorner.actor.hide();
this._button.hotCorner.setBarrierSize(0);
if (this._button.hotCorner.actor) // fallback corner
this._button.hotCorner.actor.hide();
this.parent(animate);
},
close: function(animate) {
let size = Main.layoutManager.panelBox.height;
this._hotCorner.setBarrierSize(size);
if (this._hotCorner.actor) // fallback corner
this._hotCorner.actor.show();
this._button.hotCorner.setBarrierSize(size);
if (this._button.hotCorner.actor) // fallback corner
this._button.hotCorner.actor.show();
this.parent(animate);
},
@@ -265,9 +264,8 @@ const ApplicationsButton = new Lang.Class({
_init: function() {
this.parent(1.0, null, false);
this._hotCorner = Main.layoutManager.hotCorners[Main.layoutManager.primaryIndex];
this.setMenu(new ApplicationsMenu(this.actor, 1.0, St.Side.TOP, this, this._hotCorner));
this.setMenu(new ApplicationsMenu(this.actor, 1.0, St.Side.TOP, this));
Main.panel.menuManager.addMenu(this.menu);
// At this moment applications menu is not keyboard navigable at
@@ -310,6 +308,10 @@ const ApplicationsButton = new Lang.Class({
}));
},
get hotCorner() {
return Main.layoutManager.hotCorners[Main.layoutManager.primaryIndex];
},
_createVertSeparator: function() {
let separator = new St.DrawingArea({ style_class: 'calendar-vertical-separator',
pseudo_class: 'highlighted' });