Commit Graph

13403 Commits

Author SHA1 Message Date
Florian Müllner
a77377efe7 cleanup: Avoid useless return statements
Return statements are only useful if they return a value or break
the regular function flow (i.e. early returns). Remove all returns
that do neither.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/731
2019-09-15 16:02:45 +02:00
Florian Müllner
81ab2865f7 cleanup: Don't use Array/Object constructors
The corresponding literals are more concise and cleaner.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/731
2019-09-15 16:02:45 +02:00
Florian Müllner
e585f7d97b scripting: Disable an eslint warning
Calling await in a loop means the asynchronous operations are
run sequentially instead of in-parallel. Usually that's not
what's wanted, so eslint has a rule to warn about this.

However here we use async/await to handle control back to the
mainloop between steps, so running operations sequentially is
actually intended.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/731
2019-09-15 16:02:45 +02:00
Florian Müllner
1a32e3e74a volume: Clarify some code
We have more idiomatic ways to check whether any element fullfills
some condition than breaking out of a loop.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/731
2019-09-15 16:02:45 +02:00
Florian Müllner
8d6820c4df magnifier: Do not modify function argument
The intention of the code is clearly to operate on a copy, but that's
not how the Object constructor works. While it doesn't matter in
practice that we modify the passed-in object parameter, it's still
a good idea to fix the code.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/731
2019-09-15 16:02:45 +02:00
Florian Müllner
2546445884 magnifier: Simplify some code
We don't need nested if blocks to set or unset the crosshairs'
clip size.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/731
2019-09-15 16:02:45 +02:00
Florian Müllner
e44b7df078 lint: Drop extra ignored nodes in legacy config
They didn't just allow for the style patterns they were added to,
but allowed for some messed up indentation to slip through. Now
that we adapted the code to not use the old style, it's time to
drop the exceptions.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/725
2019-09-15 13:30:19 +00:00
Florian Müllner
3a9eaa39ea cleanup: Switch some method calls to new indentation style
The legacy indent rule currently ignores arrow functions in parameters
to allow callbacks to not align with the other arguments:

    this._someFunctionWithFairlyLongishName(arg1, arg2, arg3,
        () => {
            this._someOtherFunctionWithLongName(arg1);
        });

But as ignoring entire nodes means we can end up with arbitrary
indentation, we should drop the exception. While this would make
the above "illegal" under the legacy config, it conforms with the
non-legacy style, so everything should be fine ...

... except that eslint starts to complain about some function args
that should be fine under the legacy config. Maybe it's thrown off
by the function-arg-in-arrow-function-in-function-arg structure, but
rather than figuring it out, let's just move those to the new style.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/725
2019-09-15 13:30:19 +00:00
Florian Müllner
af87bd8c87 cleanup: Use consistent style for ternary operator
We are currently inconsistent whether to put the operators in front
of the corresponding line or at the end of the preceding one. The
most dominant style for now is to put condition and first branch on
the same line, and then align the second branch:

  let foo = condition ? fooValue
                      : notFooValue;

Unfortunately that's a style that eslint doesn't support, so to account
for it, our legacy configuration currently plainly ignores all indentation
in conditionals.

In order to drop that exception and not let messed up indentation slip
through, change all ternary operators to the non-legacy style.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/725
2019-09-15 13:30:19 +00:00
Florian Müllner
4bfb4a0e3d cleanup: Fix wrong indentation
Some more places where the indentation doesn't comply with either
the old or new style. They slipped through because the legacy eslint
configuration accounts for some patterns by plainly ignoring certain
nodes. We'll address that later, first fix up the indentation errors.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/725
2019-09-15 13:30:19 +00:00
Martin Zurowietz
d1a6601e60 theme: Equalize dimensions of ws switcher popup boxes
The indicator for the active workspace is currently two pixels
smaller because it doesn't account for the border used for
inactive workspaces.

Fix that to make sure all indicators have the same size.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1243
2019-09-15 01:23:56 +02:00
Harshula Jayasuriya
817aec5466 overview: Fix fading out desktop icons
A typo in commit 0846238f69 broke the animation.

Signed-off-by: Harshula Jayasuriya <harshula@hj.id.au>

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1616
2019-09-14 14:05:12 +02:00
Марко Костић
314a89a837 Update Serbian translation 2019-09-13 19:43:24 +00:00
Jonas Ådahl
57ed68541a environment: Disable fullscreen unredirect during all transitions
When there is a transition, it's likely that we are animating some part
of the desktop, and in such situations we don't want to unredirect
fullscreen windows.

This fixes unwanted unredirection when e.g. hiding a modal dialog by
re-enabling the unredirection after the animation has finished, instead
of when it starts.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/721
2019-09-13 16:10:17 +00:00
Georges Basile Stavracas Neto
413c677fcf iconGrid: Only animate visible icons
Mutter recently added an optimization to only allocate
visible children [1]. That broke ClutterClones, but it
was subsequently fixed [2].

However, that exposed a third problem, this time with
FrequentView: visible but transparent icons, that are
not allocated by the icon grid, were cloned and animated
during the spring animation.

Only animate visible icons with opacity greater than 0.

[1] https://gitlab.gnome.org/GNOME/mutter/commit/0eab73dc
[2] https://gitlab.gnome.org/GNOME/mutter/commit/08a3cbfc

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/696
2019-09-13 15:33:45 +00:00
Milo Casagrande
3d86e6e791 Update Italian translation 2019-09-13 12:55:53 +00:00
Daniel Mustieles
3fbd61cbf0 Updated Spanish translation 2019-09-13 08:27:06 +02:00
Georges Basile Stavracas Neto
43b4f2c7d5 lookingGlass: Only update window list when visible
Updating the window list in the Looking Glass is a costly
operation: it destroys a whole lot of actors, and recreates
them. This triggers CSS changes, repaints, and allocations.

It is specially bad when paired with Wayland's big number
of window creations and deletions when showing Builder's
and Epiphany's popup window.

Only update the window list in the Looking Glass when it is
visible.

Related: https://gitlab.gnome.org/GNOME/mutter/issues/556

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/719
2019-09-13 00:49:38 +00:00
Anders Jonsson
7eb4088f45 Update Swedish translation 2019-09-12 22:16:22 +00:00
Florian Müllner
f00201fa6c ci: Disable MR handling for now
We aren't quite ready to enforce non-legacy style for now, mostly due
to the xgettext bug that prevents us from using template strings in
some places, and vast amounts of legacy indentation.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/716
2019-09-12 23:18:27 +02:00
Florian Müllner
1aca2ba6bb ci: Disallow legacy style in merge requests
In order to transition from the current legacy style to the modern
gjs one, use the MR line-filtering we used to do on common errors
to ensure new code complies with the new style.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/716
2019-09-12 23:18:27 +02:00
Florian Müllner
e9131465dd ci: Fail on any common lint errors
Now that we fixed all pre-existing errors that are common between
regular and legacy configuration, we can stop filtering the result
by the lines modified by the merge request.

This will allow us to catch errors in merge requests that slipped
through until now, for example when leaving a newly-unused import
behind.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/716
2019-09-12 23:18:27 +02:00
Florian Müllner
0ee7f02f8e cleanup: Don't assume hasOwnProperty() method on objects
Since ES5, it is possible to create objects with no prototype at all:

    let foo = Object.create(null);

Those object won't have any builtin properties like hasOwnProperty(),
which is why eslint added a corresponding rule to its default rule set.

While this isn't an issue that affects our code, there's no harm in fol-
lowing the recommendation and call the method through Object.prototype.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/716
2019-09-12 23:18:27 +02: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
2fc4987c73 cleanup: Stop using Mainloop module
It is deprecated in favor of the regular GLib functions.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/718
2019-09-12 19:09:24 +02:00
GB_2
4525ad346d windowMenu: Animate menu
Most menus have an animation, so add one to the window menu for
consistency and better looks (like !712).

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/717
2019-09-12 16:01:46 +00:00
Danial Behzadi
e4b8a4b432 Update Persian translation 2019-09-12 12:27:27 +00:00
Enrico Nicoletto
62e594af6d Update Brazilian Portuguese translation 2019-09-12 11:35:40 +00:00
Florian Müllner
ce92270626 extensionSystem: Add missing return value
_callExtensionInit() should return whether the extension was initialized
successfully or not, but the early return added in commit 2a9e065cfb
doesn't.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/715
2019-09-12 12:45:05 +02:00
Jonas Dreßler
bdcf3037ca extensionSystem: Always disable multiple extensions in reverse order
Since disabling an extension will lead to disabling and re-enabling all
following extensions in the list, always disable multiple extensions by
looping through the list in reverse order.

This lowers the execution time of the event handlers quite a bit if many
extensions are installed.

Thanks to Philippe Troin for identifying the problem and proposing the
initial patch to change the extension order when reloading.

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

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/96
2019-09-12 10:24:49 +00:00
Jonas Dreßler
9698ff491a extensionSystem: Only add to extensionOrder array if enabling worked
Only push uuids of newly enabled extensions to the `_extensionOrder`
array if enabling them was successful.

Otherwise, since `_callExtensionDisable()` doesn't remove uuids that
weren't successfully enabled from the array, those extensions get added
to the array multiple times when they're disabled and enabled.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/96
2019-09-12 10:24:49 +00:00
Jonas Dreßler
2a9e065cfb extensionSystem: Always enforce disallowing extensions using sessionMode
It's currently possible to circumvent the `sessionMode.allowExtensions`
property: For already enabled extensions one can call reloadExtension
via DBus, for new extensions it's possible by adding the extension to
the enabled-extensions gsettings key and setting the
disable-extension-version-validation key (which triggers a reload of
`this._enabledExtensions`) and then calling reloadExtension via DBus.

So to enforce `allowExtensions` while still allowing to update
extensions and keeping the extensionSystem synced with various gsettings
keys, replace the checks for `this._enabled` with simple checks for
`Main.sessionMode.allowExtensions` inside `_callExtensionInit()` and
`_callExtensionEnable()`.

The remaining checks for `this._enabled` are only small optimizations to
prevent running code on irrelevant sessionMode updates.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/96
2019-09-12 10:24:49 +00:00
Jonas Dreßler
4c93ef39fa extensionSystem: Handle added or removed sessionMode extensions
Right now we're only handling added sessionMode extensions correctly on
sessionMode updates, also handle the other case and disable removed
sessionMode extensions on sessionMode updates.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/96
2019-09-12 10:24:49 +00:00
Jonas Dreßler
22107c183b extensionSystem: Rename initted to initialized
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/96
2019-09-12 10:24:49 +00:00
Jonas Dreßler
c06eb5d0a7 extensionSystem: Log an extension error if loading the stylesheet failed
Instead of only logging a message that loading the extension stylesheet
failed and silently returning we should use `logExtensionError` for that
instead. This also sets the extension state to ERROR and makes sure we
don't try to enable it again.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/96
2019-09-12 10:24:49 +00:00
Jonas Dreßler
e76877c4b8 extensionSystem: Check if extension exists before accessing property
If the extension doesn't exist in the `this._extensions` Map, we'd try
to access `extension.dir` on undefined/null. So set the `dir` variable
after checking if `extension` is defined.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/96
2019-09-12 10:24:49 +00:00
Jonas Dreßler
2a32fb2e72 extensionSystem: Fix a wrong error message
The extension object is added to the `this._extensions` Map inside
`createExtensionObject`, not inside `loadExtension`.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/96
2019-09-12 10:24:49 +00:00
Jonas Dreßler
de86920e0e extensionSystem: Remove unncessary return statements
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/96
2019-09-12 10:24:49 +00:00
Jonas Dreßler
8754736fda extensionUtils: Check version variable for undefined first
Avoid a warning message when trying to access requiredArray[2] by
checking if its undefined first.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/96
2019-09-12 10:24:49 +00:00
Iain Lane
d2ead59d74 data: Lower TimeoutStartSec in systemd units
If there's a stubborn process in our cgroup, we shouldn't hang around
waiting for the default (30 seconds) before the session closes. We've
logged out, SIGTERMed and the thing is refusing to go away, let's not
make people hang around for ages.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/699
2019-09-12 08:16:10 +00:00
Emin Tufan Çetin
2f4fcc59a1 Update Turkish translation 2019-09-12 04:26:07 +00:00
Florian Müllner
ba6dbb228d workspace: Minor clarification
Code and comment were based on the old get_input_rect() and get_outer_rect()
method names that were changed to the more appropriate get_buffer_rect() and
get_frame_rect() a long time ago.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/713
2019-09-11 23:32:16 +00:00
Florian Müllner
60e386048b backgroundMenu: Animate menu opening
The animation was removed in commit 6a00a504d4 for consistency with
other menus. However commit a9b12d5d73 then *added* animations to
those just four minutes later.

So add back the original animations for consistency, both with menu
closing and with other menus.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1595
2019-09-11 23:25:21 +00:00
Christian Kirbach
c2904fa14d Update German translation 2019-09-11 21:14:44 +00:00
Florian Müllner
dfdb139d9c workspaceThumbnails: Replace loops with Array.find()
This is much more idiomatic and concise than iterating over
thumbnails until we find the one we are looking for.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/710
2019-09-11 20:59:31 +00:00
Florian Müllner
ce63d21dcc overview: Minor cleanup
Safe one indentation level by combining conditions.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/710
2019-09-11 20:59:31 +00:00
Florian Müllner
1da9937453 workspace: Use operator shorthand
Shorthands like a += b are well-established, so prefer them over the
less concise a = a + b.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/710
2019-09-11 20:59:31 +00:00
Florian Müllner
9f11fbad16 jsParse: Disambiguate regex
Make it clear that /= is part of a regex and not an operator shorthand.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/710
2019-09-11 20:59:31 +00:00
Florian Müllner
f54e7804c5 workspace: Don't initialize variables to undefined
The declaration itself already does this implicitly.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/710
2019-09-11 20:59:31 +00:00
Florian Müllner
7db5f8b28e calendar: Use template strings over concatenation
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/710
2019-09-11 20:59:31 +00:00