mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-14 00:04:17 +09:00
Adjust vertical allocations
This commit is contained in:
21
appIcons.js
21
appIcons.js
@@ -131,7 +131,7 @@ var taskbarAppIcon = Utils.defineClass({
|
||||
|
||||
this._container = new St.Widget({ style_class: 'dtp-container', layout_manager: new Clutter.BinLayout() });
|
||||
this._dotsContainer = new St.Widget({ layout_manager: new Clutter.BinLayout() });
|
||||
this._dtpIconContainer = new St.Widget({ style_class: 'dtp-icon-container', layout_manager: new Clutter.BinLayout()});
|
||||
this._dtpIconContainer = new St.Widget({ style: 'padding: ' + (Taskbar.checkIfVertical() ? '4px 0' : '0 4px'), layout_manager: new Clutter.BinLayout()});
|
||||
|
||||
this.actor.remove_actor(this._iconContainer);
|
||||
|
||||
@@ -512,8 +512,8 @@ var taskbarAppIcon = Utils.defineClass({
|
||||
_setAppIconPadding: function() {
|
||||
let padding = getIconPadding(Me.settings);
|
||||
let margin = Me.settings.get_int('appicon-margin');
|
||||
|
||||
this.actor.set_style('padding: 0 ' + margin + 'px;');
|
||||
|
||||
this.actor.set_style('padding:' + (Taskbar.checkIfVertical() ? margin + 'px 0' : '0 ' + margin + 'px;'));
|
||||
this._iconContainer.set_style('padding: ' + padding + 'px;');
|
||||
},
|
||||
|
||||
@@ -1434,7 +1434,8 @@ function ItemShowLabel() {
|
||||
let labelOffset = node.get_length('-x-offset');
|
||||
|
||||
let xOffset = Math.floor((itemWidth - labelWidth) / 2);
|
||||
let x = stageX + xOffset, y;
|
||||
let x = stageX + xOffset
|
||||
let y = stageY + (itemHeight - labelHeight) * .5;
|
||||
|
||||
switch(position) {
|
||||
case St.Side.TOP:
|
||||
@@ -1443,6 +1444,12 @@ function ItemShowLabel() {
|
||||
case St.Side.BOTTOM:
|
||||
y = stageY - labelHeight - labelOffset;
|
||||
break;
|
||||
case St.Side.LEFT:
|
||||
x = stageX + labelOffset + itemWidth;
|
||||
break;
|
||||
case St.Side.RIGHT:
|
||||
x = stageX - labelWidth - labelOffset;
|
||||
break;
|
||||
}
|
||||
|
||||
// keep the label inside the screen border
|
||||
@@ -1497,6 +1504,7 @@ var ShowAppsIconWrapper = Utils.defineClass({
|
||||
/* the variable equivalent to toggleButton has a different name in the appIcon class
|
||||
(actor): duplicate reference to easily reuse appIcon methods */
|
||||
this.actor = this.realShowAppsIcon.toggleButton;
|
||||
this.realShowAppsIcon.actor.x_align = Clutter.ActorAlign.START;
|
||||
this.realShowAppsIcon.actor.y_align = Clutter.ActorAlign.START;
|
||||
this.realShowAppsIcon.show(false);
|
||||
|
||||
@@ -1554,9 +1562,10 @@ var ShowAppsIconWrapper = Utils.defineClass({
|
||||
|
||||
setShowAppsPadding: function() {
|
||||
let padding = getIconPadding(Me.settings);
|
||||
let sidePadding = Me.settings.get_int('show-apps-icon-side-padding')
|
||||
let sidePadding = Me.settings.get_int('show-apps-icon-side-padding');
|
||||
let isVertical = Taskbar.checkIfVertical();
|
||||
|
||||
this.actor.set_style('padding:' + padding + 'px ' + (padding + sidePadding) + 'px;');
|
||||
this.actor.set_style('padding:' + (padding + (isVertical ? sidePadding : 0)) + 'px ' + (padding + (isVertical ? 0 : sidePadding)) + 'px;');
|
||||
},
|
||||
|
||||
popupMenu: function() {
|
||||
|
||||
162
panel.js
162
panel.js
@@ -57,6 +57,9 @@ const Transparency = Me.imports.transparency;
|
||||
const _ = imports.gettext.domain(Me.imports.utils.TRANSLATION_DOMAIN).gettext;
|
||||
|
||||
let tracker = Shell.WindowTracker.get_default();
|
||||
var sizeFunc;
|
||||
var fixedCoord;
|
||||
var varCoord;
|
||||
|
||||
var dtpPanelWrapper = Utils.defineClass({
|
||||
Name: 'DashToPanel.PanelWrapper',
|
||||
@@ -72,6 +75,18 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
|
||||
Utils.wrapActor(this.panel);
|
||||
Utils.wrapActor(this.panel.statusArea.activities || 0);
|
||||
|
||||
if (!isSecondary) {
|
||||
if (Taskbar.checkIfVertical()) {
|
||||
sizeFunc = 'get_preferred_height',
|
||||
fixedCoord = { c1: 'x1', c2: 'x2' },
|
||||
varCoord = { c1: 'y1', c2: 'y2' };
|
||||
} else {
|
||||
sizeFunc = 'get_preferred_width';
|
||||
fixedCoord = { c1: 'y1', c2: 'y2' };
|
||||
varCoord = { c1: 'x1', c2: 'x2' };
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
enable : function() {
|
||||
@@ -337,6 +352,8 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
|
||||
if (!this.isSecondary) {
|
||||
this.panel.actor.set_height(this._oldPanelHeight);
|
||||
this.panel.actor.set_width(-1);
|
||||
this._setVertical(this.panel.actor, false);
|
||||
|
||||
Main.overview._panelGhost.set_height(this._oldPanelHeight);
|
||||
this._setActivitiesButtonVisible(true);
|
||||
@@ -436,93 +453,91 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
this.panel.set_allocation(box, flags);
|
||||
this._allocate(null, box, flags);
|
||||
},
|
||||
|
||||
_allocate: function(actor, box, flags) {
|
||||
let panelAllocWidth = box.x2 - box.x1;
|
||||
let panelAllocHeight = box.y2 - box.y1;
|
||||
|
||||
let [leftMinWidth, leftNaturalWidth] = this.panel._leftBox.get_preferred_width(-1);
|
||||
let [centerMinWidth, centerNaturalWidth] = this.panel._centerBox.get_preferred_width(-1);
|
||||
let [rightMinWidth, rightNaturalWidth] = this.panel._rightBox.get_preferred_width(-1);
|
||||
_allocate: function(actor, box, flags) {
|
||||
let panelAllocVarSize = box[varCoord.c2] - box[varCoord.c1];
|
||||
let panelAllocFixedSize = box[fixedCoord.c2] - box[fixedCoord.c1];
|
||||
let [, leftNaturalSize] = this.panel._leftBox[sizeFunc](-1);
|
||||
let [, centerNaturalSize] = this.panel._centerBox[sizeFunc](-1);
|
||||
let [, rightNaturalSize] = this.panel._rightBox[sizeFunc](-1);
|
||||
|
||||
let taskbarPosition = Me.settings.get_string('taskbar-position');
|
||||
|
||||
// The _rightBox is always allocated the same, regardless of taskbar position setting
|
||||
let rightAllocWidth = rightNaturalWidth;
|
||||
let rightAllocSize = rightNaturalSize;
|
||||
|
||||
// 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;
|
||||
if (taskbarPosition == 'CENTEREDMONITOR') {
|
||||
leftAllocWidth = leftNaturalWidth;
|
||||
|
||||
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) / 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;
|
||||
centerEndPosition = centerStartPosition + centerNaturalWidth;
|
||||
} else if (taskbarPosition == 'LEFTPANEL_FLOATCENTER') {
|
||||
let leftAllocWidthMax = panelAllocWidth - rightNaturalWidth - centerNaturalWidth;
|
||||
leftAllocWidth = Math.min(leftAllocWidthMax, leftNaturalWidth);
|
||||
|
||||
let freeSpace = panelAllocWidth - leftAllocWidth - rightAllocWidth - centerNaturalWidth;
|
||||
|
||||
centerStartPosition = leftAllocWidth + Math.floor(freeSpace / 2);
|
||||
centerEndPosition = centerStartPosition + centerNaturalWidth;
|
||||
} else { // LEFTPANEL
|
||||
leftAllocWidth = panelAllocWidth - rightNaturalWidth - centerNaturalWidth;
|
||||
centerStartPosition = leftAllocWidth;
|
||||
centerEndPosition = centerStartPosition + centerNaturalWidth;
|
||||
}
|
||||
|
||||
let leftAllocSize, centerStartPosition, centerEndPosition;
|
||||
let childBoxLeft = new Clutter.ActorBox();
|
||||
let childBoxCenter = new Clutter.ActorBox();
|
||||
let childBoxRight = new Clutter.ActorBox();
|
||||
childBoxLeft.y1 = childBoxCenter.y1 = childBoxRight.y1 = 0;
|
||||
childBoxLeft.y2 = childBoxCenter.y2 = childBoxRight.y2 = panelAllocHeight;
|
||||
|
||||
if (taskbarPosition == 'CENTEREDMONITOR') {
|
||||
leftAllocSize = leftNaturalSize;
|
||||
|
||||
centerStartPosition = Math.max(leftNaturalSize, Math.floor((panelAllocVarSize - centerNaturalSize)/2));
|
||||
centerEndPosition = Math.min(panelAllocVarSize-rightNaturalSize, Math.ceil((panelAllocVarSize+centerNaturalSize))/2);
|
||||
} else if (taskbarPosition == 'CENTEREDCONTENT') {
|
||||
leftAllocSize = leftNaturalSize;
|
||||
|
||||
centerStartPosition = Math.max(leftNaturalSize, Math.floor((panelAllocVarSize - centerNaturalSize + leftNaturalSize - rightNaturalSize) / 2));
|
||||
centerEndPosition = Math.min(panelAllocVarSize-rightNaturalSize, Math.ceil((panelAllocVarSize + centerNaturalSize + leftNaturalSize - rightNaturalSize) / 2));
|
||||
} else if (taskbarPosition == 'LEFTPANEL_FIXEDCENTER') {
|
||||
leftAllocSize = Math.floor((panelAllocVarSize - centerNaturalSize) / 2);
|
||||
centerStartPosition = leftAllocSize;
|
||||
centerEndPosition = centerStartPosition + centerNaturalSize;
|
||||
} else if (taskbarPosition == 'LEFTPANEL_FLOATCENTER') {
|
||||
let leftAllocSizeMax = panelAllocVarSize - rightNaturalSize - centerNaturalSize;
|
||||
leftAllocSize = Math.min(leftAllocSizeMax, leftNaturalSize);
|
||||
|
||||
let freeSpace = panelAllocVarSize - leftAllocSize - rightAllocSize - centerNaturalSize;
|
||||
|
||||
centerStartPosition = leftAllocSize + Math.floor(freeSpace / 2);
|
||||
centerEndPosition = centerStartPosition + centerNaturalSize;
|
||||
} else { // LEFTPANEL
|
||||
leftAllocSize = panelAllocVarSize - rightNaturalSize - centerNaturalSize;
|
||||
centerStartPosition = leftAllocSize;
|
||||
centerEndPosition = centerStartPosition + centerNaturalSize;
|
||||
}
|
||||
|
||||
childBoxLeft[fixedCoord.c1] = childBoxCenter[fixedCoord.c1] = childBoxRight[fixedCoord.c1] = 0;
|
||||
childBoxLeft[fixedCoord.c2] = childBoxCenter[fixedCoord.c2] = childBoxRight[fixedCoord.c2] = panelAllocFixedSize;
|
||||
|
||||
// if it is a RTL language, the boxes are switched around, and we need to invert the coordinates
|
||||
if (this.panel.actor.get_text_direction() == Clutter.TextDirection.RTL) {
|
||||
childBoxLeft.x1 = panelAllocWidth - leftAllocWidth;
|
||||
childBoxLeft.x2 = panelAllocWidth;
|
||||
childBoxLeft[varCoord.c1] = panelAllocVarSize - leftAllocSize;
|
||||
childBoxLeft[varCoord.c2] = panelAllocVarSize;
|
||||
|
||||
childBoxCenter.x1 = panelAllocWidth - centerEndPosition;
|
||||
childBoxCenter.x2 = panelAllocWidth - centerStartPosition;
|
||||
childBoxCenter[varCoord.c1] = panelAllocVarSize - centerEndPosition;
|
||||
childBoxCenter[varCoord.c2] = panelAllocVarSize - centerStartPosition;
|
||||
|
||||
childBoxRight.x1 = 0;
|
||||
childBoxRight.x2 = rightAllocWidth;
|
||||
childBoxRight[varCoord.c1] = 0;
|
||||
childBoxRight[varCoord.c2] = rightAllocSize;
|
||||
} else {
|
||||
childBoxLeft.x1 = 0;
|
||||
childBoxLeft.x2 = leftAllocWidth;
|
||||
childBoxLeft[varCoord.c1] = 0;
|
||||
childBoxLeft[varCoord.c2] = leftAllocSize;
|
||||
|
||||
childBoxCenter.x1 = centerStartPosition;
|
||||
childBoxCenter.x2 = centerEndPosition;
|
||||
childBoxCenter[varCoord.c1] = centerStartPosition;
|
||||
childBoxCenter[varCoord.c2] = centerEndPosition;
|
||||
|
||||
childBoxRight.x1 = panelAllocWidth - rightAllocWidth;
|
||||
childBoxRight.x2 = panelAllocWidth;
|
||||
childBoxRight[varCoord.c1] = panelAllocVarSize - rightAllocSize;
|
||||
childBoxRight[varCoord.c2] = panelAllocVarSize;
|
||||
}
|
||||
|
||||
|
||||
let childBoxLeftCorner = new Clutter.ActorBox();
|
||||
let [cornerMinWidth, cornerWidth] = this.panel._leftCorner.actor.get_preferred_width(-1);
|
||||
let [cornerMinHeight, cornerHeight] = this.panel._leftCorner.actor.get_preferred_width(-1);
|
||||
childBoxLeftCorner.x1 = 0;
|
||||
childBoxLeftCorner.x2 = cornerWidth;
|
||||
childBoxLeftCorner.y1 = panelAllocHeight;
|
||||
childBoxLeftCorner.y2 = panelAllocHeight + cornerHeight;
|
||||
let [ , cornerSize] = this.panel._leftCorner.actor[sizeFunc](-1);
|
||||
childBoxLeftCorner[varCoord.c1] = 0;
|
||||
childBoxLeftCorner[varCoord.c2] = cornerSize;
|
||||
childBoxLeftCorner[fixedCoord.c1] = panelAllocFixedSize;
|
||||
childBoxLeftCorner[fixedCoord.c2] = panelAllocFixedSize + cornerSize;
|
||||
|
||||
let childBoxRightCorner = new Clutter.ActorBox();
|
||||
[cornerMinWidth, cornerWidth] = this.panel._rightCorner.actor.get_preferred_width(-1);
|
||||
[cornerMinHeight, cornerHeight] = this.panel._rightCorner.actor.get_preferred_width(-1);
|
||||
childBoxRightCorner.x1 = panelAllocWidth - cornerWidth;
|
||||
childBoxRightCorner.x2 = panelAllocWidth;
|
||||
childBoxRightCorner.y1 = panelAllocHeight;
|
||||
childBoxRightCorner.y2 = panelAllocHeight + cornerHeight;
|
||||
[ , cornerSize] = this.panel._rightCorner.actor[sizeFunc](-1);
|
||||
childBoxRightCorner[varCoord.c1] = panelAllocVarSize - cornerSize;
|
||||
childBoxRightCorner[varCoord.c2] = panelAllocVarSize;
|
||||
childBoxRightCorner[fixedCoord.c1] = panelAllocFixedSize;
|
||||
childBoxRightCorner[fixedCoord.c2] = panelAllocFixedSize + cornerSize;
|
||||
|
||||
this.panel._leftBox.allocate(childBoxLeft, flags, true);
|
||||
this.panel._centerBox.allocate(childBoxCenter, flags, true);
|
||||
@@ -539,19 +554,22 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
if(scaleFactor)
|
||||
size = size*scaleFactor;
|
||||
|
||||
this.panel.actor.set_height(size);
|
||||
|
||||
let position = Taskbar.getPosition();
|
||||
let isLeftOrRight = position == St.Side.LEFT || position == St.Side.LEFT;
|
||||
let isTop = position == St.Side.TOP;
|
||||
|
||||
this.panel.actor.set_size(isLeftOrRight ? size : -1, isLeftOrRight ? -1 : size);
|
||||
|
||||
this._setVertical(this.panel.actor, isLeftOrRight);
|
||||
|
||||
Main.overview._panelGhost.set_height(isTop ? size : 0);
|
||||
this._myPanelGhost.set_height(isTop ? 0 : size);
|
||||
|
||||
if (isTop) {
|
||||
if (!isTop) {
|
||||
this._removeTopLimit();
|
||||
} else {
|
||||
if (!this._topLimit) {
|
||||
this._topLimit = new St.BoxLayout({ name: 'topLimit', vertical: true });
|
||||
this._topLimit = new St.BoxLayout({ name: 'topLimit' });
|
||||
Main.layoutManager.addChrome(this._topLimit, { affectsStruts: true, trackFullscreen: true });
|
||||
}
|
||||
|
||||
@@ -578,6 +596,14 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
Main.layoutManager._updatePanelBarrier(this);
|
||||
},
|
||||
|
||||
_setVertical: function(actor, isVertical) {
|
||||
if ('vertical' in actor) {
|
||||
actor.vertical = isVertical;
|
||||
}
|
||||
|
||||
actor.get_children().forEach(c => this._setVertical(c, isVertical));
|
||||
},
|
||||
|
||||
_removeTopLimit: function() {
|
||||
if (this._topLimit) {
|
||||
Main.layoutManager.removeChrome(this._topLimit);
|
||||
|
||||
@@ -33,10 +33,6 @@
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#dashtopanelScrollview .dtp-icon-container {
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
#dashtopanelScrollview .app-well-app .overview-label {
|
||||
padding-right: 8px;
|
||||
}
|
||||
@@ -64,7 +60,6 @@
|
||||
}
|
||||
|
||||
#dashtopanelTaskbar .scrollview-fade {
|
||||
background-gradient-direction: horizontal;
|
||||
background-gradient-end: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
88
taskbar.js
88
taskbar.js
@@ -44,9 +44,10 @@ const Tweener = imports.ui.tweener;
|
||||
const Workspace = imports.ui.workspace;
|
||||
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const AppIcons = Me.imports.appIcons;
|
||||
const Panel = Me.imports.panel;
|
||||
const Utils = Me.imports.utils;
|
||||
const WindowPreview = Me.imports.windowPreview;
|
||||
const AppIcons = Me.imports.appIcons;
|
||||
|
||||
var DASH_ANIMATION_TIME = Dash.DASH_ANIMATION_TIME / (Dash.DASH_ANIMATION_TIME > 1 ? 1000 : 1);
|
||||
var DASH_ITEM_HOVER_TIMEOUT = Dash.DASH_ITEM_HOVER_TIMEOUT;
|
||||
@@ -65,6 +66,17 @@ function getPosition() {
|
||||
|
||||
return St.Side.LEFT;
|
||||
}
|
||||
|
||||
function checkIfVertical() {
|
||||
let position = getPosition();
|
||||
|
||||
return (position == St.Side.LEFT || position == St.Side.RIGHT);
|
||||
}
|
||||
|
||||
function getOrientation() {
|
||||
return (checkIfVertical() ? 'vertical' : 'horizontal');
|
||||
}
|
||||
|
||||
/**
|
||||
* Extend DashItemContainer
|
||||
*
|
||||
@@ -92,57 +104,67 @@ var taskbarActor = Utils.defineClass({
|
||||
this._delegate = delegate;
|
||||
this._currentBackgroundColor = 0;
|
||||
this.callParent('_init', { name: 'dashtopanelTaskbar',
|
||||
layout_manager: new Clutter.BoxLayout({ orientation: Clutter.Orientation.HORIZONTAL }),
|
||||
layout_manager: new Clutter.BoxLayout({ orientation: Clutter.Orientation[getOrientation().toUpperCase()] }),
|
||||
clip_to_allocation: true });
|
||||
},
|
||||
|
||||
vfunc_allocate: function(box, flags) {
|
||||
this.set_allocation(box, flags);
|
||||
|
||||
let availHeight = box.y2 - box.y1;
|
||||
let availSize = box[Panel.fixedCoord.c2] - box[Panel.fixedCoord.c1];
|
||||
let [, showAppsButton, scrollview, leftFade, rightFade] = this.get_children();
|
||||
let [, showAppsNatWidth] = showAppsButton.get_preferred_width(availHeight);
|
||||
let [, showAppsNatSize] = showAppsButton[Panel.sizeFunc](availSize);
|
||||
let childBox = new Clutter.ActorBox();
|
||||
let orientation = getOrientation().toLowerCase();
|
||||
|
||||
childBox.x1 = box.x1;
|
||||
childBox.x2 = box.x1 + showAppsNatWidth;
|
||||
childBox.y1 = box.y1;
|
||||
childBox.y2 = box.y2;
|
||||
childBox[Panel.varCoord.c1] = box[Panel.varCoord.c1];
|
||||
childBox[Panel.fixedCoord.c1] = box[Panel.fixedCoord.c1];
|
||||
|
||||
childBox[Panel.varCoord.c2] = box[Panel.varCoord.c1] + showAppsNatSize;
|
||||
childBox[Panel.fixedCoord.c2] = box[Panel.fixedCoord.c2];
|
||||
showAppsButton.allocate(childBox, flags);
|
||||
|
||||
childBox.x1 = box.x1 + showAppsNatWidth;
|
||||
childBox.x2 = box.x2;
|
||||
childBox[Panel.varCoord.c1] = box[Panel.varCoord.c1] + showAppsNatSize;
|
||||
childBox[Panel.varCoord.c2] = box[Panel.varCoord.c2];
|
||||
scrollview.allocate(childBox, flags);
|
||||
|
||||
let [hvalue, , hupper, , , hpageSize] = scrollview.hscroll.adjustment.get_values();
|
||||
let [hvalue, , hupper, , , hpageSize] = scrollview[orientation[0] + 'scroll'].adjustment.get_values();
|
||||
hupper = Math.floor(hupper);
|
||||
scrollview._dtpFadeSize = hupper > hpageSize ? this._delegate.iconSize : 0;
|
||||
|
||||
if (this._delegate.panelWrapper.dynamicTransparency &&
|
||||
this._currentBackgroundColor !== this._delegate.panelWrapper.dynamicTransparency.currentBackgroundColor) {
|
||||
this._currentBackgroundColor = this._delegate.panelWrapper.dynamicTransparency.currentBackgroundColor;
|
||||
let gradientStart = 'background-gradient-start: ' + this._currentBackgroundColor;
|
||||
leftFade.set_style(gradientStart);
|
||||
rightFade.set_style(gradientStart);
|
||||
let gradientStyle = 'background-gradient-start: ' + this._currentBackgroundColor + ';' +
|
||||
'background-gradient-direction: ' + orientation;
|
||||
|
||||
leftFade.set_style(gradientStyle);
|
||||
rightFade.set_style(gradientStyle);
|
||||
}
|
||||
|
||||
childBox.x1 = box.x1 + showAppsNatWidth;
|
||||
childBox.x2 = childBox.x1 + (hvalue > 0 ? scrollview._dtpFadeSize : 0);
|
||||
childBox[Panel.varCoord.c1] = box[Panel.varCoord.c1] + showAppsNatSize;
|
||||
childBox[Panel.varCoord.c2] = childBox[Panel.varCoord.c1] + (hvalue > 0 ? scrollview._dtpFadeSize : 0);
|
||||
leftFade.allocate(childBox, flags);
|
||||
|
||||
childBox.x1 = box.x2 - (hvalue + hpageSize < hupper ? scrollview._dtpFadeSize : 0);
|
||||
childBox.x2 = box.x2;
|
||||
childBox[Panel.varCoord.c1] = box[Panel.varCoord.c2] - (hvalue + hpageSize < hupper ? scrollview._dtpFadeSize : 0);
|
||||
childBox[Panel.varCoord.c2] = box[Panel.varCoord.c2];
|
||||
rightFade.allocate(childBox, flags);
|
||||
},
|
||||
|
||||
// We want to request the natural size of all our children
|
||||
// as our natural width, so we chain up to StWidget (which
|
||||
// then calls BoxLayout)
|
||||
vfunc_get_preferred_width: function(forHeight) {
|
||||
// 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] = St.Widget.prototype.vfunc_get_preferred_width.call(this, forHeight);
|
||||
|
||||
return [0, natWidth];
|
||||
},
|
||||
|
||||
vfunc_get_preferred_height: function(forWidth) {
|
||||
let [, natHeight] = St.Widget.prototype.vfunc_get_preferred_height.call(this, forWidth);
|
||||
|
||||
return [0, natHeight];
|
||||
},
|
||||
});
|
||||
|
||||
/* This class is a fork of the upstream dash class (ui.dash.js)
|
||||
@@ -170,7 +192,6 @@ var taskbar = Utils.defineClass({
|
||||
|
||||
this._shownInitially = false;
|
||||
|
||||
this._position = getPosition();
|
||||
this._signalsHandler = new Utils.GlobalSignalsHandler();
|
||||
|
||||
this._showLabelTimeoutId = 0;
|
||||
@@ -178,7 +199,7 @@ var taskbar = Utils.defineClass({
|
||||
this._ensureAppIconVisibilityTimeoutId = 0;
|
||||
this._labelShowing = false;
|
||||
|
||||
this._box = new St.BoxLayout({ vertical: false,
|
||||
this._box = new St.BoxLayout({ vertical: checkIfVertical(),
|
||||
clip_to_allocation: false,
|
||||
x_align: Clutter.ActorAlign.START,
|
||||
y_align: Clutter.ActorAlign.START });
|
||||
@@ -212,16 +233,19 @@ var taskbar = Utils.defineClass({
|
||||
this._container.add_child(new St.Widget({ width: 0, reactive: false }));
|
||||
this._container.add_actor(this._showAppsIcon);
|
||||
this._container.add_actor(this._scrollView);
|
||||
this._container.add_actor(new St.Widget({ style_class: 'scrollview-fade', reactive: false }));
|
||||
this._container.add_actor(new St.Widget({ style_class: 'scrollview-fade',
|
||||
reactive: false,
|
||||
pivot_point: new Clutter.Point({ x: .5, y: .5 }),
|
||||
rotation_angle_z: 180 }));
|
||||
|
||||
let fadeStyle = 'background-gradient-direction:' + getOrientation();
|
||||
let fade1 = new St.Widget({ style_class: 'scrollview-fade', reactive: false });
|
||||
let fade2 = new St.Widget({ style_class: 'scrollview-fade',
|
||||
reactive: false,
|
||||
pivot_point: new Clutter.Point({ x: .5, y: .5 }),
|
||||
rotation_angle_z: 180 });
|
||||
|
||||
this.showAppsButton.add_constraint(new Clutter.BindConstraint({
|
||||
source: this._container,
|
||||
coordinate: Clutter.BindCoordinate.HEIGHT
|
||||
}));
|
||||
fade1.set_style(fadeStyle);
|
||||
fade2.set_style(fadeStyle);
|
||||
|
||||
this._container.add_actor(fade1);
|
||||
this._container.add_actor(fade2);
|
||||
|
||||
this.previewMenu = new WindowPreview.PreviewMenu(panelWrapper);
|
||||
this.previewMenu.enable();
|
||||
|
||||
@@ -493,7 +493,7 @@ var PreviewMenu = Utils.defineClass({
|
||||
},
|
||||
|
||||
_getScrollAdjustmentValues: function() {
|
||||
let [value , , upper, , , pageSize] = this._scrollView[this.isLeftOrRight ? 'v' : 'h' + 'scroll'].adjustment.get_values();
|
||||
let [value , , upper, , , pageSize] = this._scrollView[(this.isLeftOrRight ? 'v' : 'h') + 'scroll'].adjustment.get_values();
|
||||
|
||||
return [value, upper, pageSize];
|
||||
},
|
||||
@@ -504,15 +504,15 @@ var PreviewMenu = Utils.defineClass({
|
||||
let x = 0, y = 0;
|
||||
let startBg = Utils.getrgbaColor(this._panelWrapper.dynamicTransparency.backgroundColorRgb, Math.min(alphaBg + .1, 1));
|
||||
let endBg = Utils.getrgbaColor(this._panelWrapper.dynamicTransparency.backgroundColorRgb, 0)
|
||||
let fadeStyle = 'background-gradient-start:' + startBg + 'background-gradient-end: ' + endBg + ' background-gradient-direction:';
|
||||
let fadeStyle = 'background-gradient-start:' + startBg +
|
||||
'background-gradient-end:' + endBg +
|
||||
'background-gradient-direction:' + Taskbar.getOrientation();
|
||||
|
||||
if (this.isLeftOrRight) {
|
||||
fadeStyle += 'vertical;'
|
||||
rotation = end ? 270 : 90;
|
||||
y = end ? this._panelWrapper.monitor.height - FADE_SIZE : 0;
|
||||
size = this.width;
|
||||
} else {
|
||||
fadeStyle += 'horizontal;'
|
||||
rotation = end ? 180 : 0;
|
||||
x = end ? this._panelWrapper.monitor.width - FADE_SIZE : 0;
|
||||
size = this.height;
|
||||
|
||||
Reference in New Issue
Block a user