13115 Commits

Author SHA1 Message Date
Jonas Ådahl
4345ff6be4 input-capture/session: Start emulating new devices if already active
The client may not wait for devices to be created before enabling,
meaning we might activate the input capture session before the device
emulation is started. This would result in events silently being
dropped.

This helps with the flaky input-capture test case.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4128>
2024-11-11 20:34:02 +00:00
Jonas Ådahl
91f1d3dab3 screen-cast-stream-src: Improve state change debug log entry
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4065>
2024-11-11 14:53:53 +00:00
Jonas Ådahl
ee41825f03 screne-cast-stream-src: Fix argument alignment
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4065>
2024-11-11 14:53:53 +00:00
Jonas Ådahl
bf758f349b screen-cast-stream-src: Track buffer sequence number
Use the 'seq' field in the spa_meta_header struct to track buffer
sequence numbers. This can be useful for predictable buffer tracking in
consumers, or for debugging purposes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4065>
2024-11-11 14:53:53 +00:00
Jonas Ådahl
cb702a7d21 screen-cast-stream-src: Use obj_props array for properties
As is convention.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4065>
2024-11-11 14:53:53 +00:00
Jonas Ådahl
bc9cc0135b screen-cast-stream-src: Remove stray newline
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4065>
2024-11-11 14:53:53 +00:00
Jonas Ådahl
2e068dd124 stage-view: Bump fake swap ready notify callback priority
This will become important when dispatching happens from a frame clock
driver, where the driver itself triggers from a GSource. If the driver
source has a higher priority, we'll risk dispatching before the frame
clock has returned to a state expecting to be dispatched.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4065>
2024-11-11 14:53:53 +00:00
Jonas Ådahl
e417643d78 tests/screen-cast-client: Add a couple of more debug logs
It makes it easier to diagnose issues.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4065>
2024-11-11 14:53:53 +00:00
Jonas Ådahl
9358d00381 tests/screen-cast-client: Don't fail on empty buffers
These are received when doing cursor-only updates.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4065>
2024-11-11 14:53:53 +00:00
Jonas Ådahl
0808c4cf52 tests/screen-cast-client: Remove incorrect 'unused' annotations
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4065>
2024-11-11 14:53:53 +00:00
Jonas Ådahl
b78eda1b73 tests/screen-cast-client: Fix expected order of events
We expect to first enter the 'streaming' state, and then receive a
buffer, not the other way around.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4065>
2024-11-11 14:53:53 +00:00
Robert Obkircher
dbf1edefdf output-xrandr: Ignore duplicate modes reported by xrandr
This fixes an issue where xrandr reports the preferred mode of an
internal laptop display twice. This triggered an assertion that
crashed GDM, because meta_monitor_normal_generate_modes assumes
that the list of display nodes doesn't contain duplicate pointers
to the preferred one.

Closes: <https://gitlab.gnome.org/GNOME/mutter/-/issues/2945>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3176>
2024-11-09 12:01:23 +00:00
Jonas Ådahl
efddf28925 eis-client: Remove brackets from a couple of if then branches
They were done this way to make capability configurations similarly
indented, but lets interpret the coding style strictly instead.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4064>
2024-11-08 22:09:52 +01:00
Jonas Ådahl
f63a2ce420 eis-client: Log received events
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4064>
2024-11-08 22:09:52 +01:00
Jonas Ådahl
c46db0a020 eis/client: Add touch support
Touch devices are handled very similarly to how absolute pointer
devices, by creating either shared or standalone devices depending on
what kind of monitor it's associated with.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4064>
2024-11-08 22:09:52 +01:00
Jonas Ådahl
6a1e1d74e5 eis-client: Handle unbinding device types
A EIS client might want to unbind a device capability; doing so should
effectively remove the device, which we didn't. Instead we always
created devices that a seat bind event had capabilities set for.

Fix this by explicitly keeping track of what is our "keyboard", our
"pointer", and whether we have a set of abs pointers, and don't create
duplicates if we already have devices created. For absolute pointer
devices, just keep track if we should have them, because we might have
many, or none, if we happen to be headless at the time being.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4064>
2024-11-08 22:09:17 +01:00
Jonas Ådahl
d2325f1507 eis-client: Configure shared and standalone abs pointer the same way
We don't need two separate configuration helpers, they do the same
thing. This will simplify making the viewport dependent device creation
more generic and reusable.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4064>
2024-11-08 22:08:21 +01:00
Jonas Ådahl
ef3870e6aa virtual-input-device/native: Move away from _evdev suffix
For some reason the variable for the *Native subclass of
MetaVirtualInputDevice was suffixed with _evdev. Long long ago the input
backend in clutter was called "evdev", so might be because of that.
Anyway, lets rename to something more closely related, i.e. _native.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4064>
2024-11-08 22:08:21 +01:00
Jonas Ådahl
f76b59322a virtual-input/native: Properly forward 'finish' scroll event flags
This makes kinetic scrolling in e.g. GTK work.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4064>
2024-11-08 22:08:21 +01:00
Jonas Ådahl
2cd84f9263 context/main: Remove unnecessary macro endif/if
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4064>
2024-11-08 22:08:21 +01:00
Jonas Ådahl
95e395c212 wayland: Add support for system bell protocol
This integrates with the system bell the same way as the equivalent
request in gtk-shell does.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3675>
2024-11-07 12:22:57 +00:00
Jonas Ådahl
59f40fe16c kms/update: Use mtk_region_get_box() instead of reconstructing the boxes
The underlying data structure of MtkRegion is pixman_region32, which
gives us boxes, not rectangles. Use the new get_box() API to bypass
going via rectangles to get the boxes directly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4103>
2024-11-07 11:53:22 +00:00
Jonas Ådahl
c8fc1edea6 cogl/onscreen: Pass regions instead
Go one step further and pass regions. Sometimes the rectangles were
already a region, e.g. the swap-buffer case, and sometimes it still
potentially needs to pass through a rectangle array, e.g. damage with a
view transform.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4103>
2024-11-07 11:53:22 +00:00
Jonas Ådahl
3548faed03 cogl/onscreen: Pass rectangle arrays as MtkRectangle arrays
Only before passing to EGL does it need to become a int tuple array.
It's used in non-EGL places which now become more easy to read. While at
it, make use of the new (and tweaked) helper function for flipping
rectangles from "cogl space" to "GL space".

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4103>
2024-11-07 11:53:22 +00:00
Jonas Ådahl
5deef6accb cogl/onscreen: Pass damage regions unflipped
The other similar API all operate with the assumptions that (0,0) is at
the top left, so lets make damage regions behave this way too. Add a
helper to flip the rectangles, to make it a bit more convenient. It'll
be used in more places in a follow up.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4103>
2024-11-07 11:53:22 +00:00
Sebastian Wick
6b72184173 core/context: Fix if/else cascade for disabled native backend
If the native backend is disabled but X11 and wayland are enabled, there
is a free standing else. Fix this by relying on the returns for control
flow.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4123>
2024-11-06 22:02:44 +00:00
José Expósito
55910e467f native/drm-lease: Handle monitors configured for lease
Follow the configuration stored in MetaMonitor and make connectors
configured as for lease available to Wayland clients.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4112>
2024-11-06 15:36:21 +00:00
José Expósito
63b7d958f2 kms/connector: Rename meta_kms_connector_is_for_lease()
Now that connectors can be configured as for lease, rename the function
to meta_kms_connector_is_non_desktop() to make clear that it returns
the hardware configuration rather than the user configuration.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4112>
2024-11-06 15:36:21 +00:00
José Expósito
863b31cae9 output/kms: Add meta_output_kms_from_kms_connector()
Add a function that returns a MetaOutputKms (if any) from a
MetaKmsConnector.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4112>
2024-11-06 15:36:21 +00:00
José Expósito
f93e85f69b monitor: Keep track of the for lease status
Add a flag to MetaMonitor indicating if the monitor is available for
lease and store/update it from the monitor configuration.

Also, add unit tests validating that the configuration is applied and
that invalid configurations fail.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4112>
2024-11-06 15:36:21 +00:00
José Expósito
406de0d6d7 monitor-manager: Add forlease config to monitors.xml
Allow to configure a list of monitors as available for lease in
monitors.xml.

The monitors available for lease, must be disabled as well.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4112>
2024-11-06 15:36:21 +00:00
Sebastian Wick
7a4a2ebd36 backend/x11: Make nested and cm subclasses final
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4018>
2024-11-06 13:54:35 +01:00
Sebastian Wick
e47379faad backend: Split dispose into dispose and finalize
Components which do not keep references to other components can be moved
to finalize and be available for longer which can help to shut down the
other components.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4018>
2024-11-06 13:54:35 +01:00
Sebastian Wick
8da99b69e2 backend: Add newlines to break the illusion of grouping
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4018>
2024-11-06 13:53:40 +01:00
Sebastian Wick
007058aac4 backend: Re-order backend component initialization
Move components without dependencies to the top and try to move
components with dependencies close to the component they depend on.

While this is an improvement, we really should start tracking and
documenting the actual dependencies between our components so that the
order here becomes comprehensible.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4018>
2024-11-06 13:52:43 +01:00
Sebastian Wick
2641d28a80 backend: Move stage creation to own function
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4018>
2024-11-06 13:51:05 +01:00
Sebastian Wick
01f7ba70e9 backend: Move InputMapper creation and signal connection to function
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4018>
2024-11-06 13:51:05 +01:00
Sebastian Wick
acc148ab7c backend: Move cursor tracker creation to function
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4018>
2024-11-06 13:51:05 +01:00
Sebastian Wick
ad4f0b74d5 backend: Move constructed to initable_init and init_basic
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4018>
2024-11-06 13:51:05 +01:00
Sebastian Wick
d289ef9434 backend: Move subclass initable to specialized init vfuncs
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4018>
2024-11-06 13:51:05 +01:00
Sebastian Wick
ed1bd6c005 backend: Move in_init from object init to initable_init
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4018>
2024-11-06 13:51:05 +01:00
Sebastian Wick
57bceb0759 backend: Split post_init into init_basic, init_render, init_post
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4018>
2024-11-06 13:51:05 +01:00
Bilal Elmoussaoui
eb5e6036be window: Add get_client_content_rect
In acbb14f34bc8fee14e77db3c100e5d116d8e3d60, we have dropped the
is_client_decorated except it was still being used by gnome-shell
to adjust the window coordinates in case it is using server side
decoration.

Instead of re-adding the same function, expose a new function that
takes care of getting the whole client area while taking into account
SSD for X11 clients.

Helps https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7984

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4087>
2024-11-06 11:04:15 +00:00
Bilal Elmoussaoui
a5be92e03d Use _once variant of g_[timeout_idle]
Nice helpers that were added in GLib 2.72, so safe to make use of as we
depend on 2.81.1 already.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4115>
2024-11-04 21:18:37 +00:00
Bilal Elmoussaoui
0f5ec2ec16 window: Use getter for fullscreen state
Avoids going through struct field directly as we might replace that with
a WindowConfiguration type soon-ish.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4111>
2024-10-30 16:25:47 +01:00
Bilal Elmoussaoui
8e5433d82a window: Replace barely used macros with func equivalents
To avoid mostly going through struct fields in macros as we might soon
move those first to a WindowConfiguration & maybe even make the window
struct private with time.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4111>
2024-10-30 16:25:37 +01:00
Bilal Elmoussaoui
696dfaa124 clutter/threads: Remove helper functions
See previous commit

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4077>
2024-10-30 08:32:46 +01:00
Bilal Elmoussaoui
d92893b6f3 clutter/threads: Remove _full functions variant
As they are not used anywhere, in the next commit
we will just remove the whole thing and use glib helpers directly as
there is nothing specific about ClutterThread anymore

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4077>
2024-10-30 08:32:46 +01:00
José Expósito
a92ecd7373 onscreen/native: Fix fd error check
meta_drm_buffer_dumb_ensure_dmabuf_fd () return -1 on error, not 0.

Fix the error check.

Fixes: 84bde805fe34 ("native: Consolidate DRM buffer management to MetaDrmBuffer types")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4109>
2024-10-29 15:21:03 +00:00
Olivier Fourdan
4c65cdec64 xwayland/surface: Connect "highest-scale-monitor-changed" signal
Similar to what MetaWaylandShellSurface does, connect the signal
"highest-scale-monitor-changed" to the handler
meta_wayland_surface_notify_highest_scale_monitor() so that
Xwaylandsurface can be notified of the fractional scale changes.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3326
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3639>
2024-10-29 08:52:21 +00:00