Commit Graph

115 Commits

Author SHA1 Message Date
Carlos Garnacho
fdac0602db background: Mark pattern backgrounds as loaded
Otherwise we don't let GNOME Shell startup to proceed. Noticed
by accidentally running on the memory GSettings backend.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1381
2020-07-30 11:48:13 +02:00
Florian Müllner
5c550daecb backgroundManager: Always emit 'loaded' signal
As backgrounds are cached, it is possible that we never emit the
'loaded' signal added in commit f386103bc1. We are relying on the
signal though, so do the same as Background and emit the signal
from an idle if the background was already loaded.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1371
2020-07-22 11:02:24 +00:00
Michael Catanzaro
f386103bc1 Delay login animation until after wallpaper has loaded
Currently, the login animation can occur before the user's wallpaper has
been loaded. When this happens, we wind up displaying a solid blue
background for half a second or so before the proper background is
displayed. This looks jarring and bad. It's great that we can start
GNOME quickly, but starting up before the wallpaper is ready is *too*
quickly.

I've been meaning to fix this since 2014. Better late than never! We can
just have BackgroundManager emit a loaded signal the first time it loads
its first background, and have the startup animation code wait for that
before proceeding.

Some of this code is by Florian, who helped with promisifying. Thanks!

https://bugzilla.gnome.org/show_bug.cgi?id=734996
2020-07-21 20:25:31 -05:00
Daniel van Vugt
75235624b2 background: Use actor.content.background
Because actor.background no longer exists and emitted errors when
referenced.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2949

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1343
2020-07-03 14:41:48 +08:00
Georges Basile Stavracas Neto
1e9b170d87 background: Adapt to MetaBackgroundContent
The properties are now part of MetaBackgroundContent, so set
the properties there instead.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1309
2020-06-09 20:10:52 +00:00
Georges Basile Stavracas Neto
dee738e24f background: Remove noise texture
Use the plain background color.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/2174

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/872
2020-02-10 22:30:52 +00:00
Florian Müllner
66fc5c07bb background: Add exception to no-loop-func rule
Modifying variables from an outer scope in functions created in a loop
is considered problematic by eslint, because the variable value in the
resulting closure is often not what the coder intended.

In this particular case however, the scoping is correct, so add a comment
to disable the rule locally.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/818
2019-11-11 23:51:17 +00:00
Florian Müllner
ebf77748a8 cleanup: Require "dangling" commas
Since ES5, trailing commas in arrays and object literals are valid.
We generally haven't used them so far, but they are actually a good
idea, as they make additions and removals in diffs much cleaner.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/805
2019-11-11 19:25:14 +00:00
Florian Müllner
c860409da5 cleanup: Use object shorthand where possible
ES6 allows to omit property names where they match the name of the
assigned variable, which makes code less redunant and thus cleaner.
We will soon enforce that in our eslint rules, so make sure we use
the shorthand wherever possible.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/805
2019-11-11 19:25:14 +00:00
Florian Müllner
682bd7e97c cleanup: Don't shadow variables
Having variables that share the same name in overlapping scopes is
confusing and error-prone, and is best avoided.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/805
2019-11-11 19:25:14 +00:00
Florian Müllner
67ea424525 cleanup: Avoid unnecessary braces
Our coding style has always been to avoid braces when all blocks
are single-lines.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/805
2019-11-11 19:25:14 +00:00
Marco Trevisan (Treviño)
348e4ac901 background: Inherit Animation from GnomeDesktop.BGSlideShow
Animation background is just wrapping a native GnomeDesktop BGSlideShow
object, so instead of using composition we can now just inherit from the
native GObject, re-using native properties when possible, and avoiding
to keep an extra wrapper to the bg file.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/563
2019-11-08 23:12:47 +00:00
Florian Müllner
1e203f4631 cleanup: Replace deprecated lower/raise calls
Those methods have been deprecated for a long time, so
move to the drop-in replacement.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/808
2019-11-06 09:42:57 +01:00
Marco Trevisan (Treviño)
c4c5c4fd5c cleanup: Use inheritance for Actor classes instead of composition
Remove the `this.actor = ...` and `this.actor._delegate = this` patterns in most
of classes, by inheriting all the actor container classes.

Uses interfaces when needed for making sure that multiple classes will implement
some required methods or to avoid redefining the same code multiple times.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/559
2019-10-16 15:26:13 +00:00
Marco Trevisan (Treviño)
c7e0c7eb79 background: Rename Background 'changed' signal to 'bg-changed'
Meta.Background has already a 'changed' signal and not to confuse the source
signal with the wrapper one, rename the wrapper class signal into 'bg-changed'.

This will be relevant when we'll inherit from Meta.Background, as signal
emissions from the base class could interfere with the wanted derived class
behavior and with the the grouping of successive changes into a single ::change
emission.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/559
2019-10-16 15:26:12 +00:00
Florian Müllner
451f4e3636 cleanup: "Only" use two indentation styles for object literals
We currently use no less than three different ways of indenting
object literals:

    let obj1 = {
        foo: 42,
        bar: 23,
    };

    let obj2 = { foo: 42,
                 bar: 23 };

    let obj3 = { foo: 42,
                 bar: 23
               };

The first is the one we want to use everywhere eventually, while the
second is the most commonly used "legacy" style.

It is the third one that is most problematic, as it throws off eslint
fairly badly: It violates both the rule to have consistent line breaks
in braces as well as the indentation style of both regular and legacy
configurations.

Fortunately the third style was mostly used for tween parameters, so
is quite rare after the Tweener purge. Get rid of the remaining ones
to cut down on pre-existing eslint errors.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/716
2019-09-12 23:18:24 +02:00
Florian Müllner
0846238f69 js: Use implicit animations for animatable properties
We now have everything in place to replace Tweener for all animatable
properties with implicit animations, which has the following benefits:

 - they run entirely in C, while Tweener requires context switches
   to JS each frame

 - they are more reliable, as Tweener only detects when an animation
   is overwritten with another Tween, while Clutter considers any
   property change

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/22
2019-08-06 23:54:29 +02:00
Florian Müllner
476816732f cleanup: Use milliseconds for animation times
The different units - seconds for Tweener and milliseconds for
timeouts - are not a big issue currently, as there is little
overlap. However this will change when we start using Clutter's
own animation framework (which uses milliseconds as well), in
particular where constants are shared between modules.

In order to prepare for the transition, define all animation times
as milliseconds and adjust them when passing them to Tweener.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/663
2019-08-05 21:55:20 +00:00
Florian Müllner
71759a0769 cleanup: Mark unused (but useful) variables as ignored
While we aren't using those destructured variables, they are still useful
to document the meaning of those elements. We don't want eslint to keep
warning about them though, so mark them accordingly.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/627
2019-07-24 00:28:45 +02:00
Florian Müllner
79cf3a6dd0 cleanup: Remove some unhelpful unused arguments
Those unused arguments aren't bugs - unbeknownst to eslint, they all
correspond to valid signal parameters - but they don't contribute
anything to clarity, so just remove them anyway.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/627
2019-07-24 00:28:45 +02:00
Florian Müllner
f9a7718dda background: Adjust to gnome-desktop API break
gnome-desktop broke API in commit ca5d61cf24, as it didn't *add* a property
as incorrectly stated in the commit message, but *replaced* an existing one.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1457
2019-07-20 12:26:28 +02:00
Florian Müllner
1398aa6562 style: Fix indentation errors
While we have some style inconsistencies - mostly regarding split lines,
i.e. aligning to the first arguments vs. a four-space indent - there are
a couple of places where the spacing is simply wrong. Fix those.

Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/608
2019-07-02 12:17:46 +00:00
Florian Müllner
8fda3116f0 style: Fix brace style
Opening braces should be on the same line as the associated statement,
and only be omitted if both surrounding blocks are one-liners.

Partially spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/607
2019-07-01 23:44:11 +02:00
Florian Müllner
e56d7f5021 cleanup: Remove unused variables
Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/607
2019-07-01 23:44:10 +02:00
Marco Trevisan (Treviño)
7059e31f6a background: Group 'changed' signal emission
Background is monitoring the whole `org.gnome.desktop.background` gsettings keys
for changes connecting to the non-specialized 'changed' signal and re-emitting
this as-is.
This means that when the background is changed via control-center, we get
multiple 'changed' signal events from GSettings, and for each one of this we
recreate a Background and a BackgroundActor.

Avoid this by using an idle to delay the emission of the 'changed' signal
grouping the events.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/558
2019-06-14 12:24:20 +00:00
Marco Trevisan (Treviño)
a9234f7631 background: Use Garbage Collector to dispose background
The same Meta.Background could be used by multiple instances of background
actors, and so should not be disposed when the actor using it is destroyed.

Instead of calling `run_dispose` directly on it, just nullify the reference
on destroy method, leaving the job of doing the proper disposition to the
gabage collector that keeps the proper reference count on the Meta.Background.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/501

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/558
2019-06-14 12:24:20 +00:00
Marco Trevisan (Treviño)
8f1fff1374 background: Don't set background actor sizing and scaling
Mutter BackgroundActor is able do detect this at lower level

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2019-03-01 17:12:53 +00:00
Florian Müllner
fd50b9a45e cleanup: Use destructuring for imports from GI
This is *much* nicer than repetitive "imports.gi" lines ...

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/399
2019-02-09 07:39:20 +01:00
Florian Müllner
bacfdbbb03 cleanup: Port non-GObject classes to JS6 classes
ES6 finally adds standard class syntax to the language, so we can
replace our custom Lang.Class framework with the new syntax. Any
classes that inherit from GObject will need special treatment,
so limit the port to regular javascript classes for now.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/361
2019-01-25 14:02:44 +00:00
Jonas Ådahl
47ea10b7c9 Remove usage of MetaScreen
Remove any usage of MetaScreen, as it has been removed from libmutter
in the API version 3. The corresponding functionality has been moved
into three different places: MetaDisplay, MetaX11Display (for X11
specific functionality) and MetaWorkspaceManager.

https://bugzilla.gnome.org/show_bug.cgi?id=759538
2018-07-06 19:56:19 +02:00
Florian Müllner
3b1330880f cleanup: Use Function.prototype.bind()
When not using arrow notation with anonymous functions, we use Lang.bind()
to bind `this` to named callbacks. However since ES5, this functionality
is already provided by Function.prototype.bind() - in fact, Lang.bind()
itself uses it when no extra arguments are specified. Just use the built-in
function directly where possible, and use arrow notation in the few places
where we pass additional arguments.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
2018-02-21 13:55:02 +00:00
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
Ray Strode
94b96f8d97 background: don't leak wall clock when background changes
The background code allocates a GnomeWallClock when its first created,
but neglects to drop a reference to that clock at destroy time.
The undestroyed clocks lead to a timerfd leak that eventually prevents
the shell from functioning.

https://bugzilla.gnome.org/show_bug.cgi?id=791655
2017-12-15 10:57:14 -05:00
Cosimo Cecchi
a432653c87 background: use of CHANGES_DONE_HINT events to avoid reloads
Instead of potentially loading a background mid-way when it changes, and
loading it again for every file monitor event, leverage
CHANGES_DONE_HINT events, which allow us to ignore CREATED and CHANGED
signals from the file monitor.

https://bugzilla.gnome.org/show_bug.cgi?id=747794
2017-07-31 16:17:35 +01:00
Florian Müllner
033277b68f Define externally accessible contants with 'var' instead of 'const'
Just as we did with classes, define other constants that are (or
may be) used from other modules with 'var' to cut down on warnings.

https://bugzilla.gnome.org/show_bug.cgi?id=785084
2017-07-18 21:52:06 +02: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
243dae14ea background: Fix file check
The _animationFile property was removed in commit 8a4c862633 ...
2017-04-11 02:43:07 +02:00
Rui Matos
b1dcea7cf1 background: Disconnect from 'prepare-for-sleep' signal
This signal connection was keeping Background instances from being
garbage collected.

https://bugzilla.gnome.org/show_bug.cgi?id=777934
2017-01-31 13:53:26 +01:00
Rui Matos
9f6f48025d background: Remove a couple of unused variables
Nothing uses these.

https://bugzilla.gnome.org/show_bug.cgi?id=777934
2017-01-31 13:48:11 +01:00
Florian Müllner
ccacb5f6de background: Update animations when coming back from suspend
We currently reload animated backgrounds on timezone changes, but
there are other cases where the time can change unexpectedly and
the background no longer matches the time of day. One case we can
easily handle is when coming back from suspend, so do that.

https://bugzilla.gnome.org/show_bug.cgi?id=773265
2016-10-30 21:10:32 +01:00
Hyungwon Hwang
e72d388a67 background: free MetaBackground explicitly when its MetaBackgroundActor is destroyed
The memory which MetaBackground resides is freed automatically, when its
wrapper object Background is freed by garbage collection. But because the
memory for MetaBackground is huge, changing the background or changing the
background mode repeatedly makes a lot of memory to be in use until garbage
collection runs.

This patch frees the MetaBackground object explicitly when its
MetaBackgroundActor is destroyed which is the moment that the memory in the
object is not used anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=766353

Signed-off-by: Hyungwon Hwang <hyungwon.hwang7@gmail.com>
2016-06-29 13:27:10 +02:00
Florian Müllner
965aedb0bb background: Reload animation on timezone changes
Animated backgrounds are based on a start time in local time - in case
of a timezone change, that time is no longer accurate. To fix, we need
to either make BGSlideShow aware of timezone changes (and notify us to
update the animation), or just reload the animation - timezone changes
should be a rare event, so go with the simpler second option.

https://bugzilla.gnome.org/show_bug.cgi?id=758939
2015-12-02 17:18:39 +01:00
Josselin Mouette
8a4c862633 background: fix a race condition when loading several animations
When loading several animations at the same time, the last call
overrides the result for all of them.

This commit caches all animations separately based on the source's
schemas.

https://bugzilla.gnome.org/show_bug.cgi?id=741453
2015-09-07 06:51:42 +02:00
Michael Biebl
785c90f4b8 background: fix indentation 2015-09-07 06:49:55 +02:00
Giovanni Campagna
0068098996 Background: add a comment for questionable GSettings usage
BackgroundSource relies on Background to watch its own settings.
Add a comment to explain that.

https://bugzilla.gnome.org/show_bug.cgi?id=746509
2015-03-27 13:11:22 -07:00
Rui Matos
260657c0b8 BackgroundCache: plug an Animation object leak
We need to return early in case the animation file is the same,
otherwise we'll create a new Animation object and leak the previous
one.

https://bugzilla.gnome.org/show_bug.cgi?id=739252
2014-10-27 17:50:41 +01:00
Owen W. Taylor
2f5a226bc2 Fix handling of SystemBackground
Since the background rework, SystemBackground is no longer a transparent
actor that you have to stack on top of a solid background, it is an
opaque actor. Fix the color of the background actor, and remove places
where we were setting the background color underneath the system background
and expecting blending - in particular, we can always set no_clear_hint
on the stage.

https://bugzilla.gnome.org/show_bug.cgi?id=738652
2014-10-16 17:16:06 -04:00
Cosimo Cecchi
49c4ba5656 theme: make a GResource
Now that we have all the infrastructure ready, port the theme to a
GResource.

https://bugzilla.gnome.org/show_bug.cgi?id=736936
2014-10-14 18:54:18 -07:00
Cosimo Cecchi
38add2e78b background: port to new GFile MetaBackground API
https://bugzilla.gnome.org/show_bug.cgi?id=736936
2014-10-14 18:51:29 -07:00