[gnome-shell/wip/exalm/dark-2: 35/35] shellDBus: Add ScreenTransition()
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/exalm/dark-2: 35/35] shellDBus: Add ScreenTransition()
- Date: Fri, 11 Feb 2022 16:12:49 +0000 (UTC)
commit e05ab76548bfbb2bc724bf685b04fec81b39b8a2
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Thu Sep 23 12:45:14 2021 +0500
shellDBus: Add ScreenTransition()
Settings will use this when switching between light and dark styles.
data/dbus-interfaces/org.gnome.Shell.xml | 1 +
js/ui/background.js | 5 +++
js/ui/layout.js | 63 ++++++++++++++++++++++++++++++++
js/ui/shellDBus.js | 14 +++++++
4 files changed, 83 insertions(+)
---
diff --git a/data/dbus-interfaces/org.gnome.Shell.xml b/data/dbus-interfaces/org.gnome.Shell.xml
index 38154cbdb9..3ffb5c3742 100644
--- a/data/dbus-interfaces/org.gnome.Shell.xml
+++ b/data/dbus-interfaces/org.gnome.Shell.xml
@@ -35,6 +35,7 @@
<arg type="au" direction="in" name="action"/>
<arg type="b" direction="out" name="success"/>
</method>
+ <method name="ScreenTransition"/>
<signal name="AcceleratorActivated">
<arg name="action" type="u"/>
<arg name="parameters" type="a{sv}"/>
diff --git a/js/ui/background.js b/js/ui/background.js
index 264ac7d704..8db4813264 100644
--- a/js/ui/background.js
+++ b/js/ui/background.js
@@ -733,6 +733,11 @@ var BackgroundManager = class BackgroundManager {
this._newBackgroundActor = null;
this.emit('changed');
+ if (Main.layoutManager.screenTransition.visible) {
+ oldBackgroundActor.destroy();
+ return;
+ }
+
oldBackgroundActor.ease({
opacity: 0,
duration: FADE_ANIMATION_TIME,
diff --git a/js/ui/layout.js b/js/ui/layout.js
index 102bed041e..7b5123dd7a 100644
--- a/js/ui/layout.js
+++ b/js/ui/layout.js
@@ -18,6 +18,9 @@ var BACKGROUND_FADE_ANIMATION_TIME = 1000;
var HOT_CORNER_PRESSURE_THRESHOLD = 100; // pixels
var HOT_CORNER_PRESSURE_TIMEOUT = 1000; // ms
+const SCREEN_TRANSITION_DELAY = 250; // ms
+const SCREEN_TRANSITION_DURATION = 500; // ms
+
function isPopupMetaWindow(actor) {
switch (actor.meta_window.get_window_type()) {
case Meta.WindowType.DROPDOWN_MENU:
@@ -298,6 +301,16 @@ var LayoutManager = GObject.registerClass({
monitorManager.connect('monitors-changed',
this._monitorsChanged.bind(this));
this._monitorsChanged();
+
+ this.screenTransition = new ScreenTransition();
+
+ this.uiGroup.add_child(this.screenTransition);
+ this.uiGroup.set_child_above_sibling(this.screenTransition, null);
+
+ this.screenTransition.add_constraint(new Clutter.BindConstraint({
+ source: this.uiGroup,
+ coordinate: Clutter.BindCoordinate.ALL,
+ }));
}
// This is called by Main after everything else is constructed
@@ -1369,3 +1382,53 @@ var PressureBarrier = class PressureBarrier {
}
};
Signals.addSignalMethods(PressureBarrier.prototype);
+
+var ScreenTransition = GObject.registerClass(
+class ScreenTransition extends Clutter.Actor {
+ _init() {
+ super._init();
+
+ this.hide();
+ }
+
+ run() {
+ if (this.visible)
+ return;
+
+ const rect = new imports.gi.cairo.RectangleInt({
+ x: 0,
+ y: 0,
+ width: global.screen_width,
+ height: global.screen_height,
+ });
+ const [, , , scale] = global.stage.get_capture_final_size(rect);
+ this.content = global.stage.paint_to_content(rect, scale, Clutter.PaintFlag.NO_CURSORS);
+
+ this.show();
+
+ const overviewShowingId = Main.overview.connect('showing', () => {
+ this.remove_transition('opacity');
+ complete();
+ });
+ const overviewHidingId = Main.overview.connect('hiding', () => {
+ this.remove_transition('opacity');
+ complete();
+ });
+
+ const complete = () => {
+ this.hide();
+ this.content = null;
+ this.opacity = 255;
+ Main.overview.disconnect(overviewShowingId);
+ Main.overview.disconnect(overviewHidingId);
+ };
+
+ this.ease({
+ opacity: 0,
+ duration: SCREEN_TRANSITION_DURATION,
+ delay: SCREEN_TRANSITION_DELAY,
+ mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+ onComplete: () => complete(),
+ });
+ }
+});
diff --git a/js/ui/shellDBus.js b/js/ui/shellDBus.js
index 39bba7aa34..18df9b3126 100644
--- a/js/ui/shellDBus.js
+++ b/js/ui/shellDBus.js
@@ -251,6 +251,20 @@ var GnomeShell = class {
invocation.return_value(GLib.Variant.new('(b)', [ungrabSucceeded]));
}
+ ScreenTransitionAsync(params, invocation) {
+ try {
+ this._senderChecker.checkInvocation(invocation);
+ } catch (e) {
+ invocation.return_gerror(e);
+ return;
+ }
+
+ Main.layoutManager.screenTransition.run();
+
+ // We don't want to wait for transition to finish
+ invocation.return_value(null);
+ }
+
_emitAcceleratorActivated(action, device, timestamp) {
let destination = this._grabbedAccelerators.get(action);
if (!destination)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]