Add initial 3.38 adjustments

This commit is contained in:
Charles Gagnon
2020-08-22 10:18:31 -04:00
parent 7d1c4584bb
commit 094e70325b
8 changed files with 105 additions and 61 deletions

View File

@@ -421,6 +421,7 @@ var dtpOverview = Utils.defineClass({
if (this._clickToExitEnabled)
return;
let views = Utils.getAppDisplayViews();
this._oldOverviewReactive = Main.overview._overview.reactive
Main.overview._overview.reactive = true;
@@ -438,15 +439,15 @@ var dtpOverview = Utils.defineClass({
if (activePage == ViewSelector.ViewPage.APPS) {
if(pickedActor != Main.overview._overview
&& pickedActor != Main.overview.viewSelector.appDisplay._controls.get_parent()
&& pickedActor != (Main.overview.viewSelector.appDisplay._views[0].view.actor || Main.overview.viewSelector.appDisplay._views[0].view)
&& pickedActor != Main.overview.viewSelector.appDisplay._views[1].view._scrollView
&& pickedActor != Main.overview.viewSelector.appDisplay._views[1].view._grid) {
&& (views.length > 1 && pickedActor != Main.overview.viewSelector.appDisplay._controls.get_parent())
&& pickedActor != (views[0].view.actor || views[0].view)
&& (views.length > 1 && pickedActor != views[1].view._scrollView)
&& (views.length > 1 && pickedActor != views[1].view._grid)) {
return Clutter.EVENT_PROPAGATE;
}
let visibleView;
Main.overview.viewSelector.appDisplay._views.every(function(v, index) {
views.every(function(v, index) {
if (v.view.actor.visible) {
visibleView = index;
return false;
@@ -456,7 +457,7 @@ var dtpOverview = Utils.defineClass({
});
if(Me.settings.get_boolean('animate-show-apps')) {
let view = Main.overview.viewSelector.appDisplay._views[visibleView].view;
let view = views[visibleView].view;
view.animate(IconGrid.AnimationDirection.OUT, Lang.bind(this, function() {
Main.overview.viewSelector._appsPage.hide();
Main.overview.hide();
@@ -478,11 +479,7 @@ var dtpOverview = Utils.defineClass({
});
Main.overview._overview.add_action(this._clickAction);
[
Main.overview.viewSelector._workspacesDisplay,
Main.overview.viewSelector.appDisplay._views[0].view,
Main.overview.viewSelector.appDisplay._views[1].view
].forEach(v => {
[Main.overview.viewSelector._workspacesDisplay].concat(views).forEach(v => {
if (v._swipeTracker) {
this._signalsHandler.addWithLabel('clickToExit', [
v._swipeTracker,

View File

@@ -221,18 +221,13 @@ var dtpPanel = Utils.defineClass({
opacity: 0
});
if (this.geom.position == St.Side.TOP) {
let isTop = this.geom.position == St.Side.TOP;
let cornerFunc = (isTop ? 'add' : 'remove') + '_child';
if (isTop) {
this.panel._leftCorner = this.panel._leftCorner || new Panel.PanelCorner(St.Side.LEFT);
this.panel._rightCorner = this.panel._rightCorner || new Panel.PanelCorner(St.Side.RIGHT);
Utils.wrapActor(this.panel._leftCorner || 0);
Utils.wrapActor(this.panel._rightCorner || 0);
if (this.isStandalone) {
this.panel.actor.add_child(this.panel._leftCorner.actor);
this.panel.actor.add_child(this.panel._rightCorner.actor);
}
Main.overview._overview.insert_child_at_index(this._myPanelGhost, 0);
} else {
let overviewControls = Main.overview._overview._controls || Main.overview._controls;
@@ -246,6 +241,14 @@ var dtpPanel = Utils.defineClass({
}
}
if (this.panel._leftCorner) {
Utils.wrapActor(this.panel._leftCorner);
Utils.wrapActor(this.panel._rightCorner);
this.panel.actor[cornerFunc](this.panel._leftCorner.actor);
this.panel.actor[cornerFunc](this.panel._rightCorner.actor);
}
this._setPanelPosition();
if (!this.isStandalone) {
@@ -278,7 +281,7 @@ var dtpPanel = Utils.defineClass({
panelBoxes.forEach(b => {
this[b].allocate = (box, flags, isFromDashToPanel) => {
if (isFromDashToPanel) {
this[b].__proto__.allocate.call(this[b], box, flags);
Utils.allocate(this[b], box, flags, true);
}
}
});
@@ -482,6 +485,9 @@ var dtpPanel = Utils.defineClass({
}
}
this.panel.actor.add_child(this.panel._leftCorner.actor);
this.panel.actor.add_child(this.panel._rightCorner.actor);
this._setShowDesktopButton(false);
delete Utils.getIndicators(this.statusArea.aggregateMenu._volume)._dtpIgnoreScroll;
@@ -871,11 +877,11 @@ var dtpPanel = Utils.defineClass({
},
_mainPanelAllocate: function(actor, box, flags) {
this.panel.actor.set_allocation(box, flags);
Utils.setAllocation(this.panel.actor, box, flags);
},
vfunc_allocate: function(box, flags) {
this.set_allocation(box, flags);
Utils.setAllocation(this, box, flags);
let fixed = 0;
let centeredMonitorGroup;
@@ -957,16 +963,16 @@ var dtpPanel = Utils.defineClass({
currentPosition = group.tlOffset + startPosition;
group.elements.forEach(element => {
let params = [element.box, flags];
let extraParams = [];
element.box[this.varCoord.c1] = Math.round(currentPosition);
element.box[this.varCoord.c2] = Math.round((currentPosition += element.natSize));
if (element.isBox) {
params.push(1);
extraParams.push(1);
}
element.actor.allocate.apply(element.actor, params);
Utils.allocate(element.actor, element.box, flags, false, extraParams);
});
group[this.varCoord.c1] = startPosition;
@@ -975,7 +981,7 @@ var dtpPanel = Utils.defineClass({
++fixed;
};
this.panel.actor.allocate(panelAlloc, flags);
Utils.allocate(this.panel.actor, panelAlloc, flags);
this._elementGroups.forEach(group => {
group.fixed = 0;
@@ -1034,8 +1040,8 @@ var dtpPanel = Utils.defineClass({
childBoxRightCorner[this.fixedCoord.c1] = panelAllocFixedSize;
childBoxRightCorner[this.fixedCoord.c2] = panelAllocFixedSize + this.cornerSize;
this.panel._leftCorner.actor.allocate(childBoxLeftCorner, flags);
this.panel._rightCorner.actor.allocate(childBoxRightCorner, flags);
Utils.allocate(this.panel._leftCorner.actor, childBoxLeftCorner, flags);
Utils.allocate(this.panel._rightCorner.actor, childBoxRightCorner, flags);
if (this.cornerSize != currentCornerSize) {
this._setPanelClip();
@@ -1255,8 +1261,8 @@ var dtpPanel = Utils.defineClass({
this._showDesktopButton = new St.Bin({ style_class: 'showdesktop-button',
reactive: true,
can_focus: true,
x_fill: true,
y_fill: true,
// x_fill: true,
// y_fill: true,
track_hover: true });
this._setShowDesktopButtonStyle();
@@ -1439,7 +1445,7 @@ var dtpSecondaryPanel = Utils.defineClass({
},
vfunc_allocate: function(box, flags) {
this.set_allocation(box, flags);
Utils.setAllocation(this, box, flags);
}
});

View File

@@ -64,7 +64,7 @@ var dtpPanelManager = Utils.defineClass({
this._saveMonitors();
Main.overview.viewSelector.appDisplay._views.forEach(v => {
Utils.getAppDisplayViews().forEach(v => {
Utils.wrapActor(v.view);
Utils.wrapActor(v.view._grid);
});
@@ -198,20 +198,25 @@ var dtpPanelManager = Utils.defineClass({
]
);
Main.overview.viewSelector.appDisplay._views.forEach(v => {
if (v.control.has_style_pseudo_class('checked')) {
Utils.getAppDisplayViews().forEach(v => {
if (!v.control || v.control.has_style_pseudo_class('checked')) {
currentAppsView = v;
}
if (v.control) {
this._signalsHandler.add(
[
v.control,
'clicked',
() => {
this._needsIconAllocate = currentAppsView != v;
currentAppsView = v;
}
],
);
}
this._signalsHandler.add(
[
v.control,
'clicked',
() => {
this._needsIconAllocate = currentAppsView != v;
currentAppsView = v;
}
],
[
v.view,
'notify::visible',
@@ -564,7 +569,7 @@ var dtpPanelManager = Utils.defineClass({
this._syncWorkspacesFullGeometry();
if (this._actualGeometry)
this._syncWorkspacesActualGeometry();
} else {
} else if (this._updateWorkspacesFullGeometry) {
this._updateWorkspacesFullGeometry();
this._updateWorkspacesActualGeometry();
}
@@ -580,7 +585,7 @@ var dtpPanelManager = Utils.defineClass({
if (this.child == null)
return;
this.set_allocation(box, flags);
Utils.setAllocation(this, box, flags);
let availWidth = box.x2 - box.x1;
let availHeight = box.y2 - box.y1;
@@ -596,7 +601,7 @@ var dtpPanelManager = Utils.defineClass({
childBox.x2 = childBox.x1 + childWidth;
childBox.y2 = childBox.y1 + childHeight;
this.child.allocate(childBox, flags);
Utils.allocate(this.child, childBox, flags);
},
});
@@ -663,7 +668,7 @@ function newDoSpringAnimation(animationDirection) {
function newAnimateIconPosition(icon, box, flags, nChangedIcons) {
if (this._needsIconAllocate) {
icon.allocate(box, flags);
Utils.allocate(icon, box, flags);
return;
}

View File

@@ -289,7 +289,7 @@ var ProgressIndicator = Utils.defineClass({
this._notificationBadgeBin.hide();
this._source._dtpIconContainer.add_child(this._notificationBadgeBin);
this._source._dtpIconContainer.connect('allocation-changed', this.updateNotificationBadge.bind(this));
this._source._dtpIconContainer.connect('notify::allocation', this.updateNotificationBadge.bind(this));
this._progressManagerEntries = [];
this._progressManager.lookupById(this._source.app.id).forEach(

View File

@@ -46,7 +46,7 @@ var ProximityWatch = Utils.defineClass({
this.threshold = [xThreshold, yThreshold];
this.handler = handler;
this._allocationChangedId = actor.connect('allocation-changed', () => this._update());
this._allocationChangedId = actor.connect('notify::allocation', () => this._update());
this._update();
},
@@ -155,7 +155,7 @@ var ProximityManager = Utils.defineClass({
let focusedWindowInfo = this._getFocusedWindowInfo(focusedWindow);
if (focusedWindowInfo && this._checkIfHandledWindowType(focusedWindowInfo.metaWindow)) {
focusedWindowInfo.allocationId = focusedWindowInfo.window.connect('allocation-changed', () => this._queueUpdate());
focusedWindowInfo.allocationId = focusedWindowInfo.window.connect('notify::allocation', () => this._queueUpdate());
focusedWindowInfo.destroyId = focusedWindowInfo.window.connect('destroy', () => this._disconnectFocusedWindow(true));
this._focusedWindowInfo = focusedWindowInfo;

View File

@@ -85,7 +85,7 @@ var taskbarActor = Utils.defineClass({
},
vfunc_allocate: function(box, flags)  {
this.set_allocation(box, flags);
Utils.setAllocation(this, box, flags);
let panel = this._delegate.dtpPanel;
let availFixedSize = box[panel.fixedCoord.c2] - box[panel.fixedCoord.c1];
@@ -100,7 +100,7 @@ var taskbarActor = Utils.defineClass({
childBox[panel.fixedCoord.c1] = box[panel.fixedCoord.c1];
childBox[panel.fixedCoord.c2] = box[panel.fixedCoord.c2];
scrollview.allocate(childBox, flags);
Utils.allocate(scrollview, childBox, flags);
let [value, , upper, , , pageSize] = scrollview[orientation[0] + 'scroll'].adjustment.get_values();
upper = Math.floor(upper);
@@ -116,11 +116,11 @@ var taskbarActor = Utils.defineClass({
}
childBox[panel.varCoord.c2] = childBox[panel.varCoord.c1] + (value > 0 ? scrollview._dtpFadeSize : 0);
leftFade.allocate(childBox, flags);
Utils.allocate(leftFade, childBox, flags);
childBox[panel.varCoord.c1] = box[panel.varCoord.c2] - (value + pageSize < upper ? scrollview._dtpFadeSize : 0);
childBox[panel.varCoord.c2] = box[panel.varCoord.c2];
rightFade.allocate(childBox, flags);
Utils.allocate(rightFade, childBox, flags);
},
// We want to request the natural size of all our children
@@ -1083,7 +1083,7 @@ var taskbar = Utils.defineClass({
if (selector._showAppsButton.checked !== this.showAppsButton.checked) {
// find visible view
let visibleView;
Main.overview.viewSelector.appDisplay._views.every(function(v, index) {
Utils.getAppDisplayViews().every(function(v, index) {
if (v.view.actor.visible) {
visibleView = index;
return false;
@@ -1110,7 +1110,7 @@ var taskbar = Utils.defineClass({
// runs if we are already inside the overview.
if (!Main.overview._shown) {
this.forcedOverview = true;
let grid = Main.overview.viewSelector.appDisplay._views[visibleView].view._grid;
let grid = Utils.getAppDisplayViews()[visibleView].view._grid;
let onShownCb;
let overviewShownId = Main.overview.connect('shown', () => {
Main.overview.disconnect(overviewShownId);
@@ -1164,7 +1164,7 @@ var taskbar = Utils.defineClass({
// Manually trigger springout animation without activating the
// workspaceView to avoid the zoomout animation. Hide the appPage
// onComplete to avoid ugly flashing of original icons.
let view = Main.overview.viewSelector.appDisplay._views[visibleView].view;
let view = Utils.getAppDisplayViews()[visibleView].view;
view.animate(IconGrid.AnimationDirection.OUT, Lang.bind(this, function() {
Main.overview.viewSelector._appsPage.hide();
Main.overview.hide();

View File

@@ -302,6 +302,11 @@ var getScaleFactor = function() {
return getStageTheme().scale_factor || 1;
};
var getAppDisplayViews = function() {
//gnome-shell 3.38 only has one view and it is now the appDisplay
return Main.overview.viewSelector.appDisplay._views || [{ view: Main.overview.viewSelector.appDisplay }];
};
var findIndex = function(array, predicate) {
if (Array.prototype.findIndex) {
return array.findIndex(predicate);
@@ -353,6 +358,38 @@ var wrapActor = function(actor) {
}
};
var getTransformedAllocation = function(actor) {
if (Config.PACKAGE_VERSION < '3.37') {
return Shell.util_get_transformed_allocation(actor);
}
let extents = actor.get_transformed_extents();
let topLeft = extents.get_top_left();
let bottomRight = extents.get_bottom_right();
return { x1: topLeft.x, x2: bottomRight.x, y1: topLeft.y, y2: bottomRight.y };
};
var allocate = function(actor, box, flags, useParent, extraParams) {
let allocateObj = useParent ? actor.__proto__ : actor;
allocateObj.allocate.apply(actor, getAllocationParams(box, flags).concat(extraParams || []));
};
var setAllocation = function(actor, box, flags) {
actor.set_allocation.apply(actor, getAllocationParams(box, flags));
};
var getAllocationParams = function(box, flags) {
let params = [box];
if (Config.PACKAGE_VERSION < '3.37') {
params.push(flags);
}
return params;
};
var setClip = function(actor, x, y, width, height) {
actor.set_clip(0, 0, width, height);
actor.set_position(x, y);

View File

@@ -24,7 +24,6 @@ const Mainloop = imports.mainloop;
const Meta = imports.gi.Meta;
const PopupMenu = imports.ui.popupMenu;
const Signals = imports.signals;
const Shell = imports.gi.Shell;
const St = imports.gi.St;
const WindowManager = imports.ui.windowManager;
const Workspace = imports.ui.workspace;
@@ -464,7 +463,7 @@ var PreviewMenu = Utils.defineClass({
_updatePosition: function() {
let sourceNode = this.currentAppIcon.actor.get_theme_node();
let sourceContentBox = sourceNode.get_content_box(this.currentAppIcon.actor.get_allocation_box());
let sourceAllocation = Shell.util_get_transformed_allocation(this.currentAppIcon.actor);
let sourceAllocation = Utils.getTransformedAllocation(this.currentAppIcon.actor);
let [previewsWidth, previewsHeight] = this._getPreviewsSize();
let appIconMargin = Me.settings.get_int('appicon-margin') / scaleFactor;
let x = 0, y = 0;
@@ -706,7 +705,7 @@ var Preview = Utils.defineClass({
this._previewDimensions = this._getPreviewDimensions();
this.animatingOut = false;
let box = new St.Widget({ layout_manager: new Clutter.BoxLayout({ vertical: true }), y_expand: true });
let box = new St.Widget({ layout_manager: new Clutter.BoxLayout({ orientation: Clutter.Orientation.VERTICAL }), y_expand: true });
let [previewBinWidth, previewBinHeight] = this._getBinSize();
let closeButton = new St.Button({ style_class: 'window-close', accessible_name: 'Close window' });
@@ -1127,7 +1126,7 @@ var WindowCloneLayout = Utils.defineClass({
height + (this.bufferRect.height - this.frameRect.height) * this.ratio
);
actor.get_first_child().allocate(box, flags);
Utils.allocate(actor.get_first_child(), box, flags);
}
});