mirror of
https://github.com/edu4rdshl/gnome-shell.git
synced 2026-07-17 23:24:51 +00:00
Merge branch 'layout-startup-monitor-changes-restart' into 'main'
layout: Ensure startup animation steps are always performed if monitors changes during init Closes #6473 See merge request GNOME/gnome-shell!2763
This commit is contained in:
commit
7ac7c6a4d6
3 changed files with 65 additions and 18 deletions
|
|
@ -527,7 +527,7 @@ const Background = GObject.registerClass({
|
|||
return;
|
||||
}
|
||||
|
||||
this._loadFile(this._file);
|
||||
this._loadFile(this._file).catch(logError);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -521,11 +521,21 @@ export const LayoutManager = GObject.registerClass({
|
|||
}
|
||||
|
||||
_waitLoaded(bgManager) {
|
||||
return new Promise(resolve => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let monitorsChangedId;
|
||||
const id = bgManager.connect('loaded', () => {
|
||||
this.disconnect(monitorsChangedId);
|
||||
bgManager.disconnect(id);
|
||||
resolve();
|
||||
});
|
||||
|
||||
monitorsChangedId = this.connect('monitors-changed', () => {
|
||||
bgManager.disconnect(id);
|
||||
this.disconnect(monitorsChangedId);
|
||||
|
||||
reject(new GLib.Error(Gio.IOErrorEnum,
|
||||
Gio.IOErrorEnum.CANCELLED, 'Loading was cancelled'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -536,7 +546,7 @@ export const LayoutManager = GObject.registerClass({
|
|||
this._bgManagers = [];
|
||||
|
||||
if (Main.sessionMode.isGreeter)
|
||||
return Promise.resolve();
|
||||
return;
|
||||
|
||||
for (let i = 0; i < this.monitors.length; i++) {
|
||||
let bgManager = this._createBackgroundManager(i);
|
||||
|
|
@ -545,8 +555,14 @@ export const LayoutManager = GObject.registerClass({
|
|||
if (i !== this.primaryIndex && this._startingUp)
|
||||
bgManager.backgroundActor.hide();
|
||||
}
|
||||
}
|
||||
|
||||
return Promise.all(this._bgManagers.map(this._waitLoaded));
|
||||
_waitBackgroundsLoaded() {
|
||||
if (this._bgManagers.every(bgManager => bgManager.isLoaded))
|
||||
return Promise.resolve();
|
||||
|
||||
return Promise.all(this._bgManagers.map(bgManager =>
|
||||
this._waitLoaded(bgManager)));
|
||||
}
|
||||
|
||||
_updateKeyboardBox() {
|
||||
|
|
@ -739,22 +755,48 @@ export const LayoutManager = GObject.registerClass({
|
|||
} else {
|
||||
this.keyboardBox.hide();
|
||||
|
||||
let monitor = this.primaryMonitor;
|
||||
const prepareMonitor = monitor => {
|
||||
if (!Main.sessionMode.hasOverview) {
|
||||
const x = monitor.x + monitor.width / 2.0;
|
||||
const y = monitor.y + monitor.height / 2.0;
|
||||
|
||||
if (!Main.sessionMode.hasOverview) {
|
||||
const x = monitor.x + monitor.width / 2.0;
|
||||
const y = monitor.y + monitor.height / 2.0;
|
||||
this.uiGroup.set_pivot_point(
|
||||
x / global.screen_width,
|
||||
y / global.screen_height);
|
||||
this.uiGroup.scale_x = this.uiGroup.scale_y = 0.75;
|
||||
this.uiGroup.opacity = 0;
|
||||
}
|
||||
|
||||
this.uiGroup.set_pivot_point(
|
||||
x / global.screen_width,
|
||||
y / global.screen_height);
|
||||
this.uiGroup.scale_x = this.uiGroup.scale_y = 0.75;
|
||||
this.uiGroup.opacity = 0;
|
||||
global.window_group.set_clip(monitor.x, monitor.y,
|
||||
monitor.width, monitor.height);
|
||||
};
|
||||
|
||||
prepareMonitor(this.primaryMonitor);
|
||||
|
||||
this._startupMonitorsChangedId = this.connect('monitors-changed', () => {
|
||||
this._coverPane.set({
|
||||
width: global.screen_width,
|
||||
height: global.screen_height,
|
||||
});
|
||||
prepareMonitor(this.primaryMonitor);
|
||||
});
|
||||
|
||||
this._updateBackgrounds();
|
||||
|
||||
while (true) {
|
||||
try {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await this._waitBackgroundsLoaded();
|
||||
break;
|
||||
} catch (e) {
|
||||
if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) {
|
||||
logError(e);
|
||||
this.disconnect(this._startupMonitorsChangedId);
|
||||
this._startupMonitorsChangedId = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
global.window_group.set_clip(monitor.x, monitor.y, monitor.width, monitor.height);
|
||||
|
||||
await this._updateBackgrounds();
|
||||
}
|
||||
|
||||
// Hack: Work around grab issue when testing greeter UI in nested
|
||||
|
|
@ -811,6 +853,11 @@ export const LayoutManager = GObject.registerClass({
|
|||
|
||||
this.keyboardBox.show();
|
||||
|
||||
if (this._startupMonitorsChangedId) {
|
||||
this.disconnect(this._startupMonitorsChangedId);
|
||||
this._startupMonitorsChangedId = 0;
|
||||
}
|
||||
|
||||
if (!Main.sessionMode.isGreeter) {
|
||||
this._showSecondaryBackgrounds();
|
||||
global.window_group.remove_clip();
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ class OverviewActor extends St.BoxLayout {
|
|||
}
|
||||
|
||||
runStartupAnimation(callback) {
|
||||
this._controls.runStartupAnimation(callback);
|
||||
this._controls.runStartupAnimation(callback).catch(logError);
|
||||
}
|
||||
|
||||
get dash() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue