3043 Commits

Author SHA1 Message Date
Florian Müllner
829d2fd469 st/theme: Reuse stylesheets if possible
The following happens when processing an `@import()` rule:

 1. `_st_theme_resolve_url()` to resolve file
 2. `insert_stylesheet()` to track file/sheet
   a. take ownership of file/sheet (ref)
   b. use file as key in `stylesheets_by_file` hash table
   c. use file as value in `files_by_stylesheet` hash table
 3. release reference to file

This leads to a refcount error when importing a file that
was already parsed before:

 1. file start with refcount 1
 2. `insert_stylesheet()`
   a. increases refcount to 2
   b. inserting into `stylesheets_by_file` *decreases* the
      passed-in key if the key already exists
   c. `files_by_stylesheet` now tracks a file with recount 1
 3. releases the last reference to file

The file object tracked in `files_by_stylesheet` is now invalid,
and accessing it results in a crash.

Avoid this issue by reusing existing stylesheets, so we don't insert
a stylesheet that's already tracked.

As a side-effect, this also saves us from re-parsing the same file
unnecessarily.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7306
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3619>
2025-01-30 16:43:57 +00:00
Florian Müllner
9beacca329 st/texture-cache: Remove load_sliced_image()
It was only used by the `Animation`/`AnimatedIcon` classes, which
have now been removed since `Spinner` is now an independent
implementation.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3612>
2025-01-28 12:50:00 +00:00
Florian Müllner
f4c46647e6 run-test: Filter out SYSTEM_EXIT errors
Calling `System.exit()` isn't an error, and there isn't much
value in logging a "Exit with code 0" message.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3599>
2025-01-28 12:38:30 +00:00
Florian Müllner
546f3d65f7 run-test: Always use returned status code if possible
gjs_context_eval_module_file() is a convenience method for

 - register the module (load and parse)
 - evaluate the module (run)

The first can fail, but has no notion of status code; the
second will always set a valid code if provided (either as
returned by the module, or set by gjs itself).

Doing those two steps separately allows us to explicitly
handle failures to register the module, so that we can then
return the original status code from evaluating the module.

That means that if evaluating the module "fails" with a
`GJS_ERROR_SYSTEM_EXIT` error (because it was terminated
with `System.exit()`), we now return the correct status
code instead of `EXIT_FAILURE`.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3599>
2025-01-28 12:38:30 +00:00
Florian Müllner
d192fc984f run-test: Split out module evaluation
The gjs API is slightly odd, in that explicit calls to `System.exit()`
are treated as errors, regardless of the passed status code.

Before addressing this, split out the module evaluation code into
a separate function to separate it from the main logic.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3599>
2025-01-28 12:38:30 +00:00
Florian Müllner
f42c2d7371 run-test: Switch to new argv API
It's a bit nicer to use than manually defining the legacy ARGV
array.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3599>
2025-01-28 12:38:30 +00:00
Florian Müllner
699c7c1b2c run-test: Check argc before using argv
We skip the filename argument when defining ARGV before actually
checking that it was provided.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3599>
2025-01-28 12:38:30 +00:00
Florian Müllner
e7691bd3df run-tests: Add missing newlines in error messages
Unlike the various g_message() macros, the g_print() functions do
not add an implicit newline at the end of the message.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3599>
2025-01-28 12:38:30 +00:00
Florian Müllner
68fe35d1a2 run-test: Use g_autoptr/autofree
While we don't really care about freeing memory before leaving
main, it doesn't hurt and is good practice anyway.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3599>
2025-01-28 12:38:30 +00:00
Florian Müllner
696bd09d18 run-test: Fix coding style errors
The original code was likely copied from gjs' console code at the
time, which means that its coding style sneaked in.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3599>
2025-01-28 12:38:30 +00:00
Florian Müllner
e2de46e9ac st/scroll-bar: Remove vertical property
Unlike `StBoxLayout` which is ubiquious, `StScrollBar` is hightly unlikely
to be used outside of `StScrollView`. It therefore seems unnecessary to
deprecate the `vertical` property before removing it, so do just that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3614>
2025-01-27 13:55:39 +01:00
Florian Müllner
8b8699d1d5 st/scroll-view: Set scrollbar orientation
Use the new `orientation` property instead of `vertical`.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3614>
2025-01-27 13:55:39 +01:00
Florian Müllner
f4f02fe4dd st/scroll-bar: Add orientation property
Like we did for `BoxLayout`, add an `orientation` property that
better expresses the orientation (duh) and is consistent with
Clutter and GTK.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3614>
2025-01-27 13:55:39 +01:00
Florian Müllner
c5546dbe12 st/box-layout: Deprecate vertical property
BoxLayout is extremely common, so removing the old `vertical` property
in favor of `orientation` would be very disruptive. Instead, deprecate
it to indicate our intention of removing it eventually.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3614>
2025-01-27 13:55:39 +01:00
Florian Müllner
01541929eb st/box-layout: Add orientation property
Using "vertical: false" to express "horizontal" has always been a
bit awkward. While we have stuck to the existing property for a long
time, transitioning to an `orientation` property like in GTK and
Clutter seems better.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3614>
2025-01-27 12:12:59 +00:00
Florian Müllner
b01d429266 st/theme-context: Make property setter public
There's no good reason to only expose the getter of a READWRITE
property.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3615>
2025-01-27 12:06:04 +00:00
Florian Müllner
794f0bcc75 st/scroll-view: Remove deprecated properties
The `hscroll` and `vscroll` properties were deprecated for GNOME 46.

We usually consider two stable cycles enough of a heads-up, so remove
them for GNOME 48.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3615>
2025-01-27 12:06:04 +00:00
Florian Müllner
094caeeeef shell/window-preview: Make window-container construct-only
It is tightly coupled to the preview, and not meant to be unset
or replaced during the lifetime of the object; size requests
and allocation assume that it exists.

Make that explicit by marking the property as construct-only.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3615>
2025-01-27 12:06:04 +00:00
Florian Müllner
eae1e8b170 shell/window-tracker: Simplify updating focus-app
It's a text-book use case for `g_set_object()` …

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3615>
2025-01-27 12:06:04 +00:00
Florian Müllner
e2f4a9b512 shell/workspace-background: Remove unnecessary notify
The `monitor-index` property is construct-only, so it can only
be set before the caller has an object on which to connect
the `notify` signal.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3615>
2025-01-27 12:06:04 +00:00
Florian Müllner
959888c601 shell/global: Remove unnecessary CONSTRUCT flag
There's nothing special about the `force-animations` property that
requires it to be set unconditionally during construction.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3615>
2025-01-27 12:06:04 +00:00
Florian Müllner
1c98283e09 shell/global: Remove imagedir property
The property has long lost its usefulness: It hasn't been
used since 2011, and we nowadays we use resources for any
image assets.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3615>
2025-01-27 12:06:03 +00:00
Florian Müllner
6c47cea2b9 build: Clean up handling of internal dependencies
We currently only specify the library to link with when declaring
a dependency, which means that satisfying other requirements like
dependencies or includes is left to the targets.

Move everything required by libshell/libst to the declared dependency,
so other targets only need to care about their own requirements.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3615>
2025-01-27 12:06:03 +00:00
Florian Müllner
0c20407f57 st/box-layout: Remove unnecessary notify
We already notify via the `notify::orientation` handler on the
layout manager, so there is no need to also do so from our own
setter.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3613>
2025-01-26 22:55:55 +01:00
Florian Müllner
a80e5a8c39 st/box-layout: Fix forwarding vertical changes
Our code to "forward" `notify` signals from the underlying layout
manager for the `vertical` property broke when ClutterLayoutManager
removed its own `vertical` property.

Property changes via the underlying layout manager should be rare,
but still worth fixing, so explicitly connect to `notify::orientation`
now.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3613>
2025-01-26 22:55:55 +01:00
Bilal Elmoussaoui
1471733dfd st/widget: Adapt to upstreamed accessible state tracking
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3510>
2025-01-20 14:38:06 +00:00
Bilal Elmoussaoui
44b84e458a st/image-content: Take a CoglContext on set_bytes/set_data functions
This avoids retrieving it from the global clutter backend and instead
pass things around.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3528>
2025-01-20 11:50:31 +00:00
Bilal Elmoussaoui
76f2262d9c st/texture-cache: Remove unused helper
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3528>
2025-01-20 11:50:31 +00:00
Bilal Elmoussaoui
a8496dc90f st/theme-node: Get resolution from context
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3528>
2025-01-20 11:50:30 +00:00
Bilal Elmoussaoui
eaee51ff16 st/theme-context: Keep a pointer to ClutterBackend
Allows avoiding the usage of the global one and would also be used in
the next commit.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3528>
2025-01-20 11:50:30 +00:00
Bilal Elmoussaoui
f5b58cf102 st/theme-context: Drop constructor
Nothing really uses it except internally.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3528>
2025-01-20 11:50:30 +00:00
Bilal Elmoussaoui
343761e70e st/node-drawing: Pass CoglContext around
We already have access to it in most of places, just pass it around
instead of going through globals.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3528>
2025-01-20 11:50:29 +00:00
Bilal Elmoussaoui
084a1b3be7 plugin: Remove unused CoglContext field
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3528>
2025-01-20 11:50:29 +00:00
Bilal Elmoussaoui
0e92689801 Remove re-shadowed variable
Drops a call to get_default_backend

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3528>
2025-01-20 11:50:29 +00:00
Bilal Elmoussaoui
b3f5f9601b Go through global stage for getting ClutterBackend
Instead of using the default backend.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3528>
2025-01-20 11:50:29 +00:00
Bilal Elmoussaoui
fea29eb490 Get ClutterBackend/CoglContext from the Actor/Texture
Avoids going through the global backend helper.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3528>
2025-01-20 11:50:29 +00:00
Philip Withnall
debf00c893 main: Gracefully shut down on SIGINT as well as SIGTERM
This is mostly for use when testing a nested gnome-shell in a terminal:
terminating it with Ctrl+C from that terminal should give the process an
opportunity to save state on shutdown (such as the screen time limits
history file).

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3397>
2025-01-13 14:24:02 +00:00
Philip Withnall
1ceb803686 shell: Add ShellTimeChangeSource to track system clock changes
This is a `GSource` which is dispatched when the offset of the system
real/wall clock changes with respect to the system monotonic clock. This
can happen when the user explicitly changes the system clock, or when
there’s an NTP sync after a prolonged period offline.

The source can’t tell you *what* the offset change was, just that there
was one.

This will be used in an upcoming commit.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3397>
2025-01-13 14:24:01 +00:00
Alberto Ruiz
46efbfb2ab build: Use python instead of perl to convert glsl source into a C string
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3578>
2025-01-04 11:24:53 +00:00
Bilal Elmoussaoui
8fbaa5e55a Adapt to split clutter/pango
In https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4106, all of
the fonts rendering related bits are now behind a build option and under
a different header.

So we bail out if mutter was built without it & make sure we include the
new clutter-pango header where needed.

<https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3544>

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3544>
2024-12-28 13:39:31 +01:00
Florian Müllner
9783f72d74 st/spinner-content: Add ClutterContent for a loading indicator
Last cycle, libadwaita added a new Spinner widget whose visuals
we should adapt. It loops extremely slowly though (a framerate
of 60fps would require 3180(!) frames), which means our current
asset-based implementation isn't well-suited for the job.

Instead, reimplement the underlying GdkPaintable as ClutterContent.
This does not only ensure consistency with libadwaita, but also
gives us more flexibility by picking up style information from
the widget the content is attached to.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3565>
2024-12-24 15:37:20 +00:00
Bilal Elmoussaoui
4034e69d0d Adapt to fixed Meta functions namespace
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3546>
2024-12-11 19:58:23 +01:00
Bilal Elmoussaoui
4980b4fce0 app-system: Mark as a final type
Also use subclassing macros

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3525>
2024-12-11 16:50:54 +00:00
Bilal Elmoussaoui
8d8f150685 network-agent: Mark as a final type
Also use subclassing macros

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3525>
2024-12-11 16:50:54 +00:00
Bilal Elmoussaoui
ab41daefcf screenshot: Mark as a final type
It was already declared as such, so get rid of the priv boilerplate.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3525>
2024-12-11 16:50:54 +00:00
Bilal Elmoussaoui
71ecb8e6cd mime-sniffer: Mark as a final type
It was already declared as such, so get rid of the priv boilerplate.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3525>
2024-12-11 16:50:54 +00:00
Bilal Elmoussaoui
791cbc7d5d mount-operation: Mark as a final type
It was already declared as such, so get rid of the priv boilerplate.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3525>
2024-12-11 16:50:54 +00:00
Bilal Elmoussaoui
910565a09a tray-manager: Mark as a final type
It was already declared as such, so get rid of the priv boilerplate.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3525>
2024-12-11 16:50:54 +00:00
Bilal Elmoussaoui
e2a7d3753f theme-node-transition: Mark as a final type
It was already declared as such, so get rid of the priv boilerplate.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3525>
2024-12-11 16:50:54 +00:00
Bilal Elmoussaoui
6ea7253322 texture-cache: Mark as a final type
It was already declared as such, so get rid of the priv boilerplate.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3525>
2024-12-11 16:50:54 +00:00