Commit Graph

34 Commits

Author SHA1 Message Date
Florian Müllner
40e22eb524 cleanup: Use optional chaining and ?? operator
Those operators have been supported since gjs switched to mozjs78
last cycle. While not ground-breaking, using it makes for a nice
cleanup here and there.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1517>
2020-12-02 15:10:29 +00:00
Jonas Ådahl
772df91762 shell/global: Add 'backend' property
Replace all Meta.get_backend() with global.backend. Maybe sooner or
later we can further decrease the amount of singletons handled by
libmutter.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1210
2020-04-27 15:18:18 +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
2e4e2500dd cleanup: Avoid "lonely" ifs where it makes sense
If an else block only contains an if statement, the two can be
combined into an if-else block, which cuts down on indentation
and usually helps legibility.

There are exceptions (for instance where the outer if and else
blocks are mirrored), but where it makes sense, change the code
to avoid lonely ifs.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/805
2019-11-11 19:25:14 +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
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
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
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
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
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
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
a1534dab02 cleanup: Clean up unused imports
Spotted by eslint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/399
2019-02-09 05:05:07 +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
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
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
Hyungwon Hwang
4b80cbe1cd xdnd: Remove XDnD handling code and receive DnD signals from mutter
Move the XDnD handling code to mutter, and receive DnD handling signals from
mutter directly.

https://bugzilla.gnome.org/show_bug.cgi?id=765003
2017-03-07 08:29:51 +08:00
Hyungwon Hwang
46f3712421 xdnd: Rename XDnD handling signals to more inclusive ones
Rename the signals which have been used to handle XDnd events to more inclusive
ones. So that these signals can be used to handle the DnD events in Wayland.

https://bugzilla.gnome.org/show_bug.cgi?id=765003
2017-03-07 08:29:51 +08:00
Jasper St. Pierre
7fcae1e974 Remove use of superfluous MetaWindowActor APIs 2013-12-16 12:48:53 -05:00
Giovanni Campagna
4db6e70f97 Disable XDND when running as a wayland compositor
We can't do xdnd on wayland easily, so let's disable this for 3.10

https://bugzilla.gnome.org/show_bug.cgi?id=707467
2013-09-12 10:34:25 +02:00
Jasper St. Pierre
7234aa601f layout: Remove some outdated set_hidden_from_pick calls
XDND no longer uses CLUTTER_PICK_ALL, so we don't need to hide
certain actors from pick anymore.
2013-08-21 16:53:04 -04:00
Jasper St. Pierre
db89648f62 Remove simple uses of ClutterRectangle
https://bugzilla.gnome.org/show_bug.cgi?id=699975
2013-05-09 09:49:12 -04:00
Jasper St. Pierre
c1dd971ce9 xdndHandler: Ensure that the XDnD clone is on top of the panel
The panel is added to the uiGroup, not the overlay group, so
to stack on top of it, we need to add ourselves to the uiGroup
as well.

https://bugzilla.gnome.org/show_bug.cgi?id=695073
2013-03-03 15:41:52 -05:00
Adel Gadllah
b37afcdba1 xdnd: Only pick reactive actors
This is the only sane way to get select windows in the overview,
as workspace._dropRect blocks our view otherwise.
2013-02-22 20:02:22 +01:00
Adel Gadllah
f644bee831 xdnd: Don't wait for the stage to be disabled when it is already visible
xdndHandler used to wait for the stage to show up before calling
global.init_xdnd() . Since commit 65303d027a xdndHandler is initalized
later so the stage might be already visible at this point causing the
show signal never to be emitted and thus global.init_xdnd will never
be called.

Fix that by checking by calling global.init_xdnd without waiting for
the stage's show signal to be emitted, as the stage is guaranted to be
visible at this point.
2013-02-22 19:37:40 +01:00
Jasper St. Pierre
ba5860cdd6 xdndHandler: Add the dummy actor to the uiGroup
While this isn't too urgent, since this won't break if we don't have
a drag actor, I was wondering what the other child in my stage was.
2013-02-18 14:47:17 -05:00
Stefano Facchini
245c58842b xdndHandler: pass actor-relative coordinates to handleDragOver
This is more reasonable and consistent with what is done in dnd.js.

https://bugzilla.gnome.org/show_bug.cgi?id=669887
2012-02-12 20:21:56 +01:00
Stefano Facchini
138b8cf874 xdndHandler: prevent dummy actor from interfering with Hot Corner
Since the dummy actor occupies exactly the same area of the Hot Corner,
it can be erroneously picked during xdnd operations. Fix this by
hiding it from pick.

https://bugzilla.gnome.org/show_bug.cgi?id=669831
2012-02-10 21:16:16 +01: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
Adel Gadllah
0065e2cfac xdndHandler: Correctly disconnect the window group visibility handler 2011-03-04 11:23:18 +01:00
Adel Gadllah
f6ae48ec70 XDND: Use only one constraint for the cursor window position
ClutterBindConstraint now supports POSITION, so use that instead
of separate X and Y constraints.
2011-01-26 20:41:26 +01:00
Adel Gadllah
ceedc7e32c Implement cross overview drag & drop
The gnome-panel allows the user to hover over a tasklist entry
while draging to activate a minimized or obscured window and drop onto it.

Implement a similar behaviour by allowing draging to the activities button or
the hotcorner (and thus opening the overview), which allows the user to
activate any window (even on different workspaces) as a drop target.

https://bugzilla.gnome.org/show_bug.cgi?id=601731
2011-01-05 23:19:56 +01:00