3157 Commits

Author SHA1 Message Date
Jonas Ådahl
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
Mattia Formichetti
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
Mattia Formichetti
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
Mattia Formichetti
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
Mattia Formichetti
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
Mattia Formichetti
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
Mattia Formichetti
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
Mattia Formichetti
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
Sebastian Wick
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
Lukáš Tyrychtr
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
Lukáš Tyrychtr
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
Lukáš Tyrychtr
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
Mattia Formichetti
4d280086fe core/place: Fix and enable centered find_next_cascade
We use place_centered to start the cascade from the center of the
usable work_area; sorting now takes either the top left or top right window
corner as a reference using window_distance_cmp.

Helps: https://gitlab.gnome.org/GNOME/mutter/-/issues/2123
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4202>
2025-02-19 19:20:38 +00:00
Mattia Formichetti
c606d1e670 core/place: Introduce window_distance_cmp
This commit introduces a new comparator, window_distance_cmp,
which uses either the top left or top right corner of a given window, based
on LTR, as reference for the squared distance.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4202>
2025-02-19 19:20:38 +00:00
Mattia Formichetti
45052aeafd core/place: Normalize comparator functions to work_area coordinates
Both northwest_cmp and northeast_cmp didn't account for the work_area's
relative x and y coordinates which would lead to improper sorting on
multi-monitor setups.
To fix this, we pass the work_area when necessary and use it to offset the
absolute coordinates.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4202>
2025-02-19 19:20:38 +00:00
Mattia Formichetti
14b90daa5a core/place: Remove unnecessary sqrt in comparator functions
Remove unnecessary sqrt() calls in northwest_cmp and northeast_cmp.
The square root would have been necessary if we needed the actual distance,
but we only care about the relative order, so it isn't.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4202>
2025-02-19 19:20:38 +00:00
Mattia Formichetti
970ac8ff50 core/place: Simplify meta_window_place
This is a preparatory commit, it refactors away of the
done_check_denied_focus label, simplifying the control flow.

The only functional difference is that now the auto-maximization when
windows don't fit the work_area is always applied.

The next commits will adapt find_next_cascade to properly handle this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4202>
2025-02-19 19:20:38 +00:00
Mattia Formichetti
b3fd815bed core/place: Drop unused arguments in find_next_cascade
We drop the x and y arguments from find_next_cascade
since they're unused.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4202>
2025-02-19 19:20:38 +00:00
Mattia Formichetti
61a7b21d08 core/place: Drop unused arguments in find_first_fit
We drop the x and y arguments from find_first_fit since they're unused.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4202>
2025-02-19 19:20:38 +00:00
Mattia Formichetti
7c5005b9b0 core/place: Reformat place.c
This commit only reformats place.c, starting off uncrustify's output, no
functional change is intended.
It mostly aligns comments, as well as properly space out math,
follow current formatter enforced guidelines and fix alignment on a rogue
bracket.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4202>
2025-02-19 19:20:38 +00:00
Sebastian Wick
25bb319ec2 debug-control: Add property for toggling the cursor shape protocol
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3668>
2025-02-19 18:06:45 +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
Florian Müllner
e49edebf92 clutter/stage: Turn get_key_focus() into a proper getter
The method currently returns the stage itself when the property
is NULL.

This has become particularly problematic as the method is detected
as getter by gobject introspection, and gjs now optimizes property
accesses by calling the getter method instead.

Address this by turning the method into a genuine getter without
falling back to the stage.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4256>
2025-02-14 20:19:45 +01:00
Alessandro Bono
907460376f prefs: Introduce new parsing mechanism for special keys
The overlay-key and locate-pointer-key are special keys. They
can be used together with other keys to create a combo or they
can be used as a single key. This means that we are treating a
modifier key as a regular key while still allowing to use it as
part of a combo. This requires a special treatment that we can't
extend to an arbitrary list of keys.

However, we would like to use both Super_L and Super_R to
activate the overview. In order to allow this, introduce a new
parsing mechanism. With the new mechanism, if we fail to parse
the configured string, we will try to parse again by appending
_L first and _R later. If both succeed then we will use their
combos for handling the special key.

With this in place, we can configure Super as overlay-key. The
parsing of Super will fail, but Super_L and Super_R will succeed.
Allowing us to use both.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1277
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4050>
2025-02-13 22:43:50 +00:00
Alessandro Bono
c051c2ff69 prefs: Handle up to two combos for special keys
The second combo is still disabled. This is in preparation for a
subsequent commit that is going to parse the preference in a
different way and might end up with two combos defined.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4050>
2025-02-13 22:43:50 +00:00
Alessandro Bono
b48c7536ab keybindings: Introduce resolve_special_key_combo()
Special keys are going to be represent by up to two combos. This
functions is able to handle them by adding all the keycodes that
these combos resolve to. Special keys don't have modifiers, so there
is no need to devirtualize them.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4050>
2025-02-13 22:43:50 +00:00
Alessandro Bono
ea53865962 keybindings: Introduce get_keycodes_for_combos()
This function allows, given an array of combos, to get all the
keycodes associated with them. Right now it is used for just
one combo, but will be used for two combos in order to handle
special keys like the overlay-key and the locate-pointer-key.

As it is now, this function is still useful for aggregate the
GArray creation/destruction in a single place.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4050>
2025-02-13 22:43:50 +00:00
Alessandro Bono
5f85d6afb1 keybindings: Don't assume keycodes GArray is empty
See 44269e6a1dadb643af3a748c2bcca04ac1ab72eb. The function
add_keycodes_for_keysym() is going to be called more than
once on purpose and we want the keycodes do be appended to
a non-empty GArray.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4050>
2025-02-13 22:43:50 +00:00
Alessandro Bono
8172ecbf2a keybindings: Add keycodes for keysym to a GArray
We are going to need to call this function more than once to add
all the keycodes to the same GArray. Switch to handle GArrays and
rename the function in order to give a hint that keycodes are going
to be added to the passed GArray.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4050>
2025-02-13 22:43:50 +00:00
Alessandro Bono
b145f659fb keybindings: Rename variable
It contains more than one combo, use the plural form.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4050>
2025-02-13 22:43:50 +00:00
Alessandro Bono
be819d9983 keybindings: Reduce variable scope
We can't remove the variable entirely because g_array_append_val()
is a macro that assumes a variable as parameter.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4050>
2025-02-13 22:43:50 +00:00
Alessandro Bono
db81ba4d5b keybindings: Stop tracking special binding combos
We use them in a single place, there is no need to internally keep
track of them. The MetaKeyBindingManager has their resolved key
combo (overlay_resolved_key_combo and locate_pointer_resolved_key_combo)
which is enough. Get the special binding combos from the preference
right away when needed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4050>
2025-02-13 22:43:50 +00:00
Alessandro Bono
c60285ff76 keybindings-private: Style fix
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4050>
2025-02-13 22:43:50 +00:00
Alessandro Bono
10d0ed65aa prefs: Invert if statement condition
Mimic what we already do for the locate-pointer. There is
no need for an empty "then" branch.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4050>
2025-02-13 22:43:50 +00:00
Peter Hutterer
65db49cafa core: Don't show the pad mode button group if we only have a single group
Only a tiny number of tablet pads that have more than one mode
group, everyone else has one mode toggle button and one group.
Let's not display "Group 0" for everyone if (almost) no-one has a Group
1 anyway.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4248>
2025-02-05 13:21:54 +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
Olivier Fourdan
fc6d79eda9 keybindings: Check modifier masks one by one
Commit 48d070dae changed the logic to compare the modifiers mask as a
whole.

Unfortunately, that does not work with all combinations of modifiers, as
some may not be reported when the ISO_Next_Group key is notified.

Revert to the original logic which is to compare against each modifier
mask individually.

Fixes: commit 48d070dae - keybindings: Check for ISO_Next_Group keysym
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4237>
2025-01-31 12:47:45 +01:00
Olivier Fourdan
48d070dae7 keybindings: Check for ISO_Next_Group keysym
In process_iso_next_group(), we would use try to match mask and keycode
of ISO_Next_Group to tell whether the key combo has been activated.

That works on X11, but not on Wayland with the native backend, because
the keycode does not match.

But we do not need to go all through that burden to match the key combo
we could just use the keysym instead, which would work even when there
is no physical key for ISO_Next_Group.

All we need to do is check whether the symbol is ISO_Next_Group and the
modifier mask matches, which simplifies the code as well.

(Note that we still need to keep the resolved iso_next_group_combo
key combo around because the X11 backend grabs that key combo.)

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3883
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4232>
2025-01-30 16:52:56 +00:00
Carlos Garnacho
4cb3518205 core: Make meta_window_move_resize_internal() truly internal
This function is no longer used anywhere outside MetaWindow code, so
make it no longer declared at the window-private.h header.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3972>
2025-01-29 12:44:05 +00:00
Carlos Garnacho
4664fce695 core: Rename/repurpose meta_window_resize_frame_with_gravity()
The gravity argument is no longer effective since the previous
commit. Drop the argument, and rename it to "meta_window_resize_frame",
all callers have been updated.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3972>
2025-01-29 12:44:05 +00:00
Carlos Garnacho
fb49a700a1 core: Drop MetaGravity argument from move_resize_internal() call
Obtain the gravity through the newly added MetaWindow method from the
window being moved/resized.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3972>
2025-01-29 12:44:05 +00:00
Carlos Garnacho
432e52bad0 core: Drop MetaGravity argument from move_resize_internal() vmethod
The implementations no longer need this argument, so drop it in
favor of meta_window_get_gravity().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3972>
2025-01-29 12:44:05 +00:00
Carlos Garnacho
ca0c6bcd69 core: Set gravity based on grab op during window move/resize ops
We will basically want to follow the gravity as specified by the drag
corner/edge. Hook this up to meta_window_get_gravity().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3972>
2025-01-29 12:44:04 +00:00
Carlos Garnacho
0928d3ec32 core: Add meta_window_get_gravity() private call
This relies on a class vmethod, so that subclasses can alter
the behavior.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3972>
2025-01-29 12:44:04 +00:00
Sebastian Wick
5152fa142b context/main: Guard logind code behind #ifdef HAVE_LOGIND
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4223>
2025-01-29 10:44:57 +00:00
Sebastian Wick
e7ca9cecea build: Rename have_libsystemd to have_logind
We really only need the logind API which can be provided either by
libsystemd or libelogind.

This also pulls out finding a logind provider from the native backend
only code because we make use of it in the generic backend code as well.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4223>
2025-01-29 10:44:57 +00:00
Jonas Ådahl
127c303254 util: Remove meta_warning()
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4005>
2025-01-16 00:48:42 +00:00
Jonas Ådahl
e88205379b workspace: Replace meta_warning() with g_warning()
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4005>
2025-01-16 00:48:42 +00:00
Jonas Ådahl
ed02ce79e9 workspace: Replace a couple of warnings with debug log entries
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4005>
2025-01-16 00:48:42 +00:00
Jonas Ådahl
7a3f87814b window: Replace meta_warning() with g_warning()
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4005>
2025-01-16 00:48:42 +00:00