1396 Commits

Author SHA1 Message Date
Mattia Formichetti
db955eccc7 tests/stacking: Account for cascading in always-on-top-map-new-partial
Since we now cascade when center-new-windows is true, we need to update the
always-above window positions to account for where the new windows will end
up being placed.
Assertions are also added for the two test windows' positions.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4202>
2025-02-19 19:20:38 +00:00
Sebastian Wick
92c6452753 cursor: Support css and wayland cursor-shape cursors
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3668>
2025-02-19 18:06:45 +00:00
Michel Dänzer
7f78b6a9e5 kms: Use encoded strings instead of UpdateStatesData
Handle NULL string pointer in meta_kms_update_states_in_impl.

Drop second parameter of meta_kms_update_states_sync, which wasn't used
by the external test caller anyway. Split out static update_states_sync
function which takes a hotplug event string pointer instead.

Preparation for next commit.

v2:
* Drop UpdteStatesData for encoded hotplug event strings.
v3:
* Put device path at the end of encoded string, allows simplifying
  meta_kms_update_states_in_impl slightly further.
v4: (Sebastian Wick)
* Use g_autofree for hotplug_event string in on_udev_hotplug, fixes
  leak.
* Store pointer to hotplug event device path string in local variable in
  meta_kms_update_states_in_impl.
v5:
* Initialize `path` local variable to `NULL` and test it instead of the
  `hotplug_event` parameter. Avoids (false-positive) compiler warning
  about `path` possibly being used uninitialized.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4209>
2025-02-19 16:53:58 +00:00
Michel Dänzer
ec73076e07 monitor-manager/native: Remove _read_current_state specialization
It forced the power save mode to META_POWER_SAVE_ON when reading the
current KMS state.

This was problematic when a hotplug event is emitted while the session
is locked, which can be triggered by monitors polling all their inputs
for a signal: There's no mechanism to restore the previous power save
mode in this case, so the monitors would fail to actually enter power
saving mode but stayed on with a blank screen. This was at least one
cause of the symptoms described in
https://gitlab.freedesktop.org/drm/amd/-/issues/662 .

Moreover, I suspect it hasn't had any effect for the actual reading of
KMS state since 5f6aee341959 ("kms/update: Make power saving an update
wide change"), as changing the power save mode to META_POWER_SAVE_ON no
longer results in any immediate KMS state change, it's now only taken
into account for the next mode set.

It's not clear what the intended effect was in the first place, it was
originally added as part of 65db8efbe8b1 ("MonitorManager: add a KMS
backend") without rationale. It might have been cargo-culted from
somewhere else. It shouldn't be necessary from a KMS API PoV though.

Also adjust the KMS hotplug test to assert that a hotplug event doesn't
implicitly change the power save mode.

v2: (Sebastian Wick)
* Fix shortlog of commit which added
  meta_monitor_manager_native_read_current_state.
v3:
* Adjust KMS hotplug test for the change.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4209>
2025-02-19 16:53:58 +00:00
Alessandro Astone
f31539984d tests/cursor: Embed a copy of the Adwaita cursor theme
As a follow-up to 87cc6633a5, embed a partial copy of the Adwaita cursor theme
and point to it with XCURSOR_PATH to make the test completely independent
from the installed cursor themes.

Indeed, adwaita-icon-theme changed ever so slightly in version 48 so the
ref tests started failing when the new version was installed.

This is a copy of adwaita-icon-theme 47, which is what was used to generate
the ref images.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4252>
2025-02-19 09:21:32 +00:00
Michel Dänzer
eeaff29264 tests/kms/render: Disable triple buffering for now
This requires reverting the previous changes intended for adapting to
triple buffering.

Fixes these tests randomly failing, also in CI pipelines of MRs not
directly related to any of this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4290>
2025-02-19 06:54:06 +00:00
Marco Trevisan (Treviño)
169ea4cf81 tests: Use env in bash scripts shebang
Bash can be in both /usr/bin/bash or /bin/bash (or elsewhere!) depending on
the distro, so let's be generic using env to figure it out.

This comes from a packaging lintian error we get:

 E: mutter-16-tests: wrong-path-for-interpreter /usr/bin/bash != /bin/bash
    [usr/share/mutter-16/tests/socket-launch.sh]

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4288>
2025-02-18 18:56:29 +00:00
Michel Dänzer
45f60a2cd4 tests: Use g_assert_nonnull in kms-cursor-force-disable test
Suggested by Carlos Garnacho.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4285>
2025-02-18 11:53:26 +01:00
Michel Dänzer
576f802e26 tests: Add test for MUTTER_DEBUG_DISABLE_HW_CURSORS=1
It tests that the cursor renderer can successfully initialize with the
environment variable MUTTER_DEBUG_DISABLE_HW_CURSORS=1.

It would have caught the crash fixed by the previous commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4272>
2025-02-18 09:32:31 +00:00
Marco Trevisan (Treviño)
63744815b9 tests/x11-test: Enable x11 debug logs by default
Since META_DEBUG_X11 has been introduced it's useful to run x11 tests
with it set

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4278>
2025-02-17 15:52:13 +00:00
Marco Trevisan (Treviño)
ee496490b6 monitor-dbus-tests: Merge stderr with stdout in gdctl tests
We want to ensure that also the stderr is matching our golden files
and at the same time we should be able to see it in logs (especially
when there's a python error to catch).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4277>
2025-02-17 14:58:06 +00:00
Marco Trevisan (Treviño)
c91c4d2d4e monitor-dbus-test: Do not fail early on wait check
In this way if we fail because of a python error in the launched
script we can still print the output in the test logs

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4277>
2025-02-17 14:58:06 +00:00
Marco Trevisan (Treviño)
f823f1052d monitor-dbus-tests: Use autopointer to free errors
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4277>
2025-02-17 14:58:06 +00:00
Marco Trevisan (Treviño)
73d4bbd1ad tests/build: Require zenity if x11 tests are enabled
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4280>
2025-02-17 10:30:08 +00:00
Florian Müllner
897cc303cb tests/shell: Do not set key-focus to stage
Moving the key focus to the stage should be done by unsetting the
focus rather than setting it to the stage itself.

`clutter_stage_set_key_focus()` already "normalizes" the stage to
NULL internally, so this does not change the actual behavior of the
code.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4256>
2025-02-14 20:19:45 +01:00
Florian Müllner
1d69b1b505 clutter: Prepare for get_key_focus() returning NULL
While the existing `get_key_focus()` methods looks like a getter of the
`key-focus` property and is detected as such by gobject introspection,
it behaves differently in that it returns the stage if no explicit
focus has been set.

This is about to change, so adjust the couple of cases that rely
on the fallback to the stage.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4256>
2025-02-14 20:17:58 +01:00
Daniel van Vugt
463fc8b92c clutter: Enable triple buffering and adapt the KMS render tests
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441>
2025-02-14 17:39:09 +00:00
Florian Müllner
eb8f2398d2 dbusmock/logind: Mock GetUser method
It will be needed by gnome-shell.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4270>
2025-02-13 05:30:24 +00:00
Jeremy Bícha
705b0845da tests: Fix bash shebang
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4253>
2025-02-06 21:40:04 -05:00
Jonas Ådahl
01c9c428b7 tests: Add remote desktop tests
This requires a newer libei, for ei_ping.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4210>
2025-02-04 17:38:32 +08:00
Jonas Ådahl
e6e725591e tests/remote-desktop-utils: Add libei helpers
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4210>
2025-02-04 17:27:19 +08:00
Jonas Ådahl
25fc60cdc5 tests/test-utils: Add command watcher helper
This can be used to allow passing commands via stdout from tests.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4210>
2025-02-04 10:28:19 +08:00
Jonas Ådahl
7b0a65d728 tests/test-utils: Pass subprocess flags when launching test executable
Will be used to create stdin/stdout pipes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4210>
2025-02-04 10:28:19 +08:00
Jonas Ådahl
53ae155e03 gdctl: Show color mode
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4192>
2025-02-01 22:46:09 +00:00
Jonas Ådahl
d855623fb4 Replace HDR debug toggle with o.g.M.DisplayConfig API
HDR being enabled was controlled by toggling a property on
org.gnome.Mutter.DebugControl, which affected how the color space and
HDR metadata of the output was configured. Replace this with a higher
level MetaMonitor / MetaOutput level "color mode" enum, that is also
reflected in the monitor configuration API.

This enum is then used to derive the color space and HDR metadata at the
lower level where it matters. The ForceHDR debug control property is
still left there, as it only affects the color space and transfer
function of the view related to a monitor.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4192>
2025-02-01 22:46:09 +00:00
Jonas Ådahl
a39e941f91 DisplayConfig: Advertise monitor color standard support
It'll be used to allow Settings to know whether it can enable HDR or
not.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4192>
2025-02-01 22:46:08 +00:00
Jonas Ådahl
839f67f1de tests/monitor-dbus: Test changing configuration
Uses some various combinations of the gdctl commands that configures the
available monitors differently.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4190>
2025-01-30 11:29:39 +00:00
Jonas Ådahl
fe79188b58 tests/monitor-test-utils: Add debug log for logical monitor checking
This was helpful when figuring out what logical monitor test data was
wrong.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4190>
2025-01-30 11:29:39 +00:00
Jonas Ådahl
1cbfc07df0 tests: Add get state D-Bus test using gdctl
Test is ref test like, with gdctl outputs being compared.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4190>
2025-01-30 11:29:39 +00:00
Jonas Ådahl
7a39f05b69 tests/build: Allow passing commandline arguments to tests
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4190>
2025-01-30 11:29:38 +00:00
Daniel van Vugt
156e1b3c07 tests: Fix "fallabck" typo
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4228>
2025-01-28 00:02:14 +00:00
Sebastian Keller
0d699a74a3 clutter/tests: Remove dead wiki link from README
This page does not seem to have been archived properly when the wiki got
shut down so the link does not work anymore. There is no replacement
page in the handbook either.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4229>
2025-01-27 19:01:43 +01:00
Alessandro Astone
87cc6633a5 tests/cursor: Set cursor theme to Adwaita
The reference images were generated using the Adwaita theme, so make sure that
the test client also draws a cursrom from the Adwaita theme rather than reading the
default theme from the environment.

Ideally the test suite would embed the cursor theme and point XCURSOR_PATH to
it, so that even if the Adwaita icon theme changes in the future the test
wouldn't suddently break; I did not implement this yet.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4225>
2025-01-21 18:23:51 +01:00
Sebastian Wick
a085281138 tests/dbus-runner: Clean up launching the tests
Move the wrapper functionality where it is actually used, use a single
mechanism to determine if we're already in a dbus-runner environment and
make the mocked launching simpler.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4022>
2025-01-15 22:56:29 +01:00
Sebastian Wick
98b347b204 dbusmock/logind: Mock logind and remove KVM special handling
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4022>
2025-01-15 22:56:24 +01:00
Jonas Ådahl
e7ff05632d tests: Add test for emitting preferred surface scales
It tests both the wl_surface integer scale and fractional scales, for
toplevels, subsurfaces and cursor surfaces. It doesn't yet test DND
surfaces.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4205>
2025-01-09 16:34:35 +00:00
Jonas Ådahl
7273f30234 tests/wayland/client-utils: Allow creating role-less surfaces
This makes it easier to create e.g. subsurfaces or cursor surfaces that
inherit generic logic from the WaylandSurface test utility helper type.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4205>
2025-01-09 16:34:35 +00:00
Jonas Ådahl
ff58ef4bb7 tests/wayland/client-utils: Bind newer wl_compositor
Out of the new metadata, only gather the preferred scale, which will be
used in a later commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4205>
2025-01-09 16:34:35 +00:00
Jonas Ådahl
d579bf4a6c tests/cursor-tests: Move cursor state helper to test utils
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4205>
2025-01-09 16:34:35 +00:00
Robert Mader
235086c788 multi-texture-format: Use BT709 coefficients in the YUV shader
In order to be consistent with KMS, i.e. avoid noticable color changes when
switching between hardware plane offloading and compositing.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4204>
2025-01-09 15:28:25 +00:00
Bilal Elmoussaoui
4ee657e31f cogl/texture: Drop set_auto_mipmap vfunc
As it is only relavant for 2D textures.
Allows getting rid of the is-primitive property which was enforcing only 2D textures
can use the set_auto_mipmap function.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4200>
2025-01-02 18:04:27 +00:00
Bilal Elmoussaoui
32c5faf010 build: Add a new fonts option
Allowing to disable font rendering integration, making it possible to
build Mutter without pango/harfbuzz/fribidi dependencies.

This commit also adds a new clutter-pango header that is used to include
pango specific bits.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4106>
2024-12-28 12:15:12 +00:00
Sebastian Wick
e68728f151 udev: Create udev in MetaBackend
So we can use it for backlight control in both the native and X11
backends.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4130>
2024-12-12 15:30:35 +01:00
Sebastian Wick
15d4123bd1 udev: Move from backends/native/ to backends/
This makes it possible to use udev even for backends which are not
native. Specifically we want to start controling backlights in mutter
which has to happen for both native and X11.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4130>
2024-12-12 15:27:11 +01:00
Sebastian Wick
1651ac8f2c launcher: Allow creating the launcher without taking session control
Currently only the native backend uses the launcher and it requires
being the session controler, so this commit should not change anything.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4130>
2024-12-12 15:12:36 +01:00
Bilal Elmoussaoui
0103288739 cogl: Rename Driver to DriverID
As we will be having a CoglDriver abstract class in the next commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4132>
2024-12-12 09:11:33 +01:00
Bilal Elmoussaoui
1d7740d537 compositor: Move various functions to their correct namespace
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4131>
2024-12-11 18:29:31 +01:00
Bilal Elmoussaoui
38a4b2e102 compositor: Drop get_stage_for_display helper
As one can get that from the backend/compositor directly.
Expose the necessary functions to allow doing so.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4131>
2024-12-11 18:28:57 +01:00
Jonas Ådahl
5a31b4e7b8 tests/cursor: Add test for transform cursor surfaces
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00
Jonas Ådahl
5e4821d9fc tests/cursors: Test viewport based cropping
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3859>
2024-12-11 16:22:57 +00:00