Commit Graph

80 Commits

Author SHA1 Message Date
Florian Müllner
e357559582 cleanup: Mark globals used from other modules as exported
eslint cannot figure out that those symbols are used from other modules
via imports, so they trigger unused-variable errors. To fix, explicitly
mark those symbols as exported.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/627
2019-07-24 00:28:45 +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
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
Florian Müllner
55235c2552 style: Avoid trailing commas in array destructuring
When destructuring multiple return values, we often use trailing commas
to indicate that there are additional elements that we are ignoring.

There isn't anything inherently wrong with that, but it's a style that's
too confusing for eslint - on the one hand we require a space after a
comma, on the other hand we require no space before closing brackets.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/607
2019-07-01 23:44:11 +02:00
Marco Trevisan (Treviño)
88697add1b js: Throw GObject.NotImplementedError when requiring overriding
Since version 1.50.0, gjs defines GObject.NotImplementedError for throwing
errors when a "virtual" method that requires a subclass implementation is not
defined.

So use this instead of a generic JS Error in such cases.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/549
2019-05-21 15:43:21 -05:00
Florian Müllner
d5ebd8c816 dashSpacer: Don't trigger allocations from size negotiations
If an actor's allocation is outdated, clutter_actor_get_allocation_box()
will queue a relayout. That's why it's advised to not use the function
unless the allocation is known to be valid (namely during paint), but
in particular not from within get_preferred_width/height vfuncs.

Using the :allocation property (which may be outdated) would be better,
but in this case we can simply delegate the request to the correct actor.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1065
2019-04-30 20:59:28 +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
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
e68dfed1f7 cleanup: Port GObject classes to JS6 classes
GJS added API for defining GObject classes with ES6 class syntax
last cycle, use it to port the remaining Lang.Class classes to
the new syntax.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/361
2019-01-25 14:02:44 +00: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
Georges Basile Stavracas Neto
e9f4f2e8ae
thumbnailBox: Stop using Shell.GenericContainer
This is another straight port from Shell.GenericContainer.
The important thing to notice is that the calculation is
broken if the StThemeNode helpers (adjust_preferred_* and
adjust_for_*) aren't used.

The downside of this patch is that it removed the skip_paint
from the thumbnails. Keeping it would add an unecessarily
large amount of code.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/153
2018-10-08 22:42:25 -03:00
Florian Müllner
764fbbe052 overview: Restore previous workspace switcher policy
We used to keep the workspace switcher slid out when the user made use
of workspaces. This was changed in commit 2d84975 to give more space
to window previews, but it turned out to make the switcher quite a lot
more difficult to interact with (rather than only being a question of
discoverability). So go back to the previous behavior.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/161
2018-08-14 17:34:57 +00:00
Florian Müllner
328c63bf64 overviewControls: Sync hover after drag operations
During global grabs, actors miss enter and leave events required
for correct hover tracking. This can cause the workspace switcher
to get stuck while slid out, so ensure the actor's hover state is
synced after drag operations.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/161
2018-08-14 17:34:57 +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
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
2d849759c8 overview: Don't expand workspace thumbnails by default
We currently expand the workspace switcher when workspaces are being
used, that is when there are any windows on a non-active workspace.
While this helps with the switcher's discoverability, it does eat into
the space available for window previews. By now the component should
be well established, so we can afford opting for space efficiency and
only expand the switcher while the user actually interacts with it.

https://bugzilla.gnome.org/show_bug.cgi?id=783953
2017-08-10 20:16:06 +02: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
c39ffa111f overview: Move overview actions and scrolling to background group
Both the Overview::scroll-event and actions added via addAction()
are meant to work anywhere in the overview, but for now only work
on the primary monitor. Move the handling to the background group
that is known to span all outputs to fix.

https://bugzilla.gnome.org/show_bug.cgi?id=766883
2016-06-27 16:31:00 +02:00
Florian Müllner
4a709792cd overviewControls: Remove message indicator
The message tray is now empty and about to be removed, so an indication
at the bottom edge of the overview becomes an odd location to convey the
status of the summary. We will eventually display an indication in the
top bar that unseen messages are available, for now just remove the
existing indicator.

https://bugzilla.gnome.org/show_bug.cgi?id=744850
2015-02-20 17:40:21 +01:00
Florian Müllner
5a8923ef95 notificationDaemon: Remove support for legacy status icons
Tray icons make for a terrible UI on their own, but trying to
shoehorn them into the notification system has only made them
worse. At least for the time being this removal is temporary
and support for tray icons will be back, but no longer as part
of the notification system.

https://bugzilla.gnome.org/show_bug.cgi?id=744815
2015-02-20 01:47:20 +01:00
Florian Müllner
aa3caff714 overviewControls: Really fix x align
Commit a4475465f1 fixed the wrong alignment for the fully visible
control, but regressed the partially slid-out one; take the slideX
factor into account to get the right offset for both cases.
2014-10-10 11:16:35 +02:00
Florian Müllner
a4475465f1 overviewControls: Fix thinko in SlideLayout
Controls that slide left are located on the left, so the offset to
align them with the corresponding edge is always 0. It's controls
on the right that need a different offset when the available width
exceeds the child's width.

https://bugzilla.gnome.org/show_bug.cgi?id=728899
2014-10-09 14:21:23 +02:00
Florian Müllner
38c70e73b9 overviewControls: Use correct translation in dragBegin
Commit 12845f0eef reset translationX to 0 to fix the slide-in
animation of the dash when dragging a search result, but 0 is the
wrong value for the thumbnail slider - the next time it will be
shown, it will just pop up instead of sliding in due to translationX
already being at its target value.
Fix this by making _updateTranslation take the actual visibility into
account and call that to set the correct translation in dragBegin.
2014-09-02 00:19:37 +02:00
Florian Müllner
e60bf44c2e overviewControls: Fix initial slide-in animation
Controls are slided in by animating translationX from the actor's
width to 0; however as _updateTranslation() will skip the animation
when the property is already at its target value and 0 happens to be
the initial value of translationX, the initial animation is skipped.
Fix this by initializing translationX to undefined, which will always
differ from a valid target value.
2014-09-02 00:19:37 +02:00
Florian Müllner
746a8692ac overviewControls: Don't update translation on slideIn()
The comment is right, updating the translation should be deferred
to pageEmpty, or else overview controls will just pop up instead
of sliding in. So revert that part of commit 6a7fa52879.
2014-09-02 00:19:37 +02:00
Florian Müllner
a00762ddd9 overviewControls: Fix typos in comment 2014-09-02 00:19:23 +02:00
Carlos Soriano
805b686576 overviewControls: don't override explicit calls to slideIn
Currently we are overriding the explicit calls to slideIn
given that it's called also with the signal of showing overview.

It was necessary because of the bug that previous patch fixed,
so now we can just delete that.

https://bugzilla.gnome.org/show_bug.cgi?id=732901
2014-08-08 16:40:41 +02:00
Florian Müllner
50f0fc4e23 overviewControls: Adjust heuristic for hiding workspace switcher
The workspace switcher should be expanded when workspaces are in use.
Our current implementation assumes that workspaces are used when there
are windows on at least two workspaces. However workspaces are already
used when moving from a non-empty workspace to an empty one (presumably
with the intention to launch something on that workspace), so tweak the
heuristic accordingly.

https://bugzilla.gnome.org/show_bug.cgi?id=662457
2014-04-30 18:06:52 +02:00
Jasper St. Pierre
b52e74b615 messageTray: Remove transient sources
As far as I can tell, the only behavior change of a transient source
is that they auto-destroy after viewing their summary box pointer.
Since all transient sources are only associated with transient
notifications, it seems that we can never get to their summary box
pointer in the first place! Remove support for this.

https://bugzilla.gnome.org/show_bug.cgi?id=710115
2013-12-04 20:25:28 -05:00
Jasper St. Pierre
ea2451d882 overviewControls: Fix bad expression causing incorrect thumbnails allocation
`a + b ? c : d` is parsed as `(a + b) ? c : d`, not the more intuitive
`a + (b ? c : d)`.

This was causing a bad slide animation and Clutter warnings when coming
out of the overview.
2013-11-02 20:07:06 -04:00
Jasper St. Pierre
e6c28cf509 Revert "overviewControls: Always allocate the actor its full size"
This reverts commit f5a9dbb348.

This broke the alignment of the workspace thumbnail widget. I don't
know why, but let's not break things if we can...
2013-10-30 18:33:13 -04:00
Jasper St. Pierre
88393f0f65 overviewControls: Move translation-x to SlideLayout
Not because ClutterActor is bad or wrong, but because I always get
confused on the difference, and having them both in SlideLayout
makes the code a bit easier to read and understand.
2013-10-30 13:16:45 -04:00
Jasper St. Pierre
f5a9dbb348 overviewControls: Always allocate the actor its full size
This is the new Clutter way -- if the actor wants to adjust its
alignment, it will do it itself with its alignment flags.
2013-10-30 13:16:45 -04:00
Jasper St. Pierre
dbf3bb112c overviewControls: Make getSlide/updateSlide private 2013-10-30 13:16:45 -04:00
Jasper St. Pierre
f3186bd501 overviewControls: Make visible and inDrag private
These don't need to be accessed from outside SlidingControl,
so don't let them be.
2013-10-30 13:16:44 -04:00
Jasper St. Pierre
3f1a252b91 overviewControls: Move slideOut on overview hide to the parent as well 2013-10-30 13:16:44 -04:00
Jasper St. Pierre
1240d6be76 overviewControls: Remove dead code
The parent SlidingControl had an onOverviewShowing, but we had
overridden it with the same code in both subclasses. Just move it
back to SlidingControl.
2013-10-30 13:16:44 -04:00
Jasper St. Pierre
faf7b62f5c overviewControls: Mark the DashSlider as x_expand
Actors need to expand in order for them to their x_aligns to be taken
into account.
2013-10-30 13:16:44 -04:00
Jasper St. Pierre
445011b1e5 overviewControls: Add the parent's box into the allocation
Currently, this is always 0, but this will change when we introduce
a custom layout manager into the story.
2013-10-30 13:16:44 -04:00
Jasper St. Pierre
89b9d079b1 overviewControls: Don't use the child's preferred size to slide from
In order for the workspace thumbnails box to have the correct size,
we need to constrain the width of the thumbnails box to the height we're
given, instead of assuming an unlimited height.

https://bugzilla.gnome.org/show_bug.cgi?id=694881
2013-10-12 14:38:13 -04:00
Jasper St. Pierre
58a8845047 overviewControls: Don't try to align something sliding to the right
0 is already the correct value.

https://bugzilla.gnome.org/show_bug.cgi?id=694881
2013-10-12 14:38:13 -04:00
Jasper St. Pierre
3e6c8e68b4 overviewControls: Clarify some code with a comment
translationX is sort of a bad name, since it confuses with the
actor's translation, which is used for sliding without allocation.

https://bugzilla.gnome.org/show_bug.cgi?id=694881
2013-10-12 14:38:13 -04:00
Jasper St. Pierre
40cd92f701 overviewControls: Correct the use of x2 in SlidingControl
The x2 here needs to be more than just the width; it needs to
be added onto the x1.

https://bugzilla.gnome.org/show_bug.cgi?id=694881
2013-10-12 14:38:13 -04:00
Jasper St. Pierre
508a511d2a Revert "overviewControls: Don't allow appearing controls to "pop in""
This reverts commit e31693bbee.

This doesn't properly adjust the allocation, leading to an unbalanced
overview where things aren't centered properly. Just revert for now,
and we'll rethink this next cycle.
2013-09-26 16:20:06 -04:00
Jasper St. Pierre
e31693bbee overviewControls: Don't allow appearing controls to "pop in"
When coming back from search or apps, the workspace thumbnails and dash
don't slide in but "pop in". This is because of bad timing: when slideIn
is called, we immediately start the translation animation, and it
completes before by the time we fade the new page in.

Fix this by calling slideIn and slideOut at two different times: we now
slide out when the old page with our controls is fading out, and slide in
when the new page with our controls is fading in.

https://bugzilla.gnome.org/show_bug.cgi?id=708340
2013-09-26 13:39:20 -04:00
Florian Müllner
df09109d81 overviewControls: Use a custom layout to catch all geometry changes
We currently update workspaces geometry when we are notified about
allocation changes of the overview group; however as the geometry
is based on stage coordinates, we miss notifications when the
allocation relative to the parent is unchanged, which happens when
the primary monitor's position changes but not its resolution.
Use a custom layout manager to give us a signal that is emitted
reliably.

https://bugzilla.gnome.org/show_bug.cgi?id=708009
2013-09-13 13:50:31 +02:00
Tarun Kumar Joshi
6a7fa52879 overviewControls: Slide dash and workspace switcher when entering and exiting overview
Adds a slide in effect to dash and workspace switcher when entering the
overview and adds a slide out effect while exiting it.

http://bugzilla.gnome.org/show_bug.cgi?id=694262
2013-08-15 18:27:15 +02:00
Jasper St. Pierre
5a2269c6c6 overviewControls: Don't push window thumbs over when workspaces are invisible
Make the sliding control invisible when the thumbnails box is as well.

https://bugzilla.gnome.org/show_bug.cgi?id=701167
2013-05-29 13:04:45 -04:00