Commit Graph

2870 Commits

Author SHA1 Message Date
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
Carlos Garnacho
854191c244 st: Handle emulated scroll events through the ClutterEventFlag
Emulated scroll events no longer get clutter_event_is_pointer_emulated()
set to TRUE, instead this information is propagated through the
ClutterEventFlags of the event.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2871>
2023-08-08 17:23:33 +00:00
Evan Welsh
12f6d7027b listModes: Port listModes command to ES module
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1499>
2023-08-05 22:16:23 +02:00
Evan Welsh
cd167ee63e docs: Update miscellaneous in-code documentation for modules
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1499>
2023-08-05 22:16:23 +02:00
Daniel van Vugt
65cde18786 main: Correct the pointer value of strtab on riscv/mips architectures
Glibc defines `d_ptr`/`d_val` to be a relocated address on most
architectures, except for riscv and mips where it is just an offset from
the binary load address. So we need to convert `strtab` from an offset
into a pointer for riscv and mips.

Internally within glibc there is the `D_PTR` macro for doing this, which
relies on private data hidden in an ABI-unstable part of `link_map`. So
we can't use the same conditional logic as glibc does internally.

Our solution is to detect when `strtab` is unreasonably low (below the
address of our binary) and so it must be an unrelocated offset. In that
case we just do the relocation manually.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6528
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2718>
2023-08-05 19:19:29 +00:00
Carlos Garnacho
a95addd772 st/focus-manager: Use ClutterEvent getter methods in StFocusManager
Also make StFocusManager keep track of the ClutterStage it is relative
to, in order to avoid the ClutterStage event getter that is going away.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2860>
2023-08-05 19:07:41 +00:00
Carlos Garnacho
aac0e0e802 st/widget: Use ClutterEvent getter methods in StWidget
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2860>
2023-08-05 19:07:41 +00:00
Carlos Garnacho
23b439dc50 st/scroll-view: Use ClutterEvent getter methods
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2860>
2023-08-05 19:07:41 +00:00
Carlos Garnacho
1d6a5f2697 st/scroll-bar: Use ClutterEvent getter methods
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2860>
2023-08-05 19:07:41 +00:00
Carlos Garnacho
ca383acff6 st/entry: Use ClutterEvent getter methods
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2860>
2023-08-05 19:07:41 +00:00
Carlos Garnacho
75c92afa31 st/button: Use ClutterEvent getter methods
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2860>
2023-08-05 19:07:41 +00:00
robert.mader@collabora.com
a5fc4ad57c shell/camera-monitor: Tweak indicator disable timeout
We currently consider idle nodes as in use to avoid too fast state
changes and thus flickering of the indicator icon. However, the current
idle timeout is rather long and arguably confusing for users.

Thus switch to only consider running nodes as in use, but delay
disabling of the indicator by 500ms.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2854>
2023-07-30 11:24:35 +00:00
robert.mader@collabora.com
d09d24666a shell: Add device monitor for cameras
Pipewire allows us to easily track whether any cameras are in used by
checking the state of camera nodes. Add a simple camera monitor to the
shell, allowing us to show e.g. a status indicator.

Naturally the monitor is limited to apps using Pipewire for camera
access and thus subject to the same chicken-egg problem like the camera
portal - it could confuse users that apps may use the camera without
being noticed by the monitor. The hope and assumption here is that a
better shell integration might speed up adoption of the new camera APIs

Pipewire 0.3.49 is required for refcounted `pw_init()`/`pw_deinit()`.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2840>
2023-07-29 13:55:15 +03:00
Evan Welsh
26fa1046a3 tests: Load unit tests as modules
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2822>
2023-07-15 02:35:56 +00:00
Evan Welsh
b798efcc1d tests: Use gjs_context_eval_file to evaluate test scripts
GJS provides utilities to run scripts given a filename, using those
utilities we can remove most of the logic implementing file loading.

Additionally the REPL logic does not make much sense for a test
runner and is unused, so remove it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2822>
2023-07-15 02:35:56 +00:00
Florian Müllner
3028d478b8 st/icon-theme: Remove special-casing of symbolic lookup
GThemedIcon considers the "-symbolic" suffix when generating
fallback names (i.e. "foo-bar-symbolic", "foo-symbolic", "foo-bar",
"foo").

That means now that we prefer more accurate name matches from any
theme over fallback matches from higher-priority themes, we no
longer need to special-case symbolic names for preferring symbolic
matches over full-color fallbacks.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2824>
2023-07-13 15:15:56 +00:00
Florian Müllner
b3b4eeb496 st/icon-theme: Pick best-matching name from all themes
When resolving an icon name, we currently look in all themes in
order whether one of the requested names matches.

That means, a "keyboard" icon from the configured theme will
trump over any of "keyboard-shift", "keyboard-brightness" and
"keyboard-preferences" from lower-ranked themes (like "Adwaita"
and "hicolor").

That applies to custom icons we include in the resource, which
are added to the fallback ("hicolor") theme.

We are less bound by the named-icons spec than GTK, so we can
adapt the lookup to prefer the most accurate match to matches
from the highest priority theme.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2824>
2023-07-13 15:15:56 +00:00
Florian Müllner
e4da6a347b test-tool: Require script argument
The purpose of the tool has shifted from running a limited set
of performance tests repeatedly to collect performance data
and catch regressions, to a wrapper that drives gnome-shell via
scripts for tests.

With that, the concept of a "default" script doesn't really make
sense anymore.

Instead, turn the argument from an optional flag into a required
parameter. This will allow us to stop bundling the existing tests
in a follow-up commit.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2812>
2023-07-07 19:43:28 +02:00
Florian Müllner
9bb003463c test-tool: Rename perf-tool
The original purpose of the tool was to collect performance data
that would optionally be uploaded to a server in Owen's living
room. While the corresponding scripts are still included (although
the server was probably dismantled years ago), the tool is mainly
used for running gnome-shell with scripted tests nowadays.

Rename the tool to reflect that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2812>
2023-07-07 19:43:28 +02:00
Florian Müllner
bf9b9838c2 main: Pass script on CLI instead of via environment
Environment variables aren't the best option to pass parameters
to a process (wouldn't it be "fun" if SHELL_PERF_MODULE appeared
in a regular user session?).

Instead, use a (hidden) --automation-script command line flag to
specify a script file that should be used to drive an automated
session.

As a side effect, the script no longer has to be relative to the
main module itself, so it will be possible to run scripts that
aren't bundled with the shell sources.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2812>
2023-07-07 19:43:28 +02:00
Florian Müllner
ebbcc31fbd st/texture-cache: Set up sliced images to fill parent
When using fractional scaling, the size of the loaded image with
applied scaling may still differ from the displayed size. This
is currently addressed by syncing the size of all slice actors
in the (probably only) caller.

Instead, set the actors to fill their parent automatically.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2798>
2023-07-05 10:36:14 +00:00
Florian Müllner
5bf61d4cad shell/util: Use gtk4 for week-start fallback
If langinfo isn't available, we determine the week start via
a "magic" string translation from GTK. We currently look up
the string in GTK3's domain, we should use GTK4's instead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2816>
2023-07-03 19:32:13 +02:00
Florian Müllner
8d562ff71c portalHelper: Port to ESM
The helper app that provides the login dialog for network portals
is another separate process that can be moved to ESM separately.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2786>
2023-06-21 13:26:42 +02:00
Florian Müllner
38c9364acc portalHelper: Stop using non-default ARGV vector
If gjs itself defines ARGV, it only holds the arguments that are
passed on to the script, and javascript code should combine the
programName and ARGV (or the newer programArgs) when it needs a
C-style argv array.

Do the same in the portal-helper process instead of passing along
the original C argv, to avoid confusion when accessing the arguments
from javascript.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2786>
2023-06-21 13:26:42 +02:00
Evan Welsh
8fb8f7f827 init: Move Meta main loop into JavaScript after GJS context is initialized
gjs now has an internal mainloop that it can spin to resolve
module imports. That loop uses the thread default context,
so its possible that other sources, namely from mutter, get
dispatched when iterating the context. If that happens before
mutter is properly initialized, this will lead to a crash.

GjsContext needs to iterate its internal mainloop when initializing
to resolve internal modules, to avoid iterating Meta's mainloop and
triggering events before Meta is ready we will initialize the Shell
global and thus the GjsContext (js_context) before Meta.

Once GjsContext is initialized, we can call meta_context_setup().
Once Meta is setup and started, we'll run init.js which uses GJS'
internal promises API to set a "mainloop hook". The mainloop hook
is run immediately after the module returns so GJS will not attempt
to iterate the main loop again before exiting.

Also adjust the 'headlessStart' test to not wait for the
MetaContext::started signal, as that signal has now already
been emitted when the code is executed.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2781>
2023-06-07 19:23:27 +00:00
Florian Müllner
02cd1ecd94 shell/perf-helper: Port to GTK4
After the preparations in the previous commits, the port is now
fairly straight-forward.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2733>
2023-06-07 11:12:40 +00:00
Florian Müllner
1c5bc35e30 shell/perf-helper: Use custom widget as content
The windows we create use a simple pattern as content, as that's
easier to follow than completely empty windows. GTK4 no longer
allows hooking into the drawing of arbitrary widgets, so prepare
for that by using a dedicated subclass instead of a signal handler.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2733>
2023-06-07 11:12:40 +00:00
Florian Müllner
54b4cfc69b shell/perf-helper: Use custom CSS for background
GTK4 no longer has the concept of "app-paintable" to skip the
default background drawing. Prepare for that by setting the
desired background via CSS and draw on top of that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2733>
2023-06-07 11:12:40 +00:00
Florian Müllner
3f9fcf418b shell/perf-handler: Use app to track window
GtkApplication already tracks its windows, so we don't have to
maintain our own list.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2733>
2023-06-07 11:12:40 +00:00
Florian Müllner
12fafec141 shell/perf-helper: Subclass ApplicationWindow
The signals we use to track whether a window has been mapped and
exposed no longer exist in GTK4. Prepare for that by using a
dedicated subclass instead of signal handlers.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2733>
2023-06-07 11:12:40 +00:00
Florian Müllner
b4ffeb36f6 shell/perf-helper: Use GApplication
The gtk_main() API is gone in GTK4, so we'll have to either
manage our own loop, or use GApplication. The latter also
handles the D-Bus setup for us, so use that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2733>
2023-06-07 11:12:40 +00:00
Florian Müllner
e9ec45e5e3 shell/perf-helper: Remove unused struct members
Some parameters are only relevant when creating the window, and
are therefore never read from the window info struct.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2733>
2023-06-07 11:12:40 +00:00
Florian Müllner
a53d7faf9d st/test-theme: Don't initialize GTK
St no longer requires GTK to be initialized, so this is no longer
needed (and pulls in an unnecessary GTK dependency).

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2733>
2023-06-07 11:12:40 +00:00
Florian Müllner
4c727b4680 st/settings: Expose system color scheme
This is the same interface setting that backs AdwStyleManager.

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

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2324>
2023-05-25 17:10:53 +02:00
Carlos Garnacho
356bab1121 shell: Use swapped signal connection for MetaWindowActor::destroy
The callback would schedule a clutter_actor_destroy() on the first
argument. Unless told otherwise, this is the same actor that is
already being destroyed, so this is a no-op.

Instead, the intent is to make the clone follow up destruction of
the window actor so that it results in correct removal of this
window from the ShellWindowPreviewLayout. Use a swapped connection
to pass the clone actor as the first argument of the signal callback.

Fixes: 04c781674c ("Move WindowPreviewLayout from JS to C")

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6570
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2756>
2023-05-03 14:00:33 +00:00
Daniel van Vugt
ce8af73745 glsl-effect: Don't overwrite the framebuffer's alpha/X channel
It's a waste of effort and will also taint screenshots if they
accidentally store that channel as alpha.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6389
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2650>
2023-04-26 13:42:34 +00:00
Marco Trevisan (Treviño)
12bb3a601d shell-app-system: Give priority to .desktop IDs that should be shown
If we have multiple desktop ID's that share the same startup-wm class
and none of them is actually matching the desktop-id, then we should
exclude the ones that should not be shown in the current desktop.

This will help preventing cases such as the previous one in case no
desktop file ID would match the startup-wm-class exactly.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2721>
2023-04-20 15:11:58 +00:00
Marco Trevisan (Treviño)
e7a09946ca shell-app-system: Do not compare startup-wm classes with full desktop IDs
When fetching the desktop ids into a map of startup-wm classes we meant
to give the ones that match the desktop ID more priority, however
this did not happen because we were always comparing a desktop
file id, including the `.desktop` suffix, with a wm-class that generally
does not include that.

This is the case of gnome-system-monitor, that provides two desktop
files, one of which is OnlyShowIn=KDE but both have the same
StartupWMClass and thus the first parsed is preferred, even though its
desktop-id is gnome-system-monitor-kde.

As per this, remove the .desktop suffix when comparing it with the
startup-wm-class, keeping the old check just in case.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2721>
2023-04-20 15:11:58 +00:00
Jonas Ådahl
1da8df81c5 perf-helper: Allow creating window with text input
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2722>
2023-04-20 14:52:01 +02:00
Jonas Ådahl
ff705fa902 shell: Make singletons owned by ShellGlobal
This means also means they will be cleaned up when disposing
ShellGlobal, which will then mean signals tied to the GObject lifetime
will be disconnected.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6536
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2722>
2023-04-20 14:49:38 +02:00
Jonas Ådahl
517482b562 shell/window-tracker: Disconnect signals on disposal
We always leak this, so this has no effect right now, but will in a
follow up commit.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2722>
2023-04-20 14:49:38 +02:00
Sebastian Keller
15048c1fcb st/icon-theme: Fix small memory leak when checking fallback theme path
This is a small one time leak if there is more than one entry in the
search path due to multiple iterations overwriting the old pointer
before finally going out of scope.

Fixes: 934faaace ("st/icon-theme: Start using g_autofree")
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2737>
2023-04-17 10:38:33 +02:00
Florian Müllner
1ca5fc7de1 st/icon-theme: Fix transparent colors in symbolic SVGs
When loading a symbolic SVG, the original file is wrapped in
a header that includes a generated stylesheet with the
appropriate colors, plus an overall opacity.

The opacity value is clamped to values between 0 and 1, which
directly matched the alpha field of the GdkRGBA type. However
since we moved to StIconColors/ClutterColor, the alpha field
is now in the range [0..255], any alpha value other than 0 now
results in full opacity.

To fix, translate the [0..255] integer into a [0..1] double
before using it as opacity.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2731>
2023-04-05 18:55:56 +00:00
Marco Trevisan (Treviño)
69e7b8e79a st/icon-theme: Disconnect from settings signals on disposal
Icon themes can be created by extensions and thus are likely destroyed on
extension unload, so we must disconnect from StSettings signals to avoid
accessing to invalid memory.

See: https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/2012021
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2711>
2023-03-21 12:17:24 +00:00