2933 Commits

Author SHA1 Message Date
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
Daniel van Vugt
76dfff1012 Pass 'radius' to blur APIs instead of 'sigma'
Requires mutter!1908 first.

So now consumers of the clutter blur code don't have to know the
implementation is Gaussian and no longer need to convert the intended
blur radius to a sigma value.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1905>
2023-12-14 18:20:59 +00:00
Zander Brown
4373a91911 doc: Switch documentation to gi-docgen
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1873>
2023-12-13 14:52:48 +01:00
Julian Sparber
33c074c738 st/scroll-view: Allow removing edge fade
Remove the fade effect when the css property `-st-vfade-offset` is removed
from a widget. The effect isn't added when the property never existed.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3047>
2023-12-07 18:15:51 +01:00
Sebastian Keller
9f7a7ed202 st/widget: Adjust to changes to get_transformed_paint_volume() in mutter
This method is now transfer full.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3045>
2023-12-06 14:19:12 +00:00
Sebastian Keller
dc931e82cd st/widget: Don't allow adding/removing "" style class
strstr() in find_class_name() will always consider "" a match so the
loop was not stopping at the end of the class_list. None of the matches
within the class_list would satisfy the return conditions, unless the
class_list was either an empty string as well or has a trailing space.
So this ends up with a match outside of the allocated string that
happens to satisfy these conditions by chance which then leads to the
class string containing some of this unrelated memory. Or it might lead
to a segfault.

This adds checks to the public API that uses find_class_name() to
prevent extensions from accidentally triggering a crash this way or
having some otherwise unexpected results.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7152
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3006>
2023-12-05 23:31:40 +00:00
Florian Müllner
c8dae24645 st/bin: Fix height request
The request currently mixes up y-align and x-align.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3043>
2023-12-05 18:11:44 +01:00
Julian Sparber
5b8347f90b st/viewport: Set adjustment properties all at once
This ensures that that property changes are notified all at the same
time and only after all were set. If we notify too early handlers
may act on a "broken" viewport.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3023>
2023-11-21 16:31:56 +01:00
Julian Sparber
78eb5f2a68 st/adjustment: Ensure changed signal emission is compressed
The docs say that `st_adjustment_set_values()` emits the `changed`
signal only once but it's actually emitted for each changed property,
this uses the `dispatch_properties_changed` vfunc to emit the `changed`
signal only per call to `st_adjustment_set_values()`. As a positive
side effect this also makes it possible to use `g_object_freeze/thaw_notify`
to compress the `changed` signal emission when using the setters for
properties.

This also fixes the wrong emission of the `changed` signal in
`st_adjustment_set_values()` when only the `value` property is changed.

Side note: the code is heavily inspired by GtkAdjustment

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3023>
2023-11-21 16:31:56 +01:00
Florian Müllner
a190a0830b st/scroll-view: Change default hscrollbar-policy
It is a bit odd to have different default values for the vertical
and horizontal policy, but then that's what we almost always want in
practice: Automatic scrolling vertically, and no scrolling horizontally.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3020>
2023-11-18 18:00:43 +00:00
Florian Müllner
b1cfe1732d st/scroll-view: Deprecate {v,h}scroll properties
We have better replacements now, so we'll eventually want to stop
exposing the internal scroll bar children.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3020>
2023-11-18 18:00:43 +00:00
Florian Müllner
a63d5b6b09 st/scroll-view-fade: Stop using {v,h}scroll properties
They are internal children of the scroll view. Instead, switch to
the dedicated APIs for accessing the adjustments directly and query
the bar offsets.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3020>
2023-11-18 18:00:43 +00:00
Florian Müllner
14749744a3 st/scroll-view: Add private API to query bar offsets
The scroll fade effect is the only component that accesses the
{v,h}scroll properties for anything other than getting access
to the corresponding adjustments.

Allow the effect to get what it needs via new private API instead,
so we can deprecate and eventually remove the scroll bar properties.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3020>
2023-11-18 18:00:43 +00:00
Florian Müllner
d243a9ba93 st/scroll-view: Expose adjustments as properties
The adjustments are currently only accessible indirectly via
the scroll bars. It is a bit odd to expose internal children,
and as nearly all users only access them for the adjustments,
it makes sense to expose those instead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3020>
2023-11-18 18:00:43 +00:00
Jonas Dreßler
65e56183b1 st/scroll-view: Hide scroll bar from layout when its hidden
We hide scrollbars with POLICY_AUTOMATIC when the content of the scroll
view fits completely inside the view without having to scroll. In this case
it seems like a good idea to give the content the full available size
without subtracting scroll bars from that size.

So subtract the scroll bar from the size we give to the child only when
the scroll bar is actually visible, when it's invisible subtract 0 instead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2190>
2023-11-18 12:22:51 +01:00
Jonas Dreßler
a59a992daa st/scroll-view: Allocate the scrollbars 0-size instead of not painting them
StScrollView applies the policy of whether to show or hide the scroll
bar,
and with the AUTOMATIC policy the scroll bar should be hidden as soon as
the
content of the scroll view is small enough to fit without scrolling.

Now we only know about the final size of the content when we're inside
st_scroll_view_allocate(), so that's where we can decide whether the
scroll
bar should be visible or not. Clutter really doesn't like calling
clutter_actor_show/hide() in the middle of an allocation cycle though,
so
what we do instead is saving the state into priv->vscrollbar_visible,
and
then just not painting the scroll bar based on that in a paint() vfunc
override.

This approach is not great for several reasons, it means we also have to
override pick() and finally it means the paint volume of the scroll bar
is
incorrect.

While the greatest solution to this would be to just hide/show the
scroll
bar inside the allocate() function as it is possible in gtk, we have an
established pattern for this kind of case too: We usually allocate a
0-sized
rect for the thing we want to hide, so let's do that instead.

A nice side effect is that we can conveniently drop another paint() and
pick() vfunc override.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2190>
2023-11-18 12:22:51 +01:00
Sebastian Keller
8d7dc098b1 main: Move g_setenv() calls before calls that may start threads
setenv() is not thread-safe and must happen before starting threads. The
g_setenv() calls in main() happened after meta_context_configure(),
which will start a thread via meta_profiler_new() which in its init
calls g_bus_get().

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6974
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3018>
2023-11-15 10:21:35 +01:00
Zander Brown
0204920d8c st/bin: Use class handlers for ::child-{added,removed}
Now these signals are directly on ClutterActor, we can use class handlers
instead

Note we don't make the same change to StScrollView as it would clash
with the internal children.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3014>
2023-11-14 11:10:53 +00:00
Zander Brown
552f1456eb st/scroll-view: Adapt for ::child-{added,removed}
These were previously known as ::actor-{added,removed}

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3014>
2023-11-14 11:09:03 +00:00
Zander Brown
ab7ed393cb st: Adapt for ClutterContainer removal
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3014>
2023-11-14 11:09:02 +00:00
Zander Brown
f9ee0c9e45 shell/window-preview-layout: Adapt for ClutterContainer removal
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3014>
2023-11-14 11:09:02 +00:00
Zander Brown
ed3b8d093e st/bin: Stop implementing a ClutterContainer
Instead we react to ::actor-{added,removed} and delegate to ClutterActor

Code should still interact with :child rather than {add,remove)_child(),
but at least we now avoid the footgun where the different APIs did
different things

Fix: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3172
Fix: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2661
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3010>
2023-11-10 20:19:13 +00:00
Zander Brown
42fc986e91 st/scroll-view: Stop implementing ClutterContainer
Instead, listen to ::actor-{added,removed} allowing ClutterActor's
regular add/remove API to work as expected — at least so long only one
child is added

We also no longer inherit StBin as we actually have up to three
children (including the two scrollbars), but by implementing :child
ourselves the API seen by JS is unchanged

Fix: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2661
Fix: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3172
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3010>
2023-11-10 20:19:13 +00:00
Florian Müllner
b36f81b955 st: Adjust to ClutterBinAlignment removal
The custom alignment property was removed, so the convenience
constructor lost the corresponding parameters.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3013>
2023-11-10 00:29:50 +01:00
Barnabás Pőcze
3e7027821d st/texture-cache: Always close GdkPixbufLoader before disposal
As per the warning emitted when destroying without closing first

  GdkPixbufLoader finalized without calling gdk_pixbuf_loader_close() - this is not allowed.
  You must explicitly end the data stream to the loader before dropping the last reference.

closing it is necessary.

Create the GdkPixbufLoader after loading the file contents so that
the loader is guaranteed to be closed before it is destroyed.
(`gdk_pixbuf_loader_write()` closes it on failure.)

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3008>
2023-11-05 03:29:12 +01:00
Robert Mader
c032bb62a5 shell/screenshot: Use MtkRegion
Remove the last user of cairo_region_t in favor of MtkRegion, fixing a
build warning.
2023-11-03 16:21:51 +01:00