[gnome-shell/gnome-40] workspaceAnimation: Get time outside of the animation-complete callback
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gnome-40] workspaceAnimation: Get time outside of the animation-complete callback
- Date: Sun, 20 Mar 2022 20:21:41 +0000 (UTC)
commit e008e7d25ccaecf19ff84b63a1e9e88df374ae6f
Author: Jonas Dreßler <verdre v0yd nl>
Date: Mon Mar 7 15:34:25 2022 +0100
workspaceAnimation: Get time outside of the animation-complete callback
We want to use the current event time for activating the workspace, and
this time is only available when calling global.get_current_time() or
Clutter.get_current_event_time() from the context of an event handler.
So instead of trying to get that time when the animation has finished
from the onComplete() handler, get it before and store it as a variable
to use in the onComplete() handler later.
This fixes an error message when switching workspaces using the swipe
gesture where MetaWorkspace complains about the 0-timestamp we pass it.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2233>
(cherry picked from commit aa9edc37a57e5267237c7c998d035eb2042e43eb)
js/ui/workspaceAnimation.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/workspaceAnimation.js b/js/ui/workspaceAnimation.js
index 1731e40276..55e20678a6 100644
--- a/js/ui/workspaceAnimation.js
+++ b/js/ui/workspaceAnimation.js
@@ -453,6 +453,7 @@ var WorkspaceAnimationController = class {
switchData.gestureActivated = true;
const newWs = switchData.baseMonitorGroup.findClosestWorkspace(endProgress);
+ const endTime = Clutter.get_current_event_time();
for (const monitorGroup of this._switchData.monitors) {
const progress = monitorGroup.getWorkspaceProgress(newWs);
@@ -465,7 +466,7 @@ var WorkspaceAnimationController = class {
if (monitorGroup.index === Main.layoutManager.primaryIndex) {
params.onComplete = () => {
if (!newWs.active)
- newWs.activate(global.get_current_time());
+ newWs.activate(endTime);
this._finishWorkspaceSwitch(switchData);
};
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]