Commit Graph

577 Commits

Author SHA1 Message Date
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
Jonas Dreßler
bf2d012e40 appDisplay: Rename _redisplay() functions unrelated to BaseAppView
The _redisplay() function is usally used for subclasses of BaseAppView
which want to implement their own _redisplay() function, having that
function name in two classes which have nothing to do with BaseAppView
can be quite confusing. Make those names less confusing and call the
functions  _sync() and _rebuildMenu() instead.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1011
2020-03-08 00:42:40 +00:00
Jonas Dreßler
711d4ba65c appDisplay: Properly hide overlay scrollbar in folders
Use the scroll-view policy ST_POLICY_EXTERNAL to hide the scrollbar
instead of setting its css properties to hidden, where it can still be
clicked but isn't visible.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1011
2020-03-08 00:42:40 +00:00
Jonas Dreßler
4490463513 appDisplay: Remove the top padding from folder app grid
There already is a bottom padding defined for the name container of the
folder, so remove the top padding of the appGrid and make sure we can
show a few more icons inside the folder.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1011
2020-03-08 00:42:40 +00:00
Jonas Dreßler
1ec5117715 appDisplay: Take the viewBox into account for the contentBox of folders
The viewBox has a border applied, so when we call adaptToSize using only
the content box of the container, the width of the border is not removed
from the content box and the grid will be allocated less space than what
we told it before using adaptToSize.

Fix that by adjusting the content box for the size of the viewBox, too.
This makes sure the correct amount of columns can be shown inside a
folder, since right now we only show 3 colums even though 4 would fit.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1011
2020-03-08 00:42:40 +00:00
Georges Basile Stavracas Neto
b8f8e1710b appDisplay: Remove unnecessary bind constraint
Now that the bind constraint changes the preferred size of
the actor, a major flaw in the AppDisplay code was exposed:
the folder dialog depends on the preferred size of a parent,
and the parent depends on the preferred size of the folder
dialog.

While we know this is not actually true, we shouldn't rely
on broken behavior to achieve this result. What's interesting
is that the bind constraint used by the folder dialog is a
relic of the development phase; we now control the position
and size of the dialog with a combination of CSS, and alignment.

Remove the unnecessary bind constraint.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1027
2020-02-19 09:20:05 -03:00
Florian Müllner
9d941f8202 js: Don't use templates in files with translations
xgettext gained some support for template strings, and no longer
fails when encountering '/' somewhere between backticks.

Unfortunately its support is still buggy as hell, and it is now
silently dropping translatable strings, yay. I hate making the
code worse, but until xgettext really gets its shit together,
the only viable way forward seems to be to not use template
strings in any files listed in POTFILES.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1014
2020-02-17 23:20:40 +01:00
Daniel van Vugt
33ae220ad2 appDisplay: Call super.vfunc_unmap last
So as to guarantee the unmapped state sticks and doesn't get toggled
back to mapped before we return.

Being in a mapped state when `FolderIcon.vfunc_unmap()` returned was
causing an assertion failure in `clutter_actor_set_mapped` and crashed
the shell.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/2170
2020-02-07 11:23:25 +00:00
Alexander Mikhaylenko
dfb8737007 appDisplay: Disable swipe tracker during swarm animation
Eensures it resets when an animation starts.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/2177
2020-02-06 17:36:05 +00:00
Georges Basile Stavracas Neto
f7620b385a appDisplay: Block search when showing app folder dialogs
Also following design guidance, make the search entry insensitive
when showing an app folder dialog.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/896
2020-01-21 11:07:08 -03:00
Georges Basile Stavracas Neto
9746c00a22 appDisplay: Set minimum folder view rows to 1
This improves the usage of empty space in the dialog.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/896
2020-01-21 11:07:08 -03:00
Georges Basile Stavracas Neto
dc6f36bf5e appDisplay: Remove rename popup
This functionality always suffered from discoveribility
problems, and now that the folder dialog can rename the
app folders, there's just no reason to keep it.

Remove the rename popup.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/896
2020-01-21 11:07:08 -03:00
Georges Basile Stavracas Neto
973c920284 appDisplay: Add folder title and entry to dialog
This allows editing the folder name, and keeps the folder title visible
at all times.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/896
2020-01-21 11:07:08 -03:00
Georges Basile Stavracas Neto
1dad5f3ffa iconGrid: Remove API to open space between icons
Since we moved to showing folders as dialogs now, there's no need
to keep this API. Remove it.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/896
2020-01-21 10:49:56 -03:00
Georges Basile Stavracas Neto
802c8d5844 appDisplay: Cleanup unnecessary code
Now that the folder dialog handles the adaptToSize workaround,
there is no need to propagate the call throughout the class
hierarchy.

Remove the propagating calls to adaptToSize, and all the satellite
code.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/896
2020-01-21 10:48:44 -03:00
Georges Basile Stavracas Neto
7781f973f2 appDisplay: Rename popup API to dialog
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/896
2020-01-21 10:48:41 -03:00
Georges Basile Stavracas Neto
53c12dc33e appDisplay: Add the folder popup to AllView itself
Now the the folder popup behaves like a dialog, it must be
above the app grid, and not be affected by the scroll view
translation.

Add the folder popup to the AllView itself, instead of the
internal Shell.Stack that is inside the scroll view.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/896
2020-01-21 10:40:34 -03:00
Georges Basile Stavracas Neto
f46d10c4f9 appDisplay: Transform folder into a dialog
Make the AppFolderPopup behave much more like a dialog than a
popup itself. To do that, remove the BoxPointer and replace it
by a StBoxLayout. The dialog is is also bind-constrained to the
view selector.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/896
2020-01-21 10:40:34 -03:00
Alexander Mikhaylenko
3e6bcbb486 appDisplay: Use SwipeTracker
Replace existing panning and touchpad scrolling by SwipeTracker.

Since SwipeTracker only references one actor, redirect scroll events
from page indicators to the main scroll view.

Change programmatic scroll animation to use easeOutCubic interpolator
to match the gesture.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/826
2020-01-10 18:20:22 +01:00
Alexander Mikhaylenko
08ebfa1acf appDisplay: Add timeout for mouse scrolling
Prevent uncontrollably fast scrolling. Use the same duration as switching
animation, but add a separate timeout to account for disabled animations.

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

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/825
2020-01-08 23:41:49 +01:00
Alexander Mikhaylenko
944b835fa9 appDisplay: Reduce page switch time to 250ms
Be consistent with workspace switching.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/825
2020-01-09 03:26:16 +05:00
Bastien Nocera
4d16d2ceed appDisplay: Remove unimplemented 'activate-discrete-gpu'
It was added in commit 009d021 but not advertised, and likely not used
by an application since then.

See: https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/781
2019-12-12 17:19:41 +01:00
Jonas Dreßler
2ba4108838 appDisplay: Rename _allItems array to _orderedItems
Since both the `_items` object and the `_allItems` array include the
same items, the difference between those variables seems unclear. The
real difference between them (except the different data type) is that
`_allItems` is ordered in the same order as the visible grid, so rename
`_allItems` to `_orderedItems` which makes that more obvious.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/799
2019-12-05 15:43:34 +00:00
Jonas Dreßler
203c3f9949 appDisplay: Make AllViews folderIcons property private
This property is not used anywhere outside the class, make it private.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/799
2019-12-05 15:43:34 +00:00
Jonas Dreßler
61b71998a0 appDisplay: Make _items object a Map
Use a Map instead of an Object here makes it easier to loop through
keys, which we're going to do in the next commit.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/799
2019-12-05 15:43:34 +00:00
Jonas Dreßler
c4fa052b03 appDisplay: Use _getCategories function instead of duplicating the code
We already have a function which gets the categories of an app and
handles the null-return case, use it.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/799
2019-12-05 15:43:34 +00:00
Georges Basile Stavracas Neto
59a43f496d appDisplay: Move to rename folder location
Following the same reasoning of the previous commit, move to
the renamed folder location.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/883
2019-12-05 12:00:11 +00:00
Georges Basile Stavracas Neto
d28bc7afe6 appDisplay: Show newly created folder when creating
The icon grid currently sorts icons by their names. When creating new
folders, the folder may end up being in a different page, and that's
confusing since we don't actually move to where the new folder is.

Move the icon grid to the newly created folder.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/883
2019-12-05 12:00:11 +00:00
Joonas Henriksson
749a4c9f6c appIcon: Draw running dot above the overview icon
Prevent the app-well-app-running dot from getting unintentionally
hidden behind the overview-icon background by initializing the
running-dot after its sibling overview-icon.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/866
2019-11-27 02:59:13 +01:00
Jonas Dreßler
5a287a4205 appDisplay: Add a timeout when switching pages during DnD
Currently when dragging an icon to the space above or below the appGrid
to switch pages, we do so very quickly without checking when the last
page-switch happened. This makes it hard to move icons to pages which
are not the first or the last one, since the other pages are skipped
very quickly.

To fix this, add a timeout of 1 second that blocks switching pages after
a page-switch using drag overshoot occured.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1693
2019-11-24 19:35:30 +01:00
Florian Müllner
b0c8192496 appDisplay: Add threshold after overshoot page switches
We currently always switch app pages when a dragged app icon
moves outside the grid boundaries, regardless of any previous
page switches. This makes it too easy to switch multiple pages
accidentally, so add a small threshold that the icon has to
move back towards the grid before allowing another page switch.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1693
2019-11-23 20:11:21 +01:00
Jonas Dreßler
0897915b05 appDisplay: Simplify event blocking while folder is opened
There's no need for a `inhibitEventBlocker` interface. Since we connect
to "open-state-changed" of our folders in the AllView anyway, we can
just make the event blocker visible while a folder is opened, and hide
the event blocker during DnD.

This allows keeping the eventBlocker reactive at all times and fixes an
issue where DnD to create a new folder is impossible if no folders are
present because the eventBlocker would not get inhibited.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1652
2019-11-23 18:31:46 +01:00
Jonas Dreßler
7e9f30da0a appDisplay: Ensure we don't recreate existing AppIcons for folders
This was missed in 910037f014, make sure
we do the same thing for AppIcons that are created when reloading
folders.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/851
2019-11-23 22:01:09 +01:00
Alexander Mikhaylenko
109f39afa5 pageIndicators: Redesign and add position-based animation
Remove setCurrentPage() function, introduce setCurrentPosition() instead,
which allows to have fractional positions.

Make inactive dots smaller, filled and partially transparent, as opposed to
larger and fully opaque active dot. Make dots smaller overall, remove
borders. Interpolate each dot between active and inactive state based on
scroll position.

Make it impossible to "uncheck" the active dot.

Thanks Florian Müllner for parts of the code.

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

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/843
2019-11-23 03:01:51 +05:00
Georges Basile Stavracas Neto
e7b9bd75d8 appIcon: Remove drag monitor on destroy
It may happen that the app icon is destroyed with a drag
monitor still around, in which case, a load of warnings
will be shown.

Make sure to remove any pending drag monitor on destroy.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/841
2019-11-21 22:28:46 +00:00
Georges Basile Stavracas Neto
bd173ac5d2 folderView: Reset schemas before removing the folder
When removing the last icon of a folder, FolderView first removes
the folder from org.gnome.desktop.app-folders.folder-children, then
proceeds to reset all its keys, which removes the relocatable schema.

That order of operations turns out to be problematic. Removing the
folder from 'folder-children' destroys the folder icon, which in turn
destroys the folder view, which throws a load of warnings in the
journal.

Fix that by removing the folder after resetting the schema keys. In
fact, what we're doing here is not using 'this' anymore.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/841
2019-11-21 22:28:46 +00:00
Georges Basile Stavracas Neto
bfc7c1cd65 baseAppView: Destroy icon when removing
We cannot rely on the garbage collector to do that in a timely
manner, so destroy it explicitly.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/841
2019-11-21 22:28:46 +00:00
Georges Basile Stavracas Neto
cae69b3a88 allView: Rename variable
The variable that holds the list of application icons is
called 'newApps', but that technically was never true,
since we only create new app icons when necessary.

Rename it to 'appIcons'.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/841
2019-11-21 22:28:46 +00:00
Georges Basile Stavracas Neto
910037f014 allView, frequentView: Only create icons when necessary
The views (AllView and FrequentView) build a list of all applications
they contain. BaseView then diffs between what's currently added, and
what needs to be added, and removed.

This approach has a problem though: creating an AppIcon or a FolderIcon
connects to various signals, and we confuse the garbage collector.

When building the list of applications, instead of always creating new
icons, try to use already existing icons first.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1610
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1694
2019-11-21 22:28:46 +00:00
Georges Basile Stavracas Neto
913990b9ea folderView: Center folder icon
The FolderView class is responsible for creating the 4-item
grid of the folder icon, with the preview of the first four
apps inside the folder.

However, with the deprecation of StAlign as child properties,
the folder icon stopped being horizontally centralized.

Center the folder icon horizontally again.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/817
2019-11-11 18:12:32 -03:00
Florian Müllner
077d8f33fb cleanup: Don't use gtk-doc syntax for regular comments
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/805
2019-11-11 19:25:14 +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