Commit Graph

620 Commits

Author SHA1 Message Date
Georges Basile Stavracas Neto
4c2c1297be appDisplay: Move child focus handling to IconGrid
The icon grid is always paginated, so the app grid code doesn't need
to behave differently in the FolderView and AppDisplay.

Move the keyboard handling to IconGrid itself, and remove the now dead
code from AppDisplay.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1271
2020-06-18 10:30:12 -03:00
Georges Basile Stavracas Neto
4e05bcd3b6 iconGrid: Use IconGridLayout
Replace the current grid code with IconGridLayout.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1271
2020-06-18 10:30:12 -03:00
Georges Basile Stavracas Neto
687928e7b7 appDisplay: Don't fade icons when a folder dialog is open
The folder dialog itself now has a background, there's no
need to fade the icons anymore.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1301
2020-06-09 16:14:30 -03:00
Georges Basile Stavracas Neto
ffdf3feb04 appDisplay: Fade the dialog background
As a last step towards the better app grid, add a semi-transparent
black background to the folder dialog.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1301
2020-06-09 16:14:30 -03:00
Georges Basile Stavracas Neto
a60b8b3b50 appDisplay: Set minRows to 3 in folder dialog grid
It gives the folder dialog a better layout overall. This is
going to be replaced in the future by the new icon grid code,
but it's a good improvement to have until there.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1301
2020-06-09 16:14:30 -03:00
Georges Basile Stavracas Neto
3d6add68c7 appDisplay: Hide folder icon when dialog is open
In such a way that gives the illusion of the icon becoming
the dialog itself.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1301
2020-06-09 16:14:30 -03:00
Georges Basile Stavracas Neto
85e055ffe3 appDisplay: Don't change search entry's reactive state
The folder dialog eats all events now, there's no need to
disable the search entry anymore.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1301
2020-06-09 16:14:29 -03:00
Georges Basile Stavracas Neto
1691e422e7 appDisplay: Remove unused variable
As the title says.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1301
2020-06-09 16:14:29 -03:00
Georges Basile Stavracas Neto
f442c9510e appDisplay: Fix misnamed variable
This should have been renamed to "displayingDialog" by
commit 7781f973f2.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1301
2020-06-09 16:14:29 -03:00
Georges Basile Stavracas Neto
0de98eb772 appDisplay: Don't connect to 'space-closed'
This signal doesn't exist anymore.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1301
2020-06-09 16:14:29 -03:00
Georges Basile Stavracas Neto
30172b5625 appDisplay: Popdown folder dialog on DnD
So that we're still able to drag icons out of folders, and to the
Dash. Wait 600ms (MENU_POPUP_TIMEOUT) before popping it down.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1301
2020-06-09 16:13:30 -03:00
Georges Basile Stavracas Neto
8ae99a6898 appDisplay: Remove event blocker
It is unused now.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1301
2020-06-09 16:01:08 -03:00
Georges Basile Stavracas Neto
5cfe5bf8c8 appDisplay: Move click action to dialog
Now that the folder dialog covers the whole primary
monitor, it eats all input events, and doesn't allow
the event blocker to detect clicks.

Move the click action to the folder dialog itself, and
popdown the dialog if a click is triggered on the dialog
(but not on any children).

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1301
2020-06-09 16:01:08 -03:00
Georges Basile Stavracas Neto
c790c01a3b appDisplay: Move adaptToSize call to FolderView
There is absolutely no need to handle this in the dialog
itself.

Move the call to adaptToSize into FolderView.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1301
2020-06-09 16:01:08 -03:00
Georges Basile Stavracas Neto
d4a947b475 appDisplay: Zoom dialog child in and out
Instead of zooming the dialog itself, zoom its only
child, which is the "actual" user-visible dialog.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1301
2020-06-09 16:01:08 -03:00
Georges Basile Stavracas Neto
60d7999b6a appDisplay: Make AppFolderDialog subclass St.Bin
It'll simplify things a bit.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1301
2020-06-09 16:01:08 -03:00
Georges Basile Stavracas Neto
c040d08b97 appDisplay: Make folder dialog cover the whole screen
Future commits will improve input handling of the folder
dialog, and they'll require the dialog to cover the whole
primary monitor.

Add another internal, center-aligned container to the
folder dialog, and make it cover the whole available area.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1301
2020-06-09 16:01:08 -03:00
Georges Basile Stavracas Neto
3a53b25873 appDisplay: Constrain dialog to primary display
Much like the overview controls themselves are tied to the
primary display, constrain the folder dialog to the primary
display as well.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1301
2020-06-09 16:01:08 -03:00
Georges Basile Stavracas Neto
d8e6f654a3 appDisplay: Add folder dialog to overview group
Right now, the app folder dialog isn't really a dialog,
since it is actually added to the AppDisplay. Furthermore,
having it added in AppDisplay may mess up with its sizing
calculations, since AppDisplay has a ClutterBinLayout and
the folder dialog has a fairly large minimum size.

Add the folder dialog to the overview group. Next commits
will adjust various actors to be able to better handle it.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1301
2020-06-09 16:01:08 -03:00
Georges Basile Stavracas Neto
8154728d09 environment: Add Math.clamp
The good old clamp function, now part of the Math family.
Clamp is happy after so many years of loneliness.

This is a strict implementation of the draft ECMAScript
proposal.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1295
2020-06-03 12:55:53 -03:00
Georges Basile Stavracas Neto
f09fbb19cf iconGrid: Merge PaginatedIconGrid and IconGrid
Now that the only user of the IconGrid is AppDisplay, and
it only uses the paginated icon grid, there's no point in
having the two classes split anymore.

In addition to that, future commits will introduce a layout
manager that will extend current icon grid features, and
merging PaginatedIconGrid and IconGrid in the same class will
vastly simplify this transition.

Merge PaginatedIconGrid into IconGrid, and adapt AppDisplay
to this change.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1267
2020-05-27 19:23:56 -03:00
Georges Basile Stavracas Neto
846fa77b37 appDisplay: Merge AppDisplay in AllView
Now that AllView is the only actor that AppDisplay creates,
we can actually merge them together.

Merge AllView in AppDisplay, remove what used to be AppDisplay,
and rename AllView to AppDisplay.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/880
2020-05-27 21:06:36 +00:00
Georges Basile Stavracas Neto
b57bcf823f appDisplay: Simplify AppDisplay
Inherit St.Widget and remove the custom layout manager. Instead,
override vfunc_allocate(). Also remove the view stack.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/880
2020-05-27 21:06:36 +00:00
Georges Basile Stavracas Neto
548e19a7cd appDisplay: Remove Frequent view
The Frequent apps grid has a few problems:

 * On a fresh install there would be no history of app usage so the
   applications shown in the grid have no relevance it takes time
   to be useful instead of being useful from the start;

 * The grid has far too many items in it to be relevant; 24 apps is
   well beyond the average use case as most people don't frequently
   use that many, so it gets populated with several apps that are
   single use (hello xterm);

 * The position of items in the grid are always changing based on an
   unknown frequency metric (and not by user-intended input) which
   makes it a poor way to quickly launch apps as one would have to
   constantly learn the positions of the items in the grid;

 * Having two app grids is a bit superfluous and needlessly complicates
   the app launching navigation: you have to spend time checking the
   frequent grid and if it's not there you have to switch over to another
   grid and find the app you need in there it's not straightforward.

Remove the Frequent tab and simplify the related code.

Related: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1425

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/880
2020-05-27 21:06:36 +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
Alexander Mikhaylenko
6895592a7b appDisplay: Lower scroll timeout
Looks like 250ms is too high, lower it to 150ms.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2602
2020-05-09 19:27:33 +05:00
Bastien Nocera
34da48453e shell-app: Add PrefersNonDefaultGPU support to shell_app_launch()
Read the "PrefersNonDefaultGPU" key in desktop files to figure out
whether the application prefers running on the discrete GPU, or the
default GPU, and apply that.

Update the "Launch..." contextual menu to allow launching on
the default GPU if the application "prefers [the] non default GPU".

See:
https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#recognized-keys

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/1804
2020-05-04 16:22:03 +02:00
Bastien Nocera
3bfa9916da appDisplay: Use global switcheroo-control D-Bus proxy
Rather than creating our own.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1226
2020-05-04 16:22:03 +02:00
Florian Müllner
153b7d525d cleanup: Don't linebreak before closing parentheses
Otherwise recent versions of eslint want "dangling" commas,
which is at least ugly considering that most functions don't
allow adding arguments at leasure.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1177
2020-04-28 09:04:49 +00:00
Georges Basile Stavracas Neto
2a9ccf2e2c appDisplay: Return the parent class' result in overrides
StButton returns CLUTTER_EVENT_STOP in various circumstances, but
AppIcon throws that away and returns CLUTTER_EVENT_PROPAGATE even
when it should stop.

Return the parent class' result instead of CLUTTER_EVENT_PROPAGATE.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1211
2020-04-23 19:14:43 -03:00
Georges Basile Stavracas Neto
2909d91c13 appDisplay: Use const instead of let in vfunc_leave_event
The return value of the chain up is not changed, let's use the
proper descriptor.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1211
2020-04-23 19:14:40 -03:00
Jonas Ådahl
b3b91f1699 js: Drop tweener.js
We're using clutter's animation framework now, so lets drop the old
tweener support layer.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1200
2020-04-15 13:25:14 +00:00
Florian Müllner
3fac0632a8 appDisplay: Look up directory- instead of category translations
Translations are provided by .directory files, so trying to look
up a category name without the suffix will always fail.

Commit 343b3351f1 tried to fix this previously by changing the
saved keys, but that broke existing translatable folders.

Appending the .directory suffix for the lookup instead fixes the
issue without regressing non-custom folders.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2623
2020-04-13 14:56:34 +00:00
Georges Basile Stavracas Neto
167bc080d9 appDisplay: Reorganize AppDisplay actor hierarchy
Right now, the actor hierarchy is such that the scroll view
does not contain the actual grid. It looks as follows:

              StScrollView
                    ↓
               StBoxLayout
                    ↓
                ShellStack
                ↓        ↓
   PaginatedIconGrid     StWidget

This hierarchy can be slightly reorganized by changing it to be as
follows:

            ShellStack
             ↓     ↓
   StScrollView   StWidget
        ↓
   StBoxLayout
        ↓
 PaginatedIconGrid

This will simplify future work where the PaginatedIconGrid will be
an implementation of StScrollable, in which case we'll be able to
simply remove the StBoxLayout from there.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1191
2020-04-08 21:12:06 -03:00
Philip Withnall
3e5b90dbba js: Add support for parental controls filtering to the desktop
Filter the apps shown on the desktop and in search results according to
whether they are blacklisted by the user’s parental controls.

This supports dynamically updating the filter during the user’s session.

This adds an optional dependency on libmalcontent. If that’s unavailable, no
parental controls filtering will occur.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/465
2020-04-07 17:47:29 +02:00
Georges Basile Stavracas Neto
b27c89f836 appDisplay: Set the folder icon geometry through CSS
The CSS engine is scale-aware, whereas simply setting the
width and height properties directly isn't.

Use CSS to set the folder icon.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1176
2020-04-06 11:24:30 -03:00
Florian Müllner
1666fa195d js: Account for promisified call() method
A promisified method expects the callback parameter to be either
a function (in which case the original method is called normally)
or omitted altogether (in which case a Promise is returned).

The call to open application details in Software does neither and
passes null instead, which will result in a warning (because no
function argument means a promise will be used, but not omitting
the parameter means we end up with too many arguments).

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2551
2020-04-03 02:02:40 +00:00
Jonas Ådahl
a9df4e7516 appDisplay: Don't clear signal handler id before emitting
Otherwise we won't clear the 'view-loaded' handler after it was emitted.

Also move field initialization to the correct place, i.e. the init
function of the base class.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1169
2020-04-02 20:53:20 +00:00
Jonas Ådahl
f49b58cf97 appDisplay: Clear animateLater callbacks when unmapping
In some situations we could end up not with lingering 'view-loaded'
handler. This could result in delayed spring animate-in being initiated,
e.g. after a minute after the activities overview was already closed.

Fix this by removing any lingering signal or later handlers when
unmapping.

Fixes: 5c33fe4a0a

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1155
2020-03-31 19:05:15 +02:00
Florian Müllner
764527c8c9 js: Promisify async operations
Promises make asynchronous operations easier to manage, in particular
when used through the async/await syntax that allows for asynchronous
code to closely resemble synchronous one.

gjs has included a Gio._promisify() helper for a while now, which
monkey-patches methods that follow GIO's async pattern to return a
Promise when called without a callback argument.

Use that to get rid of all those GAsyncReadyCallbacks!

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1126
2020-03-31 05:43:40 +00:00
Jonas Ådahl
5c33fe4a0a appDisplay: Don't start animation from the 'paint' signal
Starting the animation from the actor 'paint' signal has various
unwanted consequences, such as sometimes trigger a
clutter_actor_queue_relayout() during the paint phase. One unwanted
consequence was that an offscreen actor effect was disabled during
painting, meaning the effect would begin being active, but later during
the post-paint processing being disabled. The caused said effect to push
an offscreen framebuffer to the paint context, but then just destroy it
instead of popping it. When this happened, we'd end up trying to operate
on a framebuffer that may had been finalized, or not, depending on the
garbage collector. Sometimes, for some users, this caused a segmentation
fault when trying to pop a matrix from the framebuffer matrix stack.

Deal with this more properly, by using the 'view-loaded' signal to wait
with animation until the view is loaded, as well as using MetaLater to
schedule the start of the animation.

For when a view was signalled to be ready, we're in a state where we can
start animation before the next frame as the layout is ready, but when
not, we have to add back the "hack" where we must wait for one frame for
the target icon positions to be up to date. Do this by adding a
MetaLater IDLE callback that starts the animation *after* the next
frame. This also needs the old 'opacity = 0' work around to not show an
incorrect first frame.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2418

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1154
2020-03-30 16:24:31 +00:00
Florian Müllner
4f427f4e0d js: Do not set entries' ClutterText:editable property
The property influences the text's (and thus entry's) minimum width[0],
which is generally not what we want. And as we now prevent text from
being entered in non-reactive entries by other means, we can simply
drop it.

[0] https://gitlab.gnome.org/GNOME/mutter/-/blob/master/clutter/clutter/clutter-text.c#L2940

https://gitlab.gnome.org/GNOME/gnome-shell/issues/2423
2020-03-29 22:12:57 +02:00
Florian Müllner
34c4627db9 st/entry: Bind ClutterText reactivity to entry
The text is part of the entry, so it is surprising that it can
still be edited when the entry itself isn't reactive. Address
this by setting up a binding instead of expecting all consumers
to handle the case themselves.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/2423
2020-03-29 22:12:57 +02:00
Jonas Dreßler
702417ce83 appDisplay: Only use dragMonitor for one icon at a time
Instead of adding a dragMonitor for every icon in the grid as soon as
one icon is getting dragged, only add a dragMonitor for the icon that is
currently being dragged over (ie. the current drag-target). With a large
number of icons in the iconGrid, this should significantly reduce lags
while dragging.

We can do this by detecting the DnD-entering of an icon or folder using
the `handleDragOver()` callback of drag-targets, adding the dragMonitor
because we know an icon is hovering above the drag-target and then
detecting the DnD-leaving of the drag-target by using the `dragMotion()`
handler, where we remove the dragMonitor again as soon as the
targetActor is no longer our actor (ie. the drag-target).

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/849
2020-03-27 22:38:41 +00:00
Jonas Dreßler
766e9034e2 appDisplay: Remove dragMonitor when FolderIcon is destroyed
While it should be impossible to destroy a FolderIcon while a DnD action
is still going on, there might still be rare cases where this happens
(ie. when a folder is removed because an app got deleted during DnD).

So make sure we're on the safe side here and don't potentially leave
dragMonitors around after the icon is destroyed by removing the
dragMonitor inside the onDestroy handler of the FolderIcon, just like we
do for AppIcons.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/849
2020-03-27 22:38:41 +00:00
Florian Müllner
66f9a9df81 js: Always use AppSystem to lookup apps
There is no good reason for bypassing the application cache in
AppSystem and loading .desktop files again.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1093
2020-03-14 20:33:36 +01:00
Christian Hergert
f8db5aa106 app-cache: add ShellAppCache for GAppInfo caching
This caches GAppInfo so that the compositor thread does not have to perform
costly disk access to load them. Instead, they are loaded from a worker
thread and the ShellAppCache notifies of changes.

To simplify maintenance, ShellAppCache manages this directly and the
existing ShellAppSystem wraps the cache. We may want to graft these
together in the future, but now it provides the easiest way to backport
changes to older Shell releases.

Another source of compositor thread disk access was in determining the
name for an application directory. Translations are provided via GKeyFile
installed in "desktop-directories". Each time we would build the name
for a label (or update it) we would have to load all of these files.

Instead, the ShellAppCache caches that information and updates the cache
in bulk when those change. We can reduce this in the future to do less
work, but chances are these will come together anyway so that is probably
worth fixing if we ever come across it.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/2282
2020-03-11 18:06:15 -07:00
Jonas Dreßler
3155d03d9e appDisplay: Reload folder views on installed app changes
Since the FolderViews are not connected to the "installed-changed"
signal, we need to reload their apps by calling _redisplay() when an app
is removed or installed. We can't connect to "installed-changed" inside
FolderView because we need to ensure _redisplay() of the FolderView is
called before AppView tries to access the apps of the folder inside
_refilterApps(). So reload the FolderViews inside AllViews _redisplay()
implementation to ensure everything is up to date before accessing the
apps of the folder.

Since the "apps-changed" signal of FolderIcon now indirectly triggers a
_redisplay() of the FolderViews, the 'changed' handler of FolderView is
now redundant and can be removed. Because of this, we also need to move
the emission of the "apps-changed" signal to the start of the signal
handler to make sure the view is updated before we try to access items
of the view.

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

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1011
2020-03-08 00:42:40 +00:00
Jonas Dreßler
989c0ee49e appDisplay: Disconnect folder "changed" signal when actors are destroyed
We should disconnect the folders "changed" signal from the folder in
case the FolderView or FolderIcon is destroyed. While at it, also remove
the unused this._spaceReadySignalId of FolderIcon.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1011
2020-03-08 00:42:40 +00:00
Jonas Dreßler
69f6c43b60 appDisplay: Implement an addApp() method for FolderViews
Similar to removeApp(), implement addApp() in FolderView to make adding
folders to views a bit more obvious.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1011
2020-03-08 00:42:40 +00:00