2913 Commits

Author SHA1 Message Date
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
Sebastian Keller
bf742c3926 Revert "shell/window-tracker: Exclude screen recorder window"
This reverts commit 575ba13b9b4efa40f07d57d87d50d8f0466f2e16.

That commit did not actually prevent the "Unknown" application from
showing up in the dash or app switcher when the recorder was running,
but it introduced a problem with Proton which also uses gstreamer OpenGL
elements in its transcoder. This was causing the overview to get stuck
while the transcoder was running due to the app for the
"OpenGL Renderer" window being null.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7042
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3000>
2023-10-30 12:58:05 +01:00
Bilal Elmoussaoui
fe292ac941 st: Use correct type for CoglTexture
No idea how come CoglPipeline was used here but the fact that everything
was a CoglHandle, made things just work despite being wrong?

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2964>
2023-10-29 21:28:31 +00:00
Bilal Elmoussaoui
71accdd978 st: Adapt to CoglObject removal
Also use more memory management macro helpers

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2964>
2023-10-29 21:28:31 +00:00
Bilal Elmoussaoui
198dde2696 st: Stop using Clutter cairo helpers
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2808>
2023-10-25 21:35:18 +02:00
Bilal Elmoussaoui
64c8d94d2b Adapt to Clutter -> Cogl pixel format
As the pixel format made more sense to be part of CoglPixelFormat and
was moved there

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2808>
2023-10-25 21:35:18 +02:00
Sebastian Wick
d383f4acac shell-app: Make recent all app windows on the target workspace
meta_window_raise_and_make_recent_on_workspace now works on a target
workspace instead of the active workspace. We call this before another
workspace is made active so the previous behavior made the window the
MRU window on the wrong workspace. If an app got activated and one
window closed, the stacking and focus diverged.

Related: https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3315
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2991>
2023-10-25 14:05:40 +02:00
Sebastian Keller
fae5bdaa00 st/scroll-view: Use clutter_actor_get_effect() to get fade effect
Storing the pointer to the fade effect only works as long as we control
all the code that can modify the effects of an actor, but this is not
the case in the presence of extensions. Apparently some extension
manages to remove the effect, which leads to fade_effect pointing to
some invalid address by the time dispose is called, leading to a crash.

This instead uses clutter_actor_get_effect() to get the effect when it
is needed to avoid crashing in these situations.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6521
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2974>
2023-10-06 15:01:42 +00:00
Florian Müllner
575ba13b9b shell/window-tracker: Exclude screen recorder window
The pipeline contains a GST plugin that pops up an unclosable
zero-sized window.

Unfortunately we did not manage to come up with a proper fix
in time, so for now explicitly exclude it from app tracking.

This does not address all issues (it still prevents the
window's workspace from getting removed, even when it appears
empty), but at least it avoids the most confusing effect by
preventing the "app" from showing up in dash, alt-tab etc.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2956>
2023-09-16 11:40:58 +02:00
Bryan Ricker
9ce7c81ef3 st/icon: Fix documentation typo
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2940>
2023-09-05 18:31:07 -07:00
Florian Müllner
b45e75c4b9 st/types: Remove StAlign
The last code that used the type was removed in commit 0ab34fe21f6
over three years ago, whoops.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2936>
2023-09-02 09:19:24 +00:00
Carlos Garnacho
52182e6493 st: Drop explicit Clutter grab in StButton
Nowadays, Clutter knows what an implicit grab is, which gives
us already the feel that we are after with buttons (e.g. press
and drag on the button will not enter other actors meanwhile).

ClutterGrab was only added to provide that feel meanwhile, and
it's also slightly more intense (e.g. altering keyboard focus,
or triggering leave events on all parents of the button) which
may trigger side effects.

An example is the IBus candidates popup, where the pagination
buttons may indirectly trigger dismissing of the entire popup
when interacted, by stealing the keyboard focus to the
client/actor doing IM.

Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2497
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2244
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2924>
2023-08-31 14:17:16 +00:00
Bilal Elmoussaoui
80237b1082 Adapt to the new Mtk library
As we plan to slowly phase out Cairo where possible in libmutter
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3128

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2873>
2023-08-31 03:44:32 +00:00
Andrew Zaech
3cfc918976 st/scroll-view: Fix issue in st_scroll_view_scroll_event()
adjust_with_direction() uses a ClutterScrollDirection not ClutterTextDirection

Fixes: 23b439dc ("st/scroll-view: Use ClutterEvent getter methods")
Closes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6937

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2920>
2023-08-29 13:25:54 +02:00
Daniel van Vugt
f22f5d902c st/viewport: Keep painting, clipping and transforms pixel-aligned
Which means adjustments always converted to ints in the same way.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6835
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2828>
2023-08-20 01:10:44 +00:00
Daniel van Vugt
cd7d99dd6b st/viewport: Set the paint volume to the clipped area
Not the unclipped area that is potentially multiple screens in size.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6819
(assuming you have mutter!3112)

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2828>
2023-08-20 01:10:44 +00:00
Daniel van Vugt
6e42979fc2 st/viewport: Remove unused paint volume origin calculations
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2828>
2023-08-20 01:10:44 +00:00
Sebastian Keller
e7c269e014 shell/camera-monitor: Remove hooks before destroying objects
Otherwise removing the hook will try to unlink from a list whose
previous element belonged to the already destroyed object.

Fixes: d09d24666 ("shell: Add device monitor for cameras")
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2893>
2023-08-15 20:36:07 +02:00
Florian Müllner
9546860d05 tests/unit: Access shell sources from resource
Unit tests currently load shell sources directly from the
filesystem.

This is currently blocking generated sources - namely config.js - to
ESM, because a relative import from the source dir will fail to
locate the file in the build dir.

Address this by using the same GResource as gnome-shell instead of
direct filesystem access, as the resource will always include all
sources files at the expected location.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2880>
2023-08-10 17:42:23 +00:00
Florian Müllner
8a4275ec80 main: Don't try to translate the empty string
It's pointless in the best case, and may result in bugs.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2878>
2023-08-09 15:39:43 +00:00
Carlos Garnacho
111a0a7fa1 st: Mass update to ClutterActorClass event vmethod changes
These are now forwarded as ClutterEvent in order to remain accessible
on the Javascript side. This also means all ClutterActor implementations
in ST need to update to this change.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2872>
2023-08-09 13:46:14 +02:00