Commit Graph

13485 Commits

Author SHA1 Message Date
ef21f2307e cursor-renderer/native: Invalidate state for output color state changes
When the output color state changes, we have to re-create the color
state transform. This is especially noticable when the luminance is
adjusted and the cursor is not affected.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3935
Fixes: a72ee3be0d ("cursor-renderer/native: Transform cursor sprite into output color state")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4315>
2025-03-06 11:42:49 +00:00
192f11646c cursor-renderer/native: Removed unused argument and update name
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4315>
2025-03-06 11:42:49 +00:00
3203fbafad wayland/drm-lease: Send drm_fd to pending clients
Listen to the signal that indicates that the current session is active
and send the drm_fd, connector(s) and done events to the clients that
were waiting for them.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3921>
2025-03-04 16:34:44 +00:00
d49a5b37a9 wayland/drm-lease: Move on device bind events to a function
Now that sending a drm_fd can fail, wrap the on device bind events
(drm_fd, connector and done) in their own function.

Refactor, no function changes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3921>
2025-03-04 16:34:44 +00:00
eb4b70baed wayland/drm-lease: Put clients in a queue on drm_fd error
When a client binds to the a device, if obtaining a non-privileged fd
fails, instead of returning an error, put the client in a pending
queue.

Delaying the drm_fd is allowed by the protocol definition:

    The compositor will send this event when the wp_drm_lease_device_v1
    global is bound, although there are no guarantees as to how long
    this takes [...]

A future commit will send the drm_fd events to the clients in the list
once Mutter can obtain a valid fd.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3921>
2025-03-04 16:34:44 +00:00
30315f3fca wayland/color-management: Ensure ref lum can't be bigger than max lum
This might be possible if extended target volume is supported but
currently it isn't.

This is a requirement from the wayland color management:

"'reference_lum' may be higher than 'max_lum'. In that case reaching
the reference white output level in image content requires the
'extended_target_volume' feature support."

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4304>
2025-03-04 14:05:41 +01:00
565cff5cb9 clutter/color-state-params: Ignore explicit max_lum on EOTF_PQ
This is a requirement from the wayland color management:

"With transfer_function.st2084_pq the given 'max_lum' value is
ignored, and 'max_lum' is taken as 'min_lum' + 10000 cd/m²."

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4304>
2025-03-04 14:05:41 +01:00
c87bf90471 tests: Vary the gdctl path used for installed tests
So they don't rely on the source tree.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4309>
2025-03-04 01:30:29 +00:00
6bd634e7ad tests: Mock logind’s Inhibit method
This is needed to allow gnome-shell to start up during its unit tests,
as it now calls `Inhibit` to make saving screen time information
race-free.

See
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3643#note_2367420.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8185
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4314>
2025-03-03 12:58:55 +00:00
5a7ec6791d wayland: Move window before tiling/maximizing when restoring from session
Ensure the window is placed in coordinates, before maximizing, tiling or
minimizing it. This should make the window maximized/tiled on the right
(or correctmost) monitor given the stored coordinates.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4311>
2025-03-01 15:02:21 +01:00
351f2fddff tests: Add more session management tests
Ensure that windows get restored either in maximized and unmaximized
state. And ensure that monitors being removed result in windows
snapping back to reachable positions.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4311>
2025-03-01 15:02:21 +01:00
e82cc58614 wayland: Ensure to constrain windows restored through session management
Otherwise, these might end up outside the desktop extents.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4311>
2025-03-01 15:02:21 +01:00
9a1dc0216e core: Add MetaSessionManager::session-instantiated signal
Mostly useful for tests to catch a session being created.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4311>
2025-03-01 15:02:21 +01:00
2682ab2863 stage-view: Plumb through target presentation time to ClutterFrameInfo
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4282>
2025-03-01 13:33:09 +00:00
700510b7dc cogl/frame: Keep track of target presentation time for direct scanout
Same as for painting.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4282>
2025-03-01 13:33:09 +00:00
687f5552fb onscreen/native: Peek the correct frame for power save page flips
The superseded frame is always the oldest frame so it's the head of
the queue, not the tail. Aside from anything else, the call to
`meta_onscreen_native_notify_frame_complete` that follows *does* use
the head and not the tail.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4310>
2025-03-01 04:23:09 +00:00
44e2543172 meta/window-wayland: Update monitor from id for unplaced windows
If a window isn't placed yet, then we can't use its position to determine
the window's main monitor.
To solve this we get the monitor from its id instead, which correctly
uses preferred_logical_monitor whenever possible, as well as still handling
the potential edge case of unplaced windows during monitor configuration
changes.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2116
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/525
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4297>
2025-02-28 19:19:15 +01:00
eed9858459 core/window: Reformat window.c
This commit uses uncrustify's output with some changes to reformat parts of
window.c.
No functional change intended.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4297>
2025-02-28 14:13:35 +01:00
de2d19e882 gdctl: Support showing and setting output luminance
`gdctl show` now prints "monitor preferences", which currently consists
of only the luminance setting.

`gdctl prefs` is introduced, where one can run e.g. `gdctl prefs
--monitor DP-1 --luminance 80.0` to set the output luminance of the
monitor connected to DP-1 to 80%.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4271>
2025-02-27 13:13:42 +01:00
be6af00d6b DisplayConfig: Add API to get and set output luminance
This will in turn change the GSetting, where the setting is actually
stored.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4271>
2025-02-27 13:13:42 +01:00
db2376cb84 settings: Add API to manipulate output luminance
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4271>
2025-02-27 13:13:42 +01:00
b7a6689941 monitor-manager: Use G_CONNECT_DEFAULT instead of 0
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4271>
2025-02-27 13:13:42 +01:00
8cae2e7b08 debug-control: Remove output luminance knob
It was replaced with an actual setting and is no longer used.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4271>
2025-02-27 13:13:42 +01:00
7ae038a62d color-device: Get output luminance from MetaSettings
This makes it per output, and not a debug utility.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4271>
2025-02-27 13:13:17 +01:00
bdf1ff0360 settings: Add output luminance settings to org.gnome.mutter
This aims to allow configuring the output luminance currently used via
the color state shaders. It will replace the output luminance property
of the debug control API.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4271>
2025-02-27 11:35:22 +00:00
5b6519b4d4 monitor: Allow passing const monitor specs to equals()
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4271>
2025-02-27 11:35:22 +00:00
7fa41a6f97 monitor: Make spec clone function take a const pointer
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4271>
2025-02-27 11:35:22 +00:00
ad77344809 output: Declare color mode type in backend types
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4271>
2025-02-27 11:35:22 +00:00
463eb3993b settings: Remove stray newline
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4271>
2025-02-27 11:35:22 +00:00
e0b44bdc03 settings: Fix include order
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4271>
2025-02-27 11:35:22 +00:00
df555f4828 tests: Fall back if there's no seat_id for the current session_id
Such as in an ssh login.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3875

Fixes: 98b347b204 ("dbusmock/logind: Mock logind and remove KVM special handling")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4299>
2025-02-27 01:15:06 +00:00
a673adebab core/stack: Simplify compare_window_position
compare_window_position calls into meta_window_stack_position_compare
with inverted inputs instead of duplicating the logic.
This comes at the cost of an extra meta_stack_ensure_sorted which should
be culled out.
To ensure this, need_resort is reset before the sorting process starts.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4183>
2025-02-26 10:03:18 +00:00
02e3eb8de8 core: Drop meta_stack_windows_cmp and derived functions
Since these will not be used from now on, we can finally clean up
meta_stack_windows_cmp, window_stack_cmp and meta_display_stack_cmp.
Now the only comparison function is meta_window_stack_position_compare.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4183>
2025-02-26 10:03:18 +00:00
cddfd875bc core: Port to meta_window_stack_position_compare
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4183>
2025-02-26 10:03:18 +00:00
11d0a4b5b3 core/stack: Introduce meta_window_stack_position_compare
This moves the implementation to window.c for a more general comparison
function to be used throughout the code base.
It will be used in the successive commits.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4183>
2025-02-26 10:03:18 +00:00
a34b9276b4 core/stack: Export meta_stack_ensure_sorted
We export stack_ensure_sorted as meta_stack_ensure_sorted; it will be
needed in the next commit since the general comparison function will move
to window.c

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4183>
2025-02-26 10:03:18 +00:00
e1cf5352a6 core/stack: Get workspace_manager from display whenever possible
Simplifies meta_stack_update_layer and meta_stack_update_transient

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4183>
2025-02-26 10:03:18 +00:00
e591850206 core/stack: Reformat stack.c
This commit only reformats stack.c, mostly following uncrustify's output.
No functional change intended.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4183>
2025-02-26 10:03:18 +00:00
57698c2689 wayland/text-input: Reset focus state when destroying text_input
When closing some wayland apps using text-input-v3, text_input_destructor
could remove resource in focus_resource_list without resetting focus.

This could be an issue if, the focus is on a wayland app not using text-
input-v3 after closing those. Text committing would fail, and the
candidate window would always show on previous entry.

This commit adds check in text_input_destructor, resetting focus if
necessary.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4776
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4164>
2025-02-26 09:44:50 +00:00
54c606ed8e gdctl: Allow to lease monitors
Add a new option (--for-lease-monitor) to allow to set a monitor that is
not part of any logical monitor as available for lease.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4300>
2025-02-26 08:34:56 +00:00
5a984292a5 tests/clutter: Add color-state-transform test
The steps for this test:
  * For each testing color create an actor and assign the color to it.
  * Create a src_color_state and set it to all actors.
  * Create a target_color_state and set it to the stage_view.
  * Wait for paint.
  * Read the color for each actor which will be different after the
    color-state transformation.
  * Do the same transformation on CPU for each test color.
  * Validate that the resulting colors match.

In the future this test will be extended to compare transformations
between color_state_params and color_state_icc.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4230>
2025-02-25 18:28:49 +00:00
edb91a3cc6 udev: Don't ignore drm devices with mismatching seat when headless
The seat we'll have is not a real seat, so lets not filter out drm
devices when running headlessly.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3912
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4281>
2025-02-25 08:21:17 +00:00
d8512767ea color-device: Update the color device on force-hdr debug-control changes
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4298>
2025-02-25 03:27:27 +00:00
74f8e83154 wayland/color-management: Enable support for EXT_LINEAR tf
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4291>
2025-02-25 02:40:17 +00:00
8fb2a8a4b8 wayland/color-management: Expose the protocol by default
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4291>
2025-02-25 02:40:17 +00:00
4fe1e41ab3 wayland/color-management: Update to upstream wp_color_management_v1
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4291>
2025-02-25 02:40:17 +00:00
b1ef99bf23 build: Reorder wayland protocol alphabetically
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4291>
2025-02-25 02:40:17 +00:00
5eaed6e3f3 core: Let the MetaA11yManager handle keyboard events
Plumb the MetaA11yManager into key event handling. This manager
is partly in control of keyboard event propagation, depending on
the screen readers connected.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4217>
2025-02-25 02:14:46 +00:00
a817d7c137 core: Add a debug control override to disable the a11y manager ACL
This commit adds another way how to disable the a11y manager ACL in development.
Setting the unsafe mode might not be as straightforward as setting an
environment variable for the session, and you can control it invidually too.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4217>
2025-02-25 02:14:46 +00:00
1c34794b13 backends: Add D-Bus access control helper
Track unique DBus senders and allow only thse which own a (at least so far)
pre-defined set of well known DBus names.

Carlos Garnacho: Renamed to a more generic helper, use g_bus_watch_name().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4217>
2025-02-25 02:14:46 +00:00