Commit Graph

251 Commits

Author SHA1 Message Date
Florian Müllner
26235bbe54 js: Use (dis)connectObject()
Start using the new methods to simplify signal cleanup. For now,
focus on replacing existing cleanups; in most cases this means
signals connected in the constructor and disconnected on destroy,
but also other cases with a similarly defined lifetime (say: from
show to hide).

This doesn't change signal connections that only exist for a short
time (say: once), handlers that are connected on-demand (say: the
first time a particular method is called), or connections that
aren't tracked (read: disconnected) at all.

We will eventually replace the latter with connectObject() as
well - especially from actor subclasses - but the changeset is
already big enough as-is :-)

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1953>
2022-03-04 14:14:37 +00:00
Florian Müllner
4735193456 dash: Fix drag placeholder position in RTL
The position corresponds to a child index, which means it must
be mirrored when starting to count from the right.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4574

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2219>
2022-03-03 20:19:19 +00:00
Florian Müllner
2b45a01517 cleanup: Use new indentation style for object literals
We have made good progress on object literals as well, although there
are still a lot that use the old style, given how ubiquitous object
literals are.

But the needed reindentation isn't overly intrusive, as changes are
limited to the object literals themselves (i.e. they don't affect
surrounding code).

And given that object literals account for quite a bit of the remaining
differences between regular and legacy rules, doing the transition now
is still worthwhile.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2200>
2022-02-23 12:23:52 +00:00
Jonas Dreßler
2607880bf6 dash: Subtract vertical margins from availHeight
The vertical margins are part of this._maxHeight, so we need to subtract
it in order to propery limit icon sizes when the available height is too
small.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2191>
2022-02-16 20:08:44 +00:00
Rachit Keerti Das
a67877f520 dash: Use pin instead of favorites
Use the term 'pin' for adding new items to the dash
Note that this is only a string change.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2136>
2022-02-07 14:12:04 +00:00
Raghuveer Kasaraneni
07579f05f6 dash: Fixes wrong separator position
Sometimes when an icon is dragged and dropped in Dash, one Favourite app icon
can appear to the right of Dash separator. This can happen when available system
resources are low and the PlaceHolder destroy animation is delayed and the
corresponding container child is still present. With this commit the separator
position is calculated correctly, even when the animation is pending.

Fixes #3966, #3799

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1804>
2021-09-01 15:10:14 +00:00
Georges Basile Stavracas Neto
c0a4d90847 overviewControls: Limit Dash height to 15% of the overview's
Back when the Dash was vertical, the size of each item was calculated
solely based on the available height. After making the Dash horizontal,
this was swapped by the available width. However, when the height of the
Dash decreases, the current code results in never scaling them up ever
again.

Fix that by making ControlsManagerLayout explicitly pass the maximum Dash
sizes. Remove the 'notify::width' handler that served the same purpose.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1638>
2021-02-11 22:31:50 +00:00
Florian Müllner
3a9acb9602 dash: Re-fittsify
Now that the dash is no longer attached to a screen edge, it lost
its "infinite width" (Fitts' law). Restore it by moving the visible
bar into a separate layer underneath the actual icons, extend the
icons to the bottom edge, and replace the margin around the dash
with padding inside the icons.

https://gitlab.gnome.org/Teams/Design/os-mockups/-/issues/89

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1660>
2021-02-10 15:46:00 +00:00
Florian Müllner
5c31ef6ae2 dash: Reindent some more code
Again we're about to touch it.

https://gitlab.gnome.org/Teams/Design/os-mockups/-/issues/89

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1660>
2021-02-10 15:46:00 +00:00
Florian Müllner
73b94c3901 overviewControls: Remove DashFader
By now there is so little left of the old sliding controls that the
split from the actual dash makes little sense.

https://gitlab.gnome.org/Teams/Design/os-mockups/-/issues/89

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1660>
2021-02-10 15:46:00 +00:00
Florian Müllner
9aa25eaa0b dash: Consider additions for separator visibility
The children variable holds the icons that were originally in
the dash. For the separator visibility, we should consider the
icons that are in the dash after the update, so we must consider
additions as well as removals.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1659>
2021-02-10 09:09:34 +00:00
Florian Müllner
151a104f9a dash: Only show separator when there are running apps
The separator is only really needed to distinguish favorite apps
from running apps, the show-apps button is distinct enough already.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1610>
2021-01-30 09:44:11 +00:00
Florian Müllner
55d85cd55b dash: Add separator between favorite and running apps
Only the area used by favorite apps can be used as drop targets, it
is not possible to add new favorites between the running apps at the
end. While that behavior makes sense, it is currently impossible to
distinguish the two areas with confusing results.

Address this by adding a visual separator between favorites and
running apps.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1606>
2021-01-29 00:30:20 +00:00
Florian Müllner
9f1eb6da2b dash: Replace custom actor with layout manager
We use a custom actor to make sure that the show-apps button remains
visible even when there's not enough space to show all icons.

We can achieve the same result with much less code, by using a custom
BoxLayout layout manager for the icons to override the minimum width.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1592>
2021-01-25 22:53:34 +00:00
Georges Basile Stavracas Neto
1e2532cf25 dash/dashIcon: Popup menu above the icon
Now that the Dash is horizontal, the popup menu of the Dash icons must
show up, instead of left/right.

Make AppIcon.popupMenu() receive an optional parameter with the side
to show the menu, using St.Side.LEFT as default. Override this method
in DashIcon to always pass St.Side.TOP.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1559>
2021-01-19 13:47:06 +00:00
Abderrahim Kitouni
0a23721364 dash: Fix 'All apps' button position in RTL locales
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1559>
2021-01-19 13:47:06 +00:00
Georges Basile Stavracas Neto
97eb4560ef Make Dash horizontal
And move it to the bottom of the overview. Change the height-based calculation
of the icon sizes to be width-based. Put the DashFader in a vertical box, and
make all corners of the Dash equally rounded.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1559>
2021-01-19 13:47:06 +00:00
Georges Basile Stavracas Neto
e3542d5849 dash: Allow icon sizes equal to the available space
When checking for a suitable icon size, Dash currently checks which
of the hardcoded icon sizes is smaller than the calculated available
size.

On some circumstances, however, when the calculated available size
is exactly equal to the hardcoded icon sizes, Dash selects a smaller
size. This cascades (the next icon size is exactly the smaller size,
etc) and ends up with always Dash selecting smallest size available,
even with plenty of available space.

Check if the calculated available size is smaller or equal to the
hardcoded icon sizes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1533>
2020-12-11 17:42:56 +00:00
Florian Müllner
432c2863ab dash: Restore icon's expected DND behavior
Commit ff3d32dd18 added a custom DashIcon subclass that disables
all DND methods from ancestors, including canceling the context
menu timeout and emitting the overview's item-drag-begin signal.

All we want is opting out of the parent's scale-and-fade behavior,
so override those methods instead.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3209
2020-10-02 15:41:04 +00:00
Daniel van Vugt
206d1fa650 dash: Hide the tooltip when an item is clicked
So that when the 'Show Applications' button is clicked the icons don't
fly *through* the tooltip.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1423
2020-09-03 15:25:19 +00:00
Jonas Dreßler
9b99b67fea Remove ClutterAllocationFlags
Those flags were removed from Clutter since they're pretty much unused,
so remove them here, too.

See https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1245

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1245
2020-05-20 15:12:03 +02:00
Bryan Dunsmore
0737c8f416 dash: Allow adding favorites out of favorites zone
Previously, you could not add favorites outside of the favorites zone.
This change inserts a placeholder at the end of the favorites zone if
you are outside of it.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2777
2020-05-14 18:32:57 +00:00
Daniel van Vugt
c773c8c162 Revert "js/ui: Use Clutter.OffscreenRedirect.ON_IDLE"
This reverts commit c0c027c608. Because for
some reason animating external opacity and position is still incurring
internal repaints, which disables offscreening and makes fading of
overlapping actors look wrong. `ON_IDLE` should be fixed in mutter before
it is used (in boxpointer at least) again.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/2270
2020-02-26 11:54:54 +08:00
Daniel van Vugt
c0c027c608 js/ui: Use Clutter.OffscreenRedirect.ON_IDLE
To bypass offscreening in cases where continuous animation is happening.
Offscreening is slower in such cases so this reduces the render time of
animations within offscreenable actors.

On an i7-7700 this reduces the render time of boxpointers for example by
25-30%.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1025
2020-02-21 12:19:15 +00:00
Florian Müllner
e44adb92cf cleanup: Avoid unnecessary parentheses
Extra parentheses usually add noise rather than clarity, so avoid
them.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/805
2019-11-11 19:25:14 +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
07cc84f632 cleanup: Only omit braces for single-line blocks
Braces can be avoided when a block consists of a single statement,
but readability suffers when the statement spans more than a single
line.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/805
2019-11-11 19:25:14 +00:00
Florian Müllner
9eaa0089d0 cleanup: Fix missing/stray spaces
Those are wrong according to our style guidelines, but the previous
eslint ruleset didn't catch them.

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
Florian Müllner
f2bd39b20c js: Use generic actor properties to align StBin children
StBin's fill/align properties are now no-ops; get back the intended
child allocation by setting the corresponding x/y-align on the child.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/803
2019-11-04 21:27:56 +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
Georges Basile Stavracas Neto
0615370930 Replace Clutter.Point by Graphene.Point
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/421
2019-10-16 10:49:04 +00:00
Marco Trevisan (Treviño)
279024afc2 js: Replace Tweener time leftovers with ease duration
In some places we were not properly animating the actors as still using the
non-existent 'time' property instead of 'duration'

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/758
2019-10-10 02:14:28 +02: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
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
Georges Basile Stavracas Neto
ff3d32dd18
appIcon: Make AppIcon a drop target
Because the Dash icons are not drop targets themselves,
add a tiny DashIcon class, which is an AppDisplay.AppIcon
subclass, and disable all DND drop code from it.

Show a folder preview when dragging an app icon over another
app icon.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/671
2019-08-09 10:58:38 -03:00
Georges Basile Stavracas Neto
be6ce3c5b4
appIcon: Scale and fade itself when starting drag
As per design direction, scale and fade the app icon
when starting dragging it, and show it again if the
drop is accepted. Clutter takes care of animating the
rest of icon positions through implicit animations.

Scale and fade the dragged icon while it's being dragged.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/671
2019-08-09 10:58:38 -03: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
8eb88d17fe dash: Directly tween actors
Dash items are currently animated via the custom "childScale" and
"childOpacity" properties. However since commit efb3025d8c, those
properties actually control the scale-x/scale-y and opacity properties
of the actor itself (not the child), so cut out the intermediate
custom properties in favor of the "real" ones.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/22
2019-08-06 20:50:43 +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
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
11b116cb9d cleanup: Remove some unhelpful unused variables in destructuring
We aren't using them, and they don't add much in terms of clarity,
so drop them to fix a couple of eslint errors.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/627
2019-07-24 00:28:45 +02:00
Florian Müllner
2f97a1a55d cleanup: Mark unused arguments as unused
This will stop eslint from warning about them, while keeping their
self-documenting benefit.

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
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
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
Florian Müllner
f6b4b96737 cleanup: Use Array.includes() to check for element existence
We can use that newer method where we don't care about the actual position
of an element inside the array.

(Array.includes() and Array.indexOf() do behave differently in edge cases,
for example in the handling of NaN, but those don't matter to us)

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/152
2019-07-01 21:28:52 +00:00
Veerasamy Sevagen
b197a1affb cleanup: Fix spelling errors
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/515
2019-05-15 19:32:29 +00:00