Commit Graph

7246 Commits

Author SHA1 Message Date
Florian Müllner
40e22eb524 cleanup: Use optional chaining and ?? operator
Those operators have been supported since gjs switched to mozjs78
last cycle. While not ground-breaking, using it makes for a nice
cleanup here and there.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1517>
2020-12-02 15:10:29 +00:00
Florian Müllner
595359afa5 messageTray: Default to generic policy
How and if notifications are shown is controlled by NotificationPolicy
objects. But ever since 098bd45, only notification daemon sources or
notifications associated with an app are hooked up to GSettings.

The hardcoded default policy for built-in notifications (including
those provided by extensions) arguably made sense back then, but
now that the main setting has been rebranded as "Do Not Disturb"
and is exposed prominently in the calendar drop-down, following
GSettings is a better default.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1511>
2020-12-01 20:02:02 +00:00
Georges Basile Stavracas Neto
4863c498b2 iconGrid/iconGridLayout: Make sure to always update best size
When selecting the best icon size for the available area, we
iterate from the biggest icon size to the smallest one, and
stop when finding a size that fits the available area.

However, the 'bestSize' variable is only updated when the
available area is positive. This is problematic in super bad
cases like when none of the icon sizes actually fit the availabe
area, which was hit with a previous iteration of this branch.

Make sure to update the best size while iterating, so that the
smallest size is selected even in such bad cases.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1510>
2020-12-01 18:57:49 +00:00
Georges Basile Stavracas Neto
34e38a835c iconGrid/iconGridLayout: Floor children position
So that we don't end up with positions misaligned from the pixel grid.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1510>
2020-12-01 18:57:49 +00:00
Georges Basile Stavracas Neto
e667406984 iconGrid/iconGrid: Fill pages by default
Use the Clutter.ActorAlign.FILL alignment by default, which
expands the grid until max-row|column-spacing is hit. This
was the behavior we originally wanted for the icon grid, and
it's finally being realized.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1510>
2020-12-01 18:57:49 +00:00
Georges Basile Stavracas Neto
4ad32ab662 iconGrid/iconGrid: Hook page-padding with CSS
Add support for setting the page padding of the icon grid
through CSS. Unfortunately, each side needs to be specificied
manually, since it's not a regular padding property.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1510>
2020-12-01 18:57:49 +00:00
Georges Basile Stavracas Neto
5b6686095a iconGrid/iconGridLayout: Add support for page-padding
This is a new property to control the padding around each page,
as opposed to the padding around the entire container.

Following the original design of IconGridLayout [1], changing
the page-padding property doesn't trigger relayouts; the container
is responsible for queueing a relayout appropriately.

[1] 3555550d5e

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1510>
2020-12-01 18:57:49 +00:00
Georges Basile Stavracas Neto
ee0f250662 appDisplay: Don't update multiline for search results
The grid icons in the search results page doesn't expand to
acommodate the multiline label, resulting in the multiline
label to overflow behind the list search results. However,
after 548d3b62d, it was possible to trigger this behavior
with keyboard focus.

Don't update multiline labels for search results.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1509>
2020-11-25 16:52:50 -03:00
Jonas Dreßler
a314c05fec workspace: Handle child not being present in the window slots array
Adding children to the WorkspaceLayout without calling addPreview() is
not supported, so let's log an error in case that happened.

We also have to allocate that child an empty ClutterActorBox, otherwise
Clutter will complain loudly.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1481>
2020-11-24 20:20:45 +00:00
Jonas Dreßler
3fb0284358 Make sure to allocate all children in allocate vfuncs
Clutter expects actors overriding the allocate vfunc to allocate all
mapped children of the actor, otherwise bad things happen.

So make sure we actually allocate all our visible children in our custom
allocation functions, and since we don't want to give them a real
allocation, just pass them an empty ClutterActorBox.

It would be nice if we had a way to hide children during the allocation
process where no relayout is queued like gtk allows with
gtk_widget_set_child_visible(), then we could avoid those weird empty
ClutterActorBoxes.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1481>
2020-11-24 20:20:45 +00:00
Jonas Dreßler
96dc6d19dd windowManager: Check whether metaWindow is NULL after destroy animation
When logging out or terminating gnome-shell, mutter will unmanage all
open windows, triggering the window-close animation in gnome-shell and
very quickly after that emitting "kill-window-effects". That means we'll
call _destroyWindowDone() to cleanup our animation data, but at this
point the MetaWindow of the window is already gone, so we get an error
that get_meta_window() returns NULL.

Fix that by checking whether get_meta_window() returned NULL and if it
did, don't access the window.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1483>
2020-11-21 23:40:53 +01:00
Carlos Garnacho
51ff9ce444 js/shellDbus: Do not forward device IDs
We already pass the device event node path for identification purposes,
we can stop doing that here.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1501>
2020-11-17 19:07:30 +01:00
Florian Müllner
8a47f1c667 cleanup: Remove empty leading/trailing lines in blocks
gjs added a new rule to its eslint ruleset that forbids "block padding",
so make sure we conform to that rule before syncing up the configuration.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1498
2020-11-16 18:04:23 +00:00
Georges Basile Stavracas Neto
548d3b62d7 appDisplay: Expand titles on keyboard focus as well
In addition to hover, expand wrapped app titles when keyboard
focus is in as well. This gives keyboard users a chance to
read the app name.

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
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
Carlos Garnacho
a9a54ba2a3 magnifier: Avoid cursor visibility changes on startup
When initializing the shell, we create the magnifier, and (normally)
let it disabled. This still toggles cursor visibility on, which is
not right since there's other considerations to take during
initialization.

Only do this after actual changes to the magnifier state, so
initialization is left unperturbed.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1486
2020-10-28 20:59:07 +01:00
Florian Müllner
709c226fc3 messageTray: Don't play sound when banners are disabled
When support for notification sounds was added, it made some sense
to keep the 'enable-sound' setting independent from 'show-banners'.

However that changed when 'show-banners' was rebranded in the UI as
"Do Not Disturb", as sounds are at least as disturbing as the banners.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2873
2020-10-27 01:12:07 +01:00
Jonas Dreßler
0b2430128a windowPreview: Handle case where window already is part of layout
We sometimes add dialogs multiple times to the WindowPreview, for
example for modal dialogs we receive both the "window-added" and the
"window-entered-monitor" signal, which means we call
WindowPreview.addDialog() twice.

We handle that fine already in the WindowPreviewLayout and return NULL
in case the window already was added, so simply handle that NULL return
value and bail out of WindowPreview.addDialog() in this case.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1482
2020-10-26 03:40:19 +00:00
Harry Míchal
d318bf539d mpris: Switch text in title and body
Most media players have a media player that shows the title of a song
and artists in the song. In those media players the title is
highlighted (bold text) and the list of artists is under the title.
Shell does the exact opposite in the player in the notification area.

Example media players: Spotify, Rhythmbox, GNOME Music

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1480
2020-10-26 04:02:14 +01:00
Florian Müllner
f5d1a2858d telepathyClient: Promisify the right class
send_message_async() is a method of TpTextChannel, not the generic
TpChannel parent class.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3226
2020-10-22 21:11:01 +02: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
4fcbf6c974 iconGrid: Allocate preferred sizes if bigger than child size
IconGridLayout uses the biggest minimum size to allocate its
children. Next commit will make app icons with long names show
not ellipsize on hover, and it is important that the icon itself
is able to follow that.

Use preferred size if it's bigger than the minimum size.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1477
2020-10-21 18:54:56 -03:00
Georges Basile Stavracas Neto
b3659221bd iconGrid: Trivial style cleanup
Turns out, we only needed a gentle push to get this whole
file fit in.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1477
2020-10-21 18:46:54 -03:00
Florian Müllner
5cfec80e9d audioDeviceSelection: Center-align icons
When the icon area gets allocated additional space, we want the
icons centered rather than left-aligned. This may happen in locales
with long-ish translations for the title or buttons when only a
subset of possible icons is shown.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3307
2020-10-21 03:29:18 +02:00
Jonas Dreßler
d19683a84c dnd: Get transformed size for scaling before unparenting drag actor
Commit de610a13f1ad1e7e34d4b9a81df58d4da3693059 in mutter made it
impossible to access the actors last allocation after unmapping it,
this broke the scale-up/down animation when starting a drag.

Fix that animation again by saving the actors transformed size before
unparenting (and therefore unmapping) the actor instead of afterwards.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1475
2020-10-21 01:15:21 +02:00
Jonas Ådahl
a0e87b53ff remoteAccess: Ignore all but the screen record handles on X11
We still want to show the red dot when recording the screen on X11, so
only drop the "screen-is-shared" handles when using the X11 session.

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

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1466
2020-10-13 21:45:59 +00:00
Florian Müllner
9d5165b1aa polkitAgent: Drop separate user icon style
It should use the same style as used elsewhere (like the lock screen),
so stop using a separate style class to pick up the defaults.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3252
2020-10-09 13:23:05 +00:00
Ray Strode
6758746f25 screenShield: Fix pointer motion signal handler leak
The screen shield code listens for motion events on the stage
so that it can hide the pointer until the user moves the mouse.

Unfortunately, if the user never moves the mouse, the signal
handler connection gets leaked.

This commit makes sure the connection gets disconnected when the
shield goes away.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1459
2020-10-08 09:46:12 -04:00
Ray Strode
2b44fa893f screenShield: Use identity operator when matching for motion events
The screen shield watches for motion events to know to display
the pointer when the user wiggles their mouse.

It checks for motion events by looking at the event type and
seeing if it is of type `Clutter.EventType.MOTION`.  To do this
comparison it uses the equality operator (==).  Using the equality
operator isn't considered best practice, because it can returns true
when comparing disparate types, if those types happen to be equivalent
after coersion.

From a code resiliance point of view, it's better to use the
identity operator (===), which requires both sides of the comparison
to be of the same type.

As a policy, any legacy code that gets changed or moved should be
switched away from the equality operator to the identity operator, if
appropriate.

This commit makes that change as prep work for a fix to that part of
the code.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1459
2020-10-08 09:45:51 -04:00
Daniel van Vugt
6ba3ca5f95 windowManager: Avoid calling meta_window_actor_thaw when not frozen
Because that tends to crash in:
```
g_error ("Error in freeze/thaw accounting");
```

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1431

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1453
2020-10-08 14:27:58 +08:00
Andre Moreira Magalhaes
cc9f66d784 environment: Handle @content for property transitions
When using `Actor.ease_property` if the property starts with '@' and the
duration of the transition is zero (which may happen if the actor is not
mapped even if a non-zero duration was passed to `ease_property`), the
impl will try getting the actual target object where the property should
be set.

This works fine for most cases but it currently throws an error when
passing '@content.*' properties. Fix this by handling '@content' as
a property of `actor.content` (used by MetaBackgroundActor when
showing the overview).

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1461
2020-10-07 20:49:09 -03:00
Ray Strode
b41ef2f6e3 panel: Disconnect destroy signal handler when needed
The panel corners try to match their style to the buttons closest
to them. In order to make sure the corner styles stay in sync with
their neighboring buttons, they connect to the style-changed signals
of the buttons.

In order to make sure the style-changed signal handler isn't leaked,
it gets disconnected when the button is destroyed.

Unfortunately, the destroy signal handler connection itself gets leaked!

This commit ensures the destroy signal handler gets disconnected any
time the neighboring button is re-determined.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1460
2020-10-07 17:03:52 -04:00
Joonas Henriksson
9963f7ce84 unlockDialog: Use unique unlock-dialog style class
Allows styling the unlock dialog elements individually from the GDM
login dialog.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1421
2020-10-07 16:16:57 +00:00
Florian Müllner
da36506ea5 workspacesView: Work around Clutter optimization
Clutter nowadays omits reallocations when only the stage position
changed, that is when the allocation relative to the parent changed.

As a result (apart from better performance of course), workspaces
in the overview may now end up with an outdated "actual geometry"
in case the overview moved to a new primary monitor (of equal size
as the previous one).

Work around that by emitting a signal from the overview on allocation
changes, and use that to update the cached geometry.

We can revert that change once workspaces become part of the regular
overview hierarchy.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3211
2020-10-05 14:11:55 +02: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