Merge pull request #1584 from philippun1/gjs-71-1

Support for gjs 1.71.1 and gnome-shell 42
This commit is contained in:
Charles Gagnon
2022-03-31 08:33:04 -04:00
committed by GitHub
10 changed files with 91 additions and 61 deletions

View File

@@ -35,6 +35,10 @@ const Mainloop = imports.mainloop;
const Config = imports.misc.config;
const AppDisplay = imports.ui.appDisplay;
const AppMenu = imports.ui.appMenu;
if (Config.PACKAGE_VERSION < '42') {
const AppMenu = imports.ui.appDisplay;
}
const AppFavorites = imports.ui.appFavorites;
const Dash = imports.ui.dash;
const DND = imports.ui.dnd;
@@ -1456,7 +1460,7 @@ function getIconPadding(monitorIndex) {
var taskbarSecondaryMenu = Utils.defineClass({
Name: 'DashToPanel.SecondaryMenu',
Extends: AppDisplay.AppMenu,
Extends: AppMenu.AppMenu,
ParentConstrParams: [[0], [1]],
_init: function(source, side) {

View File

@@ -335,7 +335,7 @@ var Intellihide = Utils.defineClass({
},
_checkIfGrab: function() {
if (GrabHelper._grabHelperStack.some(gh => gh._owner == this._dtpPanel.panel.actor)) {
if (GrabHelper._grabHelperStack && GrabHelper._grabHelperStack.some(gh => gh._owner == this._dtpPanel.panel.actor)) {
//there currently is a grab on a child of the panel, check again soon to catch its release
this._timeoutsHandler.add([T1, CHECK_GRAB_MS, () => this._queueUpdatePanelPosition()]);

View File

@@ -3,7 +3,7 @@
"uuid": "dash-to-panel@jderose9.github.com",
"name": "Dash to Panel",
"description": "An icon taskbar for the Gnome Shell. This extension moves the dash into the gnome main panel so that the application launchers and system tray are combined into a single panel, similar to that found in KDE Plasma and Windows 7+. A separate dock is no longer needed for easy access to running and favorited applications.\n\nFor a more traditional experience, you may also want to use Tweak Tool to enable Windows > Titlebar Buttons > Minimize & Maximize.\n\nFor the best support, please report any issues on Github. Dash-to-panel is developed and maintained by @jderose9 and @charlesg99.",
"shell-version": [ "41" ],
"shell-version": [ "41", "42" ],
"url": "https://github.com/jderose9/dash-to-panel",
"gettext-domain": "dash-to-panel",
"version": 9999

View File

@@ -589,7 +589,11 @@ var dtpOverview = Utils.defineClass({
workAreaBox.set_origin(startX, startY);
workAreaBox.set_size(workArea.width, workArea.height);
params = [workAreaBox, searchHeight, dashHeight, workspaceAppGridBox]
if (Config.PACKAGE_VERSION < '42') {
params = [workAreaBox, searchHeight, dashHeight, workspaceAppGridBox]
} else {
params = [box, workAreaBox, searchHeight, dashHeight, workspaceAppGridBox]
}
} else {
params = [box, startX, searchHeight, dashHeight, workspaceAppGridBox];
}

View File

@@ -204,8 +204,10 @@ var dtpPanel = Utils.defineClass({
let isTop = this.geom.position == St.Side.TOP;
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);
if (Config.PACKAGE_VERSION < '42') {
this.panel._leftCorner = this.panel._leftCorner || new Panel.PanelCorner(St.Side.LEFT);
this.panel._rightCorner = this.panel._rightCorner || new Panel.PanelCorner(St.Side.RIGHT);
}
Main.overview._overview.insert_child_at_index(this._myPanelGhost, 0);
} else {
@@ -213,7 +215,7 @@ var dtpPanel = Utils.defineClass({
Main.overview._overview.add_actor(this._myPanelGhost);
}
if (this.panel._leftCorner) {
if (Config.PACKAGE_VERSION < '42' && this.panel._leftCorner) {
Utils.wrapActor(this.panel._leftCorner);
Utils.wrapActor(this.panel._rightCorner);
@@ -233,7 +235,7 @@ var dtpPanel = Utils.defineClass({
if (!this.isStandalone) {
if (this.panel.vfunc_allocate) {
this._panelConnectId = 0;
Utils.hookVfunc(this.panel.__proto__, 'allocate', (box, flags) => this._mainPanelAllocate(0, box, flags));
Utils.hookVfunc(Object.getPrototypeOf(this.panel), 'allocate', (box, flags) => this._mainPanelAllocate(0, box, flags));
} else {
this._panelConnectId = this.panel.actor.connect('allocate', (actor, box, flags) => this._mainPanelAllocate(actor, box, flags));
}
@@ -442,7 +444,7 @@ var dtpPanel = Utils.defineClass({
});
}
if (!this.panel._leftCorner.actor.mapped) {
if (Config.PACKAGE_VERSION < '42' && !this.panel._leftCorner.actor.mapped) {
this.panel.actor.add_child(this.panel._leftCorner.actor);
this.panel.actor.add_child(this.panel._rightCorner.actor);
}
@@ -459,7 +461,7 @@ var dtpPanel = Utils.defineClass({
if (this._panelConnectId) {
this.panel.actor.disconnect(this._panelConnectId);
} else {
Utils.hookVfunc(this.panel.__proto__, 'allocate', this.panel.__proto__.vfunc_allocate);
Utils.hookVfunc(Object.getPrototypeOf(this.panel), 'allocate', Object.getPrototypeOf(this.panel).vfunc_allocate);
}
this.panel.actor._delegate = this.panel;
@@ -515,7 +517,7 @@ var dtpPanel = Utils.defineClass({
this._disablePanelCornerSignals();
if (this.getPosition() == St.Side.TOP) {
if (Config.PACKAGE_VERSION < '42' && this.getPosition() == St.Side.TOP) {
let visibleElements = panelPositions.filter(pp => pp.visible);
let connectCorner = (corner, button) => {
corner._button = button;
@@ -588,14 +590,16 @@ var dtpPanel = Utils.defineClass({
},
_disablePanelCornerSignals: function() {
if (this.panel._rightCorner && this.panel._rightCorner._buttonStyleChangedSignalId) {
this.panel._rightCorner._button.disconnect(this.panel._rightCorner._buttonStyleChangedSignalId);
delete this.panel._rightCorner._buttonStyleChangedSignalId;
}
if (Config.PACKAGE_VERSION < '42') {
if (this.panel._rightCorner && this.panel._rightCorner._buttonStyleChangedSignalId) {
this.panel._rightCorner._button.disconnect(this.panel._rightCorner._buttonStyleChangedSignalId);
delete this.panel._rightCorner._buttonStyleChangedSignalId;
}
if (this.panel._leftCorner && this.panel._leftCorner._buttonStyleChangedSignalId) {
this.panel._leftCorner._button.disconnect(this.panel._leftCorner._buttonStyleChangedSignalId);
delete this.panel._leftCorner._buttonStyleChangedSignalId;
if (this.panel._leftCorner && this.panel._leftCorner._buttonStyleChangedSignalId) {
this.panel._leftCorner._button.disconnect(this.panel._leftCorner._buttonStyleChangedSignalId);
delete this.panel._leftCorner._buttonStyleChangedSignalId;
}
}
},
@@ -1009,7 +1013,9 @@ var dtpPanel = Utils.defineClass({
let currentCornerSize = this.cornerSize;
let panelAllocFixedSize = box[this.fixedCoord.c2] - box[this.fixedCoord.c1];
[ , this.cornerSize] = this.panel._leftCorner.actor[this.sizeFunc](-1);
if (Config.PACKAGE_VERSION < '42') {
[ , this.cornerSize] = this.panel._leftCorner.actor[this.sizeFunc](-1);
}
childBoxLeftCorner[this.varCoord.c1] = 0;
childBoxLeftCorner[this.varCoord.c2] = this.cornerSize;
childBoxLeftCorner[this.fixedCoord.c1] = panelAllocFixedSize;
@@ -1020,11 +1026,13 @@ var dtpPanel = Utils.defineClass({
childBoxRightCorner[this.fixedCoord.c1] = panelAllocFixedSize;
childBoxRightCorner[this.fixedCoord.c2] = panelAllocFixedSize + this.cornerSize;
Utils.allocate(this.panel._leftCorner.actor, childBoxLeftCorner, flags);
Utils.allocate(this.panel._rightCorner.actor, childBoxRightCorner, flags);
if (Config.PACKAGE_VERSION < '42') {
Utils.allocate(this.panel._leftCorner.actor, childBoxLeftCorner, flags);
Utils.allocate(this.panel._rightCorner.actor, childBoxRightCorner, flags);
if (this.cornerSize != currentCornerSize) {
this._setPanelClip();
if (this.cornerSize != currentCornerSize) {
this._setPanelClip();
}
}
}
},

View File

@@ -682,7 +682,7 @@ function newUpdateHotCorners() {
if (haveTopLeftCorner) {
let corner = new Layout.HotCorner(this, monitor, cornerX, cornerY);
corner.setBarrierSize = size => corner.__proto__.setBarrierSize.call(corner, Math.min(size, 32));
corner.setBarrierSize = size => Object.getPrototypeOf(corner).setBarrierSize.call(corner, Math.min(size, 32));
corner.setBarrierSize(panel ? panel.dtpSize : 32);
this.hotCorners.push(corner);
} else {

View File

@@ -26,8 +26,10 @@ const GLib = imports.gi.GLib;
const GObject = imports.gi.GObject;
const Gtk = imports.gi.Gtk;
const Gdk = imports.gi.Gdk;
const Adw = imports.gi.Adw;
const Lang = imports.lang;
const Mainloop = imports.mainloop;
const Config = imports.misc.config;
const Me = imports.misc.extensionUtils.getCurrentExtension();
const Convenience = Me.imports.convenience;
@@ -2459,6 +2461,16 @@ function init() {
Convenience.initTranslations();
}
function fillPreferencesWindow(window) {
window.set_default_size(680, 740);
let preferences = new Preferences();
let box = new Gtk.Box({orientation: Gtk.Orientation.VERTICAL});
box.append(new Adw.HeaderBar);
box.append(preferences.notebook);
window.set_content(box);
}
function buildPrefsWidget() {
Gtk.Window.list_toplevels()[0].set_default_size(680, 740);

View File

@@ -1232,23 +1232,13 @@ var taskbar = Utils.defineClass({
return Clutter.EVENT_STOP;
}
return this.__proto__._onStageKeyPress.call(this, actor, event);
return Object.getPrototypeOf(this)._onStageKeyPress.call(this, actor, event);
};
}
// force spring animation triggering.By default the animation only
// runs if we are already inside the overview.
// force exiting overview if needed
if (!Main.overview._shown) {
this.forcedOverview = true;
let grid = AppDisplay._grid;
let onShownCb;
let overviewSignal = Config.PACKAGE_VERSION > '3.38.1' ? 'showing' : 'shown';
let overviewShowingId = Main.overview.connect(overviewSignal, () => {
Main.overview.disconnect(overviewShowingId);
onShownCb();
});
onShownCb = () => grid.emit('animation-done');
}
//temporarily use as primary the monitor on which the showapps btn was clicked, this is

View File

@@ -21,6 +21,7 @@ const Lang = imports.lang;
const Main = imports.ui.main;
const Meta = imports.gi.Meta;
const St = imports.gi.St;
const Config = imports.misc.config;
const Me = imports.misc.extensionUtils.getCurrentExtension();
const Panel = Me.imports.panel;
@@ -39,7 +40,7 @@ var DynamicTransparency = Utils.defineClass({
this._initialPanelStyle = dtpPanel.panel.actor.get_style();
if (this._dtpPanel.geom.position == St.Side.TOP) {
if (Config.PACKAGE_VERSION < '42' && this._dtpPanel.geom.position == St.Side.TOP) {
this._initialPanelCornerStyle = dtpPanel.panel._leftCorner.actor.get_style();
}
@@ -57,7 +58,7 @@ var DynamicTransparency = Utils.defineClass({
this._dtpPanel.panel.actor.set_style(this._initialPanelStyle);
if (this._dtpPanel.geom.position == St.Side.TOP) {
if (Config.PACKAGE_VERSION < '42' && this._dtpPanel.geom.position == St.Side.TOP) {
this._dtpPanel.panel._leftCorner.actor.set_style(this._initialPanelCornerStyle);
this._dtpPanel.panel._rightCorner.actor.set_style(this._initialPanelCornerStyle);
}
@@ -218,11 +219,11 @@ var DynamicTransparency = Utils.defineClass({
this.currentBackgroundColor = Utils.getrgbaColor(this.backgroundColorRgb, this.alpha);
let transition = 'transition-duration:' + this.animationDuration;
let cornerStyle = '-panel-corner-background-color: ' + this.currentBackgroundColor + transition;
this._dtpPanel.set_style('background-color: ' + this.currentBackgroundColor + transition + this._complementaryStyles);
if (this._dtpPanel.geom.position == St.Side.TOP) {
if (Config.PACKAGE_VERSION < '42' && this._dtpPanel.geom.position == St.Side.TOP) {
let cornerStyle = '-panel-corner-background-color: ' + this.currentBackgroundColor + transition;
this._dtpPanel.panel._leftCorner.actor.set_style(cornerStyle);
this._dtpPanel.panel._rightCorner.actor.set_style(cornerStyle);
}
@@ -266,4 +267,4 @@ var DynamicTransparency = Utils.defineClass({
return bg;
}
});
});

View File

@@ -80,19 +80,31 @@ var defineClass = function (classDef) {
return parentArgs;
};
let C = eval(
'(class C ' + (needsSuper ? 'extends Object' : '') + ' { ' +
' constructor(...args) { ' +
(needsSuper ? 'super(...getParentArgs(args));' : '') +
(needsSuper || !parentProto ? 'this._init(...args);' : '') +
' }' +
' callParent(...args) { ' +
' let func = args.shift(); ' +
' if (!(func === \'_init\' && needsSuper))' +
' super[func](...args); ' +
' }' +
'})'
);
let C;
if (isGObject) {
C = eval(
'(class C extends GObject.Object { ' +
' callParent(...args) { ' +
' let func = args.shift(); ' +
' super[func](...args); ' +
' }' +
'})'
);
} else {
C = eval(
'(class C ' + (needsSuper ? 'extends Object' : '') + ' { ' +
' constructor(...args) { ' +
(needsSuper ? 'super(...getParentArgs(args));' : '') +
(needsSuper || !parentProto ? 'this._init(...args);' : '') +
' }' +
' callParent(...args) { ' +
' let func = args.shift(); ' +
' if (!(func === \'_init\' && needsSuper))' +
' super[func](...args); ' +
' }' +
'})'
);
}
if (parentProto) {
Object.setPrototypeOf(C.prototype, parentProto);
@@ -346,12 +358,11 @@ var mergeObjects = function(main, bck) {
var hookVfunc = function(proto, symbol, func) {
if (Gi.hook_up_vfunc_symbol && func) {
//gjs > 1.53.3
proto[Gi.hook_up_vfunc_symbol](symbol, func);
} else {
//On older gjs, this is how to hook vfunc. It is buggy and can't be used reliably to replace
//already hooked functions. Since it's our only use for it, disabled for now (and probably forever)
//Gi.hook_up_vfunc(proto, symbol, func);
try {
proto[Gi.gobject_prototype_symbol][Gi.hook_up_vfunc_symbol] (symbol, func);
} catch (e) {
proto[Gi.hook_up_vfunc_symbol] (symbol, func);
}
}
};
@@ -376,7 +387,7 @@ var getTransformedAllocation = function(actor) {
};
var allocate = function(actor, box, flags, useParent) {
let allocateObj = useParent ? actor.__proto__ : actor;
let allocateObj = useParent ? Object.getPrototypeOf(actor) : actor;
allocateObj.allocate.apply(actor, getAllocationParams(box, flags));
};