Commit Graph

2813 Commits

Author SHA1 Message Date
Jonas Ådahl
f4934c0421 tests/perf: Use custom solid background in tests
They don't measure performance, and we don't want to have to install
gnome-backgrounds, so bundle a solid color background image to use
instead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
2022-11-25 22:09:54 +01:00
Jonas Ådahl
bcc4d15fdf tests: Add test running basic perf test
This test runs all of GNOME Shell using the headless backend inside a
mocked D-Bus environment. The basic test tests, well, basic things, like
the panel menu, the overview, showing the app grid view, as well as
going back to the session view.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
2022-11-25 22:09:53 +01:00
Jonas Ådahl
2ca6e2e7e8 shell/window-tracker: Disassociate windows on shutdown
This avoids trying to deal with handling windows being unmanaged one by
one after we destroyed the ShellGlobal.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
2022-11-25 22:09:37 +01:00
Jonas Ådahl
210754f1e9 st/widget: Remove transitions when unmapped
This avoids having animating timelines on invisible and detached actors.
This also silences some warnings about the timeline being running
without being attached to the stage.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
2022-11-25 22:09:37 +01:00
Jonas Ådahl
9bc89b821c main: Prepend RPATH or RUNPATH paths to gir search paths
If one wants to run tests the non-installed gnome-shell, that currently
fails as gnome-shell the executable attempts to link against
./build/src/libgnome-shell.so, but when GObject introspection tries to
find what library to link to for Shell, it goes to the installed
libgnome-shell.so, causing two different versions of libgnome-shell.so
to be loaded.

This, however, can be avoided thanks to meson adding $ORIGIN paths to
relevant libraries before installing an executable. What this means in
practice is that we can inspect ourself upon startup, discover whether
the RPATH/RUNPATH header contains $ORIGIN, and if so, expand it to the
directory containing the executable, and prepend the introspection
search paths with said directory.

This effectively means that the introspection machinery now finds the
same library that the linker linked the gnome-shell executable with,
making it run successfully.

It's not possible to use $GI_TYPELIB_PATH since
g_irepository_prepend_library_path() takes precedence. There is no
"append" variant of that API.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
2022-11-25 22:09:37 +01:00
Jonas Ådahl
1559f03a82 main: Tear down the gjs context before the mutter context
Tearing down gjs means that we won't have any dangling references kept
alive by GC or otherwise alive Javascript objects, when we finally tear
down the mutter context. This allows for a clean shutdown of GNOME
Shell.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
2022-11-25 22:09:37 +01:00
Jonas Ådahl
f6a5093c09 main: Notify about shutdown before tearing down
This will allow the shell to tear things down more gracefully.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
2022-11-25 22:09:37 +01:00
Jonas Ådahl
009da0df64 shell-global: Get backend from context
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
2022-11-25 22:09:37 +01:00
Jonas Ådahl
f171f92522 shell-global: Add MetaContext getter
Start to use it instead of using g_object_get().

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
2022-11-25 22:09:37 +01:00
Jonas Ådahl
13ac25b0c5 perf-tool: Add --headless
This will use the headless mode of the native backend, and create a
1280x720 virtual monitor, for running the perf test in.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
2022-11-25 22:09:37 +01:00
Jonas Ådahl
b56f853103 perf-tool: Only 'restore' gnome-shell if run with --replace
Otherwise the perf tool will fork and spawn a gnome-shell process
that'll just go and fail.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1349>
2022-11-25 22:09:37 +01:00
Florian Müllner
d7dc50da71 shell/app-system: Retrack windows if necessary
We currently don't update running apps when the set of installed
apps changes. However we should, as the change could mean that

 - the app got uninstalled, and the running app should become
   window-backed

 - a newly installed app got launched before the app cache was
   updated, and we replace the window-backed fallback with the
   proper app

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2480>
2022-10-18 19:20:26 +00:00
Florian Müllner
329a286303 st/label: Don't guard against NULL text
Commit 9168f6055e marked the parameter as nullable, which is in
conflict with the precondition check. But given that NULL is
valid for the underlying ClutterText (and GtkLabel accepts it
as well), there's no strong argument for disallowing NULL, so
remove the precondition check.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2465>
2022-09-02 18:59:07 +02:00
Milan Crha
a6244e34de calendar: Correct handling of recurring events
When a recurring event has deleted a single instance, it's received
as an event modification, thus make sure all of the old instances
are removed before adding the event to the list of events.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2328>
2022-08-31 16:35:14 +00:00
Florian Müllner
66ae4c7ff3 shell/screenshot: Plug memory leak
grab_screenshot_content() does not follow the usual pattern of
```
  task = g_task_new (...);
  g_task_run_in_thread (task, ...);
  g_object_unref (task);
```

That means we hold the original reference throughout the operation,
and must release it ourselves when done.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2461>
2022-08-31 13:25:43 +00:00
msizanoen1
2d589ec365 Revert "shell: Fix pixbuf reference leak saving screenshots"
This reverts commit f5754adb68 in
accordance with https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2449#note_1539435.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2452>
2022-08-29 21:54:30 +07:00
Dmitrii Naidolinskii
f5754adb68 shell: Fix pixbuf reference leak saving screenshots
When saving a screenshot, the GdkPixbuf created would be left
with a dangling reference after saving to disk (either leaked
on errors, or via an extra reference on success). Always unref
the pixbuf so it's either destroyed on error or there is a single
reference fully transferred to the caller of the function.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5501
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2449>
2022-08-28 16:37:54 +05:00
Georges Basile Stavracas Neto
078aca220d Revert "st/scrollview: Add ::content-padding property to StScrollView"
This reverts commit 0d62dadfbc.

The only consumer of such API is now gone.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Daniel van Vugt
9b3ee774f6 st/theme-node-drawing: Conditionally paint the center shadow rectangle
Only when part of it is actually visible.

Because the central rectangle is generally the largest part, this
eliminates most of the shadow's render time. For example, animating
`.workspace-background` by tapping Super, the shell's overall render
time is reduced about 15%.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1915>
2022-08-09 07:11:44 +00:00
Florian Müllner
71d503dc6e st/theme-node-transition: Guard against 0-sized offscreen box
We know beforehand that setting up the framebuffers will fail in
that case, so we can avoid cluttering the log with warnings.

(Although the warning would likely indicate a stylesheet bug)

https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/issues/289

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2326>
2022-08-04 18:12:31 +00:00
Alessandro Bono
77d0471bc4 st/settings: Connect to mouse settings
This is likely a typo.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2402>
2022-08-04 16:59:33 +00:00
Ivan Molodetskikh
83564e59b3 workspace: Port WorkspaceBackground allocate to C
WorkspaceBackground's allocate is a hot function called every frame
during overview animations. Port it to C.

While we're at it, cache the work area and the monitor geometry, which
do not need to be re-fetched on every allocation.

This reduces the average WorkspaceBackground allocation time from
0.134 ms to 0.017 ms. With four workspaces, scrolling the overview sees
an average WorkspacesView allocation time improvement from
1.104 ms to 0.678 ms.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2394>
2022-08-03 12:30:31 +00:00
Ivan Molodetskikh
1fd08e80ed Add shell_global_get_workspace_manager ()
It will be used in the subsequent commit.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2394>
2022-08-03 12:30:31 +00:00
Milan Crha
5c935af7d3 build: Port to gcr4
The gcr4 is going to replace gcr3. As only base functions are used,
the port to gcr4 is trivial.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2386>
2022-08-02 16:13:54 +00:00
Sebastian Keller
fb75120a39 shell/app: Fix small memory leak in get_pids()
The iterator was pointing to NULL when going out of scope, leading to
autofree not clearing the list.

==300183== 32 bytes in 2 blocks are definitely lost in loss record 14,798 of 38,939
==300183==    at 0x484586F: malloc (vg_replace_malloc.c:381)
==300183==    by 0x4D7D980: g_malloc (gmem.c:127)
==300183==    by 0x4D95AB3: g_slice_alloc (gslice.c:1074)
==300183==    by 0x4D96D96: g_slist_prepend (gslist.c:282)
==300183==    by 0x487854F: shell_app_get_windows (shell-app.c:794)
==300183==    by 0x48791A1: shell_app_get_pids (shell-app.c:1201)
==300183==    by 0x488B293: shell_window_tracker_get_app_from_pid (shell-window-tracker.c:702)
==300183==    by 0x488B632: get_app_from_window_pid (shell-window-tracker.c:370)
==300183==    by 0x488B632: get_app_for_window (shell-window-tracker.c:436)
==300183==    by 0x488B632: track_window (shell-window-tracker.c:549)
==300183==    by 0x4CDBB75: g_cclosure_marshal_VOID__OBJECTv (gmarshal.c:1910)
==300183==    by 0x4CD8BE9: _g_closure_invoke_va (gclosure.c:893)
==300183==    by 0x4CF2A28: g_signal_emit_valist (gsignal.c:3406)
==300183==    by 0x4CF2C2C: g_signal_emit (gsignal.c:3553)

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2367>
2022-07-06 18:13:46 +00:00
Marco Trevisan (Treviño)
1bd9076590 main: Define a custom log writer to dump on structured messages
Even though GNOME Shell is not explicitly using structured logging via
G_LOG_USE_STRUCTURED, GLib uses it as default since 2016 [1], and so
we're de facto using it.

As per this, if backtrace on warnings is enabled, it is ignored since the
log handler isn't used anymore, and no dump is printed.

Thus, replace the default log handlers with writer functions instead, honoring
backtrace-warnings debug string.

[1] https://gitlab.gnome.org/GNOME/glib/-/commit/fce7cfaf40b6e1e50c9140aa0397f5

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/697>
2022-07-06 17:14:56 +00:00
Florian Müllner
a06b469fbb st: Only notify on property changes
Since commit 5a23c96bd9 we use EXPLICIT_NOTIFY for properties,
however there are still cases where we still notify unconditionally
from the setter, because we don't check the existing value first.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2325>
2022-06-08 14:16:28 +00:00
msizanoen1
afcd58e3ba shell: Do not create a systemd scope when using D-Bus app launching
Applications launched using D-Bus activation will have a returned PID of
0, which systemd interprets as moving the requesting process to a new
scope, causing GNOME Shell to be moved to another scope. Fix this by not
creating a systemd scope when PID is 0.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2305>
2022-06-07 14:35:02 +00:00
Florian Müllner
88441c35c9 build: Remove gst dependencies
Those are left-overs from the built-in Shell.Recorder.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2297>
2022-05-20 12:00:22 +00:00
Florian Müllner
1d0a08b5e2 build: Do not redefine polkit autocleanup
PolkitAgent recently added autocleanup functions itself, so check
for their existence at configure time and only define our own when
they don't exist upstream.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2296>
2022-05-17 14:04:01 +00:00
Florian Müllner
d72abf5268 st/button: Add :icon-name property
GTK4 added a convenience property for icon-only buttons. While that
use case is not quite as common in the shell as in GTK apps, it still
seems common enough to mirror the GTK API.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2254>
2022-05-06 13:39:40 +00:00
Sebastian Keller
f0a0471927 st/theme-node: Only try to parse non-empty inline styles
Otherwise cr_parser_new_from_buf() will fail creating a parser for a
buffer of length 0, resulting in further errors due to the parser being
NULL. This could happen when extensions were trying to set the style of
a widget to an empty string.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4634
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2286>
2022-04-29 21:50:55 +00:00
Sebastian Keller
8c40b48a09 shell/window-preview-layout: Fix memory leaks
The WindowInfo allocated when adding a window was not getting free'd
when the window was getting removed again or the layout was getting
disposed. Also the hash table in which the WindowInfos are stored was
not getting free'd on destruction either. Both could result in small
leaks after closing the overview.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5238
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2256>
2022-04-22 15:02:29 +00:00
Jakub Steiner
e831a9240d HC: Do not set icon theme from gnome-icon-theme-extra
- High contrast icons are regular symbolic icons

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2243>
2022-03-30 17:11:37 +02:00
Florian Müllner
e4446cd15c Revert "shell/app: Do not try to activate OR windows"
Now that shell_app_get_windows() itself filters out OR windows, this is
no longer needed.

This reverts commit f9037f5889.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2252>
2022-03-28 15:54:33 +00:00
Florian Müllner
c02ca54943 shell/app: Do not include OR windows in get_windows()
We started tracking all windows to make sure the assumption that any
window can be match to an app holds. It is not expected however to
ever represent OR windows in the UI, so it seems better to exclude
them from get_windows() instead of expecting everyone to filter the
return value themselves.

(The returned list still includes "uninteresting" windows like attached
dialogs, which can be important for cases like the correct MRU order in
alt-tab)

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2252>
2022-03-28 15:54:33 +00:00
Florian Müllner
35120dd69c st/theme-node: Default to right text-align in RTL
When neither the theme node itself nor any of its parents specifies
an explicit text direction, we default to aligning to the left.

That's a good default for LTR locales, but for RTL aligning to the
right is a better one.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2247>
2022-03-28 15:49:39 +00:00
Daniel van Vugt
918c063693 st: Generate shadows from the silhouette of the source texture
As first mentioned in commit 672171093, the CSS spec defines shadow
colors independently from the colors casting the shadow. It's not
a physical light simulation so a shadow is allowed to be a different
color from texture casting it.

This means we only care about the shape of the source where alpha
values of zero are adjacent to alpha values of non-zero. And all such
non-zero pixels should be treated as fully opaque for the purpose of
shadow generation. While this would be wrong for a physical light
simulation it does allow us to cast shadows around semi-translucent
shapes and better support CSS.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4477
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1918>
2022-03-05 13:55:37 +00:00
Carlos Garnacho
a595fc6d47 st: Move StWidget away from clutter_event_get_source()
Ask the stage about the device actor instead for hover tracking.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2216>
2022-03-04 12:27:34 +00:00
Carlos Garnacho
6064a3e020 st: Move StEntry away from clutter_event_get_source()
Ask the stage about the device actor instead. Since leaving the
StEntry also means leaving the contained ClutterText, the checks
on LEAVE can be just removed.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2216>
2022-03-04 12:27:34 +00:00
Carlos Garnacho
7b7e5ac0de st: Move StButton away from clutter_event_get_source()
Ask the stage about the device actor instead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2216>
2022-03-04 12:27:34 +00:00
Florian Müllner
574594ec22 st/theme-node: Add missing precondition checks
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4851

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2207>
2022-02-22 12:43:06 +01:00
Jonas Dreßler
8f4427f87b st/scroll-view: Don't queue redraw in update_fade_effect()
ClutterEffects are responsible for queueing redraws when their
properties change (and StScrollViewFade is a good citizen already), also
Clutter itself should queue a redraw when adding/removing an effect.

Users of Clutter should never have to queue redraws themselves (unless
they're implementing a custom ClutterEffect or ClutterContent), so don't
queue a redraw here.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2189>
2022-02-16 20:15:28 +00:00
Jonas Dreßler
0b9b13942a st/scroll-view: Only update fade effect on CSS changes if CSS sets it
The fade effect can also be added to the scroll view programatically
instead of using CSS via the st_scroll_view_update_fade_effect() API.

We make use of this API in the appDisplay, but since commit ba547ec1d
the fade margins get overridden to 0.0 from the ::style-changed handler.
Fix this by only setting the fade margins when CSS actually defines a
custom vfade/hfade offset.

Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5079
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2189>
2022-02-16 20:15:28 +00:00
Jonas Dreßler
ba547ec1db st/widget: Emit "style-changed" on all theme changes
Since now the resource consumption of the "style-changed" signal
handlers should be significantly lower, we can start emitting the signal
in all cases again as it was originally intended. This fixes some small
visual issues, like the battery percentage in the panel only being shown
on hover or updating the size of StIcons on scale-factor changes.

This effectively reverts f74c07b9ac

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2099>
2022-02-14 13:50:03 +00:00
Jonas Dreßler
09903b6426 st/label: Compare shadow spec before invalidating shadow on style change
Just like with the last commit for StEntry, check whether the text
shadow actually changed before invalidating the pipeline on style
changes of StLabel.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1744>
2022-02-14 12:52:20 +00:00
Jonas Dreßler
ba774e1fa2 st/entry: Compare shadow spec before invalidating shadow on style change
Instead of doing a lot of useless work every time we receive the
style-changed signal, only invalidate our text shadow pipeline in case
the shadow actually changed.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1744>
2022-02-14 12:52:20 +00:00
Jonas Dreßler
3b4a1fcd51 st/shadow: Add a fast path to comparisons
We do this in most places in St, it's consistent to do it here, too.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1744>
2022-02-14 12:52:20 +00:00
Jonas Dreßler
8b3e1e01f6 st/label: Invalidate text shadow on style changes to ClutterText
Just like with the last commit, listen to some ClutterText property
changes to catch style changes that were trigerred by
_st_set_text_from_style() and invalidate the shadow spec on changes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1744>
2022-02-14 12:52:20 +00:00
Jonas Dreßler
898334f31d st/entry: Invalidate text shadow on style changes to ClutterText
We update a few properties of ClutterText when the CSS changes via
_st_set_text_from_style() (which we call when receiving the
style-changed signal).

Right now we simply invalidate the text shadow every time we receive the
style-changed signal, but we're going to change that with the next
commits. To ensure the shadow still gets invalidated on CSS changed that
might affect the shadow, listen to a bunch of property changes that will
get notified when any property that affects the shadow changes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1744>
2022-02-14 12:52:20 +00:00
Jonas Dreßler
2bb36db9e8 st/entry: Invalidate shadow on cursor position/size changes
When text shadows are used, the cursor indicating the current position
also casts a shadow.

This means we have to regenerate the shadow texture after the cursor
position changed, so invalidate the shadow in that case.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1744>
2022-02-14 12:52:20 +00:00
Carlos Garnacho
57d681863a shell: Shuffle ifdef to fix !HAVE_SYSTEMD build
The internal SystemdFlags enum is used from common code for
both systemd availability cases. Shuffle it outside the ifdef
so it's seen everywhere.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2177>
2022-02-13 12:06:11 +00:00
Carlos Garnacho
352c9695f3 shell: Add call to check the existence of a systemd unit
These checks will be handy while handling ibus-daemon startup, since
this is going to move to a systemd service soon.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2171>
2022-02-11 23:51:24 +00:00
Carlos Garnacho
adc58ea743 shell: Refactor internal calls to systemd service
Add some parameters to make these calls useful beyond starting
and stopping units. We will need to query the existence of units
for starters.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2171>
2022-02-11 23:51:24 +00:00
Florian Müllner
9a2505f18c shell: Specify G_PARAM_EXPLICIT_NOTIFY where appropriate
Like we did in ST, opt out of g_object_set()'s implicit change
notifications, so that notify is only emitted when a property
*actually* changes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2168>
2022-02-10 13:09:37 +00:00
Florian Müllner
17719352f3 shell: Use g_object_notify_by_pspec() where possible
It's slightly more efficient not having to do property lookups. While
that is unlikely to be a concern for the properties in question, it's
still good practice and makes the code base a bit more consistent.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2168>
2022-02-10 13:09:37 +00:00
Florian Müllner
e3a3f79200 shell/app: Remove unused property ID
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2168>
2022-02-10 13:09:37 +00:00
Florian Müllner
5a23c96bd9 st: Specify G_PARAM_EXPLICIT_NOTIFY where appropriate
We are now consistently calling notify() when a property does change.

With that we can opt out of g_object_set()'s implicit change notifications,
so that notify is only emitted when a property *actually* changes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2168>
2022-02-10 13:09:37 +00:00
Florian Müllner
bfb52aaf9d st: Use g_object_notify_by_pspec() where possible
It's slightly more efficient not having to do property lookups. While
that is unlikely to be a concern for the properties in question, it's
still good practice and makes the code base a bit more consistent.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2168>
2022-02-10 13:09:37 +00:00
Florian Müllner
76e5e22dac st: Add static setters
Even where properties can only be set via g_object_set(), separate
setters help with code organization and consistency with other
properties.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2168>
2022-02-10 13:09:37 +00:00
Florian Müllner
6a6b7eb341 st/scroll-view: Add missing notify call
Another property where changes aren't notified when going through
the public setter.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2168>
2022-02-10 13:09:37 +00:00
Florian Müllner
621c8606df st/entry: Add missing notify calls
Whoops, at the moment changes of most properties are only notified
when going through g_object_set() and not when using the public
setters.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2168>
2022-02-10 13:09:37 +00:00
Sebastian Wick
170f3ee089 glsl-effect: Allow to set uniform matrices
Add support for setting a uniform matrix on GLSLEffect because the color
vision deficiency simulation extension requires it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2164>
2022-02-08 21:55:31 +01:00
Olivier Fourdan
5b8a32ca71 main: Raise the NOFILE limit if a Wayland compositor
When being run as a Wayland compositor, raise the NOFILE limit to
mitigate the risk of running out of file descriptors.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2117>
2022-02-08 08:25:25 +00:00
Olivier Fourdan
9862ee9b25 shell/app: Restore NOFILE limit
Restore the nofile limit when launching apps so that they do not
inherit from the Shell's own limit.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2117>
2022-02-08 08:25:25 +00:00
Olivier Fourdan
1bb05c33be shell: Restore NOFILE limit before restarting
When restarting Shell, make sure to restore the original nofile limit so
that the new instance starts with the original value.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2117>
2022-02-08 08:25:25 +00:00
Sam Hewitt
0e3ddb1f02 theme: Remove icon resources from theme
- move all icons to the icons directory
- rename some icons to be more meaningful
- put all icons on a resource sheet
- update references to icon name changes
- deprecate icons for those in standard set

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2141>
2022-02-04 13:59:20 +00:00
Milan Crha
42b3b85460 calendar-server: Read timezone from the calendar, not its timezone cache
The calendar's timezone cache holds only timezones already received
or added to the calendar, thus when asking it for a timezone for "the first
time", it returns NULL and a wrong timezone is used instead.
The get_timezone() does not do any I/O when the timezone is already cached
on the client side, thus it's fine to use it.

This could exhibit with non-recurring events, which use custom time zones,
in which case the event is shown in a wrong time.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2145>
2022-02-03 17:18:48 +00:00
Florian Müllner
c85643d9d5 st/settings: Switch icon-theme when "high-contrast" is active
This is in line with how GTK handles the setting. Since we are not
using GtkSettings for the icon theme, we have to replicate the
behavior ourselves.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2069>
2022-02-01 14:11:07 +00:00
Alexander Mikhaylenko
f67418c682 st/settings: Use the new high-contrast gsettings key
We now have a dedicated "high-contrast" setting that we can
use instead of a "magic" theme name.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2069>
2022-02-01 14:11:07 +00:00
Carlos Garnacho
643e8aec5f shell: Drop shell_global_begin/end_modal()
These are no longer used nor necessary, we now use have ClutterGrab()
which notify the internals about the changes in event handling.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2046>
2022-01-29 02:19:14 +01:00
Carlos Garnacho
a8a9d4f806 st: Use ClutterGrab for StScrollBar implicit grab
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2045>
2022-01-29 01:16:29 +01:00
Carlos Garnacho
bcfcacdb56 st: Use ClutterGrab for StButton implicit grab
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2045>
2022-01-29 01:16:29 +01:00
Ivan Molodetskikh
27bcf0da48 screenshot-ui: Use ImageContent for notification icon
StImageContent specifically, when used as a notification icon, preserves
the screenshot aspect ratio and avoids ugly scaling.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1954>
2022-01-27 22:25:42 +00:00
Ivan Molodetskikh
941774b786 screenshot-ui: Add cursor capturing option
The cursor texture, scale and position is captured separately and
overlaid on top of the preview, and on top of the final screenshot
image. This allows toggling it on and off post-factum.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1954>
2022-01-27 22:25:42 +00:00
Ivan Molodetskikh
deb614a031 screenshot: Add API to screenshot stage to a ClutterContent
As mentioned in the last commit, we'll split up taking screenshots into
creating a GPU texture first, and later saving that to disk as a PNG.

For individual windows it's already easy to get a ClutterContent with
the texture using meta_window_actor_paint_to_content (), for the stage
it's not that easy and involves a few extra steps including X11 specific
ones.

So introduce a new ShellScreenshot API which does all that and provides
the caller with a ClutterContent of the stage:
shell_screenshot_screenshot_stage_to_content ()

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1954>
2022-01-27 22:25:42 +00:00
Ivan Molodetskikh
71c6918588 screenshot: Add API to get PNG stream from a texture
With the new screenshot UI we're introducing, we'll be capturing all
screenshots to textures on the GPU at first, and then create a PNG
stream from those textures at a later point. This will allow us to
present screenshots immediately to the user so they can inspect them and
select the right area before actually saving them to disk.

As a first step to make this work, introduce a new ShellScreenshot API
that writes an existing CoglTexture to a PNG output stream:
shell_screenshot_composite_to_stream ()

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1954>
2022-01-27 22:25:42 +00:00
Florian Müllner
f9037f5889 shell/app: Do not try to activate OR windows
Since https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2029,
we track all windows, including OR ones. While this means that we can
now assume that any window can be matched to an app, it also means
we have to be more careful to not perform an unsupported action like
focus or raise on an OR window.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2131>
2022-01-27 14:30:49 +01:00
Florian Müllner
88a8bc7419 st/box-layout: Deprecate :pack-start property
A property for reversing the visible order of children is a bit odd.

It has also been unused by actual gnome-shell code since 2010, and the
somewhat related pack_start()/pack_end() API in GtkBox(Layout) is gone
in GTK4.

With that in mind, turn the property into a no-op and deprecate it,
so that it can be dropped next cycle.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2085>
2022-01-07 21:47:47 +00:00
Nate Graham
a13b2358a9 shell/app: Honor XDG SingleMainWindow key
This is the upstreamed version of X-GNOME-SingleWindow which is now a
part of the XDG desktop file spec as of version 1.5; see
https://gitlab.freedesktop.org/xdg/xdg-specs/-/merge_requests/53

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2084>
2022-01-05 18:14:09 +00:00
Florian Müllner
65450a836e build: Drop incorrect positional arg
Unlike other targets that take a name, i18n.merge_file() does not.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2078>
2021-12-23 18:43:25 +00:00
Florian Müllner
daf729de11 build: Replace deprecated meson functions
Replace deprecated functions with their direct replacements:

 - dep.get_pkgconfig_variable() → dep.get_variable()
 - prg.path() → prg.full_path()
 - source/build_root() → project_source/build_root()

In one case we need meson.global_source_root() that was only
added in meson 0.58, so bump the requirement to that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2077>
2021-12-23 15:52:21 +00:00
Florian Müllner
331454a757 shell/app: Re-order running-state cleanup
Since commit 1807be1, we clear the fallback icon when a window is
removed, and notify the icon change. The notify call currently
happens after removing the window from the running state, but
before syncing the state (and possibly clear the running state
altogether).

That state is inconsistent and results in an assertion hit when
some code tries to re-fetch the icon in response to the notify
call.

Address this by updating the state before clearing the fallback
icon, so that the app will be in the correct STOPPED state after
removing the last window.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2073>
2021-12-22 01:55:05 +01:00
Sebastian Keller
7e0c6dc2c1 st/scroll-view-fade: Simplify shader a bit
The shader was using too many ALU instructions for Intel 945GM hardware,
so simplify it a bit. The resulting math is the same, but a few
redundant operations have been removed.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4883
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2072>
2021-12-21 15:04:01 +00:00
Benjamin Berg
1807be1277 shell/app: Correctly track the window used for the fallback icon
We were not properly tracking the window used for the fallback icon.
This could trigger a crash, as disconnection of the signal handler might
happen on the wrong window, which in turn could cause the icon change
notification to happen on a destroyed ShellApp instance.

Fix this by tracking the window used for the fallback icon. Disconnect
the icon notify callback explicitly for this window only when it is
removed.

Also, just to be extra safe, make sure that the icon is never NULL even
if x11_window_create_fallback_gicon should return NULL for some reason.

Closes: #4436
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2065>
2021-12-21 14:34:38 +00:00
Florian Müllner
54f803dfee shell/window-tracker: Track all initial windows
meta_workspace_list_windows() doesn't include OR windows, so go
through the newly added meta_display_list_all_windows() instead.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2029>
2021-12-16 22:56:09 +01:00
Florian Müllner
acee68c5da shell/window-tracker: Track ::window-created
We currently track windows via MetaWorkspace's ::window-added and
::window-removed signals. Those aren't emitted for override-redirect
windows though, as those aren't actually located on any workspace
(see https://gitlab.gnome.org/GNOME/mutter/-/blob/gnome-41/src/core/window.c#L1322).

While that shouldn't be an issue as there's no good reason to look up
the ShellApp of an OR window, extensions can make modifications that
result in OR windows ending up in places that assume that every window
has an associated ShellApp.

We can either
 - accept that extensions break stuff (including badly)
 - carefully handle app-less windows everywhere
 - extend tracking to OR windows

Opt for the last option, as that's the most user-friendly and least
disruptive one.

It's also simpler to track ::window-created and ::unmanaged, as we
don't have to track workspaces or windows moving between workspaces.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2029>
2021-12-16 22:44:35 +01:00
Florian Müllner
f8e531b52d shell/window-tracker: Track windows getting unmanaged
It makes sense to not rely on workspaces' ::window-removed
signal, and we already do that in ShellApp.

However it is odd to remove a tracked window from the app,
but still track it in the window tracker. Move the code
to remove unmanaged windows from both.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2029>
2021-12-15 19:07:07 +01:00
Florian Müllner
4f91cfb5a6 shell/window-tracker: Do not filter tracked windows by type
The window-type property may change, and with it the skip-taskbar
property that decides whether we consider it "interesting".

As a result we can end up showing untracked window, i.e. one
which does not have an associated app.

Cover this case by simply tracking all windows regardless of
their type. This won't change the app's running state, as that
is solely based on the skip-taskbar property (which is enforced
for all previously excluded window types).

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2029>
2021-12-15 19:07:07 +01:00
Sebastian Keller
b37fa61eb0 calendar-server: Calculate event end according to spec if missing
The ical specification allows events to omit an end, which for dates
means the end is start + 1 day and for date times it is equal to the
start.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4753
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2023>
2021-11-30 02:13:24 +00:00
Sebastian Keller
72a6450017 calendar-server: Remove the all-day property of events
The way it is currently calculated is broken for days with DST changes
or leap seconds and it is not needed anymore anyway. This will also make
the fix in the following commit simpler.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2023>
2021-11-30 02:13:24 +00:00
Sebastian Keller
bc32a52108 shell/app: Don't move all workspace windows to their startup workspace
Windows from some applications, such as guake, are created as showing on
all workspaces. When these windows are put on the workspaces via
set_workspace_state() during construction, the first time the window is
added to a workspace in the loop triggers the shell app tracker which
then tries to move the window to its startup workspace. This makes the
window unsticky which triggers another set_workspace_state() which
tries to remove the window from all workspaces, but currently it is only
on the first one and then adds it to the startup workspace. Once that is
finished, the first set_workspace_state() continues adding the window
to the remaining workspaces, despite the window now no longer having
on_all_workspaces set to true.

When the window is now unmanaged, the window according to its internal
state is only found on the startup workspace, so it will only be removed
from that. This causes the assertion to fail that checks that the window
is no longer present on any workspace after this.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2014>
2021-10-30 13:21:17 +02:00
Carlos Garnacho
ff4ff66498 Revert "st: Only use clutter_actor_invalidate_paint_volume() if the API exists"
Since we are past the 40 API change hurdle, it is safe to revert this
commit.

This reverts commit 1cefd589da.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2010>
2021-10-27 19:51:27 +02:00
Ray Strode
ddb6276a49 st/password-entry: Fix crash when DConf changes after StEntry is destroyed
commit 8721c5db37 made StPasswordEntry
honor the 'disable-show-password' setting.

Unfortunately, it introduced a lifecycle bug where the signal handler
for noticing setting changes can out live the entry itself.

This commit fixes the problem by using g_signal_connect_object

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2004>
2021-10-12 15:27:35 -04:00
Marco Trevisan (Treviño)
2bcc6c09ed st/icon: Ensure icons are updated if theme node is invalid
Icons that are changed while an actor is not mapped may not have a theme
node associated with, and thus we'd end up not updating them at all.
In fact we return early in st_update_icon(), and this was not an issue
until commit 0b1dfbf6f3, because we'd end up to update the icon anyways
once the style was changed (and so with a valid theme node), but since
such change we might not updating the icon if no theme detail changed.

To prevent this, add a flag to require an icon update when the theme
changed, if no successfully update happened earlier.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4568
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1983>
2021-09-30 18:55:11 +02:00
Jonas Ådahl
563437de91 Always assume GLSL is supported
The support for GLSL has been advertised as unconditionally supported by
mutter for a while, and has now lost the 'GLSL' feature completely. Lets
remove the checks.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1985>
2021-09-21 16:37:01 +02:00
Florian Müllner
0eff22ebcd build: Add option to turn off tests
St's theme test now requires the libmutter-test library, which is only
built when tests are enabled. Instead of mandating a particular build
configuration in mutter, add a corresponding option in gnome-shell as
well.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1975>
2021-09-07 12:53:47 +00:00
Robert Mader
483d1b3177 shell/util: Remove get_content_for_window_actor()
It got replaced by `meta_window_actor_paint_to_content()`.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1879>
2021-09-04 12:10:51 +02:00
Evan Welsh
0d8e0025d6 init: Set console log domain
GJS added a console module that extensions may start using. To ensure that
extensions using console.log() and similar functions don't show up as
'Gjs-Console' in users' system logs, we should call setConsoleLogdomain()
with 'GNOME Shell'.

This GJS API addition is only accessible using ECMAScript Modules (ESM),
this commit moves shell startup to a small init.js module and adapts
CI jobs to either handle or ignore it.

We can drop the .jscheckignore file when future versions of SpiderMonkey
allow for compile checks without validating module specifiers.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1958>
2021-09-01 14:55:47 +00:00
Florian Müllner
f719ea8d69 st/scroll-bar: Remove pointless condition
Both branches are identical (which is correct - orientation or
text direction is irrelevant for the trough).

Spotted by coverity in CID 351261.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1950>
2021-08-13 15:16:54 +02:00