Commit Graph

685 Commits

Author SHA1 Message Date
Georges Basile Stavracas Neto
5d27a5a42a appDisplay: Factor out function
The function to update the multiline state of the title label
will be reused by the next commit, so move it into a separate
method.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1496
2020-11-13 23:29:14 +00:00
Georges Basile Stavracas Neto
47dc3043df appDisplay: Adjust label collapse and expand times
As per design feedback, these times are too slow.

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

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1496
2020-11-13 23:29:14 +00:00
Daniel García Moreno
8eec7ae2d8 appDisplay: don't change grid page on adaptToSize
If the adapt to size occurs after the grid page has been changed the
page is set to zero. This patch just keep the current page with the same
value that it has before.

Fix https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3388
2020-11-12 16:47:11 +01:00
Ian Douglas Scott
c86c294d2a appDisplay: Only show add/remove favorite when shouldShowApp() is true
`shouldShowApp()` is called in `_addFavorite`, so adding a favorite when
this isn't true won't work. Also, it seems when this is false, favorites
that do exist won't be shown anyway.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3342
2020-10-30 11:20:45 -07:00
Georges Basile Stavracas Neto
b244274d48 appDisplay: Don't expand title for search results
It creates quite a nasty visual inconsistency where the
search results' icon title overflows beneath the next
search section.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1477
2020-10-21 19:44:39 -03:00
Georges Basile Stavracas Neto
efd1e06fec appDisplay: Let icon labels be multiline when hovered
When hovered, remove constraints from the icon labels that
limit the number of lines. Do that inside a saved easing
state so that the allocation can ease the label.

This helps with applications with long titles.

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

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1477
2020-10-21 19:44:39 -03:00
Georges Basile Stavracas Neto
d04daf6a1c appDisplay: Protect against source icon destruction
When dragging icons out of a folder dialog, there is a very peculiar
combination of steps that may break GNOME Shell:

 1. Open an app folder dialog
 2. Start dragging an icon to outside the grid
 3. Wait until the popdown animation starts
 4. Before it finishes, drop the icon
 5. See the warnings / crash

That's caused by the source icon being destroyed after the delayed
move timer starts, and before it finishes.

Protect against the source icon being destroyed before the delayed
move timeout triggers by connecting to the 'destroy' signal and
removing the timeout on the callback. Use a single field, called
'_delayedMoveData', to store all data related to delayed moves.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1447
2020-10-05 12:06:48 +00:00
Georges Basile Stavracas Neto
aaff88a6bb appDisplay: Remove icon from folder when dragging out
When dragging an icon outside of a folder dialog, there's a small delay
before the dialog pops down. If the icon is dropped during this delay,
the drag is cancelled, and the icon continues to be in the folder.

However, this behavior turned out to be problematic, and it was a common
point of failure that throwing icons outside folders wouldn't work.

Remove the icon from the folder when dragging it to outside the dialog.

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

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1447
2020-10-05 12:06:48 +00:00
Georges Basile Stavracas Neto
1acbdcc9b3 appDisplay: Allow passing callback to AppFolderDialog.popdown()
Next commit will allow removing icons from the folder, and we want to
do that effectively after the dialog pops down.

Add an optional callback to AppFolderDialog.popdown().

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1447
2020-10-05 12:06:48 +00:00
Georges Basile Stavracas Neto
33bd038af2 appDisplay: Don't change opacity on destruction
At the end of BaseAppView._clearAnimateLater(), the '_grid' actor's opacity is
set to 255. As it turns out, _clearAnimateLater() is called, among others, by
vfunc_unmap(). However, unmapping is part of the destruction process, and at
the time it is called, '_grid' is already destroying, which makes GJS complain
about accessing an invalid object.

Don't change opacity on BaseAppView._clearAnimateLater(), and instead move it
to the couple of places outside vfunc_unmap() that call it.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1447
2020-10-05 12:06:48 +00:00
Georges Basile Stavracas Neto
59549e0b13 appDisplay: Save pages when folder apps change
After dragging an icon to inside a folder, we do not save the grid layout,
leaving the icon's position stored when it actually isn't there anymore.

Fix that by saving pages whenever folder apps change.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1447
2020-10-05 12:06:48 +00:00
Georges Basile Stavracas Neto
7dafd25ef4 appDisplay: Don't emit 'apps-changed' when deleting folder
To delete a folder, FolderView needs to reset all keys under that particular
folder's GSettings path. That generates 5 'changed' signals, all of which
end up calling AppDisplay._redisplay(), which is costly.

Don't emit 'apps-changed' when deleting a folder.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1447
2020-10-05 12:06:47 +00:00
Georges Basile Stavracas Neto
31591ff029 appDisplay: Only change excluded-apps when not deleting folder
It is useless to update the 'excluded-apps' list when we know we're going
to delete the folder entirely.

Only update 'excluded-apps' when not deleting the app folder.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1447
2020-10-05 12:06:47 +00:00
Georges Basile Stavracas Neto
75a8697671 appDisplay: Trivial const-correctness fix
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1447
2020-10-05 12:06:47 +00:00
Georges Basile Stavracas Neto
1709592811 appDisplay: Adjust folder position
If you try and drop an icon that's in the same page, but before the
drop target, it'll be one position ahead of where it should be -
because we just removed one icon before the target position.

Adjust the final position of the to-be-created folder.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1447
2020-10-05 12:06:47 +00:00
Georges Basile Stavracas Neto
8d84e05a2a appDisplay: Reduce folder dialog popdown timeout
1500ms is too long of a delay, and it confuses people more than it
helps with accidental drops.

Reduce the timeout to 500ms as per design feedback.

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

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1447
2020-10-05 12:06:47 +00:00
Georges Basile Stavracas Neto
cc3519332c appDisplay: Lighten folder dialog background when dragging out
As per design feedback, make the app folder dialog background lighter when
hovering it with an icon. This gives the visual feedback to show that that
region is a target.

Use the new DIALOG_SHADE_NORMAL variable in the other places where its color
was hardcoded.

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

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1447
2020-10-05 12:06:47 +00:00
Georges Basile Stavracas Neto
062c014223 appDisplay: Use new moveItem API to move items
This uses the API added in the previous commit. The intent here
is to avoid removing and readding actors when moving them around.

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

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1447
2020-10-05 12:06:47 +00:00
Georges Basile Stavracas Neto
bfd4d0f7aa appDisplay: Factor out linear position calculation
When adding an item to the app grid, the item is added to
a sorted array. This is calculated by adding all visible
items in pages before the one being modified. Future commits
will need this to move items without reparenting them, so
factor this code into a separate function.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1447
2020-10-05 12:06:47 +00:00
Georges Basile Stavracas Neto
5014d7e9fc appDisplay: Disconnect from parental controls on destroy
BaseAppView not disconnecting from the 'app-filter-changed'
signal means parental controls may trigger callbacks on
a destroyed grid, which tries to access destroyed icons,
which spams the journal with stack traces.

Disconnect from parental controls when BaseAppView is destroyed.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1441
2020-09-16 14:57:02 -03:00
Daniel García Moreno
92d3c6e051 appDisplay: Don't iterate over all pages in page manager
In getAppPosition it's not needed to continue looking for an app in the
page manager if the app is found in a page.

This patch breaks the search loop just after the first ocurrence is
found.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1434
2020-09-15 09:33:53 +00:00
Florian Müllner
69e81e4511 Revert "appDisplay: Add drop shadow to icons"
The shadows are hardly visible in the darkened overview, but have
a noticeable impact on performance.

This reverts commit 4e195d789a.
2020-09-02 11:12:47 +02:00
Georges Basile Stavracas Neto
998e3e62ad appDisplay: Connect to GSettings after reading key
As per GSettings documentation, it is necessary to read a particular
key at least once before being able to connect to the corresponding
'changed::' signal.

Read the 'app-picker-layout' key before connecting to the changed
signal.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1428
2020-09-01 17:12:56 -03:00
Georges Basile Stavracas Neto
95645e155e appDisplay: Only emit layout-changed when not updating pages
It is wasteful to emit layout-changed when updating pages, because
the caller (AppDisplay) already has an updated state by the time
this is called.

Only emit 'layout-changed' if the GSettings notification doesn't
come from AppDisplay updating the pages.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1428
2020-09-01 16:45:54 -03:00
Georges Basile Stavracas Neto
f1bc87bf6d appDisplay: Redisplay on layout changes
This was an overlook from e1ea1d2954.

We never connected to the 'layout-changed' signal, which means
changing the GSettings externally wouldn't trigger a redisplay.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1428
2020-09-01 16:45:54 -03:00
Florian Müllner
4e195d789a appDisplay: Add drop shadow to icons
The shadow is barely visible on dark backgrounds, but it's not
wrong to be consistent with Settings, Software and GNOME Classic.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3123
2020-08-31 21:04:39 +02:00
Georges Basile Stavracas Neto
7fcaf63291 appDisplay: Cache app ids in FolderView
Instead of reading a GSettings and building the app ids list
every single time FolderView needs to check for something,
cache it before redisplay and reuse this cached list everywhere.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1409
2020-08-13 23:28:51 +00:00
Jonas Dreßler
b83c93ad62 appDisplay: Return false in acceptDrop when not accepting the drop
Fix what is probably a copy-paste error and return false instead of a
CONTINUE DragMotionResult which is only meant for dragMotion events, not
drop events. This makes sure we don't create a folder when dropping an
app over the drag leeways of another icon.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1389
2020-08-03 21:48:44 +00:00
Daniel García Moreno
71d37bffdf util: Remove shell_util_get_transformed_allocation
This helper function could be replaced with the new
clutter_actor_get_transformed_extents, that does the same.

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

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1380
2020-07-29 18:09:53 +02:00
Georges Basile Stavracas Neto
bde974087a appDisplay: Append new icons at the first available page after first
As per design discussion, the first page is a somewhat of a special
page where we really don't want to change anything unless necessary.

Append new icons at the first available slot after the first page.
Make the placeholder icon be appended to the first available page
as well, since it's always used when dragging from folder dialogs.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284
2020-07-20 16:13:20 +00:00
Georges Basile Stavracas Neto
d93b51e135 appDisplay: Use a drag monitor to check for out-of-dialog drags
When the app folder dialog handles a drag hover, it starts a timeout
to popdown if dragging outside the "real" dialog area. However, when
dragging inside it, BaseAppView handles all drag hover events which
would disarm the popdown timeout. In cases like this, it's almost
impossible to prevent the timeout from triggering, which always pops
down the dialog.

Add a drag monitor when handling any drag hover (which only happens
when dragging outside the folder's icon grid); and eventually disarm
the popdown timeout from the monitor's motion event. Remove the drag
monitor when dragging over the folder dialog again.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284
2020-07-20 16:13:20 +00:00
Georges Basile Stavracas Neto
730a68dffc appDisplay: Increase folder dialog popdown timeout
App folders are now customizable, and the way to move icons to
another page is by throwing the cursor to either the left or
the right of the grid.

However, doing that triggers the popdown timeout, wich is 600ms
as of now, which is considerably short for such interaction.

Increase this timeout to 1.5 seconds.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284
2020-07-20 16:13:20 +00:00
Georges Basile Stavracas Neto
f06c257952 appDisplay: Allow reordering folders
Implement the methods to sort and query item positions
using the index in the GSettings key, and store the
updated positions when accepting the drop.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284
2020-07-20 16:13:20 +00:00
Georges Basile Stavracas Neto
7afab2c28c appDisplay: Factor out folder loading code
We'll reuse this code to implement custom positioning in
folders.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284
2020-07-20 16:13:20 +00:00
Georges Basile Stavracas Neto
16a18f2ae7 appDisplay: Only handle DnD when mapped
Now that the DnD code is shared between AppDisplay and
FolderView, we hit an unexpected problem: FolderView is
handling drag events even when the folder dialog is hidden.
As a side effect, this spams the journal with warnings.

Only handle drag events when mapped. On unmap, disable
the view's drag monitor, and disconnect from all drag
events.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284
2020-07-20 16:13:20 +00:00
Georges Basile Stavracas Neto
704e08dc08 appDisplay: Move DnD code to BaseAppView
This code will be shared with FolderView in the next commit, so
avoid duplication already and move the to-be-shared code into the
base class.

Because BaseAppView can handle vertical and horizontal orientations,
adapt the drag overshoot code to also handle horizontal overshoot.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284
2020-07-20 16:13:20 +00:00
Georges Basile Stavracas Neto
60311aa4d1 appDisplay: Fully hide icon when dragging
The partially visible icon causes more problems than
it solves, visually speaking. Fade it out completely
while dragging.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284
2020-07-20 16:13:20 +00:00
Georges Basile Stavracas Neto
cceb74706a appDisplay: Ensure icons always are at the correct position
When redisplaying, we currently only remove and add icons, but
never adjust the position of already added icons. If the icon
position changed, it wouldn't be reflected on the icon grid.

Make sure to move already added icons.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284
2020-07-20 16:13:20 +00:00
Georges Basile Stavracas Neto
578ae29ed2 appDisplay: Add placeholder when moving from folder dialog
When moving an icon from a folder dialog, the app grid doesn't
really have an icon to move around.

Add a placeholder icon and hijack it in the various places.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284
2020-07-20 16:13:20 +00:00
Georges Basile Stavracas Neto
701d110493 appDisplay: Restore dragged item's position on drag cancel
Otherwise we end up with the grid in an inconsistent state.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284
2020-07-20 16:13:20 +00:00
Georges Basile Stavracas Neto
d1cbf6c7a9 appDisplay: Allow overshooting any icon
Now that the icon being dragged can come from AppDisplay and also
a folder dialog, the check for when to overshoot is broken. Check
if the icon is a BaseAppView icon.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284
2020-07-20 16:13:20 +00:00
Georges Basile Stavracas Neto
b64ce217e4 appDisplay: Create app folder where the drop happened
Create the app folder where the icon we drop at is located. This
ensures the folder icon doesn't go into the last page, hidden and
solitary.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284
2020-07-20 16:13:20 +00:00
Georges Basile Stavracas Neto
783dbe2aa9 appDisplay: Don't resort folders when name changes
With a customizable app grid, we don't want folders to move
after renaming. Their position is fixed.

Remove the sort-after-rename code from AppDisplay.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284
2020-07-20 16:13:20 +00:00
Georges Basile Stavracas Neto
f4ce1cf462 appDisplay: Make FolderIcon draggable
By making it a subclass of AppViewItem, it automagically inherits
the DnD code.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284
2020-07-20 16:13:20 +00:00
Georges Basile Stavracas Neto
d04d6e069d appDisplay: Check 'app-picker-layout' to make icons draggable
Now we drag not only to the Dash, but also to the icon grid itself,
so make the app icon draggable only when either one or the other is
writable.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284
2020-07-20 16:13:20 +00:00
Georges Basile Stavracas Neto
40de201056 appDisplay: Factor out draggable code into AppViewItem
This will be shared by the FolderIcon.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284
2020-07-20 16:13:20 +00:00
Georges Basile Stavracas Neto
18234ea91a appDisplay: Use custom function to retrieve item page and position
It is important that '_loadApps()' return a sorted list -- adding the
same icons at the same positions but in different orders results in
a wrong icon grid.

Add support for using a custom positioning function, and implement it
in AppDisplay. Because FolderView doesn't implement a custom sorting
function, the items are still sorted alphabetically.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284
2020-07-20 16:13:20 +00:00
Georges Basile Stavracas Neto
e3f3297cba appDisplay: Save pages after dropping
Save the icon grid layout after dropping, and only in
that moment.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284
2020-07-20 16:13:20 +00:00
Georges Basile Stavracas Neto
e1ea1d2954 appDisplay: Introduce PageManager
The PageManager does the heavy lifting between reading the
'app-picker-layout' GSettings key, and saving the new pages.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284
2020-07-20 16:13:20 +00:00
Georges Basile Stavracas Neto
8a50a8e64c appDisplay: Allow incomplete pages
Allow incomplete pages in the main grid, but not on folders.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284
2020-07-20 16:13:19 +00:00