Commit Graph

13087 Commits

Author SHA1 Message Date
Florian Müllner
e0457b6dc4 lint: Add "legacy" configuration
Regarding coding style, gjs is moving in a direction that departs quite
significantly from the established style, in particular when indenting
multi-line array/object literals or method arguments:

Currently we are keeping those elements aligned, while the gjs rules now
expect them to use the regular 4-space indentation.

There are certainly good arguments that can be made for that move - it's
much less prone to leading to overly-long lines, and matches popluar JS
styles elsewhere. But switching coding style implies large diffs which
interfere with git-blame and friends, so in order to allow for a more
gradual change, add a separate set of "legacy" rules that match more
closely the style we would expect up to now.

It also disables the rules for quotes and template strings - the former
because we cannot match the current style to use double-quotes for
translatable strings and single-quotes otherwise, the latter because
template strings are still relatively new, so we haven't adopted them
yet.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/609
2019-07-12 16:01:07 +00:00
Florian Müllner
42b77e7ba5 lint: Allow multiple spaces before key values
This is useful for imitating namespaced flags/enums:

```
const FooFlags = {
    NONE:    0,
    SMEAGLY: 1 << 0,
    SMOGLEY: 1 << 1,
    MUGGLY:  1 << 2
};
```

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/609
2019-07-12 16:01:07 +00:00
Florian Müllner
f6bed08993 lint: Enforce camelCase
All variables should be in camelCase, so configure the corresponding
rule to enforce this. Exempt properties for now, to accommodate the
existing practice of using C-style underscore names for construct
properties of introspected objects.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/609
2019-07-12 16:01:07 +00:00
Florian Müllner
5f77cdb0b9 lint: Enforce arrow notation
We replaced all Lang.bind() calls with arrow functions or the standardized
Function.prototype.bind(), at least for the former eslint has some options
to ensure that the old custom doesn't sneak back in.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/609
2019-07-12 16:01:07 +00:00
Florian Müllner
109b8e8f38 lint: Require spaces inside braces in object literals
Prohibiting spaces where the established GNOME style has required
them for a decade would be a harsh change for no good reason.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/609
2019-07-12 16:01:07 +00:00
Florian Müllner
4c0bd88a2c lint: Tweak the whitelist of globals
gjs doesn't include any gettext wrappers, and obviously can't know
about the shell's global object, so include those in the list of
globals for all sources in the gnome-shell context.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/609
2019-07-12 16:01:07 +00:00
Florian Müllner
3731be9947 lint: Import eslint rules from gjs
gjs started to run eslint during its CI a while ago, so there is an
existing rules set we can use as a starting point for our own setup.

As we will adapt those rules to our code base, we don't want those
changes to make it harder to synchronize the copy with future gjs
changes, so include the rules from a separate file rather than using
the configuration directly.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/609
2019-07-12 16:01:07 +00:00
Florian Müllner
6cc19ee6f0 workspacesView: Work around spurious allocation changes
For some reason, people are still seeing those after commit d5ebd8c8.
While this is something we really should figure out, we can work around
the issue by keeping the view actors hidden until the update is complete.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1065
2019-07-12 16:48:03 +02:00
Florian Müllner
1570f838f3 cleanup: Remove bogus file
This was accidentally added in commit 14d7897a9.
2019-07-12 10:36:37 +00:00
Florian Müllner
74feb110b5 layout: Fix off-by-one indent
This sneaked into commit dbb71f0d :-(
2019-07-11 03:02:20 +02:00
Florian Müllner
6ba03ac2a6 params: Don't use Lang module
To copy the passed in default parameters, we can just as well use
another Object.assign() call.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/616
2019-07-10 22:09:09 +00:00
Florian Müllner
55c717c2dc appDisplay: Fix logic error
Commit f6b4b96737 accidentally swapped the conditions here from
!includes() to includes().

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/621
2019-07-10 21:50:17 +00:00
Florian Müllner
355b5eebec workspace: Set offscreen redirect on window previews
Window previews are sometimes shown translucent, for example during
drags or animations. They can also have attached dialogs, in which
case the opacity should affect the combination of all windows instead
of being applied to each window individually, blended together, so
make sure they are redirected as a whole when necessary.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/774
2019-07-10 21:41:58 +00:00
Florian Müllner
51938c398a workspace: Let WindowClone inherit from StWidget
Using inheritance over delegation will give us more control over
the actor drawing.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/774
2019-07-10 21:41:58 +00:00
Florian Müllner
dbb71f0dfc layout: Make the hot corner optional
Whether people love or hate the hot corner depends in large extents
on hardware sensitivity and habits, which is hard to get right
universally. So bite the bullet and support an option to enable or
disable hot corners ...

https://bugzilla.gnome.org/show_bug.cgi?id=688320
2019-07-10 17:29:24 +02:00
Florian Müllner
1cac7b2218 windowManager: Remove unused property
The last commit removed the only code that set _blockAnimations,
so stop reading it as well.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/620
2019-07-09 14:46:36 +02:00
Florian Müllner
ff9bb5399b windowManager: Use new reorder_workspace() API
With the new Mutter API, inserting a workspace at a particular position
becomes as easy as creating the workspace and moving it to the desired
index.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/620
2019-07-09 14:41:35 +02:00
Florian Müllner
68e45eb051 workspaceThumbnails: Handle reordering of workspaces
MetaWorkspaceManager gained the ability to reorder workspaces, so make
sure to pick up the new order when that happens.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/620
2019-07-09 14:41:35 +02:00
Florian Müllner
d0da96ad29 workspacesView: Handle reordering of workspaces
MetaWorkspaceManager gained the ability to reorder workspaces, so make
sure to pick up the new order when that happens.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/620
2019-07-09 14:41:35 +02:00
Illya Klymov
55b036170b shell-recorder: Restore cursor recording
Due to changes introduced in 5357e0a1 cursor recording interaction with
magnifier was reversed. This fix restores original correct behavior
Related issue: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1208
2019-07-08 21:08:51 +00:00
Florian Müllner
5473637736 cleanup: Fix style nits in last commit
Missing space after catch and wrong double quotes.
2019-07-08 20:15:15 +02:00
Mario Sanchez Prada
bb6d9734e4 endSessionDialog: Check for PackageKit before considering updates/upgrades
GNOME Shell is spitting out some errors in the journal due to its attempts
to speak to PackageKit, which is not present on Endless OS, so let's add
some runtime checks to make sure that PackageKit is actually available
before assuming so and using its proxy to decide which kind of UI to
show to the user when ending the session.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/369
2019-07-08 13:57:23 +02:00
Carlos Garnacho
53be76c9e2 shellDBus: Update ::accelerator-activated handler arguments
Mutter now passes a ClutterInputDevice. And use this to pass the
device ID (as we used to do) and the event node (so we can transition
to something that works on x11/wayland)

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/618
2019-07-08 11:53:42 +02:00
Florian Müllner
be40de5a9b st: Consider non-background properties for ::style-changed
st_theme_node_paint_equal() was originally added to preserve paint state
when a style change didn't affect any of StWidget's cached background
resources.
That's why using it for filtering out unneeded style changes as in commit
f662864a misses any non-background related properties that are relevant
for subclasses. Add additional tests to make sure we keep emitting the
signal in those cases.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1212
2019-07-07 21:01:33 +00:00
Florian Müllner
7359e431d3 st: Add st_icon_colors_equal()
This is a small convenience wrapper around clutter_color_equal()
for the different color components, which also handles the case
where one (or both) of the icon colors are %NULL.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1212
2019-07-07 21:01:33 +00:00
Florian Müllner
8a5de327bb params: Fix regression
The first parameter to Object.assign() is the same target object that
will be returned. That is, since commit 46874eed0 Params.parse() modifies
the @defaults object. Usually we pass that parameter as an object literal
and this isn't an issue, but the change breaks spectacularly in the few
cases where we use a re-usable variable.

Restore the previous behavior by copying the object first.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/615
2019-07-05 18:28:26 +02:00
Florian Müllner
1778adae0d tests: Add Params.parse() unit tests
Commit 46874eed0 accidentally changed the behavior of the function in
an incompatible way. Before addressing the actual issue, add a reproducer
to the unit tests to hopefully prevent future breakage.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/615
2019-07-05 18:28:26 +02:00
Florian Müllner
0d035a4e53 cleanup: Prefer template strings
Template strings are much nicer than string concatenation, so use
them where possible; this excludes translatable strings and any
strings containing '/' (until we can depend on gettext >= 0.20[0]).

[0] https://savannah.gnu.org/bugs/?50920

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/612
2019-07-05 11:32:31 +00:00
Florian Müllner
46874eed05 params: Simplify code
Standard javascript now has Object.assign() which is very similar to
Params.parse(), except that the latter by default disallows "extra"
parameters. We can still leverage the standard API by simply
implementing the error check, and then call out to Object.assign()
for the actual parameter merging.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/612
2019-07-05 11:32:31 +00:00
Florian Müllner
e95f3febd6 ibusManager: Use Map to store engines
This is a clear case of key->value mapping, so using the corresponding
data type makes sense.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/612
2019-07-05 11:32:31 +00:00
Jonas Dreßler
0bdd1b6fc4 st/button: Ungrab device before calling st_button_release
Since priv->device gets set to NULL inside st_button_release, ungrab the
input device before calling st_button_release and avoid
clutter_input_device_ungrab failing with a critical error.

This fixes a regression introduced with
d5a1a888d9

While at it, also remove the superfluous line resetting priv->device to
NULL and move the check for priv->grabbed into an elseif block since
there should be no case where StButton has both grabs at the same time.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/614
2019-07-04 18:25:15 +02:00
Carlos Garnacho
8a22092632 shell: Drop XDND initialization code
Let mutter take over this, and drop this piece of backend-specific
code.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/611
2019-07-03 16:37:15 +02:00
frederik.feichtmeier
915415d919 OSK variables and key rounding
- generate the OSK key colors from variables in _colors.scss without changing the design
- add hover and active colors for all key, not only letter keys
- use $button_radius for the OSK keys, buttons and entries (no value change for the latter)

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/610
2019-07-02 21:10:33 +02:00
Florian Müllner
14d7897a93 style: Stop using braces for single-line arrow functions
Braces are optional for single-line arrow functions, but there's a
subtle difference:
Without braces, the expression is implicitly used as return value; with
braces, the function returns nothing unless there's an explicit return.

We currently reflect that in our style by only omitting braces when the
function is expected to have a return value, but that's not very obvious,
not an important differentiation to make, and not easy to express in an
automatic rule.

So just omit braces consistently as mandated by gjs' coding style.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/608
2019-07-02 12:17:46 +00: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
8fcd6c7153 cleanup: Use arrow functions for tweener callbacks
While it is legal to use method syntax for the function properties
here, arrow notation is less unexpected and allows us to drop the
separate scope properties.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/608
2019-07-02 12:17:46 +00:00
Florian Müllner
6ed5bc2f6c cleanup: Use consistent switch indentation
We are currently inconsistent on whether case labels share the same
indentation level as the corresponding switch statement or not. gjs
goes with the default of no additional indentation, so go along with
that.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/608
2019-07-02 12:17:46 +00:00
Florian Müllner
5ec4c2e43e cleanup: Use spaces for indentation
Our indentation style has always mandated spaces, but over the years
some tabs sneaked in. Fix up those places.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/608
2019-07-02 12:17:46 +00:00
Florian Müllner
6f8dd065a4 cleanup: Use consistent style for GObject property definitions
Go with the style preferred by gjs.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/608
2019-07-02 12:17:46 +00:00
Florian Müllner
02db21fc55 systemActions: Reindent action map
Starting an object literal with a comment throws off eslint's rules
for brace style (newline between brace and properties for both opening
and closing brace or neither) as well as indentation (fixed four-space
indent or align with the previous argument).

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/608
2019-07-02 12:17:46 +00:00
Florian Müllner
8c28f9a77d dwellClick: Reindent modes map
Using multiple spaces after property names in order to align the
values isn't something we do elsewhere.

Instead, align the values by using a fixed 4-space indent as preferred
by gjs nowadays.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/608
2019-07-02 12:17:46 +00:00
Florian Müllner
95b80eec01 extensionPrefs: Avoid awkward indentation in string literal
The current code is carefully avoiding an overly wide line length as
well as adding literal new lines to the string due to indentation. It's
clever and barely legible.

Instead, use one string per line similar to how they appear in the actual
output, and join them together when setting the clipboard text.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/608
2019-07-02 12:17:46 +00:00
Jonas Dreßler
02c76695e5 tests: Stop using global grabs
Global grabs are being removed from Clutter in favour of input device
grabs.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/495
2019-07-02 01:18:15 +00:00
Jonas Dreßler
d5a1a888d9 st: Replace global grabs with input device grabs
Global grabs are being removed from Clutter in favour of input device
grabs, so only grab the input device instead and replace priv->grabbed
with checks for priv->grab_device.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/495
2019-07-02 01:18:15 +00:00
Jonas Dreßler
6c33aff6d1 lookingGlass: Replace global grabs with input device grabs
Global grabs are being removed from Clutter in favour of input device
grabs.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/495
2019-07-02 01:18:15 +00:00
Sonny Piers
61f86cbc54 keyboard: Remove unused keyboard gsetting schema
Since commit 7fd8fa34, the schema is no longer used.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/604
2019-07-02 02:56:48 +02:00
Florian Müllner
4c5206954a style: Use camelCase for variable names
Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/607
2019-07-01 23:44:11 +02: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
7ac35c644e style: Fix stray/missing spaces
Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/607
2019-07-01 23:44:11 +02:00
Florian Müllner
29b04fcbf2 style: Fix stray/missing semi-colons
Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/607
2019-07-01 23:44:11 +02:00