Commit Graph

19 Commits

Author SHA1 Message Date
Florian Müllner
213e38c2ef cleanup: Use arrow notation for anonymous functions
Arrow notation is great, use it consistently through-out the code base
to bind `this` to anonymous functions, replacing the more overbose
Lang.bind(this, function() {}).

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
2018-02-21 13:55:00 +00:00
Florian Müllner
76f09b1e49 cleanup: Use method syntax
Modern javascript has a short-hand for function properties, embrace
it for better readability and to prepare for an eventual port to
ES6 classes.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
2018-02-21 13:54:58 +00:00
Florian Müllner
2582d16ca7 Define classes with 'var' instead of 'const'
Any symbols (including class properties) that should be visible
outside the module it's defined in need to be defined as global.
For now gjs still allows the access for 'const', but get rid of
the warnings spill now by changing it.

https://bugzilla.gnome.org/show_bug.cgi?id=785084
2017-07-18 21:52:06 +02:00
Florian Müllner
6edcd82103 tweener: Also consider delay when disabling animations
'time' is not the only timing parameter for tweens, in order to
really disable animations, we need to override 'delay' as well.
2014-08-19 19:46:44 +02:00
Jasper St. Pierre
5bc8a0860a tweener: Remove the onAnimationStart/onAnimationComplete callbacks
Our gnome-shell tweener integration has had hooks to determine when
the tweens have started and completed... except that they had a bug
in them. When a tween completed, it queued an idle handler to run
the callback in. If no tweens were running when the idle was removing,
it reset the tween state that contained the idle handler ID. It also
returned false, meaning that the source would always get removed.

If the actor had a tween in-flight when the idle was fired, it wouldn't
clean up after itself. While this is also a simple bug fix, remove the
callback so we don't queue unnecessary, unused idles.

https://bugzilla.gnome.org/show_bug.cgi?id=711732
2013-11-09 11:44:44 -05:00
Jasper St. Pierre
96e02c4c2e tweener: Look at the XSetting for disabling animations
gnome-settings-daemon will be changed to override the XSetting in
the case where we're on a remote display rather than overwriting a
user setting, so we need to look at the XSetting here.

https://bugzilla.gnome.org/show_bug.cgi?id=694320
2013-02-25 12:59:35 -05:00
Cosimo Cecchi
5f95351074 tweener: follow org.gnome.desktop.interface enable-animations
Disable the animations by making the animation time a very small value.

https://bugzilla.gnome.org/show_bug.cgi?id=655746
2013-02-14 20:42:53 -05:00
Ray Strode
207abe9a2c tweener: make timeline loop indefinitely
Tweener uses a clutter timeline to manage all active animations
running at a given moment.  The timeline is mopped up when no
animations are going any more.

Clutter requires timelines to have a finite duration, but since
animations can happen at any moment, no fixed duration can
accomodate the shell's needs.

To combat this problem, the tweener code picks a relatively
long duration: 1000 seconds. No string of animations should take
that long, so, in theory, that should be good enough.

Unfortunately, this tactic fails, in practice, when the user
suspends their machine, or VT switches.  An animation can take
much longer than 1000 seconds (~16 minutes) to complete in those
cases.  When the user resumes, or VT switches back the timeline
completes immediately (since it's already late) and tweener
never notices that the timeline stops ticking.

This commit changes the tweener timeline to automatically loop
back to 0 after completing, so that despite its fixed duration
property, it effectively never stops. Since the timeline loops,
its concept of elapsed time no longer increases monotonically,
so we now ignore it and track time ourselves with
GLib.get_monotonic_time().

This partially reverts commit
35764fa09e.

https://bugzilla.gnome.org/show_bug.cgi?id=653833
2012-03-18 22:54:51 -04:00
Giovanni Campagna
17c46c2452 Port everything to class framework
The last patch in the sequence. Every place that was previously
setting prototype has been ported to Lang.Class, to make code more
concise and allow for better toString().

https://bugzilla.gnome.org/show_bug.cgi?id=664436
2011-11-24 09:50:04 +01:00
Dan Winship
75b824d032 *.js: Make emacs modelines consistent
js2-mode is no longer developed and we recommend js-mode these days,
so switch the modelines to specify that, and make them consistent
across all files.

https://bugzilla.gnome.org/show_bug.cgi?id=660358
2011-10-11 08:05:12 -04:00
Owen W. Taylor
192d3a94ed tweener: remove tweens when target.actor is destroyed
We already remove tweens automatically when a Clutter actor is destroyed;
do the same when the target is a JS delegate with an actor property.

https://bugzilla.gnome.org/show_bug.cgi?id=642925
2011-02-22 12:36:25 -05:00
Florian Müllner
35764fa09e Move Tweener.slowDownFactor into St
It has probably crossed the line to evil by a mile or so, but here
it is: a Tweener.slowDownFactor replacement used by all animations
without exception.
While at it, update Tweener to use the new setTimeScale() upstream
function instead of adjusting the timeline directly.

https://bugzilla.gnome.org/show_bug.cgi?id=622249
2010-06-21 16:19:25 +02:00
Owen W. Taylor
07cfb8d524 [perf] add tweener.framePrepareStart/Done events
Add events when we start preparing a frame and finish preparing
a frame. (In addition to measuring property-updating overhead, this allows
us to see the interval between finishing preparing a frame and starting
painting the frame, which is the relayout time.)

https://bugzilla.gnome.org/show_bug.cgi?id=619515
2010-05-26 15:37:27 -04:00
Owen W. Taylor
a9a513c621 Add "leisure function" capability
To support scheduling performance-measurement scripts that want to run
a number of actions in series, add shell_global_run_at_leisure() to run
a callback when all work is finished.

The initial implementation of this is not that accurate: we track
business in Tweener.js via new shell_global_begin_work(),
shell_global_end_work() functions, and we also handle the case
where the main loop is continually busy.

https://bugzilla.gnome.org/show_bug.cgi?id=618189
2010-05-20 23:21:44 -04:00
Marina Zhurakhinskaya
703b21cef0 Don't use double quotes for things that don't need to be translated
This is our convention.

The only exceptions are double quotes for words in comments that give
them a special meaning (though beware that these quotes are not truly
necessary most of the time) and double quotes that need to be a part
of the output string.
2010-05-13 16:00:38 -04:00
Dan Winship
8d31c2f4dc change a few stray tabs to spaces 2010-02-02 10:31:38 -05:00
Dan Winship
3e54087e42 Add Tweener.slowDownFactor, initialize from $GNOME_SHELL_SLOWDOWN_FACTOR
This allows for easier debugging of glitchy animations
2009-09-02 09:15:37 -04:00
Owen W. Taylor
2c7d33bad2 Port gnome-shell to the Clutter-1.0 API
- clutter_actor_get_transformed_position()/size() return floats
- clutter_stage_get_actor_at_pos() takes a pick mode
- ClutterTimeline no longer has a concept of frames
- ClutterUnit is now replaced by float
- cogl_texture_new_from_data() signature changed

http://bugzilla.gnome.org/show_bug.cgi?id=585013
2009-06-08 13:49:53 -04:00
Dan Winship
e79c776c2e Add a wrapper around tweener to do some extra integration
Automatically removes tweens on destroyed actors, and provides
additional "animation started/stopped" callbacks (eg, for tracking
whether or not to show window clone titles)
2009-02-10 11:20:39 -05:00