appDisplay: Also account for folder popup's close buttons

As the close button of folder popups overlaps at the top, it ends
up being cut off if the folder is located at the very top of the
view. Fix this glitch by taking the button's overlap into account
in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=694371
This commit is contained in:
Florian Müllner 2013-05-16 19:35:12 +02:00
parent d8d0afff0b
commit 0eba0f8dd3

View File

@ -598,9 +598,11 @@ const FolderIcon = new Lang.Class({
// Position the popup above or below the source icon // Position the popup above or below the source icon
if (side == St.Side.BOTTOM) { if (side == St.Side.BOTTOM) {
this._popup.actor.show(); this._popup.actor.show();
let closeButtonOffset = -this._popup.closeButton.translation_y;
let y = this.actor.y - this._popup.actor.height; let y = this.actor.y - this._popup.actor.height;
this._popup.parentOffset = y < 0 ? -y : 0; let yWithButton = y - closeButtonOffset;
this._popup.actor.y = Math.max(y, 0); this._popup.parentOffset = yWithButton < 0 ? -yWithButton : 0;
this._popup.actor.y = Math.max(y, closeButtonOffset);
this._popup.actor.hide(); this._popup.actor.hide();
} else { } else {
this._popup.actor.y = this.actor.y + this.actor.height; this._popup.actor.y = this.actor.y + this.actor.height;
@ -647,11 +649,11 @@ const AppFolderPopup = new Lang.Class({
this.actor.add_actor(this._boxPointer.actor); this.actor.add_actor(this._boxPointer.actor);
this._boxPointer.bin.set_child(this._view.actor); this._boxPointer.bin.set_child(this._view.actor);
let closeButton = Util.makeCloseButton(); this.closeButton = Util.makeCloseButton();
closeButton.connect('clicked', Lang.bind(this, this.popdown)); this.closeButton.connect('clicked', Lang.bind(this, this.popdown));
this.actor.add_actor(closeButton); this.actor.add_actor(this.closeButton);
this._boxPointer.actor.bind_property('opacity', closeButton, 'opacity', this._boxPointer.actor.bind_property('opacity', this.closeButton, 'opacity',
GObject.BindingFlags.SYNC_CREATE); GObject.BindingFlags.SYNC_CREATE);
global.focus_manager.add_group(this.actor); global.focus_manager.add_group(this.actor);