diff --git a/panel.js b/panel.js index 9382e19..0622ab1 100644 --- a/panel.js +++ b/panel.js @@ -414,17 +414,16 @@ var dtpPanelWrapper = new Lang.Class({ // Now figure out how large the _leftBox and _centerBox should be. // The box with the taskbar is always the one that is forced to be smaller as the other boxes grow let leftAllocWidth, centerStartPosition, centerEndPosition; - // HFADE_WIDTH is the width of the empty space at the end of the taskbar (see Taskbar.TaskbarActor.vfunc_get_preferred_width) if (taskbarPosition == 'CENTEREDMONITOR') { leftAllocWidth = leftNaturalWidth; - centerStartPosition = Math.max(leftNaturalWidth, Math.floor((panelAllocWidth - centerNaturalWidth + Taskbar.HFADE_WIDTH)/2)); - centerEndPosition = Math.min(panelAllocWidth-rightNaturalWidth, Math.ceil((panelAllocWidth+centerNaturalWidth + Taskbar.HFADE_WIDTH))/2); + centerStartPosition = Math.max(leftNaturalWidth, Math.floor((panelAllocWidth - centerNaturalWidth)/2)); + centerEndPosition = Math.min(panelAllocWidth-rightNaturalWidth, Math.ceil((panelAllocWidth+centerNaturalWidth))/2); } else if (taskbarPosition == 'CENTEREDCONTENT') { leftAllocWidth = leftNaturalWidth; - centerStartPosition = Math.max(leftNaturalWidth, Math.floor((panelAllocWidth - centerNaturalWidth + leftNaturalWidth - rightNaturalWidth + Taskbar.HFADE_WIDTH) / 2)); - centerEndPosition = Math.min(panelAllocWidth-rightNaturalWidth, Math.ceil((panelAllocWidth + centerNaturalWidth + leftNaturalWidth - rightNaturalWidth + Taskbar.HFADE_WIDTH) / 2)); + centerStartPosition = Math.max(leftNaturalWidth, Math.floor((panelAllocWidth - centerNaturalWidth + leftNaturalWidth - rightNaturalWidth) / 2)); + centerEndPosition = Math.min(panelAllocWidth-rightNaturalWidth, Math.ceil((panelAllocWidth + centerNaturalWidth + leftNaturalWidth - rightNaturalWidth) / 2)); } else if (taskbarPosition == 'LEFTPANEL_FIXEDCENTER') { leftAllocWidth = Math.floor((panelAllocWidth - centerNaturalWidth) / 2); centerStartPosition = leftAllocWidth; diff --git a/taskbar.js b/taskbar.js index dd08c8e..c334f02 100644 --- a/taskbar.js +++ b/taskbar.js @@ -53,7 +53,6 @@ var DASH_ANIMATION_TIME = Dash.DASH_ANIMATION_TIME; let DASH_ITEM_LABEL_SHOW_TIME = Dash.DASH_ITEM_LABEL_SHOW_TIME; let DASH_ITEM_LABEL_HIDE_TIME = Dash.DASH_ITEM_LABEL_HIDE_TIME; var DASH_ITEM_HOVER_TIMEOUT = Dash.DASH_ITEM_HOVER_TIMEOUT; -let HFADE_WIDTH = 48; function getPosition() { let position = St.Side.BOTTOM; @@ -107,21 +106,37 @@ var taskbarActor = new Lang.Class({ this.parent({ name: 'dashtopanelTaskbar', layout_manager: new Clutter.BoxLayout({ orientation: Clutter.Orientation.HORIZONTAL }), clip_to_allocation: true }); - this._rtl = Clutter.get_default_text_direction() == Clutter.TextDirection.RTL; + }, - this._position = getPosition(); + vfunc_allocate: function(box, flags)  { + this.set_allocation(box, flags); - this._delegate = this; + let availHeight = box.y2 - box.y1; + let [, showAppsButton, scrollview] = this.get_children(); + let [, showAppsNatWidth] = showAppsButton.get_preferred_width(availHeight); + let childBox = new Clutter.ActorBox(); + + childBox.y1 = box.y1; + childBox.x1 = box.x1; + childBox.x2 = box.x1 + showAppsNatWidth; + childBox.y2 = box.y2; + showAppsButton.allocate(childBox, flags); + + childBox.x1 = box.x1 + showAppsNatWidth; + childBox.y1 = box.y1; + childBox.x2 = box.x2; + childBox.y2 = box.y2; + scrollview.allocate(childBox, flags); }, vfunc_get_preferred_width: function(actor, forHeight) { - // We want to request the natural height of all our children + // We want to request the natural width of all our children // as our natural width, so we chain up to StWidget (which // then calls BoxLayout) let [, natWidth] = this.parent(forHeight); - return [0, natWidth + HFADE_WIDTH]; - } + return [0, natWidth]; + }, }); /* This class is a fork of the upstream dash class (ui.dash.js) @@ -183,7 +198,6 @@ var taskbar = new Lang.Class({ this.showAppsButton = this._showAppsIcon.toggleButton; this.showAppsButton.connect('notify::checked', Lang.bind(this, this._onShowAppsButtonToggled)); - this.showAppsButton.connect('notify::width', Lang.bind(this, this.updateScrollViewSizeConstraint)); this.showAppsButton.checked = Main.overview.viewSelector._showAppsButton.checked; this._showAppsIcon.childScale = 1; @@ -1168,23 +1182,6 @@ var taskbar = new Lang.Class({ } } }, - - updateScrollViewSizeConstraint: function() { - let offset = - this.showAppsButton.get_width(); - if (!this.scrollViewSizeConstraint) { - // add a width constraint to the scrollview, based on this._container width + offset - // offset is the width of this.showAppsButton - this.scrollViewSizeConstraint = new Clutter.BindConstraint({ - source: this._container, - coordinate: Clutter.BindCoordinate.WIDTH, - offset: offset - }); - this._scrollView.add_constraint(this.scrollViewSizeConstraint); - } else { - this.scrollViewSizeConstraint.set_offset(offset); - } - }, - }); Signals.addSignalMethods(taskbar.prototype);