Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Flipper@connerdev] Improve animation and replace some deprecated api's #730

Merged
merged 1 commit into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Flipper@connerdev/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 1.0.4

* Added a fix to make the animation performance better (smoother).
* Replaced usage of deprecated Actor.scale_center_[x/y] with actor.set_pivot_point().

## 1.0.3

* Fix the panels showing up in an incorrect location when animating (or when holing Ctrl+Alt after a workspace switch), but I still see occasional panel painting issues.
Expand Down
50 changes: 32 additions & 18 deletions Flipper@connerdev/files/Flipper@connerdev/5.4/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,10 @@ Flipper.prototype = {
// Allow Cinnamon to play the switcher sound if it's enabled.
Main.soundManager.play('switch');

// This is a workaround for poor animation, we enable it only during the animation
// sequence so users don't need to set it using export CLUTTER_PAINT...
Meta.add_clutter_debug_flags( 0, 1 << 6, 0 ); // CLUTTER_DEBUG_CONTINUOUS_REDRAW

if (direction == this.last_direction) {
if (this.from != null) {
to_workspace = this.get_workspace_clone
Expand Down Expand Up @@ -487,8 +491,9 @@ Flipper.prototype = {
for(let i=0; i<to.workspaceWindowActors.length; ++i) {
let actor = to.workspaceWindowActors[i];
actor.set_opacity(0);
actor.scale_center_x = actor.width / 2;
actor.scale_center_y = actor.height / 2;
//actor.scale_center_x = actor.width / 2;
//actor.scale_center_y = actor.height / 2;
actor.set_pivot_point(0.5, 0.5);
tween.delay = delay;
delay += step;

Expand Down Expand Up @@ -550,8 +555,9 @@ Flipper.prototype = {

for(let i=from.workspaceWindowActors.length-1; i >= 0; --i) {
let actor = from.workspaceWindowActors[i];
actor.scale_center_x = actor.width / 2;
actor.scale_center_y = actor.height / 2;
//actor.scale_center_x = actor.width / 2;
//actor.scale_center_y = actor.height / 2;
actor.set_pivot_point(0.5, 0.5);
tween.delay = delay;
delay += step;

Expand Down Expand Up @@ -607,8 +613,9 @@ Flipper.prototype = {
let to_x = actor.x;

actor.set_opacity(0);
actor.scale_center_x = actor.width / 2;
actor.scale_center_y = actor.height / 2;
//actor.scale_center_x = actor.width / 2;
//actor.scale_center_y = actor.height / 2;
actor.set_pivot_point(0.5, 0.5);
actor.set_scale(settings.pullaway, settings.pullaway);

if (direction == Meta.MotionDirection.LEFT) {
Expand Down Expand Up @@ -668,16 +675,18 @@ Flipper.prototype = {
x_pos = actor.x + this.monitor.width/2;
angle_to = this.const.STACK_ANGLE;

actor.scale_center_x = actor.width / 2;
actor.scale_center_y = actor.height / 2;
//actor.scale_center_x = actor.width / 2;
//actor.scale_center_y = actor.height / 2;
actor.set_pivot_point(0.5, 0.5);
} else {
actor.move_anchor_point(0, 0);
// x_pos = actor.x - this.const.STACK_DISTANCE;
x_pos = actor.x - this.monitor.width/2;
angle_to = -this.const.STACK_ANGLE;

actor.scale_center_x = actor.width / 2;
actor.scale_center_y = actor.height / 2;
//actor.scale_center_x = actor.width / 2;
//actor.scale_center_y = actor.height / 2;
actor.set_pivot_point(0.5, 0.5);
}

let tween = {
Expand Down Expand Up @@ -943,8 +952,9 @@ Flipper.prototype = {
to.raise_top();
from.set_position(0, this.monitor.height/2 );
from.rotation_angle_y = 0;
from.scale_center_y = 0;
from.scale_center_x = this.monitor.width/2;
//from.scale_center_y = 0;
//from.scale_center_x = this.monitor.width/2;
from.set_pivot_point(0.5, 0);

to.set_position(-this.monitor.width, this.monitor.height/2 - this.const.DECK_HEIGHT);
to.rotation_angle_y = -this.const.DECK_ANGLE;
Expand Down Expand Up @@ -983,8 +993,9 @@ Flipper.prototype = {
fromTransition = -this.monitor.width/2;
to.set_opacity(0);
to.set_scale(this.getScale(), this.getScale());
to.scale_center_y = 0;
to.scale_center_x = this.monitor.width/2;
//to.scale_center_y = 0;
//to.scale_center_x = this.monitor.width/2;
to.set_pivot_point(0.5, 0);

Tweener.addTween(to, {
opacity: 255,
Expand Down Expand Up @@ -1169,8 +1180,9 @@ Flipper.prototype = {
let actor = to.workspaceWindowActors[i];
actor.set_opacity(0);
actor.move_anchor_point(0, 1.5 * this.monitor.height);
actor.scale_center_x = actor.width / 2;
actor.scale_center_y = actor.height;
//actor.scale_center_x = actor.width / 2;
//actor.scale_center_y = actor.height;
actor.set_pivot_point(0.5, 1);
// actor.scale_center_x = this.monitor.width / 2;
// actor.scale_center_y = this.monitor.height;
tween.delay = delay;
Expand Down Expand Up @@ -1239,8 +1251,9 @@ Flipper.prototype = {
for(let i=from.workspaceWindowActors.length-1; i >= 0; --i) {
let actor = from.workspaceWindowActors[i];
actor.move_anchor_point(0, 1.5 * this.monitor.height);
actor.scale_center_x = actor.width / 2;
actor.scale_center_y = actor.height;
//actor.scale_center_x = actor.width / 2;
//actor.scale_center_y = actor.height;
actor.set_pivot_point(0.5, 1);
tween.delay = delay;
delay += step;

Expand Down Expand Up @@ -1283,6 +1296,7 @@ Flipper.prototype = {
this.onDestroy();
}
Main.wm.showWorkspaceOSD();
Meta.remove_clutter_debug_flags( 0, 1 << 6, 0 ); // CLUTTER_DEBUG_CONTINUOUS_REDRAW
},

processKeypress: function(action) {
Expand Down
2 changes: 1 addition & 1 deletion Flipper@connerdev/files/Flipper@connerdev/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"5.0",
"5.4"
],
"version": "1.0.3",
"version": "1.0.4",
"url": "https://github.com/ConnerHansen/Flipper",
"uuid": "Flipper@connerdev",
"name": "Flipper",
Expand Down