Adjust dnd for vertical panel

This commit is contained in:
Charles Gagnon
2019-09-10 22:06:39 -04:00
parent cbc3648323
commit 14521d9cd0
2 changed files with 16 additions and 9 deletions

View File

@@ -132,12 +132,10 @@ var taskbarAppIcon = Utils.defineClass({
this._dot.set_width(0);
this._isGroupApps = Me.settings.get_boolean('group-apps');
let isVertical = Panel.checkIfVertical();
let dtpIconContainerOpts = { layout_manager: new Clutter.BinLayout() };
if (!this._isGroupApps) {
dtpIconContainerOpts.style = 'padding: ' + (isVertical ? '4px' : '0 4px');
dtpIconContainerOpts.style = getIconContainerStyle();
}
this._container = new St.Widget({ style_class: 'dtp-container', layout_manager: new Clutter.BinLayout() });
@@ -173,7 +171,7 @@ var taskbarAppIcon = Utils.defineClass({
this._container.add_child(this._dotsContainer);
this.actor.set_child(this._container);
if (isVertical) {
if (Panel.checkIfVertical()) {
this.actor.set_width(panel.geom.w);
}
@@ -1148,6 +1146,10 @@ var taskbarAppIcon = Utils.defineClass({
});
taskbarAppIcon.prototype.scaleAndFade = taskbarAppIcon.prototype.undoScaleAndFade = () => {};
function getIconContainerStyle() {
return 'padding: ' + (Panel.checkIfVertical() ? '4px' : '0 4px');
}
function minimizeWindow(app, param, monitor){
// Param true make all app windows minimize
let windows = getInterestingWindows(app, monitor);

View File

@@ -950,20 +950,25 @@ var taskbar = Utils.defineClass({
this._box.insert_child_above(source._dashItemContainer, null);
}
x -= this.showAppsButton.width;
let isVertical = Panel.checkIfVertical();
let sizeProp = isVertical ? 'height' : 'width';
let posProp = isVertical ? 'y' : 'x';
let pos = isVertical ? y : x;
pos -= this.showAppsButton[sizeProp];
let currentAppIcons = this._getAppIcons();
let sourceIndex = currentAppIcons.indexOf(source);
let hoveredIndex = Utils.findIndex(currentAppIcons,
appIcon => x >= appIcon._dashItemContainer.x &&
x <= (appIcon._dashItemContainer.x + appIcon._dashItemContainer.width));
appIcon => pos >= appIcon._dashItemContainer[posProp] &&
pos <= (appIcon._dashItemContainer[posProp] + appIcon._dashItemContainer[sizeProp]));
if (!this._dragInfo) {
this._dragInfo = [sourceIndex, source];
}
if (hoveredIndex >= 0) {
let isLeft = x < currentAppIcons[hoveredIndex]._dashItemContainer.x + currentAppIcons[hoveredIndex]._dashItemContainer.width * .5;
let isLeft = pos < currentAppIcons[hoveredIndex]._dashItemContainer[posProp] + currentAppIcons[hoveredIndex]._dashItemContainer[sizeProp] * .5;
// Don't allow positioning before or after self and between icons of same app
if (!(hoveredIndex === sourceIndex ||
@@ -1202,7 +1207,7 @@ var DragPlaceholderItem = Utils.defineClass({
Extends: St.Widget,
_init: function(appIcon, iconSize) {
this.callParent('_init', { style_class: 'dtp-icon-container', layout_manager: new Clutter.BinLayout() });
this.callParent('_init', { style: AppIcons.getIconContainerStyle(), layout_manager: new Clutter.BinLayout() });
this.child = { _delegate: appIcon };