environment: Mark transitions as "work"

global.run_at_leisure() is used from automated scripts to schedule
a callback when the shell is idle. However since we moved away from
Tweener, animations are no longer taken into account; fix this by
marking transitions as "work" if the convenience ease() functions
are used.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1396
This commit is contained in:
Florian Müllner 2020-08-03 18:33:57 +02:00 committed by Georges Basile Stavracas Neto
parent a436226266
commit cf1d09b482

View File

@ -134,7 +134,14 @@ function _easeActor(actor, params) {
actor.set_easing_mode(params.mode); actor.set_easing_mode(params.mode);
delete params.mode; delete params.mode;
let cleanup = () => Meta.enable_unredirect_for_display(global.display); const prepare = () => {
Meta.disable_unredirect_for_display(global.display);
global.begin_work();
};
const cleanup = () => {
Meta.enable_unredirect_for_display(global.display);
global.end_work();
};
let callback = _makeEaseCallback(params, cleanup); let callback = _makeEaseCallback(params, cleanup);
// cancel overwritten transitions // cancel overwritten transitions
@ -149,9 +156,9 @@ function _easeActor(actor, params) {
.find(t => t !== null); .find(t => t !== null);
if (transition && transition.delay) if (transition && transition.delay)
transition.connect('started', () => Meta.disable_unredirect_for_display(global.display)); transition.connect('started', () => prepare());
else else
Meta.disable_unredirect_for_display(global.display); prepare();
if (transition) { if (transition) {
transition.set({ repeatCount, autoReverse }); transition.set({ repeatCount, autoReverse });
@ -191,7 +198,14 @@ function _easeActorProperty(actor, propName, target, params) {
if (actor instanceof Clutter.Actor && !actor.mapped) if (actor instanceof Clutter.Actor && !actor.mapped)
duration = 0; duration = 0;
let cleanup = () => Meta.enable_unredirect_for_display(global.display); const prepare = () => {
Meta.disable_unredirect_for_display(global.display);
global.begin_work();
};
const cleanup = () => {
Meta.enable_unredirect_for_display(global.display);
global.end_work();
};
let callback = _makeEaseCallback(params, cleanup); let callback = _makeEaseCallback(params, cleanup);
// cancel overwritten transition // cancel overwritten transition
@ -203,7 +217,7 @@ function _easeActorProperty(actor, propName, target, params) {
if (!isReversed) if (!isReversed)
obj[prop] = target; obj[prop] = target;
Meta.disable_unredirect_for_display(global.display); prepare();
callback(true); callback(true);
return; return;
@ -222,9 +236,9 @@ function _easeActorProperty(actor, propName, target, params) {
transition.set_to(target); transition.set_to(target);
if (transition.delay) if (transition.delay)
transition.connect('started', () => Meta.disable_unredirect_for_display(global.display)); transition.connect('started', () => prepare());
else else
Meta.disable_unredirect_for_display(global.display); prepare();
transition.connect('stopped', (t, finished) => callback(finished)); transition.connect('stopped', (t, finished) => callback(finished));
} }