dash: Don't underallocate show-apps button

When the dash contains more icons than fit at the minimum icon size,
icons are cut off at the end. This means that the show-apps button
will be the first to disappear, which is problematic given it's the
sole access point for other applications (for those that refuse to
use search at least).
Fix by using a dedicated widget for the dash actor, so that in case
of underallocation only icons above the show-apps button end up being
cut off.

https://bugzilla.gnome.org/show_bug.cgi?id=683340
This commit is contained in:
Florian Müllner 2012-09-10 20:42:08 +02:00
parent 7fd128eabc
commit 2db029bcdb

View File

@ -310,6 +310,40 @@ const DragPlaceholderItem = new Lang.Class({
} }
}); });
const DashActor = new Lang.Class({
Name: 'DashActor',
Extends: St.Widget,
_init: function() {
let layout = new Clutter.BoxLayout({ orientation: Clutter.Orientation.VERTICAL });
this.parent({ name: 'dash',
layout_manager: layout,
clip_to_allocation: true });
},
vfunc_allocate: function(box, flags) {
let contentBox = this.get_theme_node().get_content_box(box);
let availWidth = contentBox.x2 - contentBox.x1;
let availHeight = contentBox.y2 - contentBox.y1;
this.set_allocation(box, flags);
let [appIcons, showAppsButton] = this.get_children();
let [minHeight, natHeight] = showAppsButton.get_preferred_height(availWidth);
let childBox = new Clutter.ActorBox();
childBox.x1 = 0;
childBox.x2 = availWidth;
childBox.y1 = 0;
childBox.y2 = availHeight - natHeight;
appIcons.allocate(childBox, flags);
childBox.y1 = availHeight - natHeight;
childBox.y2 = availHeight;
showAppsButton.allocate(childBox, flags);
}
});
const Dash = new Lang.Class({ const Dash = new Lang.Class({
Name: 'Dash', Name: 'Dash',
@ -325,14 +359,11 @@ const Dash = new Lang.Class({
this._resetHoverTimeoutId = 0; this._resetHoverTimeoutId = 0;
this._labelShowing = false; this._labelShowing = false;
this._container = new St.BoxLayout({ name: 'dash', this._container = new DashActor();
vertical: true,
clip_to_allocation: true });
this._box = new St.BoxLayout({ vertical: true, this._box = new St.BoxLayout({ vertical: true,
clip_to_allocation: true }); clip_to_allocation: true });
this._box._delegate = this; this._box._delegate = this;
this._container.add(this._box); this._container.add_actor(this._box);
this._showAppsIcon = new ShowAppsIcon(); this._showAppsIcon = new ShowAppsIcon();
this._showAppsIcon.icon.setIconSize(this.iconSize); this._showAppsIcon.icon.setIconSize(this.iconSize);
@ -340,7 +371,7 @@ const Dash = new Lang.Class({
this.showAppsButton = this._showAppsIcon.toggleButton; this.showAppsButton = this._showAppsIcon.toggleButton;
this._container.add(this._showAppsIcon.actor); this._container.add_actor(this._showAppsIcon.actor);
this.actor = new St.Bin({ child: this._container }); this.actor = new St.Bin({ child: this._container });
this.actor.connect('notify::height', Lang.bind(this, this.actor.connect('notify::height', Lang.bind(this,