13417 Commits

Author SHA1 Message Date
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
Carlos Garnacho
b7d533c301 wayland: Honor wl_surface.offset on cursor surfaces
Update the cursor hotspot based on wl_surface.offset requests. This
is the expected way to update the cursor hotspot once the cursor
surface is already visible and has buffers attached.

Related: https://gitlab.gnome.org/GNOME/gtk/-/issues/7249
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4239>
2025-02-13 21:28:59 +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
Michel Dänzer
ba3b709e08 cursor-renderer/native: Skip init_hw_cursor_support_for_gpu for headless
By definition, headless means no HW display output, so initializing HW
cursor support makes no sense.

Fixes hitting the g_warning in tests when there's a GPU device
available, breaking them.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4259>
2025-02-12 08:36:54 +00:00
Alban Browaeys
99dbcf1b8c input-capture/session: Disconnect on_keymap_changed on session finalize
When Input Capture was enabled on Input Leap server startup and then
finalized when Input Leap server was stopped, switching keymap was
still triggering its on_keymap_changed callback, but on a freed session
thus triggering use after free a segfault.

Fixes: 2fb3bdf77 - input-capture: Hook up capturing of events to active session
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3360
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4257>
2025-02-12 04:11:01 +00:00
Corentin Noël
2da7805f58 meson: Use library instead of shared_library
Allow to theoretically build mutter statically.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4244>
2025-02-11 09:55:07 +00:00
Dudemanguy
e078147f7d wayland: Support presentation-time version 2
It is simply a matter of checking the version and always sending back
the refresh rate of the display if we have version 2 of the protocol.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4227>
2025-02-11 09:37:32 +00:00
Dudemanguy
271c712146 wayland: Fix refresh interval reporting in presentation-time version 1
Version 1 of the presentation protocol requires that 0 be sent for the
refresh rate for variable refresh rate. Fix this by checking the mode
during the presentation event.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4227>
2025-02-11 09:37:32 +00:00
Michel Dänzer
f459472cfe cursor-renderer/native: Probe formats supported by cursor planes
Probe all RGBA 8888 variants.

If there's a GBM device, prefer a format also supported by GBM, if any.
Fall back to dumb BOs otherwise.

This allows the HW cursor to work correctly using BGRA8888 on s390x.

v2:
* Rename get_cursor_format_info → find_cursor_format_info.
* Log device path if we can't find any suitable cursor plane format.
v3:
* Split cursor_planes_support_format helper out of
  find_cursor_format_info to make logic clearer. (Sebastian Wick)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4255>
2025-02-11 08:09:57 +00:00
Michel Dänzer
7c447b2627 cursor-renderer/native: Store formats in MetaCursorRendererNativeGpuData
Instead of hard-coding them everywhere.

Preparation for next commit, no behaviour change intended.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4255>
2025-02-11 08:09:57 +00:00
Michel Dänzer
7e4cae2f91 cursor-renderer/native: Pass destination format to scale_and_transform
Preparation for next commit, no functional change intended.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4255>
2025-02-11 08:09:57 +00:00
Michel Dänzer
ad754af151 cursor-renderer/native: Unpremultiply for color state transformation
Without doing this, a non-linear color state transformation could result
in premultiplied colour values larger than the alpha value, which
manifested with artifacts such as parts of the cursor shining brighter
than SDR white (with HDR enabled).

This was reported in the GNOME Shell Matrix room on August 8th 2024, and
I later hit it myself.

v2:
* Fix add_pipeline_snippet function formatting. (Sebastian Wick)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4224>
2025-02-07 05:39:22 +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
Nick Diego Yamane
3ca7539869 wayland/xdg-toplevel-drag: Do not set grab actor names for window drags
Those names (name and accessible-name) don't seem to be that useful
after all, so get rid of them, which simplifies the window drag grab
setup impl.

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

Signed-off-by: Nick Diego Yamane <nickdiego@igalia.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4220>
2025-02-05 15:39:32 +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
Peter Hutterer
751277a7ef virtual-input-device/native: Drop the separate "seat" property
The "seat" property is already used by the parent
ClutterVirtualInputDevice - re-using this property means the parent's
propery never gets set so clutter_virtual_input_device_get_seat()
returns NULL.

This causes mutter to crash if a tablet pad sends a key event via a pad
ring or strip.

Since this type is only ever constructed with a MetaSeatNative as seat
we can extract that object through the parent and drop our property.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4247>
2025-02-05 12:37:44 +00: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
3b1067e783 remote-desktop-session: Only add configured streams as viewports
Otherwise we risk adding streams that don't yet have a virtual monitor.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4210>
2025-02-04 10:28:19 +08:00
Jonas Ådahl
14eedb38df eis-client: Only remove MetaEisDevice when eis_device is removed
When we recreate devices, or unbind device classes, don't remove the
device from the hash table and free MetaEisDevice quite yet - only do so
when the eis_device is actually removed.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3839
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4210>
2025-02-04 10:28:19 +08:00
Jonas Ådahl
4d9a818321 eis: Don't warn on unhandled EIS event types
They are expected to be handled by libeis if we're not, so don't warn
about that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4210>
2025-02-04 10:28:19 +08:00
Jonas Ådahl
5708c6c5d1 dbus-session-manager: Generate session IDs that one doesn't need to escape
This makes it easier to deal with in test cases that uses
g_shell_parse_argv().

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
2fa0183a95 kms/connector: Add API to check color mode support
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4192>
2025-02-01 22:46:09 +00:00
Jonas Ådahl
0f9c9fdc20 monitor-config-manager: Put finding relevant configs into helper
Finding configurations relevant for inspiration when creating a new one
can be useful for finding more things to inherit from previous
configurations than the scale, so put the configuration gathering code
in a helper.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4192>
2025-02-01 22:46:09 +00:00
Jonas Ådahl
0f200efc6d monitor-config-manager: Rename helper finding logical monitor
It doesn't get a monitor, but a logical monitor, so name it according to
that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4192>
2025-02-01 22:46:09 +00:00
Jonas Ådahl
654d75b841 monitor-config-manager: Fix indentation
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4192>
2025-02-01 22:46:09 +00:00
Jonas Ådahl
a38f9c2d48 gpu: Don't include monitor manager header
Doing so pulls in too much, causing potential header include order
conflicts.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4192>
2025-02-01 22:46:08 +00:00
Jonas Ådahl
bfa0f3e2ab output: Fix include order
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4192>
2025-02-01 22:46:08 +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
f1e497acfa monitor: Add API to list supported color modes
Available modes are 'default', which is always added, and BT.2100,
which is added if the BT.2020 color space, and the PQ transfer function,
is supported by the output.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4192>
2025-02-01 22:46:08 +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
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