mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-14 00:04:17 +09:00
Work on vertical panel
This commit is contained in:
32
appIcons.js
32
appIcons.js
@@ -47,6 +47,7 @@ const Workspace = imports.ui.workspace;
|
||||
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const Utils = Me.imports.utils;
|
||||
const Panel = Me.imports.panel;
|
||||
const Taskbar = Me.imports.taskbar;
|
||||
const _ = imports.gettext.domain(Utils.TRANSLATION_DOMAIN).gettext;
|
||||
|
||||
@@ -128,10 +129,12 @@ var taskbarAppIcon = Utils.defineClass({
|
||||
|
||||
this._dot.set_width(0);
|
||||
this._isGroupApps = Me.settings.get_boolean('group-apps');
|
||||
|
||||
let isVertical = Panel.checkIfVertical();
|
||||
|
||||
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: 'padding: ' + (Taskbar.checkIfVertical() ? '4px' : '0 4px'), layout_manager: new Clutter.BinLayout()});
|
||||
this._dtpIconContainer = new St.Widget({ style: 'padding: ' + (isVertical ? '4px 0' : '0 4px'), layout_manager: new Clutter.BinLayout() });
|
||||
|
||||
this.actor.remove_actor(this._iconContainer);
|
||||
|
||||
@@ -139,7 +142,7 @@ var taskbarAppIcon = Utils.defineClass({
|
||||
|
||||
if (appInfo.window) {
|
||||
let box = new St.BoxLayout();
|
||||
|
||||
|
||||
this._windowTitle = new St.Label({
|
||||
y_align: Clutter.ActorAlign.CENTER,
|
||||
x_align: Clutter.ActorAlign.START,
|
||||
@@ -162,6 +165,10 @@ var taskbarAppIcon = Utils.defineClass({
|
||||
this._container.add_child(this._dotsContainer);
|
||||
this.actor.set_child(this._container);
|
||||
|
||||
if (isVertical) {
|
||||
this.actor.set_width(panelWrapper.geom.w);
|
||||
}
|
||||
|
||||
// Monitor windows-changes instead of app state.
|
||||
// Keep using the same Id and function callback (that is extended)
|
||||
if(this._stateChangedId > 0) {
|
||||
@@ -442,6 +449,7 @@ var taskbarAppIcon = Utils.defineClass({
|
||||
this._windowTitle.clutter_text.natural_width_set = useFixedWidth;
|
||||
this._windowTitle.set_style('font-size: ' + Me.settings.get_int('group-apps-label-font-size') + 'px;' +
|
||||
'font-weight: ' + fontWeight + ';' +
|
||||
(Panel.checkIfVertical() ? 'padding-left: 4px;' : '') +
|
||||
(useFixedWidth ? '' : 'max-width: ' + maxLabelWidth + 'px;') +
|
||||
'color: ' + Me.settings.get_string('group-apps-label-font-color'));
|
||||
}
|
||||
@@ -510,10 +518,10 @@ var taskbarAppIcon = Utils.defineClass({
|
||||
},
|
||||
|
||||
_setAppIconPadding: function() {
|
||||
let padding = getIconPadding(Me.settings);
|
||||
let padding = getIconPadding();
|
||||
let margin = Me.settings.get_int('appicon-margin');
|
||||
|
||||
this.actor.set_style('padding:' + (Taskbar.checkIfVertical() ? margin + 'px 0' : '0 ' + margin + 'px;'));
|
||||
this.actor.set_style('padding:' + (Panel.checkIfVertical() ? margin + 'px 0' : '0 ' + margin + 'px;'));
|
||||
this._iconContainer.set_style('padding: ' + padding + 'px;');
|
||||
},
|
||||
|
||||
@@ -1262,9 +1270,9 @@ function cssHexTocssRgba(cssHex, opacity) {
|
||||
return 'rgba(' + [r, g, b].join(',') + ',' + opacity + ')';
|
||||
}
|
||||
|
||||
function getIconPadding(dtpSettings) {
|
||||
let panelSize = dtpSettings.get_int('panel-size');
|
||||
let padding = dtpSettings.get_int('appicon-padding');
|
||||
function getIconPadding() {
|
||||
let panelSize = Me.settings.get_int('panel-size');
|
||||
let padding = Me.settings.get_int('appicon-padding');
|
||||
let availSize = panelSize - Taskbar.MIN_ICON_SIZE - panelSize % 2;
|
||||
|
||||
if (padding * 2 > availSize) {
|
||||
@@ -1293,7 +1301,7 @@ var taskbarSecondaryMenu = Utils.defineClass({
|
||||
// parameter, I overwite what I need later
|
||||
this.callParent('_init', source);
|
||||
|
||||
let side = Taskbar.getPosition();
|
||||
let side = Panel.getPosition();
|
||||
// Change the initialized side where required.
|
||||
this._arrowSide = side;
|
||||
this._boxPointer._arrowSide = side;
|
||||
@@ -1430,7 +1438,7 @@ function ItemShowLabel() {
|
||||
let labelWidth = this.label.get_width();
|
||||
let labelHeight = this.label.get_height();
|
||||
|
||||
let position = Taskbar.getPosition();
|
||||
let position = Panel.getPosition();
|
||||
let labelOffset = node.get_length('-x-offset');
|
||||
|
||||
let xOffset = Math.floor((itemWidth - labelWidth) / 2);
|
||||
@@ -1504,8 +1512,6 @@ 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);
|
||||
|
||||
// Re-use appIcon methods
|
||||
@@ -1561,9 +1567,9 @@ var ShowAppsIconWrapper = Utils.defineClass({
|
||||
},
|
||||
|
||||
setShowAppsPadding: function() {
|
||||
let padding = getIconPadding(Me.settings);
|
||||
let padding = getIconPadding();
|
||||
let sidePadding = Me.settings.get_int('show-apps-icon-side-padding');
|
||||
let isVertical = Taskbar.checkIfVertical();
|
||||
let isVertical = Panel.checkIfVertical();
|
||||
|
||||
this.actor.set_style('padding:' + (padding + (isVertical ? sidePadding : 0)) + 'px ' + (padding + (isVertical ? 0 : sidePadding)) + 'px;');
|
||||
},
|
||||
|
||||
156
panel.js
156
panel.js
@@ -61,6 +61,30 @@ var sizeFunc;
|
||||
var fixedCoord;
|
||||
var varCoord;
|
||||
|
||||
function getPosition() {
|
||||
let position = Me.settings.get_string('panel-position');
|
||||
|
||||
if (position == 'TOP') {
|
||||
return St.Side.TOP;
|
||||
} else if (position == 'RIGHT') {
|
||||
return St.Side.RIGHT;
|
||||
} else if (position == 'BOTTOM') {
|
||||
return St.Side.BOTTOM;
|
||||
}
|
||||
|
||||
return St.Side.LEFT;
|
||||
}
|
||||
|
||||
function checkIfVertical() {
|
||||
let position = getPosition();
|
||||
|
||||
return (position == St.Side.LEFT || position == St.Side.RIGHT);
|
||||
}
|
||||
|
||||
function getOrientation() {
|
||||
return (checkIfVertical() ? 'vertical' : 'horizontal');
|
||||
}
|
||||
|
||||
var dtpPanelWrapper = Utils.defineClass({
|
||||
Name: 'DashToPanel.PanelWrapper',
|
||||
|
||||
@@ -77,7 +101,7 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
Utils.wrapActor(this.panel.statusArea.activities || 0);
|
||||
|
||||
if (!isSecondary) {
|
||||
if (Taskbar.checkIfVertical()) {
|
||||
if (checkIfVertical()) {
|
||||
sizeFunc = 'get_preferred_height',
|
||||
fixedCoord = { c1: 'x1', c2: 'x2' },
|
||||
varCoord = { c1: 'y1', c2: 'y2' };
|
||||
@@ -101,6 +125,8 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
if (this.panel.statusArea.aggregateMenu) {
|
||||
this.panel.statusArea.aggregateMenu._volume.indicators._dtpIgnoreScroll = 1;
|
||||
}
|
||||
|
||||
this.geom = this._getGeometry();
|
||||
|
||||
this._oldPanelActorDelegate = this.panel.actor._delegate;
|
||||
this.panel.actor._delegate = this;
|
||||
@@ -113,19 +139,10 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
this.panelBox.add(this.panelBg);
|
||||
|
||||
this.panelBg.styles = 'border-radius: ' + this.panel.actor.get_theme_node().get_border_radius(0) + 'px;';
|
||||
|
||||
// The overview uses the this.panel height as a margin by way of a "ghost" transparent Clone
|
||||
// This pushes everything down, which isn't desired when the this.panel is moved to the bottom
|
||||
// I'm adding a 2nd ghost this.panel and will resize the top or bottom ghost depending on the this.panel position
|
||||
this._myPanelGhost = new St.Bin({
|
||||
child: new Clutter.Clone({ source: this.panel.actor }),
|
||||
reactive: false,
|
||||
opacity: 0
|
||||
});
|
||||
Main.overview._overview.add_actor(this._myPanelGhost)
|
||||
|
||||
this._adjustForOverview();
|
||||
|
||||
this._setPanelPosition();
|
||||
this._setPanelPosition(true);
|
||||
|
||||
this._HeightNotifyListener = this.panelBox.connect("notify::height", Lang.bind(this, function(){
|
||||
this._setPanelPosition();
|
||||
@@ -159,6 +176,30 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
});
|
||||
|
||||
if (!this.isSecondary) {
|
||||
// The overview uses the this.panel height as a margin by way of a "ghost" transparent Clone
|
||||
// This pushes everything down, which isn't desired when the this.panel is moved to the bottom
|
||||
// I'm adding a 2nd ghost this.panel and will resize the top or bottom ghost depending on the this.panel position
|
||||
if (this.geom.position != St.Side.TOP) {
|
||||
this._myPanelGhost = new Clutter.Actor({
|
||||
x: this.geom.x,
|
||||
y: this.geom.y ,
|
||||
width: this.geom.w,
|
||||
height: checkIfVertical() ? 1 : this.geom.h,
|
||||
reactive: false,
|
||||
opacity: 0
|
||||
});
|
||||
|
||||
if (this.geom.position == St.Side.BOTTOM) {
|
||||
Main.overview._overview.add_actor(this._myPanelGhost);
|
||||
} else if (this.geom.position == St.Side.LEFT) {
|
||||
Main.overview._controls._group.insert_child_at_index(this._myPanelGhost, 0);
|
||||
} else {
|
||||
Main.overview._controls._group.insert_child_above(this._myPanelGhost, null);
|
||||
}
|
||||
|
||||
Main.overview._panelGhost.set_height(0);
|
||||
}
|
||||
|
||||
if (this.panel.vfunc_allocate) {
|
||||
this._panelConnectId = 0;
|
||||
Utils.hookVfunc(this.panel.__proto__, 'allocate', (box, flags) => this._vfunc_allocate(box, flags));
|
||||
@@ -286,7 +327,6 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
|
||||
disable: function () {
|
||||
this.panelStyle.disable();
|
||||
Main.overview._overview.remove_actor(this._myPanelGhost);
|
||||
|
||||
this._signalsHandler.destroy();
|
||||
this.container.remove_child(this.taskbar.actor);
|
||||
@@ -355,7 +395,12 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
this.panel.actor.set_width(-1);
|
||||
this._setVertical(this.panel.actor, false);
|
||||
|
||||
Main.overview._panelGhost.set_height(this._oldPanelHeight);
|
||||
Main.overview._panelGhost.set_size(this.monitor.width, this._oldPanelHeight);
|
||||
|
||||
if (this._myPanelGhost) {
|
||||
this._myPanelGhost.get_parent().remove_actor(this._myPanelGhost);
|
||||
}
|
||||
|
||||
this._setActivitiesButtonVisible(true);
|
||||
this._setClockLocation("BUTTONSLEFT");
|
||||
this._displayShowDesktopButton(false);
|
||||
@@ -439,6 +484,13 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
|
||||
Me.settings.connect('changed::showdesktop-button-width', () => this._setShowDesktopButtonWidth())
|
||||
];
|
||||
|
||||
if (checkIfVertical()) {
|
||||
this._dtpSettingsSignalIds.push(
|
||||
Me.settings.connect('changed::group-apps-label-max-width', () => this._resetGeometry()),
|
||||
Me.settings.connect('changed::group-apps', () => this._resetGeometry()),
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
_adjustForOverview: function() {
|
||||
@@ -449,6 +501,49 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
this.panelBox[isShown ? 'show' : 'hide']();
|
||||
},
|
||||
|
||||
_resetGeometry: function() {
|
||||
this.geom = this._getGeometry();
|
||||
this._setPanelPosition();
|
||||
this.taskbar.resetAppIcons();
|
||||
},
|
||||
|
||||
_getGeometry: function() {
|
||||
let position = getPosition();
|
||||
let size = Me.settings.get_int('panel-size');
|
||||
let x = 0, y = 0;
|
||||
let w = 0, h = 0;
|
||||
|
||||
if (checkIfVertical()) {
|
||||
if (!Me.settings.get_boolean('group-apps')) {
|
||||
size += Me.settings.get_int('group-apps-label-max-width');
|
||||
}
|
||||
|
||||
w = size;
|
||||
h = this.monitor.height;
|
||||
} else {
|
||||
w = this.monitor.width;
|
||||
h = size;
|
||||
}
|
||||
|
||||
if (position == St.Side.TOP || position == St.Side.LEFT) {
|
||||
x = this.monitor.x;
|
||||
y = this.monitor.y;
|
||||
} else if (position == St.Side.RIGHT) {
|
||||
x = this.monitor.x + this.monitor.width - size;
|
||||
y = this.monitor.y;
|
||||
} else { //BOTTOM
|
||||
x = this.monitor.x;
|
||||
y = this.monitor.y + this.monitor.height - size;
|
||||
}
|
||||
|
||||
return {
|
||||
x: x, y: y,
|
||||
w: w, h: h,
|
||||
position: position,
|
||||
size: size * (St.ThemeContext.get_for_stage(global.stage).scale_factor || 1)
|
||||
};
|
||||
},
|
||||
|
||||
_vfunc_allocate: function(box, flags) {
|
||||
this.panel.set_allocation(box, flags);
|
||||
this._allocate(null, box, flags);
|
||||
@@ -546,26 +641,17 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
this.panel._rightCorner.actor.allocate(childBoxRightCorner, flags);
|
||||
},
|
||||
|
||||
_setPanelPosition: function() {
|
||||
let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
||||
let size = Me.settings.get_int('panel-size');
|
||||
_setPanelPosition: function(verticalize) {
|
||||
let container = this.intellihide && this.intellihide.enabled ? this.panelBox.get_parent() : this.panelBox;
|
||||
|
||||
if(scaleFactor)
|
||||
size = size*scaleFactor;
|
||||
|
||||
let position = Taskbar.getPosition();
|
||||
let isLeftOrRight = position == St.Side.LEFT || position == St.Side.RIGHT;
|
||||
let isTop = position == St.Side.TOP;
|
||||
this.panel.actor.set_size(this.geom.w, this.geom.h);
|
||||
container.set_position(this.geom.x, this.geom.y)
|
||||
|
||||
this.panel.actor.set_size(isLeftOrRight ? size : -1, isLeftOrRight ? -1 : size);
|
||||
if (verticalize) {
|
||||
this._setVertical(this.panel.actor, checkIfVertical());
|
||||
}
|
||||
|
||||
this._setVertical(this.panel.actor, isLeftOrRight);
|
||||
|
||||
Main.overview._panelGhost.set_height(isTop ? size : 0);
|
||||
this._myPanelGhost.set_height(isTop ? 0 : size);
|
||||
|
||||
if (!isTop) {
|
||||
if (this.geom.position == St.Side.TOP) {
|
||||
this._removeTopLimit();
|
||||
} else {
|
||||
if (!this._topLimit) {
|
||||
@@ -577,19 +663,11 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
this._topLimit.set_size(this.monitor.width, -1);
|
||||
}
|
||||
|
||||
if (isTop || position == St.Side.LEFT) {
|
||||
container.set_position(this.monitor.x, this.monitor.y);
|
||||
} else if (position == St.Side.RIGHT) {
|
||||
container.set_position(this.monitor.x + this.monitor.width - container.width, this.monitor.y);
|
||||
} else { //BOTTOM
|
||||
container.set_position(this.monitor.x, this.monitor.y + this.monitor.height - container.height);
|
||||
}
|
||||
|
||||
// styles for theming
|
||||
Object.keys(St.Side).forEach(p => {
|
||||
let cssName = p.charAt(0) + p.slice(1).toLowerCase();
|
||||
|
||||
this.panel.actor[(p == position ? 'add' : 'remove') + '_style_class_name']('dashtopanel' + cssName);
|
||||
this.panel.actor[(p == this.geom.position ? 'add' : 'remove') + '_style_class_name']('dashtopanel' + cssName);
|
||||
});
|
||||
|
||||
Main.layoutManager._updateHotCorners();
|
||||
|
||||
@@ -96,7 +96,7 @@ var dtpPanelManager = Utils.defineClass({
|
||||
global.dashToPanel.panels = this.allPanels;
|
||||
global.dashToPanel.emit('panels-created');
|
||||
|
||||
let panelPosition = Taskbar.getPosition();
|
||||
let panelPosition = Panel.getPosition();
|
||||
this.allPanels.forEach(p => {
|
||||
let leftOrRight = (panelPosition == St.Side.LEFT || panelPosition == St.Side.RIGHT);
|
||||
|
||||
@@ -201,7 +201,7 @@ var dtpPanelManager = Utils.defineClass({
|
||||
);
|
||||
|
||||
['_leftBox', '_centerBox', '_rightBox'].forEach(c => this._signalsHandler.add(
|
||||
[Main.panel[c], 'actor-added', (parent, child) => this._adjustPanelMenuButton(this._getPanelMenuButton(child), this.primaryPanel.monitor, Taskbar.getPosition())]
|
||||
[Main.panel[c], 'actor-added', (parent, child) => this._adjustPanelMenuButton(this._getPanelMenuButton(child), this.primaryPanel.monitor, Panel.getPosition())]
|
||||
));
|
||||
|
||||
this._setKeyBindings(true);
|
||||
@@ -499,7 +499,7 @@ function newUpdateHotCorners() {
|
||||
}
|
||||
|
||||
let size = this.panelBox.height;
|
||||
let panelPosition = Taskbar.getPosition();
|
||||
let panelPosition = Panel.getPosition();
|
||||
|
||||
// build new hot corners
|
||||
for (let i = 0; i < this.monitors.length; i++) {
|
||||
@@ -584,7 +584,7 @@ function newUpdatePanelBarrier(panel) {
|
||||
let fixed1 = panel.monitor.y;
|
||||
let fixed2 = panel.monitor.y + barrierSize;
|
||||
|
||||
if (Taskbar.checkIfVertical()) {
|
||||
if (Panel.checkIfVertical()) {
|
||||
barriers._rightPanelBarrier.push(panel.monitor.y + panel.monitor.height, Meta.BarrierDirection.POSITIVE_Y);
|
||||
barriers._leftPanelBarrier.push(panel.monitor.y, Meta.BarrierDirection.NEGATIVE_Y);
|
||||
} else {
|
||||
@@ -592,7 +592,7 @@ function newUpdatePanelBarrier(panel) {
|
||||
barriers._leftPanelBarrier.push(panel.monitor.x, Meta.BarrierDirection.POSITIVE_X);
|
||||
}
|
||||
|
||||
switch (Taskbar.getPosition()) {
|
||||
switch (Panel.getPosition()) {
|
||||
//values are initialized as St.Side.TOP
|
||||
case St.Side.BOTTOM:
|
||||
fixed1 = panel.monitor.y + panel.monitor.height - barrierSize;
|
||||
@@ -636,7 +636,7 @@ function newUpdatePanelBarrier(panel) {
|
||||
function _newLookingGlassResize() {
|
||||
this._oldResize();
|
||||
|
||||
if (Taskbar.checkIfVertical()) {
|
||||
if (Panel.checkIfVertical()) {
|
||||
this._hiddenY = Main.layoutManager.primaryMonitor.y + 40 - this.actor.height;
|
||||
this._targetY = this._hiddenY + this.actor.height;
|
||||
this.actor.y = this._hiddenY;
|
||||
|
||||
46
taskbar.js
46
taskbar.js
@@ -53,30 +53,6 @@ var DASH_ANIMATION_TIME = Dash.DASH_ANIMATION_TIME / (Dash.DASH_ANIMATION_TIME >
|
||||
var DASH_ITEM_HOVER_TIMEOUT = Dash.DASH_ITEM_HOVER_TIMEOUT;
|
||||
var MIN_ICON_SIZE = 4;
|
||||
|
||||
function getPosition() {
|
||||
let position = Me.settings.get_string('panel-position');
|
||||
|
||||
if (position == 'TOP') {
|
||||
return St.Side.TOP;
|
||||
} else if (position == 'RIGHT') {
|
||||
return St.Side.RIGHT;
|
||||
} else if (position == 'BOTTOM') {
|
||||
return St.Side.BOTTOM;
|
||||
}
|
||||
|
||||
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
|
||||
*
|
||||
@@ -104,7 +80,7 @@ var taskbarActor = Utils.defineClass({
|
||||
this._delegate = delegate;
|
||||
this._currentBackgroundColor = 0;
|
||||
this.callParent('_init', { name: 'dashtopanelTaskbar',
|
||||
layout_manager: new Clutter.BoxLayout({ orientation: Clutter.Orientation[getOrientation().toUpperCase()] }),
|
||||
layout_manager: new Clutter.BoxLayout({ orientation: Clutter.Orientation[Panel.getOrientation().toUpperCase()] }),
|
||||
clip_to_allocation: true });
|
||||
},
|
||||
|
||||
@@ -115,7 +91,7 @@ var taskbarActor = Utils.defineClass({
|
||||
let [, showAppsButton, scrollview, leftFade, rightFade] = this.get_children();
|
||||
let [, showAppsNatSize] = showAppsButton[Panel.sizeFunc](availSize);
|
||||
let childBox = new Clutter.ActorBox();
|
||||
let orientation = getOrientation().toLowerCase();
|
||||
let orientation = Panel.getOrientation().toLowerCase();
|
||||
|
||||
childBox[Panel.varCoord.c1] = box[Panel.varCoord.c1];
|
||||
childBox[Panel.fixedCoord.c1] = box[Panel.fixedCoord.c1];
|
||||
@@ -199,7 +175,9 @@ var taskbar = Utils.defineClass({
|
||||
this._ensureAppIconVisibilityTimeoutId = 0;
|
||||
this._labelShowing = false;
|
||||
|
||||
this._box = new St.BoxLayout({ vertical: checkIfVertical(),
|
||||
let isVertical = Panel.checkIfVertical();
|
||||
|
||||
this._box = new St.BoxLayout({ vertical: isVertical,
|
||||
clip_to_allocation: false,
|
||||
x_align: Clutter.ActorAlign.START,
|
||||
y_align: Clutter.ActorAlign.START });
|
||||
@@ -221,7 +199,11 @@ var taskbar = Utils.defineClass({
|
||||
// an instance of the showAppsIcon class is encapsulated in the wrapper
|
||||
this._showAppsIcon = this._showAppsIconWrapper.realShowAppsIcon;
|
||||
this.showAppsButton = this._showAppsIcon.toggleButton;
|
||||
|
||||
|
||||
if (isVertical) {
|
||||
this.showAppsButton.set_width(panelWrapper.geom.w);
|
||||
}
|
||||
|
||||
this.showAppsButton.connect('notify::checked', Lang.bind(this, this._onShowAppsButtonToggled));
|
||||
this.showAppsButton.checked = Main.overview.viewSelector._showAppsButton.checked;
|
||||
|
||||
@@ -234,7 +216,7 @@ var taskbar = Utils.defineClass({
|
||||
this._container.add_actor(this._showAppsIcon);
|
||||
this._container.add_actor(this._scrollView);
|
||||
|
||||
let fadeStyle = 'background-gradient-direction:' + getOrientation();
|
||||
let fadeStyle = 'background-gradient-direction:' + Panel.getOrientation();
|
||||
let fade1 = new St.Widget({ style_class: 'scrollview-fade', reactive: false });
|
||||
let fade2 = new St.Widget({ style_class: 'scrollview-fade',
|
||||
reactive: false,
|
||||
@@ -345,6 +327,8 @@ var taskbar = Utils.defineClass({
|
||||
this.showShowAppsButton();
|
||||
else
|
||||
this.hideShowAppsButton();
|
||||
|
||||
this.resetAppIcons();
|
||||
})
|
||||
],
|
||||
[
|
||||
@@ -904,6 +888,10 @@ var taskbar = Utils.defineClass({
|
||||
this._shownInitially = false;
|
||||
this._redisplay();
|
||||
|
||||
if (Panel.checkIfVertical()) {
|
||||
this.showAppsButton.set_width(this.panelWrapper.geom.w);
|
||||
this.previewMenu._updateClip();
|
||||
}
|
||||
},
|
||||
|
||||
_updateNumberOverlay: function() {
|
||||
|
||||
@@ -30,6 +30,7 @@ const WindowManager = imports.ui.windowManager;
|
||||
const Workspace = imports.ui.workspace;
|
||||
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const Panel = Me.imports.panel;
|
||||
const Taskbar = Me.imports.taskbar;
|
||||
const Utils = Me.imports.utils;
|
||||
|
||||
@@ -67,16 +68,16 @@ var PreviewMenu = Utils.defineClass({
|
||||
_init: function(panelWrapper) {
|
||||
this.callParent('_init', { layout_manager: new Clutter.BinLayout() });
|
||||
|
||||
let geom = panelWrapper.geom;
|
||||
this._panelWrapper = panelWrapper;
|
||||
this.currentAppIcon = null;
|
||||
this._focusedPreview = null;
|
||||
this._peekedWindow = null;
|
||||
this.peekInitialWorkspaceIndex = -1;
|
||||
this.opened = false;
|
||||
this._position = Taskbar.getPosition();
|
||||
this.isLeftOrRight = this._position == St.Side.LEFT || this._position == St.Side.RIGHT;
|
||||
this._translationProp = 'translation_' + (this.isLeftOrRight ? 'x' : 'y');
|
||||
this._translationDirection = (this._position == St.Side.TOP || this._position == St.Side.LEFT ? -1 : 1);
|
||||
this.isVertical = geom.position == St.Side.LEFT || geom.position == St.Side.RIGHT;
|
||||
this._translationProp = 'translation_' + (this.isVertical ? 'x' : 'y');
|
||||
this._translationDirection = (geom.position == St.Side.TOP || geom.position == St.Side.LEFT ? -1 : 1);
|
||||
this._translationOffset = Math.min(Me.settings.get_int('panel-size'), MAX_TRANSLATION) * this._translationDirection;
|
||||
|
||||
this.menu = new St.Widget({
|
||||
@@ -86,16 +87,16 @@ var PreviewMenu = Utils.defineClass({
|
||||
track_hover: true,
|
||||
x_expand: true,
|
||||
y_expand: true,
|
||||
x_align: Clutter.ActorAlign[this._position != St.Side.RIGHT ? 'START' : 'END'],
|
||||
y_align: Clutter.ActorAlign[this._position != St.Side.BOTTOM ? 'START' : 'END']
|
||||
x_align: Clutter.ActorAlign[geom.position != St.Side.RIGHT ? 'START' : 'END'],
|
||||
y_align: Clutter.ActorAlign[geom.position != St.Side.BOTTOM ? 'START' : 'END']
|
||||
});
|
||||
this._box = new St.BoxLayout({ vertical: this.isLeftOrRight });
|
||||
this._box = new St.BoxLayout({ vertical: this.isVertical });
|
||||
this._scrollView = new St.ScrollView({
|
||||
name: 'dashtopanelPreviewScrollview',
|
||||
hscrollbar_policy: Gtk.PolicyType.NEVER,
|
||||
vscrollbar_policy: Gtk.PolicyType.NEVER,
|
||||
enable_mouse_scrolling: true,
|
||||
y_expand: !this.isLeftOrRight
|
||||
y_expand: !this.isVertical
|
||||
});
|
||||
|
||||
this._scrollView.add_actor(this._box);
|
||||
@@ -353,7 +354,7 @@ var PreviewMenu = Utils.defineClass({
|
||||
|
||||
_onScrollEvent: function(actor, event) {
|
||||
if (!event.is_pointer_emulated()) {
|
||||
let vOrh = this.isLeftOrRight ? 'v' : 'h';
|
||||
let vOrh = this.isVertical ? 'v' : 'h';
|
||||
let adjustment = this._scrollView['get_' + vOrh + 'scroll_bar']().get_adjustment();
|
||||
let increment = adjustment.step_increment;
|
||||
let delta = increment;
|
||||
@@ -414,12 +415,13 @@ var PreviewMenu = Utils.defineClass({
|
||||
|
||||
_updateClip: function() {
|
||||
let x, y, w, h;
|
||||
let geom = this._panelWrapper.geom;
|
||||
let panelBoxTheme = this._panelWrapper.panelBox.get_theme_node();
|
||||
let panelSize = Me.settings.get_int('panel-size') * scaleFactor;
|
||||
let panelSize = geom.size;
|
||||
let previewSize = (Me.settings.get_int('window-preview-size') +
|
||||
Me.settings.get_int('window-preview-padding') * 2) * scaleFactor;
|
||||
|
||||
if (this.isLeftOrRight) {
|
||||
if (this.isVertical) {
|
||||
w = previewSize;
|
||||
h = this._panelWrapper.monitor.height;
|
||||
y = this._panelWrapper.monitor.y;
|
||||
@@ -429,11 +431,11 @@ var PreviewMenu = Utils.defineClass({
|
||||
x = this._panelWrapper.monitor.x;
|
||||
}
|
||||
|
||||
if (this._position == St.Side.LEFT) {
|
||||
if (geom.position == St.Side.LEFT) {
|
||||
x = this._panelWrapper.monitor.x + panelSize + panelBoxTheme.get_padding(St.Side.LEFT);
|
||||
} else if (this._position == St.Side.RIGHT) {
|
||||
} else if (geom.position == St.Side.RIGHT) {
|
||||
x = this._panelWrapper.monitor.x + this._panelWrapper.monitor.width - (panelSize + previewSize) - panelBoxTheme.get_padding(St.Side.RIGHT);
|
||||
} else if (this._position == St.Side.TOP) {
|
||||
} else if (geom.position == St.Side.TOP) {
|
||||
y = this._panelWrapper.monitor.y + panelSize + panelBoxTheme.get_padding(St.Side.TOP);
|
||||
} else { //St.Side.BOTTOM
|
||||
y = this._panelWrapper.monitor.y + this._panelWrapper.monitor.height - (panelSize + panelBoxTheme.get_padding(St.Side.BOTTOM) + previewSize + headerHeight);
|
||||
@@ -454,7 +456,7 @@ var PreviewMenu = Utils.defineClass({
|
||||
previewsHeight = Math.min(previewsHeight, this._panelWrapper.monitor.height);
|
||||
this._updateScrollFade(previewsWidth < this._panelWrapper.monitor.width && previewsHeight < this._panelWrapper.monitor.height);
|
||||
|
||||
if (this.isLeftOrRight) {
|
||||
if (this.isVertical) {
|
||||
y = sourceAllocation.y1 + appIconMargin - this._panelWrapper.monitor.y + (sourceContentBox.y2 - sourceContentBox.y1 - previewsHeight) * .5;
|
||||
y = Math.max(y, 0);
|
||||
y = Math.min(y, this._panelWrapper.monitor.height - previewsHeight);
|
||||
@@ -494,7 +496,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.isVertical ? 'v' : 'h') + 'scroll'].adjustment.get_values();
|
||||
|
||||
return [value, upper, pageSize];
|
||||
},
|
||||
@@ -507,9 +509,9 @@ var PreviewMenu = Utils.defineClass({
|
||||
let endBg = Utils.getrgbaColor(this._panelWrapper.dynamicTransparency.backgroundColorRgb, 0)
|
||||
let fadeStyle = 'background-gradient-start:' + startBg +
|
||||
'background-gradient-end:' + endBg +
|
||||
'background-gradient-direction:' + Taskbar.getOrientation();
|
||||
'background-gradient-direction:' + Panel.getOrientation();
|
||||
|
||||
if (this.isLeftOrRight) {
|
||||
if (this.isVertical) {
|
||||
rotation = end ? 270 : 90;
|
||||
y = end ? this._panelWrapper.monitor.height - FADE_SIZE : 0;
|
||||
size = this.width;
|
||||
@@ -539,7 +541,7 @@ var PreviewMenu = Utils.defineClass({
|
||||
if (!c.animatingOut) {
|
||||
let [width, height] = c.getSize();
|
||||
|
||||
if (this.isLeftOrRight) {
|
||||
if (this.isVertical) {
|
||||
previewsWidth = Math.max(width, previewsWidth);
|
||||
previewsHeight += height;
|
||||
} else {
|
||||
@@ -1048,7 +1050,7 @@ var Preview = Utils.defineClass({
|
||||
let size = Me.settings.get_int('window-preview-size') * scaleFactor;
|
||||
let w, h;
|
||||
|
||||
if (this._previewMenu.isLeftOrRight) {
|
||||
if (this._previewMenu.isVertical) {
|
||||
w = size;
|
||||
h = w * aspectRatio.y.size / aspectRatio.x.size;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user