Commit Graph

8338 Commits

Author SHA1 Message Date
Georges Basile Stavracas Neto
0ed1a363a3 workspacesView: Queue relayout when overview adjustment value change
The overview adjustment quite significantly impacts the layout of
SecondaryMonitorDisplay(), and this needs to be accounted for by queueing
a relayout.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1845>
2021-05-12 18:08:55 +00:00
Georges Basile Stavracas Neto
81210f5846 workspacesView: Don't update secondary monitor thumbnails box if hidden
And save quite a few C/JS trampolines. Since the thumbnails box may not
have up-to-date properties, call _updateThumbnailParams() right after
showing the thumbnails box.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1845>
2021-05-12 18:08:55 +00:00
Georges Basile Stavracas Neto
a63c44ba2c workspacesView: Increase secondary monitor workspace scale
The current value, 70%, may end up leaving too much unused space on
secondary monitors. The new value of 80% is completely based on trial
and error, but seems to work slightly better.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1845>
2021-05-12 18:08:55 +00:00
Florian Müllner
803b944ffd appDisplay: Add :gesture-modes property
Both the main app grid and folders got a swipe tracker, which is
active in both OVERVIEW and POPUP mode. The result is that two
trackers fight over the same events, and everybody loses.

Address this by adding a :gesture-modes property that determines
the allowed modes for the associated swipe tracker.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1844>
2021-05-12 01:02:19 +02:00
Carlos Garnacho
6fc93b78bc appDisplay: Improve app grid interaction for touch devices
Currently, handling of touch devices in the app grid is a bit awkward,
paging by dragging the view can only happen if started from the gaps
between icons, trying to drag from an icon will trigger DnD, and popping
up the menu takes over it all.

Instead, have the app grid actions play this game of rock-paper-scissors:
- Fast swipes on icons trigger scrolling, beats DnD and menu
- Slower press-and-drag on icons trigger DnD, beats scrolling and menu
- Long press triggers menu, beats scrolling, is beaten by DnD

This allows quick swipes to handle navigation, while still allowing the
fine grained operations. DnD, when triggered, dismisses the menu, if
shown.

This all could probably be nicer with a more stateful gesture framework,
we're not there yet though.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3849
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1774>
2021-05-11 16:13:49 +00:00
Carlos Garnacho
91a7978711 grabHelper: Propagate events while this._ignoreUntilRelease
Let these events to be handled as usual, so that the grabbing actor
can handle input differently (e.g. trigger DnD) while the grabHelper
is active.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1774>
2021-05-11 16:13:49 +00:00
Carlos Garnacho
ecead8c727 dnd: Add timeoutThreshold setting
This setting (by default, 0) sets a time threshold in order to allow
DnD. If the drag is shorter than this threshold, DnD will be cancelled,
and event handling left to the next handlers.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1774>
2021-05-11 16:13:49 +00:00
Sebastian Keller
0a7507c617 altTab: Avoid allocation cycle when showing CyclerHighlight
CyclerHighlight was showing and resizing one of its child widgets when
its own allocation was changed, queuing another relayout, resulting in
allocation cycle warnings. Avoid this by updating the size of the
highlight when the frame rect of window has changes rather than the size
of the CyclerHighlight actor itself.

Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4167
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1842>
2021-05-11 17:36:29 +02:00
Leleat
5423179844 switcherPopups: Correct selection with arrows and scrolling using RTL
The switcherPopups use _next() and _previous() to get the items
in the text direction. I. e. with LTR _next() gets the right item;
on RTL it gets the left item. This doesn't work well with RTL when using
the arrow keys since the text direction doesn't matter in those cases.
Pressing Left Arrow should still move left regardless of text direction.
So use the opposite methods.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1835>
2021-05-11 14:09:33 +00:00
Olivier Fourdan
019229c40e windowManager: Return failure to start X11 services
If for some reason the xserver failed to start, mutter/gnome-shell
should not attempt to connect to the X11 display otherwise it will
lock up in XCB.

An indication of such a premature failure of the xserver is when the X11
services fail to start.

Return the status so that the caller can cancel the connection in time
and avoid the lockup of mutter/gnome-shell in case of failure.

This, however, makes the X11 services a critical component to start
Xwayland, meaning that a failure to start those services for any other
reason than the xserver failing to start would still prevent Xwayland
and therefore X11 clients to run in Wayland. This is however a lesser
issue than mutter/gnome-shell locking up.

This basically reverts commit a96753f0 - "windowManager: X11 can work
without gsd-xsettings".

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1837>
2021-05-11 14:05:40 +00:00
Florian Müllner
0ccdb4746f appDisplay: Extend faded edges beyond fade area
Now that the fade effect was reverted to the old behavior by default,
the app grid must opt-in extend faded edges beyond the regular fade
area.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1831>
2021-05-11 13:21:40 +00:00
Nishal Kulkarni
2b2a71832a windowManager: Hide overview on using hotkey
Change behavior on pressing Super+Number in Activities/Overview mode
so that the overview mode is hidden and application can be used.

This makes it consistent with clicking icon in the dash.

Closes: #4212
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1839>
2021-05-11 12:50:01 +00:00
Sebastian Keller
234024c4f4 workspace: Update WorkspaceLayout workarea on changes
Previously the workarea was only set on construction and then never
updated. As a result the preferred width and height as well as the
allocation were based on an outdated workarea size when it changed after
construction. This for example was happening during the startup
animation, for which the WorkspaceLayout is constructed before the panel
is shown. This caused the workspace in the overview to be slightly
smaller when it is first shown and the overview closing animation to
not expand the workspace to the correct size the first time it is
closed.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1771>
2021-05-11 02:36:54 +02:00
Jonas Dreßler
954131c1c8 overview: Sync grabs after running startup animation
In the nested session the startup animation sometimes fails, weirdly
that always happens to me when running a freshly built gnome-shell the
first time. The reason it fails is that mutter fails to aquire a pointer
grab from the xserver, XIGrabDevice() is unsuccessful.

A simple workaround for this race condition in the xserver is to just
grab the devices a bit later, that is after the startups animation
instead of before it.

This was also tested with disabled animations, and seems to work just as
well in that case.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1812>
2021-05-04 16:18:30 +00:00
Sebastian Keller
e7780623fe dnd: Don't use transformed size to calculate parent scale when restoring
Some drag actor parents might change their width to 0 after the drag
actor has been removed. If the drag is now canceled and the drag actor
is animated to return to the current parent position and scale, this
scale can not be determined and falls back to 1.0. This might be wrong
and can result in the drag actor being too large/small at the end of the
return animation.

To avoid this calculate the scale of the parent by recursively
calculating the product of its parents individual scales.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1790>
2021-05-04 15:45:58 +00:00
Jonas Dreßler
4e83aaf850 workspace: Extend clip when animating from window picker to app grid
We want to clip the Workspace actor in the appGrid state of the overview
in order to make sure windows that overflow the monitor don't spill out.
So far we had commit b1970b95b8 for that.

Now since the last commit, window previews always slightly overflow the
allocation with their icons. That means a part of the window icon gets
clipped away as soon as the transition to the appGrid starts, which
looks weird.

Fix that bug in the transition by slightly extending the clip downwards
when animating between the window picker and the app grid state. The
extra height we extend the clip by is controlled by the overviewState,
which means we extend the clip by the full icon overlap in the window
picker state, but don't extend the clip at all when in the app grid
state.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1813>
2021-05-04 14:16:46 +00:00
Jonas Dreßler
fcc80407ea workspace: Make window preview overlays overflow the allocation
We want to use as much space as possible for showing window previews in
the overview, and the title and close buttons of those windows are only
visible on hover, so we can show them above anything if we want.

On both primary monitors and secondary monitors, there's a certain free
space available towards the bottom edge of the monitor (on the primary
monitor we show the dash there, and secondary monitors just scale down
the Workspaces). We can make use of this by checking how much free space
there is available from the bottom edge of our allocation to the bottom
edge of the monitor, and then aligning the window previews to make full
use of this space.

So stop adding any padding to the edges of the Workspace, which will
make the windows a lot larger and completely fill the Workspaces
allocation.

The left, top and right monitor edges should always be far enough away
to accomodate the close button and hover scale-up of the window. Only
with the bottom edge of the monitor we have to be a bit more careful
(the overflowing height of the window title is quite big), so there we
check if enough free space is available. If there isn't enough free
space, we simply apply a bit of bottom padding again and shift the
window up.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1813>
2021-05-04 14:16:46 +00:00
Jonas Dreßler
7f90a46f8c workspacesView: Clip the SecondaryMonitorDisplay instead of the view
Make the SecondaryMonitorDisplay a bit more similar to the
ControlsManager container on the primary monitor, and clip that widget
instead of the WorkspacesViews on secondary monitors.

This will allow us to overpaint the WorkspacesView allocation and paint
the WindowPreview overlays like the title and close button outside the
allocation with the next commit.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1813>
2021-05-04 14:16:46 +00:00
Jonas Dreßler
51bf7ec176 screencastService: Improve the gstreamer pipeline for recording
The current gstreamer pipeline performs quite bad on slower machines and
is dropping lots of frames, improve the pipeline by changing a few
things:

- Use threads for videoconvert and improve speed of videoconvert by
disabling some unneeded things
- Add a queue before the encoding step, this allows the encoder to work
at its own pace and will lead to a lot more stability
- Remove the fixed quantizer and only set a max quantizer, this helps
quite a bit with performance
- Change the deadline parameter of vp8enc to 1: This makes the encoder
go into real time mode, which will make it a lot faster
- Set cpu-used to 16, the maximum possible value.
- Set static-threshold to 1000, static-threshold is the motion detection
threshold, and while a value of 100 is recommended for screencasting in
the gstreamer documentation (see [1]), using 1000 appears to perform a
lot better and still outputs fairly good quality
- Set a larger buffer size than the default size, this seems to get a
bit more stability during high load scenarios

All in all, those changes make the pipeline drop no more frames when
recording at 30 FPS and 2K screen resolution. That was tested on a
fairly recent mobile core-i5 processor.

Also, because we now have two %T replacement strings for the number of
threads, we need to switch to replaceAll(). For that to work, we have to
put the %T matching expression into quotes.

[1] https://gstreamer.freedesktop.org/documentation/vpx/GstVPXEnc.html?gi-language=c#GstVPXEnc:static-threshold

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1633>
2021-05-04 13:45:57 +00:00
Simon Schneegans
a8a79c0333 extensionsService: Log error if preferences dialog failed to open
This is helpful for continuous integration checks to see whether the
preferences dialog of an extension can be opened successfully.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1830>
2021-05-01 21:07:36 +00:00
Sebastian Keller
79acae4176 dnd: Don't try to restore to parent location if parent got destroyed
The original parent of a dragged actor might have been destroyed after
the drag has been started. When the drag is canceled and _dragOrigParent
is set, the code is trying to get the current position and size of it
when restoring. With a destroyed parent this however would result in a
crash.

This could happen for example when starting a drag on a window preview
while the overview is hiding and then releasing it once the transition
is done.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1817>
2021-04-29 18:25:56 +00:00
Sebastian Keller
0e917c3dbf workspaceThumbnail: Only create thumbnails once
`ThumbnailsBox` listens for the `showing` signal from the `Overview` to
create its thumbnails and destroys them on the `hide` signal. Since the
`showing` signal can be emitted multiple times when switching between
the shown and hidden state without ever fully completing the transition,
this will cause `_createThumbnails` to be called multiple times, each
time adding another set of workspaces.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3819
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1828>
2021-04-29 17:58:45 +00:00
Sebastian Keller
77023135ac overviewControls: Stop transitions when starting a gesture
When starting a gesture to open the overview while a transition to hide
the overview is running, Overview._shown will be first set to false when
starting the transition and then to true by the gesture before the
`onComplete` callback is called. The `onComplete` callback in this case
is `Overview._hideDone()` which starts a transition to show the overview
again which also emits the `showing` signal. Since the gesture emits a
`showing` signal as well, this results in two consecutive `showing`
signals without a `hiding` signal in between.

This breaks the `searchControler` which adds a key press handler to
start the search on `showing` and removes it on `hiding`. So every time
this happens a new handler that will never be removed is added,
resulting in the first key press being repeated.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4004
Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3819
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1828>
2021-04-29 17:58:45 +00:00
Leleat
fd0da9606f appMenu: Only show Open Windows, if there are at least 2 windows
It doesn't make sense to show the 'Open Windows' in the app menu,
if the app only has 1 open window to switch between. Hide the
window section in that case.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1827>
2021-04-29 12:22:38 +02:00
Sebastian Keller
401b584384 appDisplay: Don't use symbolic icon at full size for system actions
When attempting to account for scaling in e65e5ede the icon_size of the
StIcon was set to the target size, overriding the icon-size set in the
'system-action-icon' CSS, which was only half the size. The intent of
that commit however was not to scale up the symbolic icon, but the
circle around it. Do this by manually applying the scaling factor.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1777>
2021-04-29 09:42:40 +00:00
Florian Müllner
dedfdb6d0b dbusServices/screensaver: Disable auto-shutdown
For the screensaver service, it is quite normal that a consumer only
subscribes to the "ActiveChanged" signal without calling any methods.

The result is that we don't know about the consumer, and shut down
the service anyway after we hit the timeout.

If this happens, we break functionality like gnome-settings-daemon's
screen blanking on idle.

Fix this by simply disabling auto-shutdown for the service, which
also reflects the expectation that the screen saver service is
always running in a GNOME session.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1824>
2021-04-28 18:12:13 +00:00
Benjamin Berg
724291de7f gdm: Remove pending fingerprint verification failure
It can happen that we get a problem report and a verification failure at
the same time. For fingerprint, a problem report can result in an
internal verification failure to be queued.

Remove this queued failure again if we got a failure already from GDM
directly.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1821>
2021-04-28 17:23:01 +00:00
Ray Strode
588dd6d80a gdm: Only disconnect verification signals when not going to retry
At the moment a failure in a background service can lead to the
various verification signals getting disconnected, even though
we still need them for a foreground service.

This commit changes the code to only disconnect when we've run
out of tries.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1821>
2021-04-28 17:23:01 +00:00
Ray Strode
8cfd4c969b gdm: Flip canRetry boolean to doneTrying on verification failure
This commit flips a boolean in the verification failed handler
to make things easier to read.

It also moves the retry logic to the bottom where it makes more
logical sense.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1821>
2021-04-28 17:23:01 +00:00
Ray Strode
a97c4b8945 authPrompt: Don't fail auth prompt until user is out of retries
At the moment we set the state of the auth prompt to failed any
time the user fails an attempt. But verification is still going
on until the user exhausts all attempts, so that's wrong.

This commit changes it to only set the state to failed when the
user is out of tries.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1821>
2021-04-28 17:23:01 +00:00
Ray Strode
a56d508d69 authPrompt: Don't clear querying service unless querying service fails
At the moment we treat a failure in any service as a signal to stop
tracking users responses to service questions.

This commit makes sure we don't stop waiting for answers if a background
service fails.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1821>
2021-04-28 17:23:01 +00:00
Leleat
4e35ca8e26 windowPreview: Make St.Label use single line mode
When a windowPreview is hovered or selected, it will show its window's
title as a caption. That title may contain Newline characters which will
effect the windowPreview size. Make the caption's St.Label use single
line mode to prevent that.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1822>
2021-04-28 14:29:19 +02:00
Sebastian Keller
380d61dc43 screenshot: Ignore events in SelectArea after making a selection
The grab and actor are only removed after the selection rectangle has
finished fading out. During this time it was possible to still change
the position of the selection rectangle.

Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2761
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1825>
2021-04-28 11:40:19 +00:00
Sebastian Keller
548e18ad7e screenshot: Only select area on button release after a button down
On Wayland it is possible to trigger area selection with a button
already being down. SelectArea would then react to the subsequent button
release without ever having seen a corresponding button down first,
leaving the start coordinates of the selection rectangle uninitialized.

Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2761
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1825>
2021-04-28 11:40:19 +00:00
Carlos Garnacho
82c2f293a0 keyboard: Always emit ::pressed late on keys with variants
When we press a key with variants, we used to prevent an
early ::pressed, because a long press could show the options
popover, and the press be undone.

In addition, this long press could move to one of the suboptions,
and be released there. For this case we also want this late
emission of the ::pressed signal.

This makes the "tap, drag, release" pattern work on the
regular OSK keys, in addition to the emoji panel.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1789>
2021-04-27 22:02:53 +02:00
Carlos Garnacho
40e53492ab keyboard: Allow calling _release() without press on OSK keys with touch
This is already allowed for pointer events, but touch events still expected
that the touch begin and end happen on the same Key actor. Change this
behavior for touch events, this is necessary for the tap-drag-release
pattern to select key variants to work on all input devices.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1789>
2021-04-27 21:58:24 +02:00
Prajna Sariputra
6ee2c4f74c status/power: Always show real percentage in battery label
We currently display the percentage as "100%" if the battery state is
"fully charged", but the actual capacity may be lower than that.

Just show the real percentage, which is consistent with Settings.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1787>
2021-04-27 21:04:34 +02:00
Ray Strode
1196532493 loginDialog: Allow timed login with disabled user list
At the moment the timed login feature is implemented in the user list.
If there's no user list, we don't show the indicator anywhere and
don't proceed with timed login.

This commit allows timed login to work when the user list is disabled.
It accomplishes this by putting the timed login indicator on the
auth prompt in that scenario.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1809>
2021-04-23 16:00:39 -04:00
Ray Strode
1410db2470 loginDialog: Realign list of batch tasks
The way the batch tasks are currently aligned doesn't jive with
with eslint likes.

This commit moves it over a bit.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1809>
2021-04-23 15:56:22 -04:00
Sebastian Keller
b93bf2bd69 altTab: Avoid setting GObject property to undefined instead of null
The windowActor in the CyclerHighlight was set to undefined if
this._window was null. This was causing an error when trying to set it
as a property.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1820>
2021-04-23 15:21:56 +00:00
Florian Müllner
28723ac088 overviewControls: Support double-super when animations are off
When super is pressed again during the overview transition, we shift
up to the app grid. That means that the feature currently doesn't
work when animations are disabled (like in a VM), because there is
no transition in that case.

Address this by adding a time-based fallback in that case, i.e.
shift up when a second super-press occurs within 250ms after the
first one.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1811>
2021-04-19 20:24:54 +00:00
Florian Müllner
d823141360 dialog: Ensure action callback is called with no arguments
Using the callback directly as signal handler means that it will
receive the signal parameters (in this case: the StButton instance
that emits the signal).

This leaks an implementation detail that is harmless in the best
case, but can break dialogs when using bind() on the callback.

Avoid that trap by explicitly calling the callback without arguments.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1819>
2021-04-19 19:12:59 +02:00
Florian Müllner
7eba5322b5 audioDeviceSelection: Ensure close() is called with no arguments
This is the same as commit c5b18ee66a, but for the audio device selection
dialog.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1819>
2021-04-19 19:12:59 +02:00
Florian Müllner
7935da6168 audioDeviceSelection: Move a method to the new coding style ...
... before touching its code in the next commit.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1819>
2021-04-19 19:12:59 +02:00
Alexander Mikhaylenko
58ed969dd1 background: Check xml mime type instead of extension
This is required to be able to set animated wallpapers with the wallpaper
portal, which names them 'background' without an extension.

See https://gitlab.gnome.org/bertob/nostalgia/-/merge_requests/12

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1816>
2021-04-16 19:53:53 +05:00
Jonas Ådahl
1f0ef7fb46 workspaceThumbnail: Update monitor index on 'monitors-changed'
For the primary monitor workspace thumbnail, we must keep the monitor
index in sync with what is currently the primary monitor index,
otherwise we might end up trying to move windows to non-existing
monitors.

For example, if the primary monitor index was 1 when the thumbnail box
was created, but later, the primary monitor index changed to 0, with the
other monitor being turned off, moving a window to one of the workspaces
on the workspace thumbnail, gnome-shell would attempt to move it to the
monitor with the index the primary monitor had in the past, with the
problem being that that monitor no longer exists.

Fix this by listening on the 'monitors-changed' signal on the layout
manager, and update the monitor index of the primary workspace
thumbnails box. Make sure to connect to the signal before creating the
thumbnails box, as the thumbnails box itself will listen to the signal
and recreate its actual thumbnails, and it must do this with the up to
date monitor index.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4075
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1810>
2021-04-14 15:43:09 +00:00
Jia Chao
f76e6877c7 keyboard: Fix suggestions box
The suggestions box actor was not being correctly populated.
Make it correctly use the St.BoxLayout add_child() method.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3422
Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2965
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1806>
2021-04-13 10:02:09 +00:00
Georges Basile Stavracas Neto
eb96288738 overviewControls: Use correct state when updating AppDisplay visibility
When OverviewControls goes from HIDDEN to APP_GRID, it constantly checks
if AppDisplay needs to be visible or not by checking the current overview
state is bigger than WINDOW_PICKER. Turns out in this case this check is
problematic, because when the current state trespasses WINDOW_PICKER, the
layout manager will have already positioned AppDisplay halfway to its final
position.

Use either the final or the current state, whichever is biggest, when updating
the AppDisplay visibility. It optionally allows passing the overview state
params to _updateAppDisplayVisibility() so that we avoid a few trampolines to
recaltulate the adjustment state.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1805>
2021-04-12 12:06:30 -03:00
Andrew Zaech
ce4ece2c44 util: Use fade_margins in ensureActorVisibleInScrollView function
Commit f60a469a34 removed vfade_offset in favor of fade_margins.
Util.ensureActorVisibleInScrollView function needs to be adjusted
accordingly.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1802>
2021-04-10 15:20:43 +02:00
Jan Tojnar
53dd291aba extensionsService: Really fix copying technical details
gdk_clipboard_set_text() is not introspectable, we have to use
gdk_clipboard_set_value() (shadowed as gdk_clipboard_set())
instead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1796>
2021-04-09 20:53:34 +00:00
Florian Müllner
dd7d336228 workspacesView: Don't tie PgUp/PgDown to mapped state
Both app grid and window picker are now always visible in the overview,
so their handling of the PgUp/PgDown keys conflicts.

Resolve that by checking for the overview state instead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1798>
2021-04-08 20:48:58 +02:00
Florian Müllner
fc54e0bed8 workspacesView: Fix PgUp/PgDown shortcut
We still try to switch to the workspace above/below, which doesn't
do anything since the layout is now horizontal.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1798>
2021-04-08 20:48:58 +02:00
Jonas Dreßler
dda23fc4c6 workspace: Center window previews horizontally and vertically
Window previews looks slightly offset to the left and top right now
because we don't use the same padding on all edges of the Workspace. We
do that because the oversize and overlap of the window previews is
different on all sides (for example the bottom overlap is very large
because there we show the window title).

To make sure window previews are always perfectly centered on the
Workspace, only use the largest one of the oversize values as spacing
and padding, and add the larger one of the overlap values for the
vertical padding in addition.

With this, we now center the window previews on the Workspace while
never overpainting the allocation of that Workspace to show overlays.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1670>
2021-04-08 17:51:15 +00:00
Sebastian Keller
6f0589313d appDisplay: Ensure icon grid is always aligned with the pixel grid
When adaptToSize was called with an odd width, the calculated padding
was not an integer and as a result the icon grid was no longer aligned
to the pixel grid. Similarly it was possible for the page size to be a
non-integer value, which was causing items to not be aligned for
pages > 1.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1799>
2021-04-08 16:50:46 +00:00
Jan Tojnar
1b5d71130e extensionsService: Fix copying technical details when extension crashes
This was forgotten when porting to GTK 4, leading to the following error
when user tries to copy the error message produced by an extension:

	JS ERROR: TypeError: Gtk.Clipboard is undefined
	_initActions/<@resource:///org/gnome/Shell/Extensions/js/extensionsService.js:255:31
	run@resource:///org/gnome/Shell/Extensions/js/dbusService.js:177:20
	main@resource:///org/gnome/Shell/Extensions/js/main.js:19:13
	run@resource:///org/gnome/gjs/modules/script/package.js:206:19
	start@resource:///org/gnome/gjs/modules/script/package.js:190:8
	@/nix/store/fwnkwvhwm3kqck4fhkc5y5z853radggg-gnome-shell-40.0/share/gnome-shell/.org.gnome.Shell.Extensions-wrapped:7:17

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1795>
2021-04-08 08:10:36 +02:00
Florian Müllner
e6be180df1 main: Use session mode property for welcome dialog
We only want to show the welcome dialog in the user session, not
on the login screen or during initial setup. We currently achieve
that by explicitly checking for those mode names, but there are
other modes like gnome-classic where the dialog is equally un-
helpful. Support those cases by adding a session mode property
that determines whether the welcome dialog should be enabled,
so that modes can opt in or out of the feature themselves.

(Both the 'gdm' and 'initial-setup' modes are based on the
'restricted' mode, so this change does not affect them)

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1793>
2021-04-06 18:57:39 +00:00
Zander Brown
2f70e524c3 remoteSearch: Fetch enabled/disabled list once
GLib should be caching the values but it seems unnecessary to fetch
and marshal what should be the same lists N times instead of just once

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1791>
2021-04-02 19:07:56 +00:00
Suryashankar Das
4bfb91c5cd overview: Pass state while calling _animateVisible()
Pass OverviewControls.ControlsState.WINDOW_PICKER to the _animateVisible
function in _hideDone().

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3876
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1769>
2021-04-02 10:20:32 +00:00
Carlos Garnacho
a7a7ea4af7 appDisplay: Save pages after drag end
In the case that we drop an app in the dash, we take the icon
out of its current page, but we forget to save the page after
that.

This results in oddities dragging further elements around, as
the PageManager does no longer consider them to be in the
positions they actually are.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1939984
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1775>
2021-03-31 10:35:26 +00:00
Sebastian Keller
dfc44973de status/network: Disconnect signal handler on destroy in NMConnectionItem
Otherwise this can trigger _sync() calls after the objects it is trying
to update have been destroyed.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1782>
2021-03-31 10:31:12 +00:00
Yuri Konotopov
02b06385ea extensionDownloader: Use POST request for checking updates
Usage of GET requests for checking updates was made deprecated
at website some time ago [1], but REST endpoint was
CSRF-protected until recently [2].
The body of update request may be big enough and thus does not
suitable for GET requests.

[1] 0b38da1b2b
[2] e3ab0c07dc

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1781>
2021-03-31 13:31:00 +04:00
Peng Wu
f563424417 keyboard: Fix display keyboard layout crash with some input methods
Some ibus input method will use the current keyboard layout,
and return "default" as the keyboard layout.
When this happens, display the current keyboard layout instead.

Fixes #3863.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1756>
2021-03-29 09:33:45 +00:00
Daniel van Vugt
1f0e4b58ab keyboard: Handle symbolic OSK key codes as explicitly invalid
`key` is an empty string in this case, causing `charCodeAt(0)` to return
`NaN`, which when passed to `Clutter.unicode_to_keysym` now generates an
error in gjs >= 1.67.3:

```
JS ERROR: Error: Argument wc: value is out of range for uint32
```

And the symbolic keys like Backspace, Enter and Caps Lock would have their
presses ignored.

Just skip the call to `charCodeAt` that will fail and allow
`Clutter.unicode_to_keysym` to return its usual error flag.

Fixes: https://bugs.launchpad.net/bugs/1918738
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1758>
2021-03-15 12:41:10 +00:00
Daniel van Vugt
c5b18ee66a status/network: Ensure the Cancel button passes undefined to close()
The parameter to `ModalDialog.close(timestamp)` is optional. But when
invoked via the network dialog's Cancel button it was receiving an
implicit parameter value that's definitely not a timestamp:

```
[0x560f18af0c50 StButton.modal-dialog-linked-button:first-child hover ("Cancel")]
```

And as of today (or gjs >= 1.67.3) that's reported as an error:
```
JS ERROR: Error: Argument timestamp: value is out of range for uint32
popModal@resource:///org/gnome/shell/ui/main.js:638:12
popModal@resource:///org/gnome/shell/ui/modalDialog.js:206:14
close@resource:///org/gnome/shell/ui/modalDialog.js:179:14
```
and so you can't Cancel the dialog anymore.

Make sure `ModalDialog.close()` receives an `undefined` timestamp it
knows how to handle.

Fixes: https://bugs.launchpad.net/bugs/1918666
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1757>
2021-03-15 18:19:04 +08:00
Sebastian Keller
f2db9b52c9 iconGrid: Only use page relative coords for orientation in getDropTarget
The x and y coordinates were both adjusted to be page relative, even
though the icon grid can only scroll in one direction. This was leading
to coordinates outside of the icon grid to be considered part of it and
a wrong drop target to be chosen.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1767>
2021-03-14 18:44:03 +00:00
Florian Müllner
3c221cea48 overview: Fix showApps() compatibility method
The method is unused in gnome-shell itself, but extensions may still
want to call it, so make sure it actually works.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1766>
2021-03-14 12:47:42 +00:00
Florian Müllner
d271a51bfd swipeTracker: Remove unused property
The :allow-long-swipes GObject property relies on the automatic
getter/setter added by gjs and is not actually backed by
_allowLongSwipes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1765>
2021-03-13 22:32:23 +00:00
Jonas Dreßler
d49606bbaa overview: Get rid of panel ghost actor
Right now we use a ClutterClone ghost of the panel simply to add some
spacing to the top monitor edge.

We can remove the panelGhost by adjusting the allocations of all the
parts of the overview ourselves inside ControlsManagers vfunc_allocate,
this should also work with extensions that move the panel somewhere
else.

This makes the initial relayout of the overview significantly faster,
because we now no longer have to relayout the whole panel in the
process.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1755>
2021-03-13 22:13:25 +00:00
Jonas Dreßler
ae23ad372d overviewControls: Return zero preferred size
The OverviewControls actor gets allocated a fixed size by its parent,
the OverviewActor, anyway, so it's pretty useless to go through the size
request machinery and add up all the sizes of items in the iconGrid,
coming up with a preferred size that's wrong anyway.

Instead simply return a min and preferred size of 0 in
get_preferred_height/width of ControlsManagerLayout.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1755>
2021-03-13 22:13:25 +00:00
Jonas Dreßler
9152d6613b workspacesView: Store some variables outside the children-allocate loop
We've seen this to help quite a bit with performance previously, so also
do it here.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1755>
2021-03-13 22:13:25 +00:00
Jonas Dreßler
c239cd398d overviewControls: Hide the appDisplay when it's not shown
Hiding actors allows excluding them from layout, so by hidding the
appDisplay in all the cases where the overviewAdjustment is not actually
showing it, we can save a lot of time on the first frame of painting
the overview because we no longer have to layout the whole appGrid.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1755>
2021-03-13 22:13:25 +00:00
Jonas Dreßler
d21a0b186e iconGrid: Subclass a C actor for BaseIcon
We create a lot of BaseIcons for the appGrid, one for every app, and for
all of those we have to hop through JS to get the preferred width. That
makes it another obvious target for moving to C, so let's do that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1755>
2021-03-13 22:13:25 +00:00
Jonas Dreßler
36b103525c keyboard: Correctly compare cursor rect to keyboard rect
The logic that decides whether we should shift the window up when the
cursor rectangle overlaps with the keyboard rectangle doesn't work
properly right now, we want it to work like this:

- If the currently focused window is shifted up, keep it shifted up
until the cursor rect no longer overlaps the keyboard rect. To do that
comparison correctly, we need to adjust for the height the cursor rect
is shifted up by (keyboardHeight) and temporarily shift it down again.

- If the currently focused is not shifted up, we want to shift it up as
soon as the focus rect overlaps the keyboard rect. If that's not the
case, want still want to call _setFocusWindow(null) in order to shift
the previously focused window back down.

This fixes two issues: 1) We're currently shifting windows back down at
the wrong position of the cursor (that is y < keyboardHeight). 2) We're
not shifting down previously focused windows when focusing a different
window with the new focus in a specific region (y >= keyboardHeight &&
y + h < monitor.y + monitor.height - keyboardHeight).

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1760>
2021-03-13 18:28:15 +00:00
Jonas Dreßler
95ed7c7a06 keyboard: Add proper tracking of window movements to focus tracker
So far the FocusTracker of the OSK can only recognize grab ops on a
window, that is when the user grabs the window using a mouse or the
touchscreen and actively drags it somewhere.

Window can also be moved using keyboard shortcuts, fullscreen buttons or
other ways which don't rely on grabs. Start also supporting those window
movements by listening to the "position-changed" signal on the currently
focused window and emitting the new "window-moved" signal in that case.

Because the OSK sometimes moves windows by itself, we temporarily
disconnect from that new signal while we move the focused window in
_windowSlideAnimationComplete().

This also takes care of resetting this._focusWindowStartY on movements
of the window.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1760>
2021-03-13 18:28:15 +00:00
Jonas Dreßler
7b990daee2 keyboard: Animate focus window using position instead of translation-y
Commit 8526776b4a changed the OSK to use
the translation-y property of the MetaWindowActor when animating a focus
window, which broke two things:

1) It's not compatible with the obscured region culling we do for
windows in mutter. That's because MetaCullable strictly operates in
integer coordinates and thus has to ignore any transformations
(translation-y is a transformation). Because of this, during the
animation and gesture, window damage is now tracked incorrectly,
introducing painting issues. The best fix for this would probably be
factoring in transformations when tracking damage in MetaCullable, but
that's not feasible right now.

2) It broke the shifting up of maximized and tiled windows, likely that
is because they are positioned using constraints internally, and mutter
enforces those constraints every time meta_window_move_frame() is
called, not allowing the window to move somewhere else.

To fix both issues, go back to the old way of shifting the window for
now, using the fixed y position of the ClutterActor. To make sure the
drag-up gesture still works, store the initial y1 position of the window
and then use that as a reference point for all our animations.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1760>
2021-03-13 18:28:15 +00:00
Jonas Dreßler
2cf8b93a7b keyboard: Allow closing immediately
Just like opening the OSK, make it possible to close it immediately,
we'll make use of this in the next commit.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1760>
2021-03-13 18:28:15 +00:00
Jonas Dreßler
95b83575cb keyboard: Don't move focusWindow back down on window grab
I suggested it myself when reviewing
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1668, so
here I am reverting that again...

The difference between calling _setFocusWindow(null) and simply
unsetting the focusWindow is that the former animates the window back to
its position before we shifted it up, while the latter simply "lets go
of the window".

In this case we actually want the latter because after the user grabbed
the window, we obviously should not animate it away right underneath the
users pointer/finger.

To ensure the same mistake doesn't happen again, add a small comment
explaining why this code is as it is.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1760>
2021-03-13 18:28:15 +00:00
Alexander Mikhaylenko
f48e58a81a swipeTracker: Reset before emitting 'end' and not after
If the actor is unmapped in the handler, the touch gesture will cancel.
Since we haven't reset the state yet, it will still work and will actually
cancel the gesture, so reset before that instead.

Fixes overview cancelling when trying to open it with a swipe.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1731>
2021-03-13 18:08:24 +00:00
Alexander Mikhaylenko
3c1074085e swipeTracker: Clamp position when long swipes are enabled too
Avoid wrapping back to the first page when swiping forward from the last
page.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1731>
2021-03-13 18:08:24 +00:00
Alexander Mikhaylenko
df4c05f834 swipeTracker: Pass orientation in constructor
When this class was written, all swipes in the shell were vertical, so it
made sense to make the default orientation vertical. This isn't the case
anymore, thus pass make it mandatory to specify orientation when creating
a tracker.

Change the property default values to horizontal as well to match Clutter
instead of the old shell design.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1731>
2021-03-13 18:08:24 +00:00
Alexander Mikhaylenko
c06bc74d6d swipeTracker: Check orientation with a threshold for touchpad
Avoid picking the direction too early.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1731>
2021-03-13 18:08:24 +00:00
Jonas Dreßler
b160e44dab keyboard: Stop offsetting the focus rectangle
The focus rectangle of the OSK currently gets stored with an offset that
removes the global coordinates and makes it window-local coordinates.
This offsetting has been applied since the introduction of the
FocusTracker with commit fc5ab44704 and it
seems there's no real reason for it.

By removing this, we also emit position-changed when the window has
moved but the window-local coordinates stayed the same. We really want
to emit position-changed in that case because it might affect whether
the window needs to be shifted up.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1728>
2021-03-12 15:56:12 +00:00
Jonas Dreßler
746230f8b6 keyboard: Ignore focus rects outside the window
Apparently some clients, including gtk don't "clip" the focus rectangle
to their window bounds when scrolling the focus outside the window. This
makes us shift up windows when the focus actually is no longer visible.

This issue needs fixing in GTK, it should probably stop reporting
focus changes when the focus moves outside of the visible view. We can
still do a little bit better on our side though and "clip" the rectangle
to the windows frame rect: If it moves out of the window, we simply stop
updating our focus rect.

The intersection check introduces a small problem though: Some clients
(for example gedit) will give us a cursor rect that has a 0 width or
height. This won't play well with graphene_rect_intersect()
(GrapheneRects never intersect if they are 0-sized), so we set the size
to 1 in case we get a 0-sized rectangle.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1728>
2021-03-12 15:56:12 +00:00
Jonas Dreßler
7c83cbe135 keyboard: Use GrapheneRect in focus tracker
This will be useful in the next commit.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1728>
2021-03-12 15:56:12 +00:00
Jonas Dreßler
3acf840c99 keyboard: Initialize the FocusTrackers current window correctly
The FocusTracker keeps track of the currently focused window using its
internal this._currentWindow property. It will only pick up the focused
window though when receiving a "notify::focus-window" signal, so the
focused window that's set when the FocusTracker is created won't be
picked up.

Fix that by setting the _currentWindow during creation of the
FocusTracker.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1728>
2021-03-12 15:56:12 +00:00
Jonas Dreßler
d8adeba6b6 keyboard: Properly destroy focus manager when destroying keyboard
We're currently leaking this object, so make sure to disconnect
everything properly and plug the leak.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1728>
2021-03-12 15:56:12 +00:00
Jonas Dreßler
6f39d76a3e keyboard: Remove unused argument
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1728>
2021-03-12 15:56:12 +00:00
Jonas Dreßler
9f415f1c89 keyboard: Make a few functions private
Now that we got rid of the external calls to setCursorLocation(), we can
make that private. animateShow() and animateHide() weren't called from
outside anyway, so let's make those private, too.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1728>
2021-03-12 15:56:12 +00:00
Jonas Dreßler
f3f0396b7e keyboard: Clear keyboard rest timer when opening immediately
When immediate is true on open(), we want to show the OSK immediately,
it also makes sense to cleanup the keyboard rest timer in that case.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1728>
2021-03-12 15:56:12 +00:00
Jonas Dreßler
cb68bbee36 keyboard: Rename focusTracker "reset" signal to "window-grabbed"
What this signal does is fire when a window was grabbed. A receiver
might want to do something special when a window was grabbed, whereas
"reset" can mean anything. Rename the "reset" signal to
"window-grabbed".

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1728>
2021-03-12 15:56:12 +00:00
Florian Müllner
16c7739170 messageTray: Remove deprecated code
Originally the Source method for showing notifications was "notify",
which had to change when turning it into a GObject subclass to not
clash with g_object_notify().

That change happened during the 3.36 cycle, so extensions have had
two releases (a year) to adapt to the replacement. That seems long
enough, so remove the deprecated compat code.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1749>
2021-03-10 15:17:52 +00:00
Jonas Dreßler
59b97a3095 workspace: Use Util.lerp() instead of actor box for interpolating
Instead of interpolating our workspace and layout boxes for each child
using clutter_actor_box_interpolate(), use our Util.lerp() function and
stay in JS land instead.

This is quite a large performance improvement since it avoids
heap-allocating a new ClutterActorBox for every child. With this, we're
finally at a duration of 1.0 ms to allocate the Workspace with 20
windows.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1743>
2021-03-09 15:40:49 +00:00
Jonas Dreßler
afb56df55c windowPreview: Subclass a C actor
Move the get_preferred_width/height() and allocate() vfunc
implementations of WindowPreview to C, subclassing the C GObject from
JS.

This gets us another significant performance gain, allocating a
workspace with 20 windows now only takes 1.2 ms.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1743>
2021-03-09 15:40:49 +00:00
Jonas Dreßler
650e0960a2 workspace: Get some values outside the children loop when allocating
It turned out that getting properties and saving them to a variable
outside of loops instead of accessing them everytime inside the loop can
have significant impact on performance, so do that in Workspaces
vfunc_allocate().

Here the impact is not that large, about 0.05 ms with 20 open windows,
that still seems worth it though.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1743>
2021-03-09 15:40:49 +00:00
Jonas Dreßler
5792b98f79 workspace: Don't create useless childBox
Creating a ClutterActorBox here is superfluous, we actually create and
assign a new box to this variable inside the loop.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1743>
2021-03-09 15:40:49 +00:00
Jonas Dreßler
ec4b9b8894 workspace: Don't do checks in animateAllocation()
These checks aren't needed since Clutter should enforce this for us
already and skip the implicit transition when possible. This gets our
time spent in vfunc_allocate() down to 2.0 ms with 20 windows

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1743>
2021-03-09 15:40:49 +00:00
Jonas Dreßler
3e9a08a2e1 workspace: Use set_origin/set_size instead of properties when allocating
Setting four properties is more expensive than calling two C functions,
so move to set_origin()/set_size() calls for our ClutterActorBox
handling.

This gets us down to an average time of 2.1 ms spent in vfunc_allocate()
with 20 windows

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1743>
2021-03-09 15:40:49 +00:00
Jonas Dreßler
e75f3a8aed workspace: Iterate windowSlots directly when allocating
We can save a little bit of time in this loop by iterating directly
over the windowSlots array instead of iterating through children and
then performing a search for the windowSlot. This saves more time and we
only spend 2.2 ms instead of 2.3 ms in vfunc_allocate() now.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1743>
2021-03-09 15:40:49 +00:00
Jonas Dreßler
04c781674c Move WindowPreviewLayout from JS to C
This layout manager is used quite often and the time we spend calling
it's allocate and get_preferred_width/heigth functions increases with
every open window.

We can save a lot of precious time during the layout cycle by moving
this layout manager from JS to C, thus avoiding the overhead of
trampolining between C and JS land.

In a measurement where the average time spent in vfunc_allocate() of the
Workspace actor was measured while opening an overview with 20 windows,
the average time spent went down from 3.1 ms to 2.3 ms.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1743>
2021-03-09 15:40:49 +00:00
Jonas Dreßler
5de9166f7a panel: Only update appMenu icon when the app actually changed
Right now we always recreate the icon of the appMenu when calling
_sync(). This will relayout the panel everytime we open the overview,
because we call _sync() in that case.

We can easily avoid that by only recreating the icon actor in case the
app that's opened actually changes. This gets us close to doing no more
relayouts of the panel when opening the overview.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1733>
2021-03-09 13:15:09 +00:00