Fix allocations for 3.32

This commit is contained in:
Charles Gagnon
2019-01-13 23:18:19 -05:00
parent 91bb8e3e09
commit 15a3cea2d5
5 changed files with 88 additions and 33 deletions

View File

@@ -133,13 +133,12 @@ var taskbarAppIcon = new Lang.Class({
this._focused = tracker.focus_app == this.app;
this._isGroupApps = this._dtpSettings.get_boolean('group-apps');
this._container = new St.Widget({ layout_manager: new Clutter.BinLayout() });
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.actor.remove_actor(this._iconContainer);
this._dtpIconContainer = new St.Widget({ name: 'dtp-icon-container', layout_manager: new Clutter.BinLayout() });
this._dtpIconContainer.add_child(this._iconContainer);
if (appInfo.window) {
@@ -174,6 +173,9 @@ var taskbarAppIcon = new Lang.Class({
this._stateChangedId = 0;
}
this._setAppIconPadding();
this._showDots();
this._focusWindowChangedId = global.display.connect('notify::focus-window',
Lang.bind(this, this._onFocusAppChanged));
@@ -193,9 +195,6 @@ var taskbarAppIcon = new Lang.Class({
this._switchWorkspaceId = global.window_manager.connect('switch-workspace',
Lang.bind(this, this._onSwitchWorkspace));
this._setAppIconPadding();
this._showDots();
this._dtpSettingsSignalIds = [
this._dtpSettings.connect('changed::dot-position', Lang.bind(this, this._settingsChangeRefresh)),
this._dtpSettings.connect('changed::dot-size', Lang.bind(this, this._updateDotSize)),
@@ -535,7 +534,7 @@ var taskbarAppIcon = new Lang.Class({
}
this.actor.set_style('padding: 0 ' + margin + 'px;');
this._dtpIconContainer.set_style('padding: ' + padding + 'px;');
this._iconContainer.set_style('padding: ' + padding + 'px;');
},
popupMenu: function() {
@@ -1461,7 +1460,6 @@ var ShowAppsIconWrapper = new Lang.Class({
/* 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.actor.name = 'show-apps-btn';
// Re-use appIcon methods
this._removeMenuTimeout = AppDisplay.AppIcon.prototype._removeMenuTimeout;
@@ -1508,13 +1506,6 @@ var ShowAppsIconWrapper = new Lang.Class({
customIconPath = this._dtpSettings.get_string('show-apps-icon-file');
this.realShowAppsIcon.icon._createIconTexture(this.realShowAppsIcon.icon.iconSize);
});
this._dtpSettings.connect('changed::appicon-padding', () => this.setShowAppsPadding());
this.setShowAppsPadding();
},
setShowAppsPadding: function() {
this.actor.set_style('padding:' + (this._dtpSettings.get_int('appicon-padding') + 2) + 'px;');
},
popupMenu: function() {
@@ -1583,4 +1574,4 @@ var MyShowAppsIconMenu = new Lang.Class({
item.connect('activate', Lang.bind(this._source._dtpPanel, this._source._dtpPanel._onShowDesktopButtonPress));
}
}
});
});

View File

@@ -130,7 +130,6 @@ var dtpPanelWrapper = new Lang.Class({
if (!this.isSecondary) {
if (this.panel.vfunc_allocate) {
this._panelConnectId = 0;
this.panel.__proto__._dtpOldAllocate = this.panel.__proto__.vfunc_allocate;
this.panel.__proto__[Gi.hook_up_vfunc_symbol]('allocate', (box, flags) => this._allocate(null, box, flags));
} else {
this._panelConnectId = this.panel.actor.connect('allocate', (actor,box,flags) => this._allocate(actor,box,flags));
@@ -310,8 +309,7 @@ var dtpPanelWrapper = new Lang.Class({
if (this._panelConnectId) {
this.panel.actor.disconnect(this._panelConnectId);
} else {
this.panel.__proto__[Gi.hook_up_vfunc_symbol]('allocate', this.panel.__proto__._dtpOldAllocate);
delete this.panel.__proto__._dtpOldAllocate;
this.panel.__proto__[Gi.hook_up_vfunc_symbol]('allocate', this.panel.__proto__.vfunc_allocate);
}
this.panel._leftBox.allocate = this.panel._leftBox.oldLeftBoxAllocate;
@@ -852,4 +850,4 @@ var dtpSecondaryAggregateMenu = new Lang.Class({
menuLayout.addSizeChild(this._power.menu.actor);
menuLayout.addSizeChild(this._system.menu.actor);
},
});
});

View File

@@ -35,6 +35,8 @@ const Taskbar = Me.imports.taskbar;
const Utils = Me.imports.utils;
const BoxPointer = imports.ui.boxpointer;
const Clutter = imports.gi.Clutter;
const Dash = imports.ui.dash;
const Gi = imports._gi;
const IconGrid = imports.ui.iconGrid;
const Main = imports.ui.main;
@@ -137,6 +139,17 @@ var dtpPanelManager = new Lang.Class({
this._oldGetShowAppsButton = Main.overview.getShowAppsButton;
Main.overview.getShowAppsButton = this._newGetShowAppsButton.bind(this);
if (Dash.DashItemContainer.prototype.vfunc_allocate) {
Dash.DashItemContainer.prototype[Gi.hook_up_vfunc_symbol]('allocate', this._newDashItemContainerAllocate);
Dash.ShowAppsIcon.prototype[Gi.hook_up_vfunc_symbol]('allocate', function(box, flags) { St.Widget.prototype.vfunc_allocate.call(this, box, flags); });
}
this._needsIconAllocate = new IconGrid.BaseIcon('') instanceof St.Bin;
if (this._needsIconAllocate) {
IconGrid.BaseIcon.prototype[Gi.hook_up_vfunc_symbol]('allocate', this._newBaseIconAllocate);
}
// Since Gnome 3.8 dragging an app without having opened the overview before cause the attemp to
//animate a null target since some variables are not initialized when the viewSelector is created
if(Main.overview.viewSelector._activePage == null)
@@ -227,6 +240,15 @@ var dtpPanelManager = new Lang.Class({
Main.layoutManager.panelBox.set_position(Main.layoutManager.primaryMonitor.x, Main.layoutManager.primaryMonitor.y);
Main.layoutManager.panelBox.set_size(Main.layoutManager.primaryMonitor.width, -1);
if (Dash.DashItemContainer.prototype.vfunc_allocate) {
Dash.DashItemContainer.prototype[Gi.hook_up_vfunc_symbol]('allocate', Dash.DashItemContainer.prototype.vfunc_allocate);
Dash.ShowAppsIcon.prototype[Gi.hook_up_vfunc_symbol]('allocate', Dash.ShowAppsIcon.prototype.vfunc_allocate);
}
if (this._needsIconAllocate) {
IconGrid.BaseIcon.prototype[Gi.hook_up_vfunc_symbol]('allocate', IconGrid.BaseIcon.prototype.vfunc_allocate);
}
},
setFocusedMonitor: function(monitor, ignoreRelayout) {
@@ -370,6 +392,45 @@ var dtpPanelManager = new Lang.Class({
let focusedMonitorIndex = Taskbar.findIndex(this.allPanels, p => this.checkIfFocusedMonitor(p.monitor));
return this.allPanels[focusedMonitorIndex].taskbar.showAppsButton;
},
_newDashItemContainerAllocate: function(box, flags) {
if (this.child == null)
return;
this.set_allocation(box, flags);
let availWidth = box.x2 - box.x1;
let availHeight = box.y2 - box.y1;
let [minChildWidth, minChildHeight, natChildWidth, natChildHeight] = this.child.get_preferred_size();
let [childScaleX, childScaleY] = this.child.get_scale();
let childWidth = Math.min(natChildWidth * childScaleX, availWidth);
let childHeight = Math.min(natChildHeight * childScaleY, availHeight);
let childBox = new Clutter.ActorBox();
childBox.x1 = (availWidth - childWidth) / 2;
childBox.y1 = (availHeight - childHeight) / 2;
childBox.x2 = childBox.x1 + childWidth;
childBox.y2 = childBox.y1 + childHeight;
this.child.allocate(childBox, flags);
},
_newBaseIconAllocate: function(box, flags) {
this.set_allocation(box, flags);
let contentBox = this.get_theme_node().get_content_box(box);
let [iconMinHeight, iconNatHeight] = this._iconBin.get_preferred_height(-1);
let [iconMinWidth, iconNatWidth] = this._iconBin.get_preferred_width(-1);
let childBox = new Clutter.ActorBox();
childBox.x1 = (contentBox.x2 - contentBox.x1 - iconNatWidth) * .5;
childBox.x2 = contentBox.x1 + iconNatWidth;
childBox.y1 = (contentBox.y2 - contentBox.y1 - iconNatHeight) * .5;
childBox.y2 = contentBox.y1 + iconNatHeight;
this._iconBin.allocate(childBox, flags);
}
});
@@ -516,4 +577,4 @@ function newUpdatePanelBarrier(panel, dtpSettings) {
x2: barriers[k][1], y2: y2,
directions: barriers[k][2] });
});
}
}

View File

@@ -21,24 +21,25 @@
* Some code was also adapted from the upstream Gnome Shell source code.
*/
#dashtopanelScrollview .app-well-app .overview-icon {
border-radius: 0;
#dashtopanelScrollview .app-well-app .overview-icon,
#dashtopanelTaskbar .show-apps .overview-icon {
border: none;
margin: 0;
padding: 0;
}
#dashtopanelScrollview .app-well-app #dtp-icon-container {
#dashtopanelScrollview .app-well-app .dtp-icon-container {
padding: 0 4px;
}
#dashtopanelTaskbar .show-apps {
padding: 0 8px;
}
#dashtopanelScrollview .app-well-app .overview-label {
padding-right: 8px;
}
#show-apps-btn, #show-apps-btn .overview-icon {
margin: 0px;
padding: 0px;
}
#dashtopanelThumbnailScrollview {
-st-hfade-offset: 48px;
}
@@ -48,8 +49,8 @@
background: none;
}
#dashtopanelScrollview .app-well-app:hover > :first-child,
#dashtopanelScrollview .app-well-app:focus > :first-child {
#dashtopanelScrollview .app-well-app:hover .dtp-container,
#dashtopanelScrollview .app-well-app:focus .dtp-container {
background-color: rgba(238, 238, 236, 0.1);
}
@@ -118,4 +119,4 @@
background-color: rgba(0,0,0,0.8);
color: rgba(256, 256, 256, 1);
text-align: center;
}
}

View File

@@ -232,6 +232,11 @@ var taskbar = new Lang.Class({
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
}));
if (!this._dtpSettings.get_boolean('show-show-apps-button'))
this.hideShowAppsButton();
@@ -728,7 +733,6 @@ var taskbar = new Lang.Class({
// Getting the panel height and making sure that the icon padding is at
// least the size of the app running indicator on both the top and bottom.
let availSize = (this.panelWrapper.panel.actor.get_height() -
(this._dtpSettings.get_int('dot-size') * scaleFactor * 2) -
(this._dtpSettings.get_int('appicon-padding') * 2)) / scaleFactor;
if (availSize == this.iconSize)