Update to Gnome 40 (#1303)

* 1

* renamed ui.viewSelector to ui.searchController

* add arrowIcon null check

* add object null check

* add _showAppsButton null check

* fixed _workspacesDisplay

* removed shadow-type properties

* removed packing from ui

* renamed margin_left/right to margin_start/end

* renamed GtkRadioButton to GtkToggleButton, removed draw_indicator and image_position

* removed xalign from buttons, stock -> icon_name, GtkFileChooserButton -> BtkButton (todo connect a GtkFileChooserNative), removed format-value (todo connect GtkScaleFormatValueFunc callback)

* removed events, relief

* comment arrowIcon.set_icon_name and _hbox.get_last_child out

* called gtk4-builder-tool simplify --3to4 on Settings.ui

* fix _workspaceDisplay

* revert Settings.ui back to old gtk3 version

* removed _builder.connect_signals_full and added a BuilderScope instead, use class specific add functions, removed show_all for widgets, updated margins* for GtkGrid

* add try catch aroung object.connect

* fixed _searchEntry path

* disabled _newUpdateWorkspacesViews temporarily, because it is very buggy right now

* fixed _searchEntry path (this time for real?)

* dialog.show_all() -> dialog.show(), widget.get_toplevel() -> widget.get_root(), fixed adjustScrollableHeight (no longer crashes, still does not work correctly)

* updated GtkGrid.attach calls

* added Gtk.FileChooserNative for show_applications_icon_file_filebutton

* added packing again to ui (commented) and also added layout row/column/width/height in exchange for top_attach/left_attach/colspan/rowspan

* renamed colspan/rowspan to column-span/row-span

* removed all packaing left_attach/top_attach

* updated adjustScrollableHeight so the dialog will have a reasonable size again

* limit shell-version to 40 since it is not backwards compatible right now

* called _updateBackgrounds in layoutManager ,fixed overview <-> _overview typo?

* pass Settings instead of Settings._settings to BuilderScope

* workaround for showAppsIcon (_showAppsButton seems to be no longer be available)

* replaced newlines in the ui file with the newline unicode symbol, so code block collapsing works peroperly

* moved the scrolled window directly into each notebook tab, so the tab headers are always visible

* fixed taskbarListBox children loops

* commented non working elements out (panel on left/right, import/export settings, update)

* renamed Settings to Preferences to avoid confusion with dconf settings object

* updated this.widget to this.notebook

* fixed dialogs size and expand

* fixed window preview options having too many columns

* removed all packing with expand/fill/position (already uncommented)

* removed menu arrows since they are no longer recommended for gnome40

* removed adjustScrollableHeight, default sizes are acceptable

* updated ui required version to gtk 4.0

* updated path to dash.showAppsButton

* fixes for showAppsButton

* fixed clickToExit

* fixed import/export settings

* added disable show overview on startup option

* removed old show apps animation

* fixed panel on left/right side

* fixed scroll on volume icon

no longer will scrolling on the volume icon switch workspaces as well

* commented some setFocusedMonitor support out, caused issues on Xorg

* removed oldDash

* updated hide overview on startup, no longer closes overview after suspend etc

* removed _newOverviewRelayout

* removed _newUpdateWorkspacesViews

* commented setFocusedMonitor out completly, because show overview on non primary monitor does not work properly for now

* fixed typo

* fixed merging error

* check if func is valid in hookVfunc

* updated ui to gtk4, fixed merging error

* fixed layout for apply changes to all monitors

* fix behaviour tab and app icon margin/padding grid

* fix animate launching new windows grid row

* fixed about tab

Co-authored-by: Cole Gerdemann <corvettecole@gmail.com>
This commit is contained in:
Philipp
2021-05-08 15:07:25 +02:00
committed by GitHub
parent 925f5b27b3
commit a4224f4acc
10 changed files with 3807 additions and 4741 deletions

View File

@@ -76,6 +76,8 @@ var dtpPanelManager = Utils.defineClass({
this.dtpPrimaryMonitor = Main.layoutManager.monitors[dtpPrimaryIndex] || Main.layoutManager.primaryMonitor;
this.proximityManager = new Proximity.ProximityManager();
this._oldGetShowAppsButton = imports.ui.main.overview.dash.showAppsButton;
Utils.wrapActor(Main.panel);
Utils.wrapActor(Main.overview.dash || 0);
@@ -129,11 +131,6 @@ var dtpPanelManager = Utils.defineClass({
if (reset) return;
this._oldViewSelectorAnimateIn = Main.overview.viewSelector._animateIn;
Main.overview.viewSelector._animateIn = Lang.bind(this.primaryPanel, newViewSelectorAnimateIn);
this._oldViewSelectorAnimateOut = Main.overview.viewSelector._animateOut;
Main.overview.viewSelector._animateOut = Lang.bind(this.primaryPanel, newViewSelectorAnimateOut);
if (Config.PACKAGE_VERSION > '3.35.1') {
this._oldDoSpringAnimation = AppDisplay.BaseAppView.prototype._doSpringAnimation;
AppDisplay.BaseAppView.prototype._doSpringAnimation = newDoSpringAnimation;
@@ -157,20 +154,13 @@ var dtpPanelManager = Utils.defineClass({
this._enableHotCornersId = Main.layoutManager._interfaceSettings.connect('changed::enable-hot-corners', () => Main.layoutManager._updateHotCorners());
}
this._oldOverviewRelayout = Main.overview._relayout;
Main.overview._relayout = Lang.bind(Main.overview, this._newOverviewRelayout);
this._oldUpdateWorkspacesViews = Main.overview.viewSelector._workspacesDisplay._updateWorkspacesViews;
Main.overview.viewSelector._workspacesDisplay._updateWorkspacesViews = Lang.bind(Main.overview.viewSelector._workspacesDisplay, this._newUpdateWorkspacesViews);
this._oldGetShowAppsButton = Main.overview.getShowAppsButton;
Main.overview.getShowAppsButton = this._newGetShowAppsButton.bind(this);
// 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)
Main.overview.viewSelector._activePage = Main.overview.viewSelector._workspacesPage;
this._needsDashItemContainerAllocate = !Dash.DashItemContainer.prototype.hasOwnProperty('vfunc_allocate');
if (this._needsDashItemContainerAllocate) {
Utils.hookVfunc(Dash.DashItemContainer.prototype, 'allocate', this._newDashItemContainerAllocate);
}
LookingGlass.LookingGlass.prototype._oldResize = LookingGlass.LookingGlass.prototype._resize;
LookingGlass.LookingGlass.prototype._resize = _newLookingGlassResize;
@@ -340,14 +330,6 @@ var dtpPanelManager = Utils.defineClass({
Main.layoutManager._updatePanelBarrier = this._oldUpdatePanelBarrier;
Main.layoutManager._updatePanelBarrier();
Main.overview.viewSelector._animateIn = this._oldViewSelectorAnimateIn;
Main.overview.viewSelector._animateOut = this._oldViewSelectorAnimateOut;
Main.overview._relayout = this._oldOverviewRelayout;
Main.overview._relayout();
Main.overview.viewSelector._workspacesDisplay._updateWorkspacesViews = this._oldUpdateWorkspacesViews;
Utils.getPanelGhost().set_size(-1, -1);
if (this._oldDoSpringAnimation) {
@@ -366,18 +348,16 @@ var dtpPanelManager = Utils.defineClass({
},
setFocusedMonitor: function(monitor, ignoreRelayout) {
this._needsIconAllocate = 1;
if (!this.checkIfFocusedMonitor(monitor)) {
Main.overview.viewSelector._workspacesDisplay._primaryIndex = monitor.index;
Main.overview._overview.clear_constraints();
Main.overview._overview.add_constraint(new Layout.MonitorConstraint({ index: monitor.index }));
if (ignoreRelayout) return;
// todo show overview on non primary monitor is not working right now on gnome40
this._newOverviewRelayout.call(Main.overview);
}
// this._needsIconAllocate = 1;
// if (!this.checkIfFocusedMonitor(monitor)) {
// Main.overview._overview._controls._workspacesDisplay._primaryIndex = monitor.index;
// Main.overview._overview.clear_constraints();
// Main.overview._overview.add_constraint(new Layout.MonitorConstraint({ index: monitor.index }));
// }
},
_saveMonitors: function() {
@@ -393,7 +373,7 @@ var dtpPanelManager = Utils.defineClass({
},
checkIfFocusedMonitor: function(monitor) {
return Main.overview.viewSelector._workspacesDisplay._primaryIndex == monitor.index;
return Main.overview._overview._controls._workspacesDisplay._primaryIndex == monitor.index;
},
_createPanel: function(monitor, isStandalone) {
@@ -511,66 +491,6 @@ var dtpPanelManager = Utils.defineClass({
});
},
_newOverviewRelayout: function() {
// To avoid updating the position and size of the workspaces
// we just hide the overview. The positions will be updated
// when it is next shown.
this.hide();
let workArea = Main.layoutManager.getWorkAreaForMonitor(Main.overview.viewSelector._workspacesDisplay._primaryIndex);
this._coverPane.set_position(0, workArea.y);
this._coverPane.set_size(workArea.width, workArea.height);
this._updateBackgrounds();
},
_newUpdateWorkspacesViews: function() {
for (let i = 0; i < this._workspacesViews.length; i++)
this._workspacesViews[i].destroy();
this._workspacesViews = [];
let monitors = Main.layoutManager.monitors;
for (let i = 0; i < monitors.length; i++) {
let workspaces;
let view;
if (this._workspacesOnlyOnPrimary && i != Main.layoutManager.primaryIndex) {
view = new WorkspacesView.ExtraWorkspaceView(i);
view.getActiveWorkspace = view.getActiveWorkspace || function() { return this._workspace; };
workspaces = [view._workspace];
} else {
view = new WorkspacesView.WorkspacesView(i, this._scrollAdjustment || 0);
workspaces = view._workspaces;
}
Utils.wrapActor(view);
view.actor.connect('scroll-event', this._onScrollEvent.bind(this));
if (i == Main.layoutManager.primaryIndex && view.scrollAdjustment) {
this._scrollAdjustment = view.scrollAdjustment;
this._scrollAdjustment.connect('notify::value',
this._scrollValueChanged.bind(this));
}
workspaces.forEach(w => w.setFullGeometry = geom => w._fullGeometry = geom);
this._workspacesViews.push(view);
}
this._workspacesViews.forEach(wv => Main.layoutManager.overviewGroup.add_actor(wv.actor));
if (this._syncWorkspacesFullGeometry) {
//gnome-shell 3.36.4
if (this._fullGeometry)
this._syncWorkspacesFullGeometry();
if (this._actualGeometry)
this._syncWorkspacesActualGeometry();
} else if (this._updateWorkspacesFullGeometry) {
this._updateWorkspacesFullGeometry();
this._updateWorkspacesActualGeometry();
}
},
_newGetShowAppsButton: function() {
let focusedMonitorIndex = Utils.findIndex(this.allPanels, p => this.checkIfFocusedMonitor(p.monitor));
@@ -661,47 +581,6 @@ var IconAnimator = Utils.defineClass({
}
});
function newViewSelectorAnimateIn(oldPage) {
if (oldPage)
oldPage.hide();
let vs = Main.overview.viewSelector;
vs.emit('page-empty');
vs._activePage.show();
if (vs._activePage == vs._appsPage && oldPage == vs._workspacesPage) {
// Restore opacity, in case we animated via _fadePageOut
vs._activePage.opacity = 255;
let animate = Me.settings.get_boolean('animate-show-apps');
if(animate)
vs.appDisplay.animate(IconGrid.AnimationDirection.IN);
} else {
vs._fadePageIn();
}
}
function newViewSelectorAnimateOut(page) {
let oldPage = page;
let vs = Main.overview.viewSelector;
if (page == vs._appsPage &&
vs._activePage == vs._workspacesPage &&
!Main.overview.animationInProgress) {
let animate = Me.settings.get_boolean('animate-show-apps');
if(animate)
vs.appDisplay.animate(IconGrid.AnimationDirection.OUT, Lang.bind(this,
function() {
vs._animateIn(oldPage)
}));
else
vs._animateIn(oldPage)
} else {
vs._fadePageOut(page);
}
}
function newGetPositionForDirection(direction, fromWs, toWs) {
let [xDest, yDest] = WM.WindowManager.prototype._getPositionForDirection(direction, fromWs, toWs);