3058 Commits

Author SHA1 Message Date
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
Marco Trevisan (Treviño)
794acd65a8 na-tray-child: Use absolute icon position as root event coordinates
Currently we're using relative positioning when sending click events to
tray icon clients, and this leads to some apps (especially Qt ones) to
try to open the menus at such absolute coordinate under X11.

To prevent this to happen, let's get the root coordinate from the xembed
and let's use it to compute the synthetic event root x/y.

We could have even used the actual event position for this, but getting
it from the xembed makes this more consistent.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3283>
2024-04-29 16:50:13 +00:00
pesader
72208da0c2 shell/window-tracker: Update docs on chromium shortcuts
The format of the .desktop file names and their StartupWMClass of
Chromium and Chrome shortcuts has changed, so update the docs to match
the most recent versions of these web browsers.

The user interface to create shortcuts has also changed. They are no
longer created through a "Tools" menu (which doesn't exist anymore), but
rather through a "Save and share" menu. So add that to the docs as well.

Finally, replace the examples using the GNOME Wiki with examples using
the new GNOME Developer Handbook.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7482
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3289>
2024-04-29 12:18:52 +00:00
Jamie Gravendeel
448df5c58e general: Remove periods from single sentences
This is done to align with the HIG rule about periods in single sentence
strings.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3280>
2024-04-24 13:58:01 +02:00
Sebastian Wick
b3580919e3 shell-util: Only use systemd if gnome-shell is managed by systemd
Simply looking at the return value of sd_pid_get_user_unit can be used
to determine if the process is in a systemd unit, but it doesn't say if
gnome-shell is managed by systemd.

For example, running toolbx on a host with systemd creates a libpod
unit, even if the gnome-shell that gets started in the toolbx is itself
not managed by systemd.

We can make sure that gnome-shell is managed by systemd simply by
checking if the unit we're running starts with org.gnome.Shell.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3267>
2024-04-22 23:11:06 +00:00
Sebastian Wick
0586158389 st/clipboard: Pass non-NULL mimetype to SelectionSourceMemory
meta_selection_source_memory_new previously had some precondition checks
which would return NULL if the mimetype is NULL but now that it returns
an error we can't do that anymore.

Move the precondition checks to the caller instead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3260>
2024-04-19 13:45:40 +00:00
Yotam Bar-On
77af504930 st/clipboard: Check for errors when creating MetaSelectionSourceMemory
depends on !3551

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3161>
2024-03-08 18:45:25 +01:00
Julian Sparber
90e9f56f79 shell/global: Don't force active workspace for launch context
Since the launch context may also be used to activate an action on an
running application with an already existing window, which we don't
necessarily want to move to a different workspace, don't set a workspace
for the launch context. If no active window exists for an application
then it will be place on the currently active workspace anyways.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3198>
2024-02-28 11:28:06 +01:00
Julian Sparber
54bc3aa4f5 shell/app: Add method to activate an action via FDO DBus activation
There are multiple different places where we activate an app action,
but none set the correct activation token. Therefore this adds an async
method to to call `ActivateAction` on `org.freedesktop.Appliaction`
with the correct activation token/startup id as platform data.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3198>
2024-02-28 11:27:40 +01:00
Florian Müllner
a1dd5d5e1e shell: Remove left-over function declaration
The function itself was removed in commit 4b80cbe1cd9e back
in 2016.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3206>
2024-02-21 16:10:40 +01:00
Bilal Elmoussaoui
8b6e1fe896 plugin: Stop overriding xevent_filter
The vfunc was used to register profiling hooks for glx.swapComplete
as we have sysprof nowadays and as that code path is x11 specific
anyways, let us drop it

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3201>
2024-02-20 13:51:30 +00:00
Bilal Elmoussaoui
cd33baff7d cleanup: Prefer CoglColor.init_form_4f
As we are slowly moving colors to be represented by a [0, 1] floats.
The unsigned integer variant will likely be removed in the near future, so be
ready for that already

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3147>
2024-02-16 12:34:30 +01:00
Bilal Elmoussaoui
43d4a12576 cleanup: Adapt to removal of CoglPipeline.set_color_*
Associated Mutter PR: https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3553

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3147>
2024-02-16 12:34:30 +01:00
Florian Müllner
8f2ab674fc st/drawing-actor: Queue redraw when repainting
Commit e7734e30bd removed the clutter_content_invalidate() call
that took care of queuing a redraw for us. Now that we no
longer delegate to a content we have to do that ourselves.

Fixes: e7734e30bd ("st/drawing-area: Merge ClutterCanvas to StDrawingArea")
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7397
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3190>
2024-02-14 00:04:20 +01:00
Carlos Garnacho
14db121ce5 st: Adapt to ClutterGrab becoming a GObject
Change the unref function, since it's no longer a boxed type.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3028>
2024-02-13 11:49:28 +00:00
Bilal Elmoussaoui
2dc0f48a22 window tracker: Adapt to renamed function
Ideally, the use case we have for MetaGroup would be removed but that
requires investigation that could be done as a future step

The function also expects a MetaWindowX11, so add a check to ensure
we don't crash at runtime if the function gets called on a wayland
client

Also removes an unused header import

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3157>
2024-02-08 16:45:06 +01:00
Julian Sparber
7b5da30f21 st/button: Fix small mistake in st_button_toggle_mode docs
When the toggle mode is enabled the checked state will be changed not
the active state.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3172>
2024-02-08 10:27:03 +01:00
Carlos Garnacho
92bea8a73e st: Do not use markup in button labels
It sounds strange that buttons would admit Pango markup
in their label text. It sounds better to default to plain
text, and let users wanting markup to access the child
directly.

This also makes the first label being set consistent
with later text being assigned wrt markup usage, since
the non-markup ClutterText API is used if the child is
already present and of the expected type.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3149>
2024-01-29 22:15:53 +00:00
Florian Müllner
671c242958 st/icon: Automatically update on icon theme changes
St.Icon is very commonly used for displaying themed icons, yet so
far updating the icon on icon theme changes is left to the caller.

Unsurprisingly, very few actually do that, with the result that
for most icons, icon theme changes only take effect after a delay
(say, a color change on hover) or not at all.

This is also inconsistent with GTK, where Gtk.Image will automatically
pick up icon theme changes.

Address this by tracking whether the current icon corresponds to
a themed icon, and update it automatically on theme changes if
it does.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3141>
2024-01-26 23:36:25 +00:00
Shmuel Melamud
e7734e30bd st/drawing-area: Merge ClutterCanvas to StDrawingArea
Since StDrawingArea is the only user of ClutterCanvas, it is possible
to move ClutterCanvas completely out of Mutter to gnome-shell. This
allows to remove another Cairo dependency from Mutter.

This patch merges ClutterCanvas code extracted from Mutter to
StDrawingArea.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3098>
2024-01-17 09:41:40 +00:00
Florian Müllner
7e0209f905 build: Make g-ir-scanner warnings fatal when werror is set
This should help catching problems with introspection in CI.

Adapted from Sebastian Wick's corresponding mutter change
in https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3528.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3121>
2024-01-16 23:51:13 +00:00
Florian Müllner
64b7249405 st/settings: Don't notify "icon-theme" on "high-contrast" changes
Since commit e831a924, the two are no longer linked.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3105>
2024-01-10 15:14:53 +00:00
Bilal Elmoussaoui
129fe3a07e shell/tray-icon: Adapt to moved xwindow property to XWindow
Associated merge request:
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3211

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3026>
2024-01-09 19:17:20 +01:00
Julian Sparber
4b09aa2b8a st/viewport: Queue only redraw when StAdjustment value changes
It's enough to redraw the actor. Also the actor may be already in a relayout cycle
when the StAdjustment value changes which is bad.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3059>
2024-01-09 08:13:30 +00:00
Florian Müllner
02c8249e0b shell/util: Drop unused capture_images() function
It hasn't been used since commit 757e4b6731, so drop it. This
also avoids a warning when generating the typelib that was
introduced in commit f48729f6e.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3091>
2024-01-05 11:49:28 +01:00
Bilal Elmoussaoui
00813828f3 tray: Adapt to meta_x11_error_* removal
By switching to use the mtk helpers instead

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3087>
2024-01-05 10:46:17 +00:00
Bilal Elmoussaoui
f48729f6e0 util: Adapt to ClutterCapture removal
It is not used anywhere by Mutter itself so move it here

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3088>
2024-01-04 14:17:06 +00:00
Carlos Garnacho
71164a544f shell: Drop X11-specific code to handle stage focus
This code is being adopted by Mutter, so remove this handling
from ShellGlobal.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2950>
2023-12-18 16:23:04 +00:00
Florian Müllner
c290a38730 st/bin: Delegate child allocation to layout manager
Since commit ed3b8d093e16, the actor's single-child policy is
enforced even when using the generic add/remove_child() methods.

This makes it possible to follow GTK/AdwBin's lead and replace
out custom child allocation with a BinLayout, without changing
the actor's semantics in a fundamental way.

However this does change slightly how the child is allocated, as
it now only expands according to its expand properties, not when
the alignment is set to FILL.

Even after the preparations in the previous commit, some fallout
is still likely, but it will be easy to address, and the cleanup
is significant enough to justify it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3046>
2023-12-15 14:45:38 +00:00
Florian Müllner
ef2e96bb32 st/box-layout: Set layout manager type
Now that ClutterActor itself provides API to use a particular
layout manager type, we can use that instead of our own mechanism.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3046>
2023-12-15 14:45:37 +00:00
Florian Müllner
e746b038ef st/texture-cache: Drop bind_surface_property() method
It was only used for the fallback icon of X11 windows.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3056>
2023-12-15 14:10:53 +00:00
Florian Müllner
069a12b6d0 shell/app: Remove X11-specific icon fallback
We have considered .desktop files a required app component for
more than 10 years now. It also has been several years that the
default session switched to wayland, which doesn't have protocol
for window icons.

So stop using an elaborate fallback path just for legacy clients,
and just fall back to the same generic icon we use for wayland
clients.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3056>
2023-12-15 14:10:53 +00:00