2989 Commits

Author SHA1 Message Date
Florian Müllner
411fe9c42f st: Fix closure annotations
Quoting Ebassi https://www.bassi.io/articles/2023/02/20/bindable-api-2023/:

    Whenever you’re describing a function that takes a callback, you
    should always annotate the callback argument with the argument that
    contains the user data using the (closure argument) annotation

    You should not annotate the data argument with a unary (closure).

    The unary (closure) is meant to be used when annotating the callback
    type

Recently gobject-introspection became a bit more strict with this and
that generated some warnings:

    Warning: St: invalid "closure" annotation: only valid on callback
    parameters

This commit fix all the closure annotations.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3535>
2024-11-06 14:59:43 +01:00
Bilal Elmoussaoui
715b47bddc Adapt to renamed Clutter threading functions
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3501>
2024-10-30 08:38:41 +01:00
Bilal Elmoussaoui
c3cd21cc16 texture-cache: Add missing cairo include
As the indirect include has been moved in Mutter.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3527>
2024-10-23 22:17:10 +02:00
Florian Müllner
30f99e11c1 shell/plugin: Stop implementing plugin_info()
The hook would be optional if anything called `meta_plugin_get_info()`,
except that nothing has done so for the last ten years.

It seems a bit pointless to export information that is completely
unused, in particular as we never updated it ("version 0.1"?!),
so just stop doing that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3524>
2024-10-22 10:57:36 +00:00
Sebastian Keller
50434f0138 st/theme-node-drawing: Don't skip square top left inset shadow corners
When the inner radius of the top left corner is 0, the corresponding arc
does not get drawn, resulting in a path going from the bottom left
corner to the top right corner when the path is closed.

Fix this by always including a line_to from the bottom left to the top
left corner.

Fixes: dde13b30c ("st/theme-node-drawing: Trace the correct path for inset box shadows")
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7996
2024-10-21 22:17:35 +02:00
Bilal Elmoussaoui
38cca6279c docs: Port various parts to gi-docgen annotations
So they properly show up in the docs.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3518>
2024-10-21 10:25:45 +00:00
Bilal Elmoussaoui
fd8d923a34 Adapt to exposed CoglSnippetHook
It was exposed few cycles back, so get rid of the duplicated type.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3519>
2024-10-21 12:03:23 +02:00
Bilal Elmoussaoui
ad0e2c940b st: Use macros to generate type boilerplate
Also mark certain types as final when they are not meant to be used
externally

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3506>
2024-10-16 17:37:43 +02:00
Bilal Elmoussaoui
31119228a8 st/focus-manager: Mark as final type
Nothing can derive this type. Also squeeze in a macro usage for cleanup

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3508>
2024-10-16 12:29:19 +00:00
Bilal Elmoussaoui
7aee2ca854 st: Remove useless HAVE_CONFIG
That doesn't exists anymore

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3507>
2024-10-16 13:50:52 +02:00
Bilal Elmoussaoui
5cbd847c84 Prefer using pragma once
Similar to what we did in mutter

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3507>
2024-10-16 13:17:45 +02:00
Bilal Elmoussaoui
aa0f2c4915 Use NULL for nick/blurb in GObject params
As they are only used by gstreamer for gst-inspect & other tools.
Projects like Mutter/gtk have completely dropped them as well, so follow
their path

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3505>
2024-10-16 10:19:41 +00:00
Bilal Elmoussaoui
9b58704c5d build: Replace cogl-pango with pango dependency
As CoglPango will be merged with Clutter and GNOME Shell
only uses Pango directly, so depend on that instead

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3494>
2024-10-02 22:54:59 +02:00
Daniel van Vugt
dde13b30c7 st/theme-node-drawing: Trace the correct path for inset box shadows
Previously we just copied the outer path and scaled it down, but that
resulted in an inconsistent thickness at the corners because the pivot
points for the arcs also moved inward.

So now we trace the inset path explicitly to maintain the correct
thickness (spread) around all the corners.

The spec actually mentions you need to do it in section 6.1 [1]:

> Note that for inner shadows, expanding the shadow (creating more
> shadow area) means contracting the shadow’s perimeter shape.

Despite the fact the example diagram gets it wrong in section 6.1.1 [2],
it does then follow with more confirmation that the shadow radius should
be reduced:

> To preserve the box’s shape when spread is applied, the corner radii
> of the shadow are also increased (decreased, for inner shadows) from
> the border-box (padding-box) radii by adding (subtracting) the spread
> distance (and flooring at zero).

[1] https://www.w3.org/TR/css-backgrounds-3/#box-shadow
[2] https://www.w3.org/TR/css-backgrounds-3/#shadow-shape

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7913
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3488>
2024-09-26 19:59:22 +08:00
Bilal Elmoussaoui
72db960a99 test/theme: Get ClutterSettings from the ClutterStage
As the global getter is now gone

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3452>
2024-08-29 13:48:42 +00:00
Florian Müllner
b7e42952dc cleanup: Remove gnome-shell-extension-prefs wrapper
After the old tool transformed into the extensions app, we added
a wrapper for compatibility with extensions that spawned the
command to open their preferences.

This was a long time ago.

As the ESM port happened since, we *know* that all extensions
are newer than that change. And as spawning the old prefs tool
is no longer accepted in review, no extension that is compatible
with current shell versions still does it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3456>
2024-08-28 21:55:16 +00:00
Bilal Elmoussaoui
ccc46d3f5c Remove text mipmapping disabling
As it is now disabled by default in CoglPango as a preparation for
merging it inside libst in the future

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3451>
2024-08-22 17:19:10 +02:00
Jonas Ådahl
deb9f05303 st/theme-node-drawing: Fix corner pipeline leak
The corner pipelines state theme node paint state was not necessarily
free of existing pipelines, so make sure to free them before looking up
new ones.

This avoids leaking thousands of CoglPipeline instances after toggling
the overview a bunch of times.

Fixes: e1868cab1a ("st/theme-node-drawing: Factor in border radius in update_resources()")
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3421>
2024-08-19 11:47:32 +00:00
Bilal Elmoussaoui
31c7cf800c st/widget: Don't use notify for emitting accessibility changes
Reduces the overhead

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3433>
2024-08-08 01:07:25 +00:00
Bilal Elmoussaoui
6e57d42d26 st: Adapt to Cally merge inside of Clutter
ClutterActor has now a get_accessible_type that replaces
the StWidget one, switch to using that

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3433>
2024-08-08 01:07:25 +00:00
Florian Müllner
1403747863 build: Add option to disable portal-helper
The portal login window uses WebKit, which is a security-sensitive
component that not all vendors want to support.

Support that case with a build option, and update the captive
portal handler to use the user's default browser if the portal-helper
is disabled.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3408>
2024-07-25 01:51:17 +00:00
Bilal Elmoussaoui
2a9722cf3a Adapt to required CoglContext params
They used to retrieve it from a global variable which we are trying to
remove from mutter

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3402>
2024-07-15 12:48:36 +02:00
Jonas Ådahl
90f69dcd25 st: Setup color state on nested paint contexts
This requires plumbing the parent paint context around, to get the
current color state of the paint context.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3363>
2024-07-09 17:36:55 +00:00
Jonas Ådahl
401ba0837e st: Adapt to the paint_node() vfunc passing a paint context
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3363>
2024-07-09 17:36:55 +00:00
Jonas Ådahl
6a612e78cb st: Replace 'material' with 'pipeline'
'Material' is an old name for the same Cogl concept, but lets use the
current naming to avoid confusion.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3363>
2024-07-09 17:36:55 +00:00
Philip Withnall
976c99c5e3 shell-util: Fix a memory leak of a floating variant on error
If `params` is floating when provided by the caller, and if one of the
early return paths is taken from this function, the call into GIO never
sinks and takes ownership of the `GVariant`, and hence it’s leaked.

Always explicitly sink the input variant as soon as the function is
called, then it can’t be leaked.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3396>
2024-06-28 17:06:31 +01:00
Bilal Elmoussaoui
4c771e2da0 shell/global: Stop tracking xdisplay/input-region
Instead, let mutter do that

Part-of:
<https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3362>
2024-06-27 16:39:08 +02:00
Bilal Elmoussaoui
446bee5f1d build: Allow to disable x11
By detecting whether libmutter was built with x11 or xwayland support
and disabling relavant code paths

Part-of:
<https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3362>
2024-06-27 16:39:08 +02:00
Bilal Elmoussaoui
19a37ed02a Remove obsolete/unnecessary includes
Part-of:
<https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3362>
2024-06-27 16:39:08 +02:00
Jonas Ådahl
63153a0af1 tests: Stop using nested test backend
It is replaced with a new test backend that uses the native backend
running in headless mode.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3373>
2024-06-21 21:03:07 +02:00
Jonas Dreßler
e1868cab1a st/theme-node-drawing: Factor in border radius in update_resources()
The reduced border radius from st_theme_node_reduce_border_radius() depends
on the allocation size, and when it changes, has_large_corners can change.
has_large_corners is used to determine whether to pre-render using cairo,
so that means a change to the allocation size can influence whether the
pre-render using cairo should happen or not.

On changes to the allocation size we don't want to call render_resources()
though, but just update_resources() instead. And since we know now that
changes to the allocation size might cause pre-rendering to get enabled
or disabled, we need to do the "should pre-render" checks in
update_resources(), too.

So factor out those "should pre-render" checks into a new function
st_theme_node_maybe_prerender_background(), and then call that function from
both render_resources() and update_resources().

This fixes rendering artifacts with borders or rounded corners after changes
to the actor size.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6567
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3354>
2024-06-21 15:32:34 +00:00
Florian Müllner
dc6f7a1289 st/theme-node: Fix potential NULL pointer dereferences
If the new CSS functions added in commit c593aecbde3
are used wrongly, an expected argument may be missing.

The code checks for that, but only after dereferencing
it to assign the next argument. Fix that by splitting
up the checks.

Spotted by coverity.
CID: #462818
Fixes: c593aecbde ("st/theme-node: Implement extensions for accent
color")

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3380>
2024-06-21 12:31:14 +02:00
Alice Mikhaylenko
c593aecbde st/theme-node: Implement extensions for accent color
Add -st-accent-color and -st-fg-accent-color so that these colors can be
accessed from CSS.

Since they are often transformed in SCSS atm, add st-transparentize(),
st-mix(), st-lighten(), st-darken() that work in runtime.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2715>
2024-06-20 13:18:00 +00:00
Alice Mikhaylenko
1ce6193f4e st/theme-context: Expose accent color
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2715>
2024-06-20 13:18:00 +00:00
Alice Mikhaylenko
ec9217bc0d st/settings: Add :accent-color
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2715>
2024-06-20 13:18:00 +00:00
Georges Basile Stavracas Neto
a96868d1b0 st: Switch to render nodes
Switch to render nodes. Most of the changes follow the pattern of
replacing a cogl_framebuffer_draw_*() call by (1) creating a paint
node, and (2) calling the corresponding clutter_paint_node_add_*()
API.

StWidget now overrides ClutterActor.paint_node(), instead of paint.
All subclasses that overrided the paint vfunc also are changed to
override paint_node.

The entry point for CSS rendering, st_widget_paint_background(), now
receives a root ClutterPaintNode, and propagates it to the rendering
machinery.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1538>
2024-06-18 16:59:38 +02:00
Bilal Elmoussaoui
7f0b1e98cf cleanup: Adapt to removed ClutterColor
It was replaced by CoglColor

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3142>
2024-06-13 18:29:13 +00:00
Florian Müllner
55027bb084 shell/app: Remove some dead code
`g_desktop_app_info_launch_uris_as_manager_with_fds()` was added
in GIO 2.57.2. We now depend on at least 2.79.2, so we no longer
need a fallback path for the case the function isn't available.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3361>
2024-06-13 18:21:01 +00:00
Bilal Elmoussaoui
f155eb7576 tests: Adapt to Clutter.Color.to_pixel removal
By using the to_string representation instead

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3367>
2024-06-12 16:09:43 +00:00
Bilal Elmoussaoui
cbf1d372f1 shell/screenshot: Don't use region type where rect is enough
New API added in
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3801

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3366>
2024-06-11 01:12:00 +02:00
Marco Trevisan (Treviño)
9abad7f25f shell-util: Pass the mutter context to the spawn child setup function
This was the type the function expected, but we were actually passing
the global context to it.

This didn't crash for some reason, but indeed it was wrong and we didn't
catch it because mutter side had not type-checks either

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3355>
2024-05-31 16:46:14 +02:00
Philip Withnall
37e49e8a22 shell-camera-monitor: Fix warning about strict aliasing
Changing type when casting a double pointer is not strictly allowed in
C. In order to fix compilation with `-fstrict-aliasing`, don’t use
`g_clear_pointer()` for clearing this pointer where the type expected by
the destroy notify function does not match the type stored in the
`ShellCameraMonitor` struct.

This introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3351>
2024-05-28 17:39:46 +00:00
Georges Basile Stavracas Neto
4e449536f8 st/scroll-view-fade: Cleanup unecessary vfunc override
It does exactly what ClutterOffscreenEffect does these days.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3347>
2024-05-26 15:55:56 +02:00
Bilal Elmoussaoui
37fd461759 build: Make use of the x11 dependency
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3344>
2024-05-25 10:29:28 +02:00
Bilal Elmoussaoui
c0c4572ed5 build: Remove unnused dependencies
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3344>
2024-05-25 10:28:51 +02:00
Marco Trevisan (Treviño)
781010be66 shell-util: Add async-signal-safe wrappers for GLib.spawn_async implementations
In the shell code we often use GLib.spawn_async to launch processes
with a GSpawnChildSetupFunc implementation in JavaScript to reset the
mutter nofile rlimit in the new child process.

However, this is highly unsafe to do because this implies that the child
setup function code is executed in gjs where a lot of allocations are
done and even more not-async-signal-safe code is executed, in fact
leading to dead-locks as reported in the past.

To prevent this, declare a new functions that do the same of the GLib
counterpart but without providing a GSpawnChildSetupFunc that is instead
implemented in the C-side doing the cleanup that mutter requires without
allocations or async-signal-unsafe code.

Helps: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6698
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3293>
2024-05-24 22:48:53 +00:00
Marco Trevisan (Treviño)
dcb5956dea shell-app: Do not allocate memory during GSpawnChildSetupFunc
The child context setup function used as launch GSpawnChildSetupFunc
uses g_object_get that internally potentially allocates memory, making
it not async-signal-safe and so not something that is safe to use in
between fork and exec, so just use the simpler getter here.

Note that the current implementation of app_child_setup() is safe
already as sd_journal_stream_fd, dup2 and close are so.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3293>
2024-05-24 22:48:53 +00:00
Florian Müllner
1fcdc60ca0 tests: Drop wrapper script for unit test runner
We build a small run-js-test executable so tests run in a
similar environment as gnome-shell, and then wrap it with
a generated script that provides environment variables like
GI_TYPELIB_PATH.

This is more complicated than it needs to be, we can just as
well set up the typelib search path from the runner and pass
in the environment via meson.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3164>
2024-05-21 13:42:28 +00:00
Florian Müllner
3220005eea croco: Remove unused and dodgy function
The function creates a parser object that is never used nor
freed, then always returns NULL.

Luckily it's unused, so just remove it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3321>
2024-05-20 13:42:11 +00:00
Florian Müllner
56cc755bf6 st/icon: Add :is-symbolic property
It can be useful to know whether an icon displays a symbolic (rather
than just requesting it). Add a new :is-symbolic property for that
purpose, backed by private API on StImageContent that allows the
texture cache to shuffle that information through to the icon.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3296>
2024-05-09 17:47:32 +00:00