MessageTray: tweak how allocation works to fix the reactive area

Rather than having the notificationBin, summaryBin, and
summaryNotificationBin span the whole width of the screen and just
align their children to the right spot, set their anchor_gravity
appropriately, set their anchor point correctly, and let their width
vary with the width of their child.

Fixes the fact that the area to the left and right of an expanded
notification was reactive, because the notificationBin was invisibly
covering it.

https://bugzilla.gnome.org/show_bug.cgi?id=612072
This commit is contained in:
Dan Winship 2010-03-26 15:23:53 -04:00
parent 1dd4c7140e
commit 611ca3c161

View File

@ -377,13 +377,13 @@ MessageTray.prototype = {
this.actor.connect('notify::hover', Lang.bind(this, this._onTrayHoverChanged)); this.actor.connect('notify::hover', Lang.bind(this, this._onTrayHoverChanged));
this._notificationBin = new St.Bin({ reactive: true, this._notificationBin = new St.Bin({ reactive: true,
x_align: St.Align.MIDDLE }); anchor_gravity: Clutter.Gravity.NORTH });
this.actor.add(this._notificationBin); this.actor.add(this._notificationBin);
this._notificationBin.hide(); this._notificationBin.hide();
this._notificationQueue = []; this._notificationQueue = [];
this._notification = null; this._notification = null;
this._summaryBin = new St.Bin({ x_align: St.Align.END }); this._summaryBin = new St.Bin({ anchor_gravity: Clutter.Gravity.NORTH_EAST });
this.actor.add(this._summaryBin); this.actor.add(this._summaryBin);
this._summary = new St.BoxLayout({ name: 'summary-mode', this._summary = new St.BoxLayout({ name: 'summary-mode',
reactive: true, reactive: true,
@ -393,7 +393,7 @@ MessageTray.prototype = {
this._summaryBin.opacity = 0; this._summaryBin.opacity = 0;
this._summaryNotificationBin = new St.Bin({ name: 'summary-notification-bin', this._summaryNotificationBin = new St.Bin({ name: 'summary-notification-bin',
x_align: St.Align.END, anchor_gravity: Clutter.Gravity.NORTH_EAST,
reactive: true, reactive: true,
track_hover: true }); track_hover: true });
this.actor.add(this._summaryNotificationBin); this.actor.add(this._summaryNotificationBin);
@ -446,8 +446,10 @@ MessageTray.prototype = {
this.actor.y = primary.y + primary.height - 1; this.actor.y = primary.y + primary.height - 1;
this.actor.width = primary.width; this.actor.width = primary.width;
this._notificationBin.x = this._summaryBin.x = this._summaryNotificationBin.x = 0; // These work because of their anchor_gravity
this._notificationBin.width = this._summaryBin.width = this._summaryNotificationBin.width = primary.width; this._notificationBin.x = primary.width / 2;
this._summaryBin.x = primary.width;
this._summaryNotificationBin.x = primary.width;
}, },
contains: function(source) { contains: function(source) {