1
0
Fork 0
Commit graph

12652 commits

Author SHA1 Message Date
Carlos Garnacho
e5483a963e wayland: Pass button/touch press begin coordinates as window drag hint
This will make windows stick to the pointer from the right point
where dragging started.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3546>
2024-02-27 00:19:22 +01:00
Carlos Garnacho
1b3759d51c x11: Pass NET_WM_MOVERESIZE coordinates as window drag hint
This will make windows stick to the pointer from the right point
where dragging started.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3546>
2024-02-27 00:19:22 +01:00
Carlos Garnacho
4b1e24fcc4 core: Pass position hint to meta_window_begin_grab_op()
Add an argument to pass the position hint to this public API
call, so that callers can specify such hint. Everyone passes
NULL at the moment.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3546>
2024-02-27 00:19:22 +01:00
Carlos Garnacho
51e084ee8d compositor: Forward window drag position hint across internals
Allow passing an argument to meta_compositor_drag_window() to pass
the hint. Unused so far.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3546>
2024-02-27 00:19:20 +01:00
Carlos Garnacho
e4542a6495 compositor: Add MetaWindowDrag API to add a hint on the grab coordinates
This is added as a hint so that the caller can optionally use it, e.g.
in the case that a window drag is driven by the mouse. This will be used
to more accurately follow the drag position, other than starting at the
current pointer position.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3546>
2024-02-27 00:18:23 +01:00
Carlos Garnacho
4fa2706b9b wayland: Look up pointer logical focus when enabling constraints
Pointer constraints obey to logical pointer focus changes, and looking
up the current surface in order to maybe enable them is getting ahead
of itself, since the pointer focus might differ from the current surface
due to other factors (e.g. grabs).

Change the code checking whether constraints should be enabled to again
check the pointer logical focus, this will be influenced by the
MetaWaylandEventInterface mechanism, and correctly reflect the logical
state accounting for those factors.

Fixes: 125ba92169 ("wayland: Port pointer constraints to using MetaWaylandEventInterface")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3303
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3618>
2024-02-26 22:15:19 +00:00
Carlos Garnacho
1d5676bc9a wayland: Handle event interface changes during focus synchronization
Currently, we don't handle too well the removal of a MetaWaylandEventInterface
during meta_wayland_event_interface_invalidate_all_focus(), since the
MetaWaylandEventInterface may be freed at an intermediate point in that function
while handling the focus change for all input devices.

Turn this invalidate_all_focus() function into a MetaWaylandInput method, and
always ensure to use the currently effective MetaWaylandEventInterface when
resetting the focus for each device.

This fixes the situation through handling reentrancy naturally, a focus
sync (say, triggered by a grab) would reset a device focus (say, pointer), which
would remove an event interface (say, a pointer constraint), which would
invalidate_all_focus() again underneath using the new effective
MetaWaylandEventInterface. When that is done, the initial invalidate_all_focus()
call would re-apply the same focus to the same currently effective
MetaWaylandEventInterface, resulting in a no-op for the remainder of the function.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3618>
2024-02-26 22:15:19 +00:00
Carlos Garnacho
7fc49f742b wayland: Add getter for the MetaWaylandPointer logical focus
Even though the logical focus is typically business that only the
MetaWaylandEventInterface mechanism minds about, there are some pointer
subsystems that want to look this up, as opposed to the current surface.

Add a getter to make this easier, without struct peeking.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3618>
2024-02-26 22:15:19 +00:00
Sebastian Wick
b102b6eca7 kms/connector: Remove getters for state tracked by KmsConnectorState
This also removes some g_return_if_fail's because the test suite expects
to be able to create arbitrary KmsUpdates even if they don't make sense
for the real state. We just get lucky that the test suite isn't
constructing updates with color space and hdr changes, yet.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3552>
2024-02-26 18:18:53 +00:00
Sebastian Wick
420c8cb37f kms/connector: Simplify privacy screen tracking
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3552>
2024-02-26 18:18:53 +00:00
Sebastian Wick
3e14edb00c kms/connector: Track max_bpc in KmsConnectorState
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3552>
2024-02-26 18:18:53 +00:00
Sebastian Wick
e9e613a6c3 kms/connector: Track underscan in KmsConnectorState
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3552>
2024-02-26 18:18:53 +00:00
Sebastian Wick
0dc43c04ee onscreen/native: Move rgb range support to OutputInfo
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3552>
2024-02-26 18:18:53 +00:00
Sebastian Wick
706bee2a58 onscreen/native: Use max bpc support from OutputInfo
The max bpc support is already tracked in the OutputInfo, so let's use
that instead of querying the KMS Connector directly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3552>
2024-02-26 18:18:53 +00:00
Sebastian Wick
8acf250583 output: Move privacy screen support to OutputInfo
Same as previous commit for privacy screen support.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3552>
2024-02-26 18:18:53 +00:00
Sebastian Wick
a3a4de6c6b output: Move color space and hdr tf support to OutputInfo
Currently querying support for some output features is done partially
through the OutputInfo and partially via KMS CRTC and Connector objects.
Let's be consistent and use OutputInfo always which works with all
backends and backend types.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3552>
2024-02-26 18:18:53 +00:00
Sebastian Wick
fb7b9b0955 onscreen/native: Disable the CRTC LUT when we have no LUT to set
The KmsImplDevice supports bypassing the hardware LUT when we pass in
NULL or an empty LUT.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3552>
2024-02-26 18:18:53 +00:00
Sebastian Wick
eb8a12c24b tests/kms/update: Use proper gamma LUT size
We're currently pretending the gamma LUT has another size. This becomes
a problem when we try to reset the LUT to passthrough, create an
identity LUT for it and it has a size that the kernel doesn't accept.

We do track the size and have utility for creating the LUTs, so let's
just use them.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3552>
2024-02-26 18:18:53 +00:00
Sebastian Wick
b083ad67df kms/impl-device/simple: Handle NULL gamma LUTs for passthrough
The kernel doesn't let us set gamma to passthrough with the legacy API
so we have to trick a bit and create an identity LUT, and also when we
read the KMS state, detect when an identity LUT is active.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3552>
2024-02-26 18:18:53 +00:00
Sebastian Wick
a55e2e5af2 crtc: Add identity gamma LUT helpers
One to create a identity LUT of a certain size, one to check if a LUT
represents identity.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3552>
2024-02-26 18:18:53 +00:00
Sebastian Keller
6876b51875 frames: Drop unused border property from frame content
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3608>
2024-02-26 17:03:56 +00:00
Sebastian Keller
f10b3eac62 frames: Always initialize _MUTTER_FRAME_EXTENTS to zero
The frame size_allocate() will set it correctly once show() is called by
the window tracker.

This is less code and also help reduces the chance of a brief visual
glitch in fullscreen games during startup. If the window is initially
still decorated the gray area would still show up until the next redraw,
which due to loading times can take a while.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3608>
2024-02-26 17:03:56 +00:00
Sebastian Keller
bcdd282e9c frames: Update _MUTTER_FRAME_EXTENTS from frame size_allocate
Relying on the content size_allocate() to determine the content position
can fail in situations where the position of the content has changed,
but not its size.

This happens for example when the window initially is sized fullscreen
height + headerbar height while not considered fullscreen yet. Then when
the window is resized to just the fullscreen height and marked as
fullscreen, the content size has not changed and size_allocate() is not
called on the content. Thus the previous position which assumes the
presence of a headerbar still applies. As a result the window is shifted
down, revealing a headerbar sized area showing the gtk window background
color.

This issue can be avoided by using the frame's size_allocate(), which
gets called in response to all relevant events, such as any headerbar
size changes, headerbar visibility changes, window resizes and
fullscreen status changes.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2937
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3608>
2024-02-26 17:03:56 +00:00
Leonhard
d603cc351f wayland/client: Add make_desktop() method
Allows to mark a wayland client window as a DOCK window. The reason for
this is that in Gala (elementary OS's window manager) we would like to
continue using GTK apps as panel and dock on wayland.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3612>
2024-02-26 11:19:03 +00:00
Leonhard
7bf8945da4 window: Handle layer of DOCK windows
Assigning the corresponding stack layer of DOCK windows is currently X11
specific, because there is no way for wayland clients to set the DOCK
window type. This is about to change, so move the code to the generic
layer handling.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3612>
2024-02-26 11:19:03 +00:00
Florian Müllner
5bd820d746 tests/wayland-test-clients: Update cursor names
adaita-icon-theme cleaned up its cursor set, and now only provides
names defined by GTK/CSS. Update the cursor-hotplug test to not
use legacy cursor that will fail with a recent cursor theme.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3613>
2024-02-25 21:46:36 +00:00
Sebastian Keller
fa67588788 frames: Use g_clear_pointer
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3611>
2024-02-24 21:30:00 +00:00
Sebastian Keller
9a5aa846e4 frames: Rename update_extents to clarify it is not public
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3611>
2024-02-24 21:30:00 +00:00
Sebastian Keller
f47b816037 frames: Move overrides and class functions after helpers
This is in preparation of calling helper functions from class overrides
in a later commit and also brings things more in line with the mutter
coding style.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3611>
2024-02-24 21:30:00 +00:00
Sebastian Keller
9bac742ba5 frames: Drop unused class member
Everything just uses gtk_window_get_child() to get the content.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3611>
2024-02-24 21:30:00 +00:00
Bilal Elmoussaoui
60e10511ae cogl: Remove Color.init_from_4ub
Slowly switching to using floats only in CoglColor
Helps https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3544

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3594>
2024-02-22 12:34:58 +00:00
Bilal Elmoussaoui
cf0803ab71 cogl: Remove Color.get_*_byte
Helps with https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3544

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3594>
2024-02-22 12:34:58 +00:00
Bilal Elmoussaoui
40dde833af cogl: Remove Color.get_*_float
They are exactly the same as the get_* variants

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3594>
2024-02-22 12:34:57 +00:00
Bilal Elmoussaoui
11691b107c cleanup: Avoid using None on non-x11 only code paths
Just replace it with it actual value

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3606>
2024-02-21 18:29:03 +01:00
Bilal Elmoussaoui
68d5b5ea50 keybindings: Use ClutterModifierType
As it is compatible with the X11 KeyMask avoiding x11 usage

Helps https://gitlab.gnome.org/GNOME/mutter/-/issues/2272

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3606>
2024-02-21 18:28:54 +01:00
Bilal Elmoussaoui
2834780cbe window: Move set_frame_xwindow to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3603>
2024-02-21 16:01:00 +01:00
Bilal Elmoussaoui
3cc44b1f04 cleanup: Guard x11 headers includes
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3603>
2024-02-21 16:01:00 +01:00
Bilal Elmoussaoui
b5cf16fa74 cleanup: Remove not used X11 includes
Also add ones where they are actually used

Helps https://gitlab.gnome.org/GNOME/mutter/-/issues/2272

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3603>
2024-02-21 15:25:44 +01:00
Jonas Dreßler
a14200a75c wayland/surface: Notify highest scale monitor after updating window monitor
meta_window_update_monitor() can emit "::highest-scale-monitor-changed",
and we connected to that signal right before. Let's avoid calling
meta_wayland_surface_notify_highest_scale_monitor() twice and move the
g_signal_connect() for that signal and the initial call to
meta_wayland_surface_notify_highest_scale_monitor() to happen after
meta_window_update_monitor().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3598>
2024-02-21 12:19:02 +00:00
Jonas Dreßler
0fc39b2a87 Revert "wayland/surface: Add fallback for get_highest_output_scale"
Turns out there is a better solution: Almost always, MetaWindow already has
an idea on which monitor it will be, even if it isn't positioned yet. Since
the last commit we're now using that monitor for setting the
highest-output-scale of the window, so this fallback is no longer necessary.

While we could keep this fallback around and also return a valid scale in
case the surface is not even mapped yet, this means we report fractional
scale twice for new surfaces: Once from
wp_fractional_scale_manager::get_fractional_scale() (here we'll enter the
fallback), and a second time (this time with correct scale) right after
creating the MetaWindow.

Note that wp_fractional_scale_v1 doesn't specify that a preferred_scale
event must be sent immediately after
wp_fractional_scale_manager::get_fractional_scale(), so we can safely remove
the fallback.

This reverts commit 8cfbdb4313.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3598>
2024-02-21 12:19:02 +00:00
Jonas Dreßler
bf4aff823f window: Fall back to main window monitor for highest scale monitor
MetaWindow always tries to have a main monitor: If the frame rect is empty
and the window has not been positioned, in meta_window_constructed() we fall
back to asking the backend for the current monitor, and in
meta_window_wayland_update_main_monitor() we fall back to
meta_window_find_monitor_from_id(), which then falls back to the primary
monitor.

In general this means that window->monitor is always set as long as there is
a monitor around.

For getting the highest-scale-monitor the window is on, we currently rely
completely on the frame rect. If the frame rect is empty, we set the
highest-scale-monitor to NULL. Since we usually know though which monitor
the window is, or will be on, and window->monitor is even set to that, we
can just fall back to window->monitor for the highest-scale-monitor.

This makes sure ::highest-scale-monitor-changed is emitted right after the
window is created, and it's set to the correct monitor that the window will
be on. This in turn means that we can send a correct wp_fractional_scale
fraction_scale event to clients right away.

https://gitlab.gnome.org/GNOME/mutter/-/issues/3262

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3598>
2024-02-21 12:19:02 +00:00
Agustín Dall'Alba
9dff6a5013 backends/native: Remove DO_NOT_AUTO_START flag from rtkit dbus proxy
With this flag, the KMS Thread isn't made realtime at boot when the shell
starts before the rtkit daemon

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3327>
2024-02-21 11:48:49 +00:00
Bilal Elmoussaoui
917526ee9d plugin-manager: Drop MetaPluginClass.xevent_filter
This was added for registering profiling hooks for glx.swapComplete on
x11 code paths.

Nowadays we have sysprof

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3599>
2024-02-20 15:21:21 +00:00
Bilal Elmoussaoui
c72e129eb2 cursor-renderer: Move x11 specific bits to CursorRendererX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3599>
2024-02-20 15:21:21 +00:00
Bilal Elmoussaoui
899b4aad37 x11/display: Don't go through meta_create_x_cursor
As the cursor would always be default in this case and we would
want to move that function to the x11 cursor renderer.See next commit

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3599>
2024-02-20 15:21:21 +00:00
Bilal Elmoussaoui
ea74414b2e cursor-renderer: Make translate_meta_cursor public
Would be used in the upcoming commits

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3599>
2024-02-20 15:21:21 +00:00
Daniel van Vugt
f606a4424a compositor/x11: Sync again at the end of before_paint
The existing comment tells us this is necessary:

> there may be drawing between the last damage event and the
> XDamageSubtract() that needs to be flushed as well.

But the commit message for 551101c65c also tells us that
synchronization is necessary before-update. Assuming both are correct
then it needs to be done in both places.

I did try optimizing out the second sync to only do it if damage
arrived during the update, but that doesn't seem to be the issue.
The damage event is arriving before the update starts and it's some
secondary changes within the damage region running late that need
flushing. So this means the client is reporting damage more frequently
than the frame rate and we're ignoring the secondary damage reports
for efficiency (XDamageReportBoundingBox), which is still a good thing.

Fixes: 551101c65c ("compositor-x11: Move synchronization to before-update")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2880
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3590>
2024-02-20 18:22:00 +08:00
Bilal Elmoussaoui
cf9f7f427e window: Add a copy of XSizeHints
The type ended being used even in wayland code paths
so add a copy of it for now.

Helps https://gitlab.gnome.org/GNOME/mutter/-/issues/2272

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3597>
2024-02-19 20:19:41 +01:00
Bilal Elmoussaoui
97635753d9 clutter/tests: Remove unused color check helpers
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3595>
2024-02-17 14:30:19 +01:00
Bilal Elmoussaoui
85dbdc8fa6 cleanup: Remove unused defines
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3595>
2024-02-17 14:16:20 +01:00
Corentin Noël
e7de5c36f3 build: Remove the config.h inclusion from all public headers
Do not include it at header side as it is not part of the installed headers.

Only keep it in cogl-gl-headers.h as it is a private header.

Add it to all the source files that depend on it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3593>
2024-02-17 11:58:55 +00:00
Daniel van Vugt
5b49e0853c core/events: Restore IS_GESTURE_EVENT check for X11
It got lost during feec896d85 resulting in a PROPAGATE that should
be STOP.

For Wayland, gesture events are already handled (663f9d44).

Fixes: feec896d85 ("core: Simplify meta_display_handle_event()")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3293
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3589>
2024-02-17 08:26:05 +00:00
Doğukan Korkmaztürk
dc2b2e379b screen-cast-stream: Add explicit modifier support
This change adds modifier-aware screencasting support to Mutter.
Implicit modifier support is kept for backward compatibility and the
code fallbacks to implicit modifiers in case any new functionality added
for explicit modifier support fails.

The advertised modifiers are retrieved by a call to
eglQueryDmaBufModifiersEXT() function. The "external only" modifiers are
excluded as Mutter uses the buffers created with the explicit modifiers
as renderbuffers. Support for implicit modifiers is checked with a test
allocation since there are drivers that do not support them.

This change also removes various implicit modifier support checks that
disable DMA-BUF screen casting support globally as they are no longer
needed. DMA-BUF support for screencasting is determined by the available
formats and modifiers case-by-case now.

It also effectively enables DMA-BUF screencasting on NVIDIA hardware as
well since GBM buffer objects with linear modifiers are no longer used
by default to create a renderbuffer object for screencasting.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3537>
2024-02-16 09:15:34 -05:00
Doğukan Korkmaztürk
34d00d769e render-device: Update DMA-BUF allocation API to allow modifiers
meta_render_device_gbm_allocate_dma_buf() function is updated to take a
list of modifiers. If no modifiers are specified, the modifier is
selected by the allocator, and implicit modifiers are used to import the
created DMA-BUF.

Co-authored-by: Jonas Ådahl <jadahl@gmail.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3537>
2024-02-16 08:22:04 -05:00
Bilal Elmoussaoui
ab1322781d tests/cogl: Remove unused legacy_mode
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3553>
2024-02-16 12:13:23 +01:00
Bilal Elmoussaoui
2c613df4eb cogl: Drop Pipeline.set_color_*
Those setters variants makes it very hard to do across project changes
to the
color type. As part of
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3544
I would like to switch from using integers to floats inside CoglColor
which this PR would simplify

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3553>
2024-02-16 12:13:23 +01:00
Bilal Elmoussaoui
b00fcbf948 clutter: Remove unused Color APIs
Nothing uses them in GNOME Shell, so let us simplify the API
a little bit

Helps https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3544

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3588>
2024-02-16 10:24:24 +00:00
Bilal Elmoussaoui
72c2d8913e clutter: Drop static colors
There is literally zero reasons nowadays to still provide the tango color
palette as part of the Clutter API. End users of Mutter can define the
colors on their side if they want to.

The change simplifies https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3544

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3588>
2024-02-16 10:24:24 +00:00
Bilal Elmoussaoui
41cc85c857 window: Move shape_region to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3584>
2024-02-15 13:40:07 +00:00
Bilal Elmoussaoui
5e8e7df5bd window: Move input_region to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3584>
2024-02-15 13:40:07 +00:00
Bilal Elmoussaoui
606197de46 window: Move opaque_region to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3584>
2024-02-15 13:40:07 +00:00
Bilal Elmoussaoui
bf5f597141 window: Remove unused fields
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3584>
2024-02-15 13:40:07 +00:00
Bilal Elmoussaoui
09fc3e966a window: Move wm_client_machine to WindowX11
Also removes the public getter as nothing uses it and it no longer
make sense to expose X11-ism as API

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3584>
2024-02-15 13:40:07 +00:00
Bilal Elmoussaoui
692414c078 window: Move sm_client_id to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3584>
2024-02-15 13:40:07 +00:00
Bilal Elmoussaoui
72326d8ca5 window: Move grab_on_frame to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3584>
2024-02-15 13:40:07 +00:00
Bilal Elmoussaoui
de2a24b313 window: Move keys_grabbed to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3584>
2024-02-15 13:40:07 +00:00
msizanoen
b6802e1f00 wayland-surface: Fix get_absolute_coordinates() for active transition cases
Currently, we blindly apply the transformation matrices of all parent
actors when calculating the absolute coordinates. This means if this
function is called while the window actor containing the surface is in
the middle of a transition (e.g. window open animation), it may return
incorrect values. As this function is used for calculating pointer
confinement bounds for a specific surface, this will result in incorrect
bounds value being used if pointer constraints are applied by the
application at the same time the window is created and the mouse is
inside the surface's bounds when it's created.

Fix this by only applying transformation matrices up to the window actor
of the surface and then calculating the absolute coordinates by adding
the position of the window actor.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3585>
2024-02-15 13:20:33 +00:00
Sebastian Wick
8677e36c4c edid: Change HDR Static Metadata luminances to be float
They are float in libdisplay-info and our own EDID parsing also returns
a float but when then converted both to an integer. Especially the min
luminance can be <1.

We also don't need a variable for indicating presence of a CTA Static
Metadata block. The values are all zero if it is absent.

Found by Dor Askayo.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3574>
2024-02-14 21:46:26 +00:00
Bilal Elmoussaoui
32082f26ce keybindings: Simplify initializing builtin keybindings
Reduces code duplication

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3583>
2024-02-14 19:10:21 +00:00
Bilal Elmoussaoui
ec3d658968 keybindings: Drop unneeded function declaration
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3583>
2024-02-14 19:10:21 +00:00
Bilal Elmoussaoui
bd1ca76168 keybindings: Move grab/freeze functions per backend
By making those functions virtual functions of MetaBackend
and have the BackendNative implementation no op

Helps https://gitlab.gnome.org/GNOME/mutter/-/issues/2272

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3583>
2024-02-14 19:10:21 +00:00
Bilal Elmoussaoui
e31c47877a frame: Inline get_mask where it is used
The function was used only once so just move it content where it is
called. It allows us to drop more cairo paths from the API surface even
if it is not part of a public api

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3581>
2024-02-14 11:20:30 +00:00
Robert Mader
8cfbdb4313 wayland/surface: Add fallback for get_highest_output_scale
If we don't have a monitor for a surface - e.g. because the surface is
not mapped yet - return the highest scale of all outputs. This makes us
send a preferred scale before a client draws its first frame. The highest
scale is always correct in single monitor cases and arguably a good
option otherwise as scaling down usually looks better than scaling up.

Note that this is currently only used by the fractional scale protocol,
but will also be used for the core `send_preferred_scale()` once we
implement it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3217>
2024-02-13 12:42:13 +00:00
Robert Mader
6034100160 wayland/surface: Move a function
So it's closer to where it's used.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3217>
2024-02-13 12:42:13 +00:00
Carlos Garnacho
feec896d85 core: Simplify meta_display_handle_event()
With all early "goto out" paths bypassing wayland, we can pretty
much avoid the goto and use early returns in this function. This
will hopefully improve readability.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:27 +01:00
Carlos Garnacho
663f9d4495 wayland: Return boolean value handling pointer events
We've so far returned FALSE (i.e. PROPAGATE) here, somehow
oblivious of the fact that the core event handler would stop
all non-gesture events directed to windows.

Incorporate this knowledge there, in order to be able to
streamline this piece of event handling in core/ code.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:27 +01:00
Carlos Garnacho
c496b17b3d core: Move display->current_time out of meta_display_handle_event()
While this updates the display current time a bit earlier, it allows
for early returns in the big bad function.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
93a9e7f3f4 core: Move code ignoring events on windows with modals to Wayland
This is Wayland specific code, handle it directly in MetaWaylandPointer.
This also fixes issues with the crossing event itself managing to reach
the window occluded by modals.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
f46205417f compositor: Drop grab_begin/end vfuncs
These do no longer anything on any implementation, and may be
removed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
3c5bbedb7c compositor: Move code to sync pointer position to backends/x11
Since the backend also knows when did we start/stop being grabbed,
we can shuffle this backend-y code to the backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
afed7fde03 wayland: Update DnD surface scale according to correct device
Pass the device/sequence to the DnD surface role, so it can to
coordinate tracking for scale updates.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
e7f436bc39 compositor: Refactor MetaDnD wayland event handling
Hook MetaDnD event delivery in the case of Wayland DnD ops
directly in the Wayland code, instead of indirectly in core/
code.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
d48129f5ee wayland: Fix pointer cursor during Wayland grabs
With Wayland popups and drag-and-drop using grabs, we
should let window cursors prevail when there is one
in effect.

Also, resort always to the actor as known by the
stage. This fixes the cursor lookup right after crossing
events induced by grabs, e.g. right clicking on the
gtk4-demo textview without motion would keep the I-beam
cursor, now results on the right actor/cursor for the
menu being picked.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
2bcf6607d3 compositor: Do not sync input focus
The wayland bits do already take care of logically unsetting
their focus in the presence of extraneous grabs, there is no
need to trigger this from the compositor.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
2a584a8f01 wayland: Make use of Wayland event grabbing mechanism
Enable grabbing input for popups, and drag-and-drop. Since the very
switch to using ClutterGrab underneath Wayland grabs will challenge
assumptions in existing code, these had to change in one go. A notable
one is that meta_display_windows_are_interactable() is not 100% true
anymore for xdg_popups, at least not the same.

Another change happening in lockstep is MetaDnD no longer having
to funnel events to Wayland, since the grab triggered by Wayland DnD
is now a cause of "compositor grabs", and will naturally receive events
as long as it hold. while "modal".

A number of ad-hoc checks for grabbing state has also been dropped
from src/wayland/ internals, since again Wayland grabs are a reason
for Clutter grabs, plus the mechanism itself will already take care
of focus loss and restoration.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
67773ab88d wayland: Add argument to grab when attaching MetaWaylandEventInterface
Add the mechanism to integrate MetaWaylandEventInterface with grabs,
callers may now specify whether a grab is required, in which case
one is created, shared by all the event interface stack.

ClutterStage grab state is also tracked, so the MetaWaylandEventInterface
in charge will focus or unfocus depending on whether input should be
handled (if ungrabbed, or grabbed by the MetaWaylandInput itself), or
not (if grabbed by something else).

At the moment nothing uses this mechanism yet, later commits will add
the first users.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
b154fddd0f clutter: Make ClutterGrab a GObject
We'll want to add notifications on it, make it a GObject
to allow that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
02bb9651e1 wayland: Unify pointer constraints event interfaces
Now that the backend handles 0-size regions naturally and MetaWaylandPointer
avoids sending wl_pointer.motion on unchanged coordinates, we can use the
default motion handler for the locked pointer constraint.

And since that is the only difference with the pointer constraint event
interface, we can unify them both into a single MetaWaylandEventInterface
handling focus for them both.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
0e56ebb51a wayland: Avoid sending wl_pointer.motion on unchanged coordinates
This might happen for a variety of reasons, like monitor edges or
pointer constraints. Handle this naturally in MetaWaylandPointer for
all these cases.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
07d24fe502 backends/native: Allow infinitely small pointer constraint regions
The small catch is that MtkRegion (and pixman regions) "optimize away"
0-size rectangles, so a 0-sized region will always be seen as having
a 0,0 origin. We don't want that, so transfer the origin separately from
the region.

While at it, make the Wayland pointer lock use one such 0-size region,
to avoid the 1x1px wiggle room that it currently has (accounting for subpixel
motion).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
c931ed0d81 wayland: Allow XDnD with other devices than the pointer
While every kind of input is seen as coming from the Virtual
Core Pointer in the X11 case, we can largely abstract away from
that fact, and lock XDnD pointer input to the most plausible
source (e.g. a device with a pressed button), instead of only
working with pointer input.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
b09374735b wayland: Cleanup MetaWaylandPointer header
Drop some functions that are no longer used outside of MetaWaylandPointer,
after interactions between components were reduced.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
ec435ea540 wayland: Drop pointer grab interface
This is now unused, with everything ported to MetaWaylandEventInterface.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
bcfb7a4a33 wayland: Drop keyboard grab interface
This is now unused and may be dropped. All usage has been
replaced by MetaWaylandEventInterface.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
5fa112c298 wayland: Port drag and drop to MetaWaylandEventInterface
This collection of event handlers is the most special of them all, as
they want to unset any pointer/touch/stylus/keyboard/pad/etc focus,
and handle events from a selected device/sequence combination through
the MetaWaylandDragDest interfaces.

The same interfaces also replace the MetaWaylandKeyboardGrabInterface
in effect that handled DnD action changes.

On the XDnD special grab side, we mainly need to let the current
client (i.e. the drag source) keep receiving input events, as they
drive the DnD operation from the X11 realm.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
5ade2060a7 wayland: Port popup grabs to MetaWaylandEventInterface
This is again a grab interface that mostly wants to meddle with focus,
logically setting a NULL surface if the surface client does not match
the popup client.

Since popups are meant to naturally work with any input device, the
code has been refactored to not involve the MetaWaylandPointer directly
in MetaWaylandPopup creation or getting the top popup surface (memory
management was shuffled), or compressing multiple grabbing xdg_popups
together (the existing grab maintains a single MetaWaylandEventHandler
for all).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
125ba92169 wayland: Port pointer constraints to using MetaWaylandEventInterface
Besides the pointer locking/constraining mechanism, these grab interfaces
were more of a focus tracking mechanism, revoking the constraints when
the conditions didn't meet.

This can be handled pretty similarly to keyboard grabs with the new
interface, with the added bonus that we can chain up to let the
parent/default handler handle the events themselves, without poking at
MetaWaylandPointer API.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
9da40aa9fd wayland: Port xwayland key grabs to MetaWaylandEventInterface
This event interface simply enforces key focus to the grab window,
but stands out of the way for every other kind of input.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
80ed79a0d3 wayland: Add default event interface handling seat events
This is implemented at the MetaWaylandSeat level, and it governs
focus and event delivery for all devices, falling through each
of the MetaWaylandPointer/MetaWaylandKeyboard/etc components.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 12:36:26 +01:00
Carlos Garnacho
a2c11f0e87 wayland: Introduce MetaWaylandInput/MetaWaylandEventInterface
MetaWaylandInput is an object that will become in charge of handling
input events on their way to the Wayland socket. It keeps a stack
of event handlers, and propagates events and changes across them in
order to have them emit Wayland events, or change focus.

Each of these event handlers has a MetaWaylandEventInterface, this
is a vtable meant to replace MetaWaylandPointerGrabInterface and
MetaWaylandKeyboardGrabInterface in an unified manner, with the
following methods:

- get_focus_surface: to return the focus surface for a device/sequence.
  Since several handlers will want to delegate logic on previous
  handlers, it is optional to chain up with
  meta_wayland_event_handler_chain_up_get_focus_surface().
- focus: To trigger a focus change for a device/sequence, since
  event handlers are daisy chained by default, it is mandatory to
  chain up with meta_wayland_event_handler_chain_up_focus(), either
  with the given surface, or passing NULL to let later handlers
  unset their state.
- press/motion/release: Unified handlers for pointer/touch/stylus
  input, they chain up like event handlers do.
- key: Key event handler, propagates like event handlers do.
- other: Fallthrough for other events (pad, scroll, ...), propagates
  like event handlers do.

Since there is a variety of expected behaviors, and the possibility
of stacking for some of the existing Wayland "grabs", this provides
the mechanism for that to happen.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 01:01:48 +01:00
Carlos Garnacho
77ec0d1e41 wayland: Add API to change a tool focus surface
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 01:01:48 +01:00
Carlos Garnacho
9c2514b75c wayland: Add MetaWaylandPointer method to focus surface
This method ATM hooks up with MetaWaylandPointer's grabbing
mechanism, triggering a focus on the existing grab interface.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 01:01:48 +01:00
Carlos Garnacho
a98f1b2764 wayland: Add getter for the implicitly grabbed surface of a touch sequence
This will be used to implement the default MetaWaylandEventInterface at
MetaWaylandSeat.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 01:01:48 +01:00
Carlos Garnacho
20f7a60e11 wayland: Add getter for the current surface of a tablet device
That would be the surface under the tool that is being currently used
on the device. This will be used by MetaWaylandSeat to implement the
default MetaWaylandEventInterface.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 01:01:48 +01:00
Carlos Garnacho
fe71588a2d wayland: Add getter for MetaWaylandPointer current surface
This is the surface currently under the pointer, and will be used
by MetaWaylandSeat to implement the default MetaWaylandEventInterface.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 01:01:48 +01:00
Carlos Garnacho
09101e36f8 wayland: Handle pointer focus inhibition at the Clutter level
The MetaWaylandPointer used to put this together through
MetaCursorTracker cursor visibility, and ClutterSeat-level
inhibition API, applying the pointer focus changes due to
visibility logically to Wayland clients.

In order to make this work over all Clutter widgetry
instead of just Wayland clients, make the ClutterSeat-level
inhibition API control this feature at the ClutterStage picking
level, and leave/enter the seat pointer as appropriate.

By default, the seat pointer has (un)focus inhibited. The
MetaCursorTracker has been made another player in unfocus
inhibition, simply asking for the pointer to get its focus
while the cursor is visible.

This in practice means that picking code may return a NULL
actor, some asserts and preconditions had to be changed to
handle this, plus some test code slightly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 01:01:48 +01:00
Carlos Garnacho
7a2411ce50 wayland: Refactor grab checks for tablets
Do not jump at MetaWaylandSeat across the MetaWaylandTabletSeat to
poke at the tablet tools, and chain up the checks through a
MetaWaylandTabletSeat method instead.

While at it, use g_autoptr to manage the tool list, and fix a leak.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 01:01:48 +01:00
Carlos Garnacho
a37fd34bbb wayland: Make MetaWaylandSeat in charge of its own tablet seat
The relation between seats and tablet seats is always 1:1, Make
the MetaWaylandSeat hold its own MetaWaylandTabletSeat, and
manipulate it directly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
2024-02-13 01:01:48 +01:00
columbarius
692a4cec09 screen-cast-stream-src: Cleanup includes and defines
Removes unused includes and fix indentation of macros to make CI happy
:).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2557>
2024-02-12 21:46:14 +01:00
columbarius
9d328001d1 screen-cast-stream-src: Renegotiate when DMABUF allocation fails
After negotiation of DMABUF transport mutter will silently allocate SHM
buffers if the allocation in the add_buffer callback fails. It's cleaner
to renegotiate the supported formats without announcing DMABUF
capabilities in this case.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2557>
2024-02-12 21:45:27 +01:00
columbarius
1462eb69a8 screen-cast-stream-src: Move FormatParam building code into function
To fixate the format or renegotiate after a DMABUF allocation failed we
need to rebuild the EnumFormat params.

The function meta_screen_cast_query_modifiers will return false if no
modifiers are supported, thouse we can drop the check and remove the
macro guard.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2557>
2024-02-12 21:45:27 +01:00
columbarius
265a17e01c screen-cast: Implement query_modifiers
This function contains a stub, which returns support for implicit
modifiers, if modifiers are supported preserving the current
capabilities. The stub has to be replaced with a query to the cogl
renderer to support explicit modifiers.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2557>
2024-02-12 21:45:27 +01:00
Robert Mader
f26939255e compositor-view/native: Remove leftover check
This check was originally added because `window` was actually used.
While technically correct, there's no reason to keep it around.

Fixes: 4736f873f2 ("compositor/native: Add support for direct scanout per view")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3177>
2024-02-10 17:41:12 +00:00
Robert Mader
bd6196f4ca wayland: Implement direct scanout for cropped and scaled surfaces
Until now we only supported direct scanout to the primary plane if the
buffer size perfectly matched the display size.
Since display controllers usually support scaling and cropping buffers
highly efficiently, try to let them do the job. This is usually helpful
if wp_viewporter is used by the client or Mutter uses fractional
scaling.

This has several advantages:
 - Games (e.g. SDL2 based ones) can almost always hit direct scanout
   paths in fullscreen mode. Notably when fractional scaling is used or
   the game renders in a non-native resolution (or both).
 - Video players using YUV buffer formats and wp_viewporter can easily
   hit direct scanout paths, making displaying video very power
   efficient as the 3D engine is not used at all.

Note that this still only uses the primary plane, no overlay or underlay
planes, making this change comparatively low risk.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3177>
2024-02-10 17:41:12 +00:00
Robert Mader
ed50cbbfe4 window-actor/wayland: Update scanout candidate check
In a following commit we will start supporting scaled and croped
surfaces, thus, in preparation, update the logic to three common cases:
1. only one surface, fullscreen (most apps)
2. a content surface and a black background surface which the client
   does not want to unmap, fullscreen
3. top-level subsurface covers the whole window and is opaque (Firefox)

The remaining currently supported cases should be fairly uncommen and
and harder to compute.

Note that we already check that the window cover the stage view in
MetaCompositorView.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3177>
2024-02-10 17:41:12 +00:00
Robert Mader
50f8f1e8b3 wayland/single-pixel: Add API to check if buffer is opaque black
Which is the typical background color we also use for fullscreen
padding. This will allow us to apply optimizations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3177>
2024-02-10 17:41:12 +00:00
Robert Mader
adc776d0d7 crtc/kms: Pass on src and dst rects to primary plane assignments
This allows us to pass on the related data from CoglScanouts.

If dst_rect does not match the mode, we assume that not covered areas
are opaque black - usually black bars around a centered surface.

While such driver behaviour does not appear to be documented (well) yet,
it seems to be followed by all known existing drivers and is used in a
similar way in ChromeOS.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3177>
2024-02-10 17:41:12 +00:00
Robert Mader
26ce5cd6be kms/update: Add meta_fixed_16_from_double helper
It will be used in the next commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3177>
2024-02-10 17:41:12 +00:00
Robert Mader
d5fe58f355 kms/update: Use bitshifts for fixed_16 helpers
For easier understanding.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3177>
2024-02-10 17:41:12 +00:00
Robert Mader
912cd80f10 cogl/scanout: Add API for source/destination rectangles
These will get passed on to KMS later.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3177>
2024-02-10 17:41:12 +00:00
Robert Mader
52c4b85161 cogl: Turn CoglScanout into an object
We need an object to hold additional scanout related information, such
as scaling and positioning data. Turn CoglScanout into such an object,
moving the interface into CoglScanoutBuffer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3177>
2024-02-10 17:41:12 +00:00
Bilal Elmoussaoui
f72dbc8046 barrier: Drop deprecated display property
It was deprecated 23 months ago in 0debb24e12

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3573>
2024-02-09 18:03:09 +01:00
Bilal Elmoussaoui
fa59796afd meta: Drop deprecated methods
Both functions were deprecated 20months ago, so should be safe
to remove now

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3573>
2024-02-09 18:03:09 +01:00
Bilal Elmoussaoui
cc1957a4ba clutter/flow-layout: Use Orientation enum
Instead of having a custom FlowOrientation one

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3573>
2024-02-09 18:03:09 +01:00
Bilal Elmoussaoui
9bf55cd054 cleanup: Drop unused MetaVirtualModifier
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3573>
2024-02-09 18:03:09 +01:00
Bilal Elmoussaoui
cd245bce0c core/stack: Check client type before getting group
Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/3283

Fixes: 43351b483 ("window: Move group to WindowX11")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3572>
2024-02-08 22:05:39 +01:00
Bilal Elmoussaoui
5d4cfb607c core/stack-tracker: Guard X11 usages
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3555>
2024-02-08 16:55:06 +01:00
Bilal Elmoussaoui
e1e6534eb2 group: Move various functions to MetaWindowX11
Except meta_window_x11_get_group, which is still used by GNOME Shell
and we can't make it a private API for now.

Will need further investigation and could be done as a future
step

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3555>
2024-02-08 16:55:06 +01:00
Bilal Elmoussaoui
f0c22cb3bc core: Guard MetaGroup usage
For now, we just guard part of the group header as it is
consumed by gnome-shell. Ideally, we would drop that use case and make
the whole header private.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3555>
2024-02-08 16:54:50 +01:00
Bilal Elmoussaoui
43351b483f window: Move group to WindowX11
Which means meta_window_get_group now requires a x11 client type,
so ensure we don't call it on a wayland client

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3555>
2024-02-08 16:24:58 +01:00
Bilal Elmoussaoui
e17d20191e display: Refactor IN_TAB_CHAIN macro
The macro used to call into a bunch of other macros so let us turn it
into a single function.
This would simplify things for the next commit that puts the MetaGroup
usage behind a X11 ifdef

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3555>
2024-02-08 16:24:58 +01:00
Bilal Elmoussaoui
467120d5aa cleanup: Remove unused callbacks
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3570>
2024-02-08 13:32:51 +00:00
Daniel van Vugt
1c58c8cb92 onscreen/native: Notify frame complete on failure to lock front buffer
If such a failure is followed by a successful frame then the Cogl frame
queue would have size 2, leading to an assertion failure in
`meta_onscreen_native_notify_frame_complete`:

```
g_assert (!cogl_onscreen_peek_head_frame_info (onscreen));
```

Notifying on the failure however keeps the Cogl frame queue limited to
a size of 1 and we recover gracefully with only a missed frame and a
warning message.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3278
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3565>
2024-02-08 12:44:55 +00:00
Carlos Garnacho
0eb9c43908 wayland: Trigger seat focus change on popup changes
Popups were missing the "input focus" unification in the pointer
seat, triggering MetaWaylandKeyboard focus changes underneath. On
one hand this missed moving all associated focus with it, on the
other hand this made keyboard and global input focus get out of
sync, and bring funky behavior like keyboard focus loss after
dismissing popups.

Fixes: 7b232d9f65 ("wayland: Keep track of the "input focus" on MetaWaylandSeat")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3256
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3568>
2024-02-08 11:32:31 +00:00
Carlos Garnacho
bf89ada2c1 backends: Disambiguate output mapped to tablet with connector name
In some circumstances, we may end up with outputs with the same
vendor/product/serial, in which case we have a hard time finding the
right one to map tablets to, since configuration only has these 3
pieces of data.

Add the handling of a 4th argument containing the output name
based on the connector (e.g. HDMI-1), so that it can be used to
disambiguate the output if necessary.

This only kicks in if there actually are multiple outputs with the
same EDID data. A goal of the configuration as it was stored was to
remain useful if the user changed how the device is physically
connected to the computer, this remains true for the vast majority
of users having a single thing of each.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3556>
2024-02-06 10:03:48 +00:00
Peter Hutterer
ff38cf366d backends/x11: Store eraser and stylus tools separately
Our hashtable stores tools by the serial but our stylus tool and eraser
tool share the same serial - they only differ by the tool type.

This results in only one tool being created and this tool re-used for
the other type tool. Fun side-effects of this are that the stylus ends
up using the eraser pressure curve (or vice versa).

Hack around this by bit-flipping the serial for the eraser to
make it distinct - this is the only place we need to wrorry .

Closes #1884

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3542>
2024-02-05 12:33:43 +00:00
Olivier Fourdan
b8914da0c8 input-capture: Fix barrier validation without a monitor at (0.0)
For barrier validation, check_barrier() would start from the
(presumably) left-most monitor and walk the neighbor monitors to the
right.

This is assuming that there is always a monitor at (0.0), which is not
necessarily the case. If the first monitor on the left is not aligned at
the top, there is no logical monitor at (0.0) causing a NULL pointer
derefence.

Instead of starting from the monitor at (0,0), start from the primary
logical monitor, as there is necessarily one.

Fixes: 85885c6 - Check barriers don't extend into nonexisting monitors
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3272
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3562>
2024-02-05 10:45:26 +01:00
Robert Mader
a422ae022b wayland/buffer: Move scanout lifetime handling
There doesn't seem to be a good reason to keep this code in
`MetaWaylandSurface`. Moving it to `MetaWaylandBuffer` cleans things
up and will allow us to tread buffers differently depending on their
type.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3559>
2024-02-02 17:52:30 +01:00
Robert Mader
03a98343d2 wayland/dma-buf: Take MetaWaylandBuffer in try_acquire_scanout
And do some minor variable order cleanup while on it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3559>
2024-02-02 17:40:37 +01:00
Peter Hutterer
e928128743 core: Handle Alt in the MetaPadActionMapper
In the parser we set MOD1 if we encounter <Alt>, so let's send the
respective key event here.

Closes: gnome-control-center#2593
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3522>
2024-02-01 10:22:22 +00:00
Bilal Elmoussaoui
3774554028 core/window: Guard some x11 calls
Also drops an unused x11 header

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3540>
2024-01-31 12:25:39 +00:00
Bilal Elmoussaoui
e68a8a0a17 core/launch-context: Guard X11 calls
Also make use of display where possible to avoid a warning
about an unused display variable if one tries to build without x11

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3540>
2024-01-31 12:25:39 +00:00
Bilal Elmoussaoui
d8812c0d2f compositor/drag: Guard X11 call
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3540>
2024-01-31 12:25:39 +00:00
Bilal Elmoussaoui
67e21e0881 compositor/actor: Guard X11 actor usage
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3540>
2024-01-31 12:25:39 +00:00
Bilal Elmoussaoui
b6f38b21b7 backends/barrier: Guard X11 usage
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3540>
2024-01-31 12:25:39 +00:00
Bilal Elmoussaoui
8922ada681 core/context: Guard X11 calls
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3540>
2024-01-31 12:25:39 +00:00
Bilal Elmoussaoui
c388abe1e3 core/context: Make notify_ready vfunc optional
As it is used only in a X11 build for session management
See next commit

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3540>
2024-01-31 12:25:39 +00:00
Sebastian Wick
947f20b1a7 renderer-native: Ensure all planes support EGL config format
For secondary GPU rendering contexts we currently might choose an EGL
config with a format which is not supported on all primary planes. The
renderer is created when a GPU is detected and lighting up outputs and
thus assigning CRTC and primary planes can happen at any point after
that. This means we have to make sure that all possible plane
assignments will work with the rendering context when we create it.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3235
Fixes: cc7bca073 ("crtc/kms: Dynamically assign primary and cursor planes")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3512>
2024-01-31 00:58:29 +00:00
Sebastian Wick
fbf68bf88c crtc-kms: Get rid of meta_crtc_kms_supports_format
Instead get the assigned primary plane and use
meta_kms_plane_is_format_supported.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3512>
2024-01-31 00:58:29 +00:00
Sebastian Wick
60fd80b616 crtc-kms: Get rid of meta_crtc_kms_get_modifiers
Instead get the assigned primary plane and use
meta_kms_plane_get_modifiers_for_format.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3512>
2024-01-31 00:58:29 +00:00
Sebastian Wick
2fda8ae6d9 crtc-kms: Get rid of meta_crtc_kms_copy_drm_format_list
Instead get the assigned primary plane and use
meta_kms_plane_copy_drm_format_list.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3512>
2024-01-31 00:58:29 +00:00
Sebastian Wick
ee60e33d95 crtc-kms: Get rid of unusedmeta_crtc_kms_set_is_underscanning
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3512>
2024-01-31 00:58:29 +00:00
Sebastian Wick
84070b4a3f crtc-kms: Get rid of unused is_transform_handled
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3512>
2024-01-31 00:58:29 +00:00
Sebastian Wick
d6dc403fa8 backends/native: Move KmsUpdate plane assignment to OnscreenNative
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3512>
2024-01-31 00:58:29 +00:00
Sebastian Wick
23b30267b5 monitor-unit-tests: Add basic tests for RGB range
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3535>
2024-01-30 16:24:52 +00:00
Sebastian Wick
926f7ea26d backends: Get the RGB range from a monitor config to the output
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3535>
2024-01-30 16:24:52 +00:00
Sebastian Wick
3f866d22c9 monitor-config-store: Store and parse rgbrange monitor property
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3535>
2024-01-30 16:24:52 +00:00
Sebastian Wick
5ca2e06b2c monitor-config-store: Explicitly initialize MonitorConfig
To the defaults. This will become useful in the next commit where we
want a default value that's not 0.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3535>
2024-01-30 16:24:52 +00:00
Sebastian Wick
7b1e89b046 monitor: Add a getter for the RGB range
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3535>
2024-01-30 16:24:52 +00:00
Sebastian Wick
d945626318 onscreen/native: Set the RGB range when mode setting
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3535>
2024-01-30 16:24:52 +00:00
Sebastian Wick
aa7cd84f7c output: Introduce the RGB range property
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3535>
2024-01-30 16:24:52 +00:00
Sebastian Wick
665c21e65b output: Explicitly initialize output properties
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3535>
2024-01-30 16:24:52 +00:00
Sebastian Wick
c4399bd94d kms/connector: Add support for the Broadcast RGB property
It can be used to force a specific RGB range. Some monitors don't follow
the specification and expect a signal different from what we send. This
property allows to force a mode which hopefully then works correctly for
the sink.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3535>
2024-01-30 16:24:52 +00:00
Sebastian Wick
d45104c14a backends/native: Build up connector updates in onscreen-native
instead of building them in OutputKms. The KMS objects are really not
the place for this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3535>
2024-01-30 16:24:52 +00:00
Sebastian Wick
af4de2a681 output/native: Remove unused function declarations
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3535>
2024-01-30 16:24:52 +00:00
Carlos Garnacho
3528b54378 backends/native: Fix clutter button number assignment to pointer evcodes
Commit 947c636275 meant to swap BTN_STYLUS* buttons, not BTN_MIDDLE/RIGHT
as used by pointing devices. This was also missed during review.

Fixes: 947c636275 ("backends/native: Swap BTN_STYLUS and BTN_STYLUS2")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3550>
2024-01-27 14:11:42 +01:00
Peter Hutterer
a26d08d3bc core: Detect pad ring wraparound values
A ring will naturally go from 355 degrees to 5 degrees (or vice versa),
giving us the illusion of a direction change. Avoid this by assuming
that any change larger than 180 degrees is actually the equivalent
smaller change in the other direction.

Closes #1885

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3545>
2024-01-27 10:44:51 +00:00
Peter Hutterer
947c636275 backends/native: Swap BTN_STYLUS and BTN_STYLUS2
BTN_STYLUS is the lower one and traditionally (read: in X) maps to
middle button (2), BTN_STYLUS2 is the upper one and traditionally maps
to right button (3).

This is also what GTK does and our desktop actions too map MIDDLE to
BTN_STYLUS and RIGHT to BTN_STYLUS2.

See also gtk!6168

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3541>
2024-01-27 10:32:40 +00:00
Peter Hutterer
d92c89ca23 backends/native: Use the define for BTN_STYLUS3
We #define it if at the top of the file if it's not available.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3541>
2024-01-27 10:32:40 +00:00
Carlos Garnacho
381048cf90 wayland: Restore IM state flushing before handling key events
The code that maybe flushed IM state before processing a key event
became ineffective at commit 7716b62fa2, since the handle_event()
method on MetaWaylandTextInput won't handle key events, only IM
events and touch/button press events causing IM state to be
committed. Basically, the events that directly change the IM state.

Move this ineffective code to the the filter_event() method handling
the key presses in order to let the IM maybe filter them, and handle
them so that any key event that is let through (both key events
previously injected by the IM, and key events that the IM chooses to
ignore) will ensure that the pending IM state is flushed before the
key event is handled and emitted to the client.

This brings back lost guarantees of orderly event emission when IMs
alternate key events and IM actions.

Fixes: 7716b62fa2 ("clutter: Separate ClutterInputFocus event processing and filtering")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3090
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3536>
2024-01-27 10:18:40 +00:00
Bilal Elmoussaoui
92ef543a44 window: Clarify rectangle type
It is no longer a cairo rectangle

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3530>
2024-01-27 10:03:15 +00:00
Bilal Elmoussaoui
700ef19e8b tests: Remove unnused cairo import
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3530>
2024-01-27 10:03:15 +00:00
Sebastian Keller
f99c6badb9 backends: Update cursor names to match updated metaphors
adwaita-icon-theme updated its cursor metaphors and changed all DnD
cursors to use arrows instead of hands, except for the grab related
ones. Mutter was using "grabbing" as default DnD cursor, which now
does not match the other DnD cursors ("copy" and "no-drop") anymore.
Change this to the "default" cursor.

Additionally, because the "no-drop" cursor now puts a stronger emphasis
on the crossed out symbol also prefer "default" for
META_CURSOR_DND_IN_DRAG and only use "no-drop" for things that
explicitly don't accept a drop.

Related: https://gitlab.gnome.org/GNOME/adwaita-icon-theme/-/merge_requests/63
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3532>
2024-01-26 23:44:02 +00:00
Sebastian Wick
af0ca0cdc2 kms/cursor-manager: Create CrtcStateImpls for all active CRTCs
even if they don't have a cursor plane. This way we can just use the
object. Updating the cursor plane then just looks at the cursor_plane
field to skips updates when there is none.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3254
Fixes: cc7bca073 ("crtc/kms: Dynamically assign primary and cursor planes")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3539>
2024-01-26 23:07:39 +00:00
Dor Askayo
0eaf4b4f4c Revert "frame/native: Remember whether the frame carried a kms update"
This reverts commit 020d128d15.

This API is no longer used and can be removed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3549>
2024-01-26 22:23:05 +00:00
Dor Askayo
b8deb4caa0 wayland: Emit frame callbacks when the frame is pending presentation
When Wayland clients send commits without a buffer attached ("empty"
commits), they may lead to stage updates that do not result in any
frame being submitted for presentation ("empty" updates).

Due to how frame scheduling is handled, there can be many such
"empty" updates in a single refresh cycle. If frame callbacks were
emitted after each of these "empty" updates, and if the client
sending "empty" commits was using frame callbacks to throttle the
same logic that results in these "empty" commits being sent, it would
result in a feedback loop between Mutter and the client where the
client would send "empty" commits and Mutter would reply almost
immediately with a frame callback causing the client to send "empty"
commits continuously.

As such, when an "empty" update is detected, frame callbacks are
scheduled to be emitted only once in every refresh cycle, avoiding the
feedback loop.

When a "non-empty" update is detected, frame callbacks are instead
emitted immediately to allow clients to draw their next frame as soon
as possible. It is safe to emit frame callbacks in this case because
the frame for the current refresh cycle is already "finalized" and
that any commit sent by the client at that point would only be handled
in a future refresh cycle.

To implement this, the previous logic had used
meta_frame_native_had_kms_update() to detect "non-empty" updates,
assuming that those would always result in a KMS presentation with the
native backend.

However, this approach misses the fact that virtual monitors do not
use KMS, and as such do not result in KMS presentation even for
"non-empty" updates. As a result, frame callbacks would not be emitted
immediately, resulting in unintended throttling of client rendering.

Instead, assume that it is safe to emit frame callbacks immediately
whenever an update results in the frame clock waiting to be notified
of presentation, since this is also when commits sent by clients are
scheduled to be handled in a future refresh cycle.

This issue was mostly hidden because frame callbacks would be sent
immediately when the target presentation time for the frame had
changed compared to the previous frame. However, this behavior was
removed in 26d8b9c69 ("wayland: Remove unnecessary dispatch of frame
callback source"), exposing the issue.

Fixes: a7a7933e0 ("wayland: Emit frame events in GSource after "empty" updates")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3263
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3549>
2024-01-26 22:22:52 +00:00
Dor Askayo
3e4a330ae7 clutter/frame-clock,wayland: Calculate frame deadline during scheduling
Calculate the frame deadline in ClutterFrameClock's
calculate_next_update_time_us() rather than in MetaWaylandCompositor's
on_after_update().

The specifics of the deadline calculation for a given frame should be
implementation detail of the frame clock and and remain internal to
allow extensibility.

This extensibility is specifically useful for scenarios where a
different deadline calculation is needed due to alternative frame
scheduling logic, such as for VRR.

No change in behavior.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3521>
2024-01-22 15:39:48 +00:00
Dor Askayo
d5c2f20d55 wayland: Flatten logic in on_after_update()
Slightly improves the cognitive complexity of the function.

No change in behavior.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3521>
2024-01-22 15:39:48 +00:00
Dor Askayo
26d8b9c69b wayland: Remove unnecessary dispatch of frame callback source
To avoid communicating lower frame rate to clients through frame
callbacks, it is important to avoid delaying the source dispatch when
a dispatch is already scheduled.

To that end, the previous logic would emit pending frame callbacks
immediately in case a source dispatch was still scheduled for the
previous refresh cycle and then (potentially) schedule another source
dispatch for the current refresh cycle.

However, emitting pending frame callbacks immediately would send
frame events for every pending frame callback, including for the
current "empty" update. Scheduling another source dispatch for the
current cycle was then unnecessary and potentially undesirable
because there may not even be another "empty" update during the cycle.

Instead, let the already-scheduled source dispatch handle emitting any
pending frame callbacks, and do not schedule an additional source
dispatch for the current cycle as it may not be needed.

This approach is useful because it removes an implicit assumption
that the refresh rate is fixed and that target presentation time
remains constant within a refresh cycle. This assumption does not
apply for VRR.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3521>
2024-01-22 15:39:48 +00:00
Dor Askayo
8c88dbfbe8 wayland: Rename source_ready_time_us to frame_deadline_us
The value of this variable represents the last point in time in
which an update would be allowed to scheduled for the given frame.

Rename it for clarity and in preparation for the next commits.

No change in behavior.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3521>
2024-01-22 15:39:48 +00:00
Dor Askayo
83713a38bb wayland: Remove unreachable condition
The value returned from clutter_frame_get_target_presentation_time()
is always same as the value returned from
clutter_frame_get_min_render_time_allowed() when they are called
consecutively because both functions effectively return the value of
frame->has_target_presentation_time. This is with the assumption
that this variable is only ever modified by the same thread that
also executes on_after_update().

As such, a case where the former returns FALSE after the latter
returned TRUE is not possible, which means the line that sets
"target_presentation_time_us = 0;" is effectively unreachable.

Acknowledging this fact allows the call to
clutter_frame_get_target_presentation_time() to be moved outside the
"else" case and into the "if" condition itself. This is done in
preparation for the next commits.

No change in behavior.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3521>
2024-01-22 15:39:48 +00:00
Bilal Elmoussaoui
a2397e6b80 clutter: Prefer using ClutterTextDirection
In various public APIs, Clutter used to return a PangoDirection
while we have a text direction enum defined in Clutter.

This allows us to drop pango dependency from meta making it specific
to cogl-pango & clutter

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3531>
2024-01-22 15:02:33 +00:00
Robert Mader
c19eef3f5e wayland/dmabuf: Bump protocol version to 5
It adds the following clarification:
```
Starting from version 5, the invalid_format protocol error is sent if
all planes don't use the same modifier.
```

We already send an error, just the wrong one.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3450>
2024-01-22 14:20:30 +00:00
Robert Mader
8b1015a5c7 wayland: Switch to stable linux-dmabuf protocol
It is the first protocol to keep the `-vN-` despite being declared
stable.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3450>
2024-01-22 14:20:30 +00:00
Dor Askayo
5e13c1dca6 kms/impl-device: Inhibit the deadline timer on permission errors
Set the deadline timer state as "inhibited" in case a permission error
is returned while attempting to arm the deadline timer. This makes each
device enable its deadline timer again after a VT switch.

Also print a note in this case instead of a warning as such errors are
expected during a VT switch and should not raise concerns.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3259
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3534>
2024-01-19 18:46:41 +00:00
Dor Askayo
79063604ad kms: Resume all devices when KMS is resumed
KMS is resumed when the current VT becomes active.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3534>
2024-01-19 18:46:41 +00:00
Dor Askayo
9eb38b4107 kms/impl-device: Add function to resume all devices
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3534>
2024-01-19 18:46:41 +00:00
Dor Askayo
ada4ac49fb kms/impl-device: Add function to handle device resumption
For now, this function only enables the deadline timer in case it was
inhibited. This would result in an attempt to use the deadline timer
again after a device is resumed.

If the conditions that resulted in the timer becoming inhibited
remain, it is expected to return to this state after the next frame
and before being armed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3534>
2024-01-19 18:46:41 +00:00
Dor Askayo
98cdafdf0b kms/impl-device: Use enum for deadline timer state
The "disabled" state indicates that the deadline timer is disabled
for the lifetime of the device, while the "inhibited" state indicates
that it is disabled temporarily for the device.

This distinction is needed to handle each state differently in a
following commit. For now, only "disabled" is used.

No change in behavior.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3534>
2024-01-19 18:46:41 +00:00
Leorize
8e39398d05 backends: Allow XKB model to be configured
This allows GNOME Shell to communicate the user desired XKB model
to the compositor instead of sticking with the pc105 default.

Particularly useful for those with a custom keyboard layout/irregular
keyboards.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2760>
2024-01-18 18:51:42 +00:00
Florian Müllner
1ab4faaf18 place: Fix centering transients over parent
Transient dialogs are meant to be placed centered over their
parent. However as we don't use the DIALOG window type on
wayland, this currently only works for modal dialogs.

To fix this, also apply the policy to NORMAL windows for
wayland clients.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3533>
2024-01-18 16:07:15 +00:00
Kai-Heng Feng
8e58aa46ac gen_default_modes: Consider reduced blanking with lower pixelclock
Some panels only support fixed resolutions and fixed refresh rate with reduced blanking:
  Established Timings I & II: none
  Standard Timings: none
  Detailed Timing Descriptors:
    DTD 1:  2560x1600  120.001823 Hz   8:5    203.283 kHz    552.930000 MHz (345 mm x 215 mm)
                 Hfront   48 Hsync  32 Hback   80 Hpol P
                 Vfront    3 Vsync   6 Vback   85 Vpol N
    DTD 2:  2560x1600   48.000295 Hz   8:5     81.312 kHz    221.170000 MHz (345 mm x 215 mm)
                 Hfront   48 Hsync  32 Hback   80 Hpol P
                 Vfront    3 Vsync   6 Vback   85 Vpol N
...
    Minimum Pixel Clock: 552922 kHz
    Maximum Pixel Clock: 552922 kHz

When using mirror mode, resolutions like 2560x1440 120Hz can be too high
to meet the pixelclock limitation, so 2560x1440 90Hz is selected
instead. However, the panel only supports 120Hz so using 90Hz result to
failed mode set.

So add reduced blanking to fallback mode, so correct refresh rate can be
used.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3449>
2024-01-18 12:12:06 +08:00
Shmuel Melamud
237e505cc7 clutter: Move ClutterCanvas to gnome-shell
Since StDrawingArea in gnome-shell is the only user of ClutterCanvas,
it is possible to move ClutterCanvas completely out of Mutter to
gnome-shell. This allows to remove another Cairo dependency from
Mutter.

This patch removes ClutterCanvas code from Mutter.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3470>
2024-01-17 11:58:47 +01:00
Sebastian Wick
41a7e8e3e0 build: Make g-ir-scanner warnings fatal when -werror is set
This should help catching problems with introspection in CI.

This also pulls out some common arguments to the gnome.generate_gir
call.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3528>
2024-01-17 09:26:00 +00:00
Bilal Elmoussaoui
2dd04f7cbe compositor: Use subclassing macros for Module
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3520>
2024-01-13 17:22:26 +00:00
Bilal Elmoussaoui
b1bc03a314 native: Use subclassing macros for InputDeviceToolNative
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3520>
2024-01-13 17:22:26 +00:00
Bilal Elmoussaoui
a79834a1ff x11: Use subclassing macros for InputSettingsX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3520>
2024-01-13 17:22:26 +00:00
Bilal Elmoussaoui
b1fc022ee6 x11: Use subclassing macros for InputDeviceX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3520>
2024-01-13 17:22:26 +00:00
Bilal Elmoussaoui
5387135220 x11: Use subclassing macros for InputDeviceToolX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3520>
2024-01-13 17:22:26 +00:00
Bilal Elmoussaoui
4f96b43222 x11: Use subclassing macros for CursorRendererX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3520>
2024-01-13 17:22:26 +00:00
Bilal Elmoussaoui
d90a938c17 core: Use subclassing macros for GestureTracker
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3520>
2024-01-13 17:22:26 +00:00
Bilal Elmoussaoui
59bdc69544 native: Use subclassing macros for InputSettingsNative
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3520>
2024-01-13 17:22:26 +00:00
Dallas Strouse
c8c5560916 backends/native: Main thread rt-scheduler: experimental feature no more
To paraphrase jadahl: we have a dedicated KMS thread now, which also
has realtime scheduling enabled unconditionally. realtime scheduling
on the main thread isn't too great of an idea, considering GC can
take a hot minute.

And to quote rmader: we most likely won't be able to make the main
thread rt as long as we use GJS and thus have GC.

So let's get rid of it! It's just been breaking things anyways.

This just ignores the setting; we'll fully remove it when GNOME 46
comes around.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3296>
2024-01-13 15:10:31 +01:00
Simon McVittie
ecdd2aeb85 workspace: Don't crash on invalid argument to meta_workspace_index
Mitigates: https://gitlab.gnome.org/GNOME/mutter/-/issues/2559
Mitigates: https://bugs.debian.org/1024438
Signed-off-by: Simon McVittie <smcv@debian.org>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2774>
2024-01-12 15:24:14 +00:00
Sebastian Wick
399ffdfc88 kms/connector: Keep a ref to the KmsImplDevice instead of KmsDevice
The KmsImplDevice always exists as long as a KmsConnector exists. The
KmsDevice doesn't exist yet as long as the KmsImplDevice is not fully
initiallized. Going through the KmsImplDevice makes sure we always have
a valid reference and can release the device fd correctly when the
initialization fails.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3243
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3518>
2024-01-12 14:51:14 +00:00
Carlos Garnacho
7b232d9f65 wayland: Keep track of the "input focus" on MetaWaylandSeat
This is the unified focus (key, IM, pads, ...) for the focus window.
Just like MetaWaylandPointer and others keep track of the "current"
surface, this is the "current" surface for those (not necessarily
the focused surface, e.g. in the case of compositor grabs).

Since this unified focus will exist regardless of keyboard
capabilities (e.g. even if just for "logical" focus like IM/clipboard
that does not depend on input devices), it does not make sense
to trigger a focus sync on keyboard capability changes, the focus
is staying the same, we however need to focus the keyboard interface
to the already existing focus when the capability is enabled.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3511>
2024-01-12 14:39:17 +00:00
Carlos Garnacho
962eb9e054 wayland: Hook focus synchronization to MetaDisplay signals
Instead of letting the MetaDisplay be aware of the Wayland compositor,
and take care of updating its focus. This makes the MetaWaylandCompositor
able to track focus changes by itself, using MetaDisplay as the source
of truth.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3511>
2024-01-12 14:39:17 +00:00
Carlos Garnacho
38421b07c7 compositor: Use MetaWaylandCompositor API to drive focus synchronization
Use Wayland API directly here, and avoid using MetaDisplay API that will
go away.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3511>
2024-01-12 14:39:17 +00:00
Carlos Garnacho
a2d2e04d80 wayland: Use MetaWaylandCompositor API to drive focus synchronization
Keep this within the wayland code itself, and avoid poking MetaDisplay
API that will go away.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3511>
2024-01-12 14:39:17 +00:00
Carlos Garnacho
9383171958 wayland: Move Wayland focus synchronization code out of core
Handle focus synchronization in MetaWaylandCompositor itself. This
is so far plumbed so that MetaDisplay still drives focus synchronization
directly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3511>
2024-01-12 14:39:17 +00:00
Carlos Garnacho
17d1d3abd8 compositor: Avoid special grab begin/end handling in MetaWindowDrag
This is already performed through the ClutterStage::is-grabbed property
being tracked. There is no need to do this ad-hoc.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3511>
2024-01-12 14:39:17 +00:00
Carlos Garnacho
54e4d1df79 x11: Defer ClutterStage focus actor change until window is focused
If we happen to be changing focus to a window *while* taking focus
away from Clutter widgetry, we would unintendedly trigger reentrance
in a way that the old focused window remained in focus, by asking
to focus the default focus window in an untimely manner.

To handle this reentrancy, delay dropping the Clutter key focus
until the window focus changed, so that the focus change will look
up the default focused window in the workspace, and find the up to
date one.

Fixes: ae102ee301 ("x11: Refactor ClutterStage key focus management")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3467>
2024-01-10 20:56:24 +01:00
Bilal Elmoussaoui
94f9d88371 x11: Drop error trap helpers
They are no longer that useful as they end up calling
mtk functions nowadays

Followup of https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3230

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3483>
2024-01-10 13:58:18 +00:00
Bilal Elmoussaoui
09b7cd9f4a x11/display: Don't try to retrieve xwindow of wayland windows
Trying to get the xwindow of a wayland only window would fail when
casting to a x11 window. Which happens as
meta_x11_display_set_input_focus is called whenever the focused
window changes, whether it is a wayland or x11 one

Fixes: bc9cd123e ("window: Move xwindow to WindowX11")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3506>
2024-01-09 23:51:37 +01:00
Bilal Elmoussaoui
5ad8a79823 display: Add a helper to retrieve associated xwindow
As we moved the xwindow property from Window to WindowX11 which is
not exposed as public API. So instead of exposing WindowX11,
the API is added to MetaX11Display which is already exposed.

This is only needed by gnome-shell for it tray icons support
https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/81f18d7d/src/shell-tray-icon.c#L67

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3211>
2024-01-09 18:59:36 +00:00
Bilal Elmoussaoui
0236506cff window: Move has_pointer_x11 to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3211>
2024-01-09 18:59:36 +00:00
Bilal Elmoussaoui
19a36b8879 window: Stop storing xtransient_for field
Instead retrieve the associated Window from the xwindow property.
Avoids having a vfunc to handle the get_transient_for differences
between Wayland and x11

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3211>
2024-01-09 18:59:36 +00:00
Bilal Elmoussaoui
5e098eadce window: Move user_time_window to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3211>
2024-01-09 18:59:36 +00:00
Bilal Elmoussaoui
9e150fda42 window: Move xgroup_leader to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3211>
2024-01-09 18:59:36 +00:00
Bilal Elmoussaoui
7d6e7773bf window: Make Window.set_transient_for a vfunc
So we can move the xgroup_leader to WindowX11. See next commit

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3211>
2024-01-09 18:59:36 +00:00
Bilal Elmoussaoui
c0685fe29b window: Move xclient_leader to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3211>
2024-01-09 18:59:36 +00:00
Bilal Elmoussaoui
bc9cd123e9 window: Move xwindow to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3211>
2024-01-09 18:59:36 +00:00
Bilal Elmoussaoui
d98b0eb71e window: Move xvisual to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3211>
2024-01-09 18:59:36 +00:00
Bilal Elmoussaoui
2a75661883 region: Move RegionBuilder to Mtk
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3501>
2024-01-09 18:47:34 +00:00
Bilal Elmoussaoui
fced59b33d region: Make Region.transform private
It is only used once in MetaWaylandSurface

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3501>
2024-01-09 18:47:34 +00:00
Bilal Elmoussaoui
9953704ceb region: Move RegionIterator to Mtk
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3501>
2024-01-09 18:47:34 +00:00
Bilal Elmoussaoui
cf8eb4944a region: Make make_region_border private
It is only used by the shadow factory and doesn't make sense to
have as part of mtk

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3501>
2024-01-09 18:47:34 +00:00
Bilal Elmoussaoui
39aeb81a8b region: Move Region.apply_matrix_transform_expand to Mtk
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3501>
2024-01-09 18:47:34 +00:00
Bilal Elmoussaoui
4d53e4d156 region: Move Region.crop_and_scale to Mtk
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3501>
2024-01-09 18:47:34 +00:00
Bilal Elmoussaoui
6e7d314e75 region: Move Region.scale to Mtk
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3501>
2024-01-09 18:47:34 +00:00
Bilal Elmoussaoui
4513abd584 region: Move rectangle helper macro to Mtk
Rename it to Rectangle prefix to avoid confusion with MtkRegion

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3501>
2024-01-09 18:47:34 +00:00
Bilal Elmoussaoui
6f9e75b6f2 boxes: Move Rectangle.is_adjacent_to to Mtk
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3501>
2024-01-09 18:47:34 +00:00
Bilal Elmoussaoui
fcc8cfff11 boxes: Move Rectangle.scale_double to Mtk
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3501>
2024-01-09 18:47:34 +00:00
Bilal Elmoussaoui
59457dff81 boxes: Move Rectangle.crop_and_scale to Mtk
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3501>
2024-01-09 18:47:34 +00:00
Peter Hutterer
b5e9279ea0 backends/x11: Fetch the tablet serial prop on device add
For tablet device, the tool was created when the "Wacom Serial IDs" prop
changed values. This property does not exist on the xf86-input-libinput
driver but v1.5.0 of that driver has a different property for the serial.

The serial is constant (the driver creates one X device per serial), so
we can fetch it after device creation and set it then. For earlier
versions of the driver we assign the random serial 0xffffffaa - good
enough to have at least a tool.

This fixes the crash in #3120 - clutter_event_motion_new()
overrides event->device to the tool's device (if any). Without a tool
motion events use the Virtual Core Pointer instead and our source device
is never added to the stage's priv->pointer_devices.

When we generate an crossing event (which uses the source device) we
fall afoul of an assert in clutter_stage_update_device() that expects
our source device to be in priv->pointer_devices.

Fixes https://gitlab.gnome.org/GNOME/mutter/-/issues/3120

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3383>
2024-01-09 17:33:33 +00:00
Zander Brown
b1dd6973df workspace-manager: Accessors for layout-{columns,rows}
This will allow C code in shell to avoid going though `g_object_get`,
and in future GJS will also be able to take advantage giving a slender
yet not unwelcome boost to perf in some animations

(Semi relates to https://gitlab.gnome.org/GNOME/mutter/-/issues/3083)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3351>
2024-01-09 16:38:25 +00:00
Bilal Elmoussaoui
346e9a7f2c docs: Remove remaining SECTIONs
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3489>
2024-01-09 15:23:04 +00:00
Bilal Elmoussaoui
52c64d44fc docs: Move kms abstractions to a separate file
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3489>
2024-01-09 15:23:04 +00:00
Bilal Elmoussaoui
00b4d4c4bc docs: Update more links to gi-docgen
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3489>
2024-01-09 15:23:04 +00:00
Bilal Elmoussaoui
e7a920f94d docs: Migrate remaining content to markdown
By stopping using gtk-doc annotations

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3489>
2024-01-09 15:23:04 +00:00
Albert Esteve
1a0d00467d backends/native: Fix atomic cursor plane assign
Make atomic cursor plane assignment not depending on
cursor hotspot support.

Fixes: 4b9d1271a ("backends/native: Add PLANE_PROP_HOTSPOT_[X,Y]")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3238
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3503>
2024-01-09 13:52:37 +00:00
Bilal Elmoussaoui
39a8b153d5 backends: Drop unused private functions
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3492>
2024-01-09 13:14:35 +00:00
Bilal Elmoussaoui
57b59f95a6 x11: Drop unused private functions
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3492>
2024-01-09 13:14:35 +00:00
Bilal Elmoussaoui
74cab06b72 core: Drop unused private functions
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3492>
2024-01-09 13:14:35 +00:00
Bilal Elmoussaoui
ad49ecccf7 compositor: Drop unused private functions
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3492>
2024-01-09 13:14:35 +00:00
Zack Rusin
27f798b6d0 kms/impl-device/atomic: Implement mouse cursor hotspots
DRM's kms atomic code was updated to include an API to set the mouse
cursor hotspot. This has historically been missing in the atomic kms
which meant that the virtualized drivers which require mouse cursor
hotspot info to properly render had to be put on a deny list and
had to fallback to the legacy DRM kms code.

Implement the new hotspot API by checking whether the device supports
hotspot properties and if it does set them on the cursor plane. This
enables atomic kms on all virtualized drivers for kernels where
mouse cursor hotspots are in drm core.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3337>
2024-01-08 15:54:15 +01:00
Albert Esteve
3885d2b3f6 backends/native: Set hotspot property on updates
Add a `has_update` flag to the cursor hotspot struct
to allow selective update of the hotsport property
only when it will take an effect.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3337>
2024-01-08 15:54:01 +01:00
Albert Esteve
4b9d1271a0 backends/native: Add PLANE_PROP_HOTSPOT_[X,Y]
Add META_KMS_PLANE_PROP_HOTSPOT_[X,Y] properties
to the MetaKmsPlaneProp enumeration, and
properly initialise them.

Also, add a convenience method in meta-kms-plane
(i.e., `meta_kms_plane_supports_cursor_hotspot`)
to check whether a plane supports hotspot
property setting.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3337>
2024-01-08 15:15:25 +01:00
Daniel van Vugt
8252f71447 onscreen/native: Replace an old strerror with g_strerror
For consistency with the previous commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3418>
2024-01-08 13:05:17 +00:00
Daniel van Vugt
ee3968981f onscreen/native: Explain why surface creation failed in the error message
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3418>
2024-01-08 13:05:17 +00:00
Bilal Elmoussaoui
9e4d1f51ee misc: Drop remaining nick/blurbs
Those were added again after we dropped their usage in the codebase

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3498>
2024-01-08 11:54:58 +00:00
Bilal Elmoussaoui
5273422aef cleanup: Make meta includes consistent
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3491>
2024-01-05 14:22:22 +01:00
Bilal Elmoussaoui
6b8c1c430e cleanup: Make clutter includes consistent
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3491>
2024-01-05 14:22:22 +01:00
Bilal Elmoussaoui
3b4fe5d577 cleanup: Make cogl includes consistent
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3491>
2024-01-05 14:22:22 +01:00
Peter Hutterer
e7ba16689d backends/native: Use a pre-sampled bezier pressure curve
Based on the pressure curve control points sample a bezier curve and
then look up the pressure at that point of the curve.

We sample 256 points and do linear interpolation in between, this
strikes a balance between having to calculate the point for all
8K pressure points a modern pen supports while still giving us
reasonable detailed curves.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3158
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3399>
2024-01-05 10:21:42 +00:00
Peter Hutterer
4d6add290e backends/native: Switch the pressurecurve points to graphene points
No functional changes but a little bit of type-safety for future
patches.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3399>
2024-01-05 10:21:42 +00:00
Peter Hutterer
5ec67a8e90 backends/native: Change the MetaBezier API to sampling and lookup
This keeps the existing ClutterBezier implementation but changes
the visible API to match the needs of the tablet tool pressure curve:
a bezier defined within a [0.0/0.0, 1.0/1.0] box,(sampled
into a set of x->y mappings for each possible pressure input x, and
a lookup function to get those values out of the curve.

This patch moves the internally-only functions to be statics and changes
meta_bezier_init() to take only the second and third control point, as
normalized doubles. Because internally we still work with integers, the
bezier curve now has an integer "precision" that defines how many points
between 0.0 and 1.0 we can sample.

The meta_bezier_rasterize() function calculates the x->y mapping for
each point on the bezier curve given the initial scale of the curve.
That value is then available to the caller via meta_bezier_lookup().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3399>
2024-01-05 10:21:42 +00:00
Peter Hutterer
f2ed377f48 backends/native: Update MetaBezier coding style for modern standards
Let's try to get past that pesky code-style checker.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3399>
2024-01-05 10:21:42 +00:00
Peter Hutterer
414357a70f backends/native: Restore the ClutterBezier code to here
The ClutterBezier code was removed in
    580d62b9b clutter: Remove unused Path related types
because it wasn't used anywhere. We do need a bezier curve for the
tablet tool pressure curve calculation though so let's move it
to the native backend and rename it to MetaBezier in the process.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3399>
2024-01-05 10:21:42 +00:00
Bilal Elmoussaoui
b64381d366 x11: Rename cairo_rects to mtk_rects
Avoids the result from showing up in a grep cairo

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3486>
2024-01-04 14:00:26 +00:00
Carlos Garnacho
4f68713020 frames: Notify borders on first content resize
This addresses the following race condition:
1. Window+MetaFrame are created non-fullscreen, _MUTTER_FRAME_EXTENTS
   is initialized through widget measuring, accounting for frame.
2. Window and MetaFrame become fullscreen.
3. MetaFrameContent gets first size allocation, already fullscreen.
4. Borders were initialized to 0,0,0,0, become set to 0,0,0,0 correctly
   reflecting fullscreen, however notify::borders is not emitted.
5. _MUTTER_FRAME_EXTENTS stays accounting for the frame extents.

It sounds sensible to have the borders initialized to a meaningful value,
so account for the first time the border would be set due to the content
being (re)sized, and let this first value trigger notify::borders resulting
in _MUTTER_FRAME_EXTENTS updates.

Since all later _MUTTER_FRAME_EXTENTS changes happen through content
resizes, we only have to cater for this initial handover between the
frame/content initialization paths done through widget measuring and
the later paths done through MetaFrameContent resizes.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2937
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3476>
2024-01-03 19:31:51 +00:00
Bilal Elmoussaoui
5964ccb385 wayland: Fix building without native backend
Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/1026

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3480>
2024-01-03 14:46:41 +01:00
Bilal Elmoussaoui
cebde5c2d1 backend/native: Move DrmFormatBuf to cogl-drm-formats
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3480>
2024-01-03 14:46:41 +01:00
Bilal Elmoussaoui
786a9d9072 build: Require libdrm >= 2.4.95
So we can drop the DRM_FORMAT_INVALID fallback

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3480>
2024-01-03 14:46:04 +01:00
Bilal Elmoussaoui
50fd53d465 x11/seat: Initialize group/mode for pad events
Otherwise, if Mutter is built without libwacom, garbage values would be
passed to clutter_event_pad_button_new

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

Fixes: 1611979fa ("x11: Implement ClutterSeat")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3479>
2024-01-03 10:56:11 +00:00
Mart Raudsepp
d7db784b54 build: Fix building without wayland headers
Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3046
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3471>
2024-01-03 10:48:00 +00:00
Robert Mader
cb794329e7 clutter/stage-view: Remove superfluous return in void function
Fixes: 9d3e4fd402 ("clutter/stage-cogl: Use buffer age when view monitor is rotated")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3473>
2024-01-02 13:54:38 +00:00
Sebastian Wick
4c6216e8a3 tests/wayland: Add basic YCbCr ref-tests
The test makes sure the YCbCr formats create the expected image and we
don't accidentally break it.

Like all wayland tests, this is now part of mutter/wayland, mutter/tty,
and mutter/kvm and will use either shm or dma-buf depending on which
suite is chosen.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3371>
2023-12-20 23:51:14 +00:00
Sebastian Wick
59d4343057 wayland-buffer: Enable YCbCr support for wayland shm
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3371>
2023-12-20 23:51:14 +00:00
Sebastian Wick
c8f4c85bfb wayland-buffer: Support MultiTexture formats via wayland shm
Finding the shm offset and shm stride for each plane is the main issue.
The rest is just creating multiple textures for each plane.

One assumption is that shm planes are always contiguous in memory so the
next plane comes directly after the size of the current plane.

The size of a plane is determined by the height and stride. There is
only a single stride parameter for shm buffers but we assume that the
first plane is always non-subsampled which gives us a number of "logical
elements" on one line (stride / bpp of the first plane). The stride of
the other planes is then the number of logical elements devided by the
subsampling factor and multiplied by the bpp of the plane.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3371>
2023-12-20 23:51:14 +00:00
Sebastian Wick
a4d75e8252 cogl/test: Test 16bpc RGBA UNORM formats
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3371>
2023-12-20 23:51:14 +00:00
Sebastian Wick
19472c75be tests/wayland-test-clients: Fix up whitespace
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3371>
2023-12-20 23:51:14 +00:00
Sebastian Wick
5652c61c06 tests/wayland-test-clients: Use stride of the first plane
The assumption is that all planes are always contiguous, and we don't
have any multi-plane formats where the first plane is subsampled.

The stride of the entire buffer is then just the stride of the first
plane and the stride of the other planes is derived from that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3371>
2023-12-20 23:51:14 +00:00
Sebastian Wick
005ede7702 tests/wayland-test-clients: Fix YUV420 vertical subsampling factor
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3371>
2023-12-20 23:51:14 +00:00
Sebastian Wick
0930282baa tests/wayland-test-clients: Destroy WaylandBuffers when released
Instead of forcing every user of WaylandBuffer to create a listener and
destroy the wl_resource and the WaylandBuffer object, provide a default
listener which does it for the user.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3371>
2023-12-20 23:51:14 +00:00
Sebastian Wick
628f12a48b tests/wayland-test-clients: Try simple dma-buf alloc first and fall back
to the complex one. If a driver supports allocating linear YCbCr formats
we can use that instead of constructing our own compatible buffer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3371>
2023-12-20 23:51:14 +00:00
Sebastian Wick
ff3b8197fd tests/wayland-test-clients: Use ARGB dma-buf format for YUYV buffers
They are the same for our purposes of allocating a linear buffer and
writing to the CPU mapping, but the ARGB format is widely supported and
the YUYV format is not.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3371>
2023-12-20 23:51:14 +00:00
Sebastian Wick
c0832b99d8 multi-texture-format: Always use the tex coords of the first plane
The texture coordinates of all planes should be the same in theory so
using the coordinates of the first plane works.

The reason for this change is that Cogl somehow doesn't manage to get us
the correct coordinates for the 3rd plane in some circumstances. This is
really a workaround but not wrong in any way.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3176
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3469>
2023-12-20 19:39:06 +00:00
Alynx Zhou
33088d59db wayland/text-input: Pass char based offset to ClutterInputFocus
Wayland's text-input-v3 uses byte based offset for cursor and anchor of
surrounding text, but Clutter needs char based offset here. This commit
converts byte based offset to char based offset before passing them to
ClutterInputFocus.

Fixes <https://gitlab.gnome.org/GNOME/mutter/-/issues/3102>.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2712>
2023-12-20 19:31:05 +00:00
Alynx Zhou
27bdf0c577 wayland/text-input: Use byte based offset in delete_surrounding_text
ClutterInputFocus/GtkIMContext uses char based offset for
delete_surrounding, however, text_input_v3 uses byte based offset for
it. Currently only GTK with mutter can work correctly via text_input_v3
because they both forget to convert between char based offset and byte
based offset.

This commit fixes it in mutter by saving committed surrounding text in
MetaWaylandTextInput and converting char based offset to byte based
offset with the UTF-8 encoded surrounding text.

Fixes <https://gitlab.gnome.org/GNOME/mutter/-/issues/2146>.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2712>
2023-12-20 19:31:05 +00:00
Sebastian Wick
4b8798a800 shaped-texture: Don't use mipmaps for small textures
Mipmapping extremely small textures is pointless. We chose a lower limit
of 8 pixels in each direction.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3468>
2023-12-19 22:25:21 +01:00
Sebastian Wick
54c5ea9c13 texture-mipmap: Handle textures with width or height of 1
Calculating the mipmap width as half of the texture width leads to a
mipmap width of zero for textures with width of 1 which leads to an
early exit instead of a mipmap texture.

Fixes: 16fa2100d ("shaped-texture: Stop using MetaTextureTower and use GL mipmapping instead")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3468>
2023-12-19 22:24:57 +01:00
Sebastian Wick
5dc92aa134 Revert "background: Make the final monitor texture RGB instead of RGBA"
This reverts commit 93e938e22f.

The alpha channel is required for the background-color to show where the
background-image is not visible.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1911
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3459>
2023-12-19 12:30:19 +00:00
Michel Dänzer
14d84707fc wayland/surface: Move committed buffer size check out of if (buffer)
A surface commit may change the buffer scale but not attach a new
buffer. In that case, the size of the previously attached buffer needs
to be consistent with the new buffer scale.

Fixes: 7649e2f3ab ("wayland/surface: Move buffer size check to meta_wayland_surface_commit")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3466>
2023-12-19 11:53:26 +01:00
Michel Dänzer
17640d9c98 wayland/surface: Use committed texture width/height in _surface_commit
meta_wayland_surface_get_buffer_width/height uses the currently applied
buffer, which may have a different size.

Fixes: 7649e2f3ab ("wayland/surface: Move buffer size check to meta_wayland_surface_commit")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3466>
2023-12-19 11:23:22 +01:00
Michel Dänzer
98c8c03729 wayland/surface: Check buffer size also for role-less surfaces
The Wayland protocol spec doesn't say anything about this being required
only for surfaces with a role.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3463>
2023-12-18 21:56:59 +00:00
Michel Dänzer
7649e2f3ab wayland/surface: Move buffer size check to meta_wayland_surface_commit
Multiple reasons:

* More consistent with the protocol spec language.
* Ensures the size is checked and the protocol error sent from a
  protocol processing context, instead of whatever context
  meta_wayland_surface_commit might get called from.
* The latter implies that surface->resource is guaranteed to be valid.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3211
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3463>
2023-12-18 21:56:59 +00:00
Michel Dänzer
0a0d1e2066 wayland/surface: Track committed and applied scale separately
Preparation for next commit, no functional change intended.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3463>
2023-12-18 21:56:59 +00:00
Carlos Garnacho
4081d409c6 core: Avoid checks for no_focus_window
This window is set as the key focus in the MetaX11Display when the
MetaDisplay focus is NULL, we can check for that directly instead of
its aftereffects.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3269>
2023-12-18 17:55:27 +00:00
Carlos Garnacho
7fbc0ccc01 x11: Hook X11 focus management to MetaDisplay signal
This makes the MetaX11Display indirectly react to MetaDisplay changes,
rather than having the MetaDisplay also drive the MetaX11Display focus.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3269>
2023-12-18 17:55:27 +00:00
Carlos Garnacho
24344d8141 core: Add ::focus-window signal
This will be triggered whenever the input focus changes, so that
other pieces may hook to this place.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3269>
2023-12-18 17:55:27 +00:00
Carlos Garnacho
ae102ee301 x11: Refactor ClutterStage key focus management
Integrate it into the code, instead of depending on MetaDisplay
notify::focus-window for it. Now, instead of focusing explicitly the
stage window, we focus a NULL window, and let the MetaX11Display
determine whether focus should go to the stage window if there's
a focused actor, or the no_focus_window if nothing has focus.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3269>
2023-12-18 17:55:27 +00:00
Carlos Garnacho
a36616f81d core: Drop focus_frame argument from meta_display_set_input_focus()
Sort that out in the X11 display, where it matters, without the need
of this argument in generic API.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3269>
2023-12-18 17:55:27 +00:00
Carlos Garnacho
4179679239 x11: Adopt code to focus stage window on Clutter key focus
We currently offer the mechanism for GNOME Shell to implement, and
while this is not exercised often (our entries are typically surrounded
by a ClutterGrab ensuring key events, so this is reserved to grab-less
entries, probably there are some in extensions), this is arguably
something Mutter should cover by itself without GNOME Shell guidance.

This is only necessary on the X11 backend, although it is conceptually
more tied to the MetaX11Display connection, so perform the focus
tracking there only if not running as a Wayland compositor (i.e. --x11).

This avoids the only case where the low-level
meta_x11_display_set_input_focus_xwindow() function is used, or rather
makes it completely a MetaX11Display implementation detail, leaving
only the MetaDisplay API as the high-level entry points to handle
window key focus.

The public API that allowed GNOME Shell to implement these mechanisms
is also gone in this commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3269>
2023-12-18 17:55:27 +00:00
Jonas Ådahl
3b46b4a099 kms/device: Replace get_plane*() with has_plane*()
There might not be a single plane that is "for" a CRTC, so remove the
API that made it appear as if it did. The existing users only cared if
there was some plane for said CRTC, so replace the getters with API that
just checks the existance at all.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3428>
2023-12-18 13:35:09 +00:00
Jonas Ådahl
48c7caadd2 monitor-manager: Remove is_transform_handled()
There was one user, but it got changed to bypass the monitor manager and
talk directly to MetaCrtcNative.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3428>
2023-12-18 13:35:09 +00:00
Jonas Ådahl
cc7bca073b crtc/kms: Dynamically assign primary and cursor planes
When there are a set of primary planes, and a set of CRTCs, where each
plane can be used on multiple CRTCs, we need to make sure that when we
mode set and page flip, each CRTC gets assigned an individual plane that
isn't used with any other CRTC.

Do this during the monitor resource assignments that sets up later to be
applied configurations of the mode setting objects, but with the new
hooks into the backend, so that we don't need to teach the monitor
config manager about planes.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2398
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3428>
2023-12-18 13:35:09 +00:00
Jonas Ådahl
48145a91f9 monitor-config-manager: Let CRTC assignment transform be logical
This means that it doesn't necessarily mean what transform / rotation
the hardware resource gets, e.g. it instead represents the logical
transform related to the configured mode. This allows us to postpone
checking the plane capabilities until later (as rotation capabilities
depends is a plane property), when a plane has been assigned.

This was in practice already handled when configuring the
transform-via-offscreen case, handled when creating the view, and the
mode setting configuration.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3428>
2023-12-18 13:35:09 +00:00
Jonas Ådahl
429e65b993 monitor-config-manager: Allow backends to assign extra data
When we're configuring monitors, allow backends to add backend specific
assignments during resource assignment (mapping connectors and CRTCs
etc).

This will later allow the native backend's KMS monitor resources to
assign a primary plane and optionally a cursor plane during
configuration. This will then dictate what plane will be used for
primary plane updates, as well as cursor updates, until reconfigured
again.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3428>
2023-12-18 13:35:09 +00:00
Jonas Ådahl
2bb75a3c97 crtc: Make the caller allocate the config struct
This will make it more convenient to offload some part of the
configuring the backend by passing the config forward.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3428>
2023-12-18 13:35:09 +00:00
Jonas Ådahl
c87fc36804 crtc: Remove trailing empty line in header
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3428>
2023-12-18 13:35:09 +00:00
Jonas Ådahl
f7043ca3d6 tests/kms: Use test helper for finding planes
A set of primary planes can be usable with a set of CRTCs, meaning we
can't have general purpose functions that gets a plane for a CRTC, as
there is no such one to one relationship.

For tests we still want to have helpers that makes writing tests easier,
so to prepare for those functions going away, make the tests do the
equivalent themselves.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3428>
2023-12-18 13:35:09 +00:00
Jonas Ådahl
4c0f3ea80f renderer/x11/nested: Remove dead view transform handling
With the (nested) X11 we always "handle" view transforms, so lets remove
the code that handles when we don't.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3428>
2023-12-18 13:35:09 +00:00
Daniel van Vugt
74ce9592b5 kms: Avoid queuing multiple (un)assignments to the same plane in an update
Just like we already do in `meta_kms_update_assign_plane`.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2620>
2023-12-15 16:00:26 +00:00
Christopher Fore
ec1778a37f backends: Include unistd.h to fix compilation on musl
Musl doesn't seem to include this by default so explicitly including it
should fix compilation on Musl.

Tested with Clang 16/17 and GCC 14.

Error:
src/backends/meta-fd-source.c:70:3: error: call to undeclared function 'close'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  close (fd_source->poll_fd.fd);
  ^

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3078
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3455>
2023-12-15 14:59:26 +00:00
Peter Hutterer
f76952e83f backends/native: If the tablet tool is relative, constrain it normally
If we're moving our tool like a relative pointer, constrain to our
viewports, if any. This fixes the cursor moving off the screen in
relative mode.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3168
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3410>
2023-12-15 14:36:19 +00:00
Peter Hutterer
d575138cce backends/native: Shuffle static constrain functions up
No functional changes, this just moves two functions up to make the
follow-up patch more obvious.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3410>
2023-12-15 14:36:19 +00:00
Peter Hutterer
e7f91fad9d backends/native: Fix whitespace
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3410>
2023-12-15 14:36:19 +00:00
Peter Hutterer
01f78c0451 backends/native: Pass the axes down to the relative clutter motion event
Otherwise we get a happy segfault when we're trying broadcast_axis()
during the tablet event handling.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3410>
2023-12-15 14:36:19 +00:00
Peter Hutterer
9e781545aa backends/native: Set the tool for relative events
Otherwise a tablet in relative mode will never have a tool set and
nothing happens on motion events - meta_wayland_tablet_seat_update()
simply exits early for tablet proximity, button or motion events.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3410>
2023-12-15 14:36:19 +00:00
Peter Hutterer
baafec089a backends/x11: Fix tab/space indentation issue
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3410>
2023-12-15 14:36:19 +00:00
Florian Müllner
d16ddc42ce x11: Remove icon cache
We stopped reading window icons, so there's nothing to cache
anymore.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3452>
2023-12-15 14:14:33 +00:00
Florian Müllner
5fc6ff19fa wayland/xwayland: Include x11-display-private
The include is currently satisfied by

window-x11-private → iconcache → x11-display-private

The icon cache is about to be removed, so add the missing include
directly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3452>
2023-12-15 14:14:33 +00:00
Florian Müllner
25d6e4524c window: Remove window icon properties
Window icons are X11 specific, and gnome-shell stopped using them
even as fallback.

Time for some cleanup …

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3452>
2023-12-15 14:14:33 +00:00
Sebastian Wick
7458907360 shaped-texture: Reset pipelines when texture format changes
Changing the MultiTexture may require a different set of pipelines when
the texture format is different. We keep track of the attached
MultiTextureFormat just like we do for the width and height.

This fixes misrendering when a client attaches buffers with different
MultiTextureFormats to the same surface.

Fixes: 3dd9f15eb ("shaped-texture: Start using MetaMultiTexture")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3456>
2023-12-15 11:48:32 +01:00
Olivier Fourdan
a191af1f3d remote-desktop/eis: Fix ConnectToEIS device-types
The change to the device types in xdg-desktop-portal-gnome needs to be
reflected in mutter as well, otherwise the device types are not properly
passed along.

As a result, input emulation fails.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3194
See-also: https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/merge_requests/108/diffs?commit_id=2b3163a
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3447>
2023-12-13 17:22:10 +00:00
Bilal Elmoussaoui
580d62b9b6 clutter: Remove unused Path related types
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3437>
2023-12-13 11:20:04 +00:00
Bilal Elmoussaoui
3f09a86e7a clutter: Drop CLUTTER_PARAM_* defines
They are not used every where making the codebase very incosistent
So just drop the current usages

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3437>
2023-12-13 11:20:04 +00:00
Sebastian Wick
c8191920e8 tests/wayland: Create native backends for KVM/tty tests
Run the wayland tests also in the KVM and tty tests suits. Change some
of the tests to also use a native backend via VKMS.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3350>
2023-12-13 10:43:31 +00:00
Sebastian Wick
13bbc4bc43 tests/wayland: Move virtual output to lowest VKMS resolution
We want to run those tests in VKMS later with the same reference image.
To make the tests as close to each other as possible we use the same
resolution for the VKMS and the virtual output which is 640x480.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3350>
2023-12-13 10:43:31 +00:00
Sebastian Wick
8f687ed98d tests/wayland/buffer-transform: Draw the buffer with the right size
This test currently only works because the monitor has the same width
and height. Generalize it to arbitrary monitor sizes by taking into
account that width and hight are swapped for some rotations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3350>
2023-12-13 10:43:31 +00:00
Sebastian Wick
d4b9e72440 tests/wayland/dma-buf-scanout: Use WaylandBuffer
WaylandBuffer supports dma-bufs now, even ones which can be scanned out.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3350>
2023-12-13 10:43:31 +00:00
Sebastian Wick
6f4da83b36 tests/wayland-test-clients: Remove unused create_shm_buffer
We moved the last user of `create_shm_buffer` and can now get rid of it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3350>
2023-12-13 10:43:31 +00:00
Sebastian Wick
2c23a94be0 tests/wayland-test-clients: Use WaylandBuffer in draw_surcace
Most tests use the draw_surface function to draw a solid color to a
surface. This moves it from the shm-only path to WaylandBuffer which
makes all of those tests usable via dma-buf.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3350>
2023-12-13 10:43:31 +00:00
Sebastian Wick
d842fe601d tests/wayland/buffer-transform: Use WaylandBuffer
The custom drawing requires adjusting the test. Instead of poking at
memory directly, we can just draw a color at certain coordinates which
makes it independent of the pixel format used.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3350>
2023-12-13 10:43:31 +00:00
Sebastian Wick
145649538a tests/wayland-test-clients: Add a WaylandBuffer for shm and dma-buf
It abstracts away the kind of buffer so clients can be tested with both
shm and dma-buf paths. We'll make use of it in the future by adding the
wayland tests to the TTY and KVM test suits.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3350>
2023-12-13 10:43:31 +00:00
Sebastian Wick
63f84fedd9 tests/wayland-test-clients: Keep track of advertised modifiers
We will need to check against them for figuring out if we can import a
specific dma-buf.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3350>
2023-12-13 10:43:31 +00:00
Sebastian Wick
24ef34f680 tests/wayland-test-clients: Add gbm_device to WaylandDisplay
We'll use this later to allocate dma-bufs from.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3350>
2023-12-13 10:43:31 +00:00
Sebastian Wick
8e7600322b tests/wayland-test-clients: Make WaylandSurface a GObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3350>
2023-12-13 10:43:31 +00:00
Sebastian Wick
cceccc0f68 tests/wayland-test-clients: Add missing WAYLAND_TYPE_DISPLAY define
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3350>
2023-12-13 10:43:31 +00:00
Sebastian Wick
2993462700 tests/ref-test: Inhibit direct scanout for ref-tests
When capturing the view we have to make sure the stage is actually
updated. In direct scanout mode the stage is unmodified and we can't
find the content we want to test.

Currently the ref-tests are all running on non-native setups where
direct scanout is impossible but we will change that soon!

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3350>
2023-12-13 10:43:31 +00:00
Sebastian Wick
e42c5dbd79 tests/ref-test: Go directly from Crtc to Backend
This avoids going through the GPU which can be NULL in some cases.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3350>
2023-12-13 10:43:31 +00:00
Sebastian Wick
1069085612 tests/test-utils: Allow calling set_custom_monitor_config outside tests
by using g_test_build_filename instead of g_test_get_filename.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3350>
2023-12-13 10:43:31 +00:00
Sebastian Wick
289e511c1a cogl/tests: Add fp16 offscreen texture format store/paint tests
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3441>
2023-12-06 23:01:02 +01:00
Ivan Molodetskikh
5cbcf1c94f meta/kms-impl: Emit trace message on page flips
It's sometimes useful to see the earliest point when the compositor
became aware of a page flip.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3417>
2023-12-06 16:12:58 +00:00
Ivan Molodetskikh
77413ed9a0 clutter/frame-clock: Store output name
Will be used in a subsequent commit for including the output name in
COGL_TRACE plot names.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3417>
2023-12-06 16:12:58 +00:00
Ivan Molodetskikh
521668202d meta/later: Remove extra word from trace span description
This used to be the span name. Now that it's the description, repeating
the word Later is not needed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3417>
2023-12-06 16:12:58 +00:00
Ivan Molodetskikh
e11ee42dfa screen-cast/stream-src: Add trace spans to recording
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3417>
2023-12-06 16:12:58 +00:00
Ivan Molodetskikh
ff1ee92aa7 events: Add event name to trace description
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3417>
2023-12-06 16:12:58 +00:00
Ivan Molodetskikh
3c27b75f2f meta/stage-impl: Add trace span to paint_damage_region
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3417>
2023-12-06 16:12:58 +00:00
Ivan Molodetskikh
752632276d meta/stage-impl: Move swap framebuffer span inside the function
It was covering damage calculation also.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3417>
2023-12-06 16:12:58 +00:00
Ivan Molodetskikh
5669ee2dc3 meta/stage-impl: Add trace span to redraw_view_primary
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3417>
2023-12-06 16:12:58 +00:00
Ivan Molodetskikh
8f5d0c236e backend: Add a trace span for clutter_source_dispatch
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3417>
2023-12-06 16:12:57 +00:00
Michel Dänzer
50980f995b tree-wide: Fix spelling of "inhibition"
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3444>
2023-12-06 16:01:36 +00:00
Michel Dänzer
200fc76f14 wayland/idle-inhibit: Pass actor instance in on_actor_changed
This matches the other g_signal_connect / g_clear_signal_handler calls
for these signal handlers.

Fixes: a3c62bf8aa ("wayland/idle-inhibit: Add state tracking to fix races")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3444>
2023-12-06 16:01:36 +00:00
Michel Dänzer
212283c13b wayland/idle-inhibit: Handle NULL inhibitor->actor
Fixes: a3c62bf8aa ("wayland/idle-inhibit: Add state tracking to fix races")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3444>
2023-12-06 16:01:36 +00:00
Sebastian Keller
dfe4d218f1 clutter/actor: Make get_transformed_paint_volume() transfer full
Transfer none was achieved using a stack GArray in the stage which
would get resized to 0 at the end of every frame to "free" it.
In the case of direct scanout however, painting the next frame only
happens after leaving fullscreen again. Until then the array just kept
growing and because GArrays don't reallocate when shrunk, this memory
remained allocated even after leaving fullscreen.

There is no cache benefit from storing paint volumes this way, because
nothing accesses them after their immediate use in the calling code.
Also the reduced overhead from avoiding malloc calls seems negligible as
according to heaptrack this only makes up about 2-3% of the temporary
allocations.

Changing this to transfer full and removing the stack array simplifies
the code and fixes the "leak".

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3191
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3442>
2023-12-06 14:07:39 +00:00
Jonas Ådahl
83e2f70f1f backend: Rename update_screen_size() to update_stage()
We don't only update the size of the screen / stage, but also regenerate
views etc. Make this a bit more obvious by renaming the function to
update_stage().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3443>
2023-12-06 13:45:03 +00:00
Jonas Ådahl
08d2155b6c shaped-texture: Rename GObjectClass pointer variable
To be consistent with the rest of mutter, call it `object_class`.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3443>
2023-12-06 13:45:03 +00:00
Jonas Ådahl
68412cedac shaped-texture: Get type from klass
We don't need to get the type from the type casted class pointer, just
get it from the one from the function argument.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3443>
2023-12-06 13:45:03 +00:00
Jonas Ådahl
b282097834 clutter/stage-view: Rename offscreen pipeline vfunc
It doesn't really "set it up", it just sets the transform according to
the renderer view state. We'll do more setup outside, so lets rename it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3443>
2023-12-06 13:45:03 +00:00
Jonas Ådahl
a27949d25e renderer/native: Stop passing around CoglContext when creating offscreen
We can easily get it, so it's unnecessary to pass it around everywhere.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3443>
2023-12-06 13:45:03 +00:00
Michel Dänzer
c47730894e wayland/dma-buf: Prefer sync_file for dma-buf readiness source
Similarly to https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3389,
this avoids over-synchronization due to the client reading from the
buffer, e.g. if drawing a frame re-uses the previous frame contents.

v2:
* Rename owned_fd → owned_sync_fd (Sebastian Wick)
* Put curly braces around do/while loop

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3408>
2023-12-05 14:53:21 +00:00
Michel Dänzer
0e471bcea7 wayland/dma-buf: Refactor create_source helper
No functional change intended.

v2:
* Make local source assignment separate from its declaration
  (Ivan Molodetskikh)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3408>
2023-12-05 14:53:21 +00:00
Jonas Ådahl
501d19656e context: Make ClutterContext a GObject and move to separate file
This is a step in cleaning up the Clutter context management. By making
it a GObject it's easier to add e.g. properties and features that helps
with introspection.

For now, this means the context creation is changed to go via a
"constructor" (clutter_create_context()). This is so that the global
context singleton can be mantained outsid of ClutterContext, until it
can be removed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2016>
2023-12-05 14:39:25 +00:00
Jonas Ådahl
6aebd5407d stage/impl: Fix variable naming consistency
Changed to follow convention in mutter.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2016>
2023-12-05 14:39:25 +00:00
Jonas Ådahl
f14b5da387 clutter/backend: Remove 'finish_init()' vfunc
The original purpose of being able to report errors is no longer
relevant, since the Clutter backend is now practically a thin wrapper
around the actual backend, which has already dealt with error reporting.
Thus move this to the regular constructor path.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2016>
2023-12-05 14:39:25 +00:00
Carlos Garnacho
6ad0114d1f compositor: Undo MetaWindowDrag on MetaWindow::unmanaged signal
The current usage of MetaWindow::unmanaging may result in confused
focus window lookups while undoing the MetaWindowDrag grab (i.e.
still pointing to the window that is now being unmanaged).

The meta_window_unmanage() function itself takes care of changing
focus outside of the window being unmanaged, so postpone the
MetaWindowDrag undoing to a point after that is done.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3073
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3376>
2023-12-05 14:16:27 +00:00
Michel Dänzer
75d00027ca kms: Remove dead MetaKmsPageFlipListenerFlag type
Unused since 02b1cfe08f ("onscreen/native: Handle unexpected scanout
failures async").

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3389>
2023-12-05 12:51:32 +00:00
Michel Dänzer
e8a213beef kms/impl-device/atomic: Set IN_FENCE_FD for direct scanout
Since meta_kms_impl_device_get_sync_file always returns the same
file descriptor referencing the same sync_file, this means the atomic
ioctl doesn't need to wait for any fences to signal. This is fine
because we already waited for the buffer to become idle before applying
the Wayland surface state.

Fixes the atomic commit ioctl spuriously synchronizing to the screen
cast paint (at least with the amdgpu driver), which could result in
the page flip missing its target scanout cycle.

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

v2:
* Rename local variable to signaled_sync_file for consistency with new
  function name

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3389>
2023-12-05 12:51:32 +00:00
Michel Dänzer
281ff86b4b kms/impl-device: Add meta_kms_impl_device_get_signaled_sync_file helper
It returns a file descriptor which references a signaled sync_file.

v2:
* Change function name and add Doxygen comment to hopefully make its
  purpose a bit clearer (Ivan Molodetskikh)
v3: (Jonas Ådahl)
* Create sync_file from scratch via a syncobj, no buffer needed anymore
* Initialize priv->sync_file = 1 and use g_clear_fd in finalize

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3389>
2023-12-05 12:51:32 +00:00
Michel Dänzer
3ad32ee0bc kms/plane: Add META_KMS_ASSIGN_PLANE_FLAG_DIRECT_SCANOUT flag
It marks plane assignments for direct scanout.

Preparation for following commits, no functional change intended.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3389>
2023-12-05 12:51:32 +00:00
Michel Dänzer
0f52c2a6da onscreen/native: Plumb through MetaKmsAssignPlaneFlag
Through meta_onscreen_native_flip_crtc and
meta_crtc_kms_assign_primary_plane.

Preparation for following commits, no functional change intended.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3389>
2023-12-05 12:51:32 +00:00
Michel Dänzer
ebf9a1edde ksm/plane: Add support for IN_FENCE_FD property
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3389>
2023-12-05 12:51:32 +00:00
Sebastian Wick
962ca18341 cogl/tests: Skip 10bpc tests if the pixel formats are not supported
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3429>
2023-12-05 08:47:11 +00:00
Daniel van Vugt
2a17a5dee8 onscreen/native: Remove trailing whitespace
check-code-style complains about this, when it works (after !3426).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3430>
2023-12-05 08:30:03 +00:00
Jonas Ådahl
adc5489ba7 Add debug controller
The debug controller can optionally, when passing --debug-control,
enable manipulating debug state, so far enabling/disabling HDR, via
D-Bus.

It's always created, in order to have a place to store debug state and
emit signals etc when it changes, but so far, it doesn't have its own
state it tracks, it just mirrors that of the monitor manager.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3432>
2023-12-01 14:25:08 +00:00
Jonas Ådahl
d5253b1385 build: Make input-capture use declarative D-Bus code generation
This was cleaned up, but a input capture rebased didn't port to the new
way of declaring what D-Bus protocol files that should go through code
generation.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3432>
2023-12-01 14:25:08 +00:00
Jonas Ådahl
294739db15 monitor-manager: Apply HDR settings before updating the stage
This means we can make use of the HDR configuration of outputs to derive
stage rendering configuration.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3432>
2023-12-01 14:25:08 +00:00
Jonas Ådahl
3561f3c20e monitor-manager: Set up experimental HDR change listener after starting
This means we can fiddle with it during startup without an accidental
reconfigure being sneaked in by the listener.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3432>
2023-12-01 14:25:08 +00:00
Jonas Ådahl
e4badfecb3 monitor-manager: Allow forcing experimental HDR mode with an env var
This makes it possible to test without GNOME Shell and looking glass.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3432>
2023-12-01 14:25:08 +00:00
Jonas Ådahl
be3394646f monitor-manager: Stop leaking experimental HDR setting
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3432>
2023-12-01 14:25:08 +00:00
Carlos Garnacho
9f89421ef5 backends: Attempt a fallback to 'default' cursor on failed lookups
While we should ideally have a sensible cursor theme, handle the
case of cursor themes that lack certain cursor names, and fallback
to the 'default' cursor in those cases.

The 'grey rectangle' fallback is still left, in case we even fail
to load a 'default' cursor.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3295>
2023-11-30 20:38:22 +00:00
Carlos Garnacho
d970c9db1a backends: Use standard cursor names from the CSS specification
This is the preferred name set, and handled by adwaita icon theme.
Use the names from https://www.w3.org/TR/css-ui-4/#cursor, like
GDK does at https://docs.gtk.org/gdk4/ctor.Cursor.new_from_name.html.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3040
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3295>
2023-11-30 20:38:22 +00:00
Pascal Nowack
a2a4067e07 screencast: Add ability to stop streams
When a stream is destroyed by a consumer, mutter won't be able to
recognize that.
For mutter, the stream just paused, but did not disconnect, because the
connection state of a PipeWire stream only represents, whether the
respective PipeWire context is connected to PipeWire.
In addition to that, it may be the case, that the stream consumer just
recreates the stream.
So even if mutter would be able to know, when the stream consumer
destroyed a stream, but not the whole screencast or remote-desktop
session, then mutter would not know, whether the stream will be resumed
eventually or not.

So, add an explicit API call to the screencast interface to stop a
stream.
For virtual streams, this also means, that the respective virtual
monitor is destroyed.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2889
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3307>
2023-11-30 12:22:59 +01:00
Pascal Nowack
d2122a02a3 monitor-manager: Reload monitor manager in idle callback
When a virtual stream is destroyed, its respective virtual monitor is
destroyed too. When the virtual monitor is destroyed, mutter reloads
the monitor manager.
However, at this point, the virtual stream is not completely destroyed
yet. The viewport of the virtual monitor still exists at this point and
when the monitor manager reloads, it will try to fetch the logical
monitor of the now destroyed virtual monitor, which will fail and thus
gnome-shell will run into a segfault.

Fix this situation by reloading the monitor manager in an idle callback.
When the monitor manager reloads, the virtual monitor is completely
gone, since the viewport of the virtual monitor is destroyed after the
virtual monitor itself.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2864
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3307>
2023-11-30 12:22:52 +01:00
Pascal Nowack
e70fa342a9 monitor-manager: Fix minor code style issue
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3307>
2023-11-30 12:13:26 +01:00
Jonas Ådahl
822ea67358 tests/utils: Add helper for waiting for monitor reconfigurations
This is useful after having removed a virtual monitor, which
will soon reconfigure in an idle callback.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3307>
2023-11-30 12:13:26 +01:00
Jonas Ådahl
5dc0824ea9 tests/utils: Raise error if monitors changed while waiting for paint
If it does, the views we are waiting for won't get painted.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3307>
2023-11-30 12:13:26 +01:00
Jonas Ådahl
c3c144f991 color-manager: Don't try to manage virtual monitors
There is no way to set any gamma luts, or do anything other color
management related. Eventually we'll probably want to, but that requires
bringing color management plumbing to PipeWire.

Doing this is also needed when running a headless session, as when
headless, polkit doesn't let us create colord devices without explicit
user permission, meaning we'll spam the session with useless dialogs
each time a session is started.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3423>
2023-11-27 14:21:37 +00:00
Carlos Garnacho
8de30c3b6e core: Disconnect notify::is-grabbed signal when closing display
Given destruction order, the display goes away before the stage, so
this lingering signal connection may trigger unintended crashes.

Fixes: 05eeb684d1 ("window: Postpone focusing until grab ended if uninteractable")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3422>
2023-11-24 13:54:05 +01:00
Daniel van Vugt
8103ebc21a backends/native: Count MetaRenderDeviceEglStream instances externally
`count_mode_setting_devices` was incorrect in both name and in function.
What it was actually doing was counting GPUs that had been registered with
the backend so far (during the `init_gpus` loop). What it was intended to
do was to count the number of `MetaRenderDeviceEglStream` instances, which
is the thing we're limited to only one of. So `count_mode_setting_devices`
would return zero whenever the first GPU initialized happened to be a
`MetaRenderDeviceEglStream`, which would in turn prevent
`MetaRenderDeviceEglStream` from successfully initializing. Seems it only
ever worked in the case of a hybrid system where the first GPU initialized
was GBM-based.

Now we count `MetaRenderDeviceEglStream` instances (zero or one) externally.
This allows initialization to succeed when it happens to be the first (or
only) GPU. And so `MUTTER_DEBUG_FORCE_EGL_STREAM=1` now works.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2905>
2023-11-24 15:07:16 +08:00
Daniel van Vugt
6cb68d39f5 native/render-device-egl-stream: Remove unused variable
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2905>
2023-11-24 15:07:16 +08:00
Michel Dänzer
69e0ce36b1 renderer/native: Try 10 bpc formats for EGL surfaces
For scanout on a secondary GPU, for the time being try only formats
which are guaranteed to be renderable with GLES3, which notably excludes
10 bpc formats without alpha channel.

v2:
* Use separate format array for 10 bpc formats without alpha.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3139>
2023-11-23 20:11:31 +00:00
Michel Dänzer
e1f795ff79 onscreen/native: Add and use choose_onscreen_egl_config helper
If the EGL_KHR_no_config_context extension is supported, use it to
choose a format per onscreen which is compatible with the scanout CRTC
and the GL rendering API used.

Suggested by Jonas Ådahl.

v2:
* Drop code which checked for GLES3 renderability. Makes no sense for
  various reasons, in particular that EGLconfigs are about EGLSurfaces,
  whereas secondary GPU contexts use an FBO for blitting.
* Use error parameter directly for meta_renderer_native_choose_gbm_format
  call (Jonas Ådahl)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3139>
2023-11-23 20:11:31 +00:00
Michel Dänzer
4c42eab358 renderer/native: Refactor meta_renderer_native_choose_gbm_format helper
Preparation for the following commits, no functional change intended.

v2:
* Pass through MetaEgl pointer
v3:
* Make it return gboolean (Robert Mader)
v4:
* Add debug logging and corresponding purpose parameter
v5:
* Fix excessive function parameter indentation (Jonas Ådahl)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3139>
2023-11-23 20:11:31 +00:00
Sebastian Wick
3897bf68f7 tests/wayland-unit-tests: Order unit test categories alphabetically
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3394>
2023-11-22 13:56:48 +00:00
Sebastian Wick
c0952f02e7 tests/wayland-unit-tests: Use the same naming convention for all tests
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3394>
2023-11-22 13:56:48 +00:00
Sebastian Wick
e1812dbf86 tests/wayland: Order test clients and add missing dependencies
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3394>
2023-11-22 13:56:48 +00:00
Sebastian Wick
97c1d19017 wayland-buffer: Use MetaFormatInfo to find supported formats
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3280>
2023-11-22 12:11:38 +00:00
Sebastian Wick
dbdc821ca7 multi-texture-format: Expose immutable fields directly
Split the struct into mutable and immutable parts. Access the mutable
parts via getters and the immutable parts via a single struct. This
avoids copying around the immutable parts.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3280>
2023-11-22 12:11:38 +00:00
Sebastian Wick
6f1edfc776 common/drm-formats: Rename to MetaFormatInfo and simplify API
Every format kind has it's own function to search for a MetaFormatInfo
from which contains all the information.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3280>
2023-11-22 12:11:38 +00:00
Ivan Molodetskikh
2d1fc65b3a Adjust COGL_TRACE names to improve automatic processing
In profilers with a timeline or flame graph views it is a very common
scenario that a span name must be displayed in an area too short to fit
it. In this case, profilers may implement automatic shortening to show
the most important part of the span name in the available area. This
makes it easier to tell what's going on without having to zoom all the
way in.

The current trace span names in Mutter don't really follow any system
and cannot really be shortened automatically.

The Tracy profiler shortens with C++ in mind. Consider an example C++
name:

SomeNamespace::SomeClass::some_method(args)

The method name is the most important part, and the arguments with the
class name will be cut if necessary in the order of importance.

This logic makes sence for other languages too, like Rust. I can see it
being implemented in other profilers like Sysprof, since it's generally
useful.

Hence, this commit adjusts our trace names to look like C++ and arrange
the parts of the name in the respective order of importance.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3402>
2023-11-22 11:46:07 +00:00
Georges Basile Stavracas Neto
f96d6b0afe screen-cast/monitor-src: Bring back blitting
Now that the monitor screencast records to DMA-BUF buffers immediately
(since bc2f1145d8), and we know which phase of the paint rountines we
are (since last commit), we have the opportunity to bring back the
blitting technique.

Bring back blitting. This time, instead of simply failing if the blit
fails, add a fallback path that does a stage paint if something goes
wrong. Unlike the previous implementation of blitting, this one only
blits the current view - it does not blit all views that intersect
with the screencasted monitor.

Embedded cursors should still be fine because hardware cursor is
inhibited while embedded cursor screencasts are running.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3406>
2023-11-22 07:55:04 +00:00
Georges Basile Stavracas Neto
91bdb2b692 screen-cast/src: Track paint phase
Track where we are in terms of the paint cycle. Do this through an
enumeration that is passed through the paint vfuncs of screencast
sources.

Right now, this information is not used by any one of the sources,
but next patch will use it to prevent blitting when detached from
the paint cycle.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3406>
2023-11-22 07:55:04 +00:00
Robert Mader
9ddb0371c6 cursor-renderer/native: Disable HW cursor when inhibited by backend
We need to disable the hardware cursor in some situations, notably when
doing a screencast with clients that require an embedded cursor.

While a API to do so is in place already, until now we didn't actually
make use of it. Do so.

Closes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7007

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3412>
2023-11-20 22:51:57 +01:00
Jonas Ådahl
8d3696f39a monitor-manager/x11: Ignore errors when creating tiled monitors
The error is most likely a race where the tiled outputs disappeared
before we had the chance to turn them into a whole monitor. Ignoring the
error should be harmless, as we should be receive another RANDR event
where we'd eventually fix things up.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7120
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3335>
2023-11-18 10:33:23 +00:00
Carlos Garnacho
571acf57d1 backends/native: Make tablet devices "floating"
With the existing ClutterInputMode terminology (inherited from XI2),
hardware devices may be "physical" (i.e. attached to a logical device),
or "floating" (i.e. detached from all logical devices).

In the native backend, tablet devices are closer to "floating" than
"physical", since they do not emit events relative to the ClutterSeat
pointer logical device, nor drive the MetaCursorTracker sprite. This
is in contrast to X11 where all tablet devices drive the Virtual
Core Pointer by default, along with every other pointing device.

Change this mode in the Wayland backend to be more coherent. The
existing checks on the ClutterInputMode along Mutter seem appropriate
for handling these as floating devices, since they mainly care about
logical vs non-logical.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3393>
2023-11-17 20:49:18 +00:00
Mike Gorse
c1feb2dc40 screen-cast/window-stream: Mark as configured
This is needed for the pointer to be exposed to an existing libei session.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3403>
2023-11-17 19:43:48 +00:00
Sebastian Wick
63c6fe11fb window-actor/wayland: Keep track of when the geometry needs to be synced
The window actor can be mapped every frame, e.g. when it is dragged in
the overview. This commit keeps track when the geometry changed and we
didn't managed to sync the geometry yet and need to sync it at a later
time.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3404>
2023-11-17 16:08:36 +00:00
Sebastian Wick
9e036bfd23 window-actor/wayland: Map the window before trying to sync geometry
We need to chain up to the parent class to make sure the
WindowActorWayland is actually mapped which is required for the
sync_geometry_internal function to succeed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3404>
2023-11-17 16:08:36 +00:00
Sebastian Wick
2dbfc1c23d window-actor/wayland: Move map method to a more appropriate place
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3404>
2023-11-17 16:08:36 +00:00
Sebastian Wick
ee7f13fd84 window-actor/wayland: Return success status from syncing geometry
We do this by  moving it to a helper function. We will use this to keep
track of when syncing the geometry is actually needed in a later commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3404>
2023-11-17 16:08:36 +00:00
Sebastian Wick
90d27e7b2e window-actor: Adjust sync_geometry
At the end of the sync_actor_geometry function the window buffer_rect
and the WindowActor position and size are the same and consistent.

Call the virtual method at the end and let the implementations look at
either the buffer_rect or the actor position/size itself.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3404>
2023-11-17 16:08:36 +00:00
Sebastian Wick
976bcef3d5 window-actor/wayland: Sync geometry only when window is mapped
In some cases the window is not mapped when the geometry changes.
Without the mapped window the surfaces are not mapped either and don't
have a sensible allocation.

This patch makes sure we abort syncing the geometry if the window is not
mapped and also make sure we sync geometry when the actor eventually
does get mapped.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3152
Fixes: 8f4ab53bd ("window-actor/wayland: Ensure to use allocation for black background check")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3401>
2023-11-15 17:03:45 +01:00
Ivan Molodetskikh
47814fab71 Remove COGL_TRACE_BEGIN in favor of BEGIN_SCOPED
Scoped traces are less error prone, and they can still be ended
prematurely if needed (this commit makes that work). The only case this
doesn't support is starting a trace inside a scope but ending outside,
but this is pretty unusual, plus we have anchored traces for a limited
variation of that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3396>
2023-11-15 13:57:43 +00:00
Bilal Elmoussaoui
371d28a766 cleanup: Stop allowing deprecated Cogl API usage
Allow only specific files to use those deprecated APIs making
it easier to find where deprecated APIs are still in use
and avoid introducing new usages without being noticed

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3400>
2023-11-15 13:13:00 +01:00
Bilal Elmoussaoui
da2771e293 tests/cleanup: Stop allowing deprecated GLib API usage
We only use one deprecated API, so allow only that file to contain
deprecated APIs

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3400>
2023-11-15 13:12:13 +01:00
Bilal Elmoussaoui
7de0707dfa clutter/cleanup: Stop disabling deprecated API usage warnings
As we have stopped using the deprecated APIs all over clutter, so let us
enforce that newly introduced code doesn't use code that gets depreccated
in the future

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3400>
2023-11-15 13:12:13 +01:00
Bilal Elmoussaoui
f5dac3a5d9 build: One config file to rule them all
Group all the three config files from clutter/cogl/meta into one
and also remove unnused configurations and replace duplicated ones

This also fixes Cogl usage of HAS_X11/HAS_XLIB to match the expected
build options

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3368>
2023-11-15 12:00:19 +00:00
Michel Dänzer
ca5bf847ee wayland/surface: Rename output/protocol_state to applied/committed_state
This is more consistent with Wayland protocol spec language.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3395>
2023-11-15 10:55:21 +00:00
Ivan Molodetskikh
31c5525382 wayland/dma-buf: Name readiness source
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3398>
2023-11-15 10:24:41 +00:00
Ivan Molodetskikh
a1b2725238 thread: Name callback source
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3398>
2023-11-15 10:24:41 +00:00
Ivan Molodetskikh
6c2383d625 thread: Name wrapper source
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3398>
2023-11-15 10:24:41 +00:00
Ivan Molodetskikh
a6e23dc9e2 thread/impl: Correct task source name
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3398>
2023-11-15 10:24:41 +00:00
Ivan Molodetskikh
be81296fb2 eis: Name event source
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3398>
2023-11-15 10:24:41 +00:00
Bilal Elmoussaoui
306ff81004 clutter: Drop ClutterUnits
As nothing uses it now that ClutterScript was dropped

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3354>
2023-11-14 16:13:19 +01:00
Bilal Elmoussaoui
8a3181f741 clutter: Make json-glib a debug only dependency
Currently, json-glib is used for two things:
- For loading scripts, nothing seems to use that in real life other
than some tests
- For debugging paint nodes

For now, the PR drops the first use case and only require json-glib
if it is a debug build

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3354>
2023-11-14 16:13:18 +01:00
Zander Brown
c42fa34b01 clutter/actor: Rename ::actor-{added,removed} to ::child-{added,removed}
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3384>
2023-11-14 09:59:52 +00:00
Zander Brown
7113ecd86c clutter/actor: Take responsibility for ::actor-{added,removed}
These signals have de facto been ClutterActor signals for some time now,
simply move them in from ClutterActor

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3384>
2023-11-14 09:57:39 +00:00
Zander Brown
e1cdeb0319 clutter/layout-manager: Consume Actors not Containers
We don't actually need the host to be a container, so simply work on
actors saving us a few casts.

This'll simplify dropping ClutterContainer entirely later, and
StViewport/ShellWindowPreviewLayout will also need to be updated for the
new signatures

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3384>
2023-11-14 09:57:39 +00:00
Carlos Garnacho
9399c984cc backends/native: Avoid redundant changes to sticky keys state mask
Sticky keys configuration changes reset the pressed modifier state mask,
even though the XKB state might already match with the expected new
state. In those cases we can avoid the XKB state mask update completely.

This also fixes a crash at initialization with sticky keys toggled on,
since configuring the device a11y settings will trigger a XKB state
mask merely reassuring the initial state with no modifiers pressed,
while the connection between the ClutterSeat and the impl object has
not been set up yet. This crash was introduced by commit 00bb4190b
("backends/native: Drop device_native->seat_impl field").

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3392>
2023-11-13 16:47:21 +00:00
Sebastian Wick
ad7ce7c7ca tests/stacking: Add pointer rest and auto raise tests
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3258>
2023-11-13 14:22:44 +00:00
Sebastian Wick
ac33792db4 tests/stacking: Add a test for sloppy focus
Tests that
* the window under the cursor has focus
* focus_default_window won't move the focus away from a previously
  focused window even if the cursor is somewhere else

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3258>
2023-11-13 14:22:44 +00:00
Sebastian Wick
de2daf65b4 wayland-pointer: Call meta_window_handle_enter when focusing desktop
When the desktop is focused instead of a window we want to tell the core
about this to handle focus-mode mouse. This is handled by looking for
CLUTTER_LEAVE events where the newly focused window is NULL.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3258>
2023-11-13 14:22:44 +00:00
Sebastian Wick
49d1af2023 display: Deal with destroying windows in pointer rest callback
Take a reference to the window to make sure the MetaFocusData->window
pointer is not pointing to a freed object.

Also make sure that the window that we want to focus is not currently
unmanaging.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3258>
2023-11-13 14:22:44 +00:00
Sebastian Wick
44fcf33156 display: Handle entering NULL windows (desktop)
On X meta_window_handle_enter was called when the desktop window was
entered. On wayland the "desktop" is no window anymore. We still want to
inform the core that the desktop is focused, so it can unfocus windows
if focus-mode is mouse.

This commit prepares the core for handling a NULL windows to mean the
desktop.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3258>
2023-11-13 14:22:44 +00:00
Sebastian Wick
5a33b0075a core: Move window enter/leave to display
The following commits will make it possible to pass a NULL window to
display_handle_window_enter/leave to represent the cursor entering the
desktop. This means it can't be a method of the window class anymore.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3258>
2023-11-13 14:22:44 +00:00
Sebastian Wick
c73e178a2d workspace: Refactor focus_default_window
The existing nested if-else statements are hard to follow. Handle cases
and return as early as possible.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3258>
2023-11-13 14:22:44 +00:00
Sebastian Wick
8a1388c930 workspace: Focus on existing focused window if possible
If we have an existing focused window that may have focus, default focus
will leave the focus there. An unmanaging window for example must not
have focus and default focus will continue to select another window in
this case.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3258>
2023-11-13 14:22:44 +00:00
Sebastian Wick
87907674f5 tests/test-client: Use draw_surface for subsurface corner case tests
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3388>
2023-11-12 12:49:22 +01:00
Carlos Garnacho
91d70ad7a2 core: Query pad devices on MetaPadActionMapper initialization
This object might miss pad devices being made available too early
during seat construction at Mutter initialization, and not initialize
its own backing data properly for these.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3143
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3370>
2023-11-10 21:05:44 +00:00
Carlos Garnacho
2dec4dd088 core: Manage MetaPadActionMapper devices through events
Use the CLUTTER_DEVICE_ADDED/REMOVED set of events instead of the
ClutterSeat signals to track device availability.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3370>
2023-11-10 21:05:44 +00:00
Florian Müllner
b611569b26 clutter/bin-layout: Remove custom alignment properties
The layout manager takes the generic ClutterActor expand/align
properties into account. Everyone should already use those instead
of the custom layout/child properties, so removing them should have
little fallout, while making for a nice cleanup.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3382>
2023-11-10 00:24:26 +01:00
Zander Brown
84c3a3fbef clutter/script-parser: Drop support for child properties
Which means ClutterContainer is no longer special cased, removing one of
it's final users.

In practice ClutterScript is unused anyway.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3377>
2023-11-09 18:11:00 +00:00
Zander Brown
7ae7beaa94 tests: Stop using ClutterContainer
clutter_container_{add,remove}_{,actor} have been deprecated for a
decade, using them rather than ClutterActor's API in tests is a tad
silly

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3377>
2023-11-09 18:11:00 +00:00
Bilal Elmoussaoui
81c75b3157 clutter/swipe-action: Remove deprecated swept signal/vfunc
Also update the test to use swipe signal instead. Nothing seems to
use the signal from GNOME Shell side though

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3379>
2023-11-09 16:42:24 +00:00
Michel Dänzer
8ec26dfd27 test/wayland: Add subsurface-corner-cases unit test
It tests various sub-surface corner cases. It would fail without the
previous fixes.

v2:
* Fix draw_descendant parameter formatting
* Make toplevel window fullscreen (Robert Mader)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3364>
2023-11-08 09:47:57 +00:00
Michel Dänzer
35d92e0fac wayland/subsurface: Drop unapplied subsurface state on unmap
To prevent it from getting spuriously applied if a wl_subsurface is
later created again for the same wl_surface.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3364>
2023-11-08 09:47:57 +00:00
Michel Dänzer
cdfc8cf967 wayland/subsurface: Reset position to (0, 0) in permanent unmap helper
To make sure a new wl_subsurface created for the same wl_surface won't
inherit the position from the wl_subsurface being destroyed.

v2:
* Move into permanently_unmap_subsurface

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3364>
2023-11-08 09:47:57 +00:00
Michel Dänzer
9dc5d98607 wayland/subsurface: Use unmap helper in destructor & parent_destroyed
Instead of duplicating the code in both.

v2:
* Rename helper to make it clear(er) that it permanently unmaps the
  sub-surface
* Move transaction allocation & commit into the helper

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3364>
2023-11-08 09:47:57 +00:00
Michel Dänzer
9f4eee33a2 wayland/subsurface: Remove redundant g_node_unlink call
If the sub-surface has no parent, the node was already unlinked by
get_subsurface_placement_op.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3364>
2023-11-08 09:47:57 +00:00
Michel Dänzer
a2863fc1ea wayland/subsurface: Hook up sub-surface placement ops in callers
wl_subsurface_place_above/below need to hook it up to the parent
surface's pending state, so that it gets picked up next time the parent
is committed.

v2:
* Adapt to wl_subsurface_destructor not resetting sub-surface position

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3364>
2023-11-08 09:47:57 +00:00
Michel Dänzer
6718e267fb wayland/transaction: Call add_placement_surfaces from commit
This is simpler, and makes sure it's called only once for each surface
in the transaction as committed.

v2:
* Use array for surface states with placement ops (Jonas Ådahl)
v3:
* Use GPtrArray instead of GArray (Robert Mader)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3364>
2023-11-08 09:47:57 +00:00
Michel Dänzer
66408f907f wayland/subsurface: Fix actor hiding in sync_actor_subsurface_state
Unmapped sub-surfaces need to be hidden instead of just ignored.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3364>
2023-11-08 09:47:57 +00:00
Michel Dänzer
6fd77ce515 wayland/transaction: Call sync_actor_state for unmapped sub-surfaces
This is necessary to make sure the unmapped sub-surface is no longer
visible.

v2:
* Use META_IS_WAYLAND_SUBSURFACE (Jonas Ådahl)
* Use same sequence of assignments in both cases

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3364>
2023-11-08 09:47:57 +00:00
Michel Dänzer
0bd40968ab wayland/transaction: Handle NULL from->state in entry_merge_into
This never happened so far, but it will with following commits.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3364>
2023-11-08 09:47:57 +00:00
Sebastian Keller
0807579cdd window: Add IS_ALIVE to get_property
This was causing looking glass to wrongly claim that is_alive = false
for all windows.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3367>
2023-11-08 09:02:32 +00:00
Sebastian Keller
d978ab1890 delete: Don't wrongly set window as not alive when pings are disabled
meta_display_ping_window() does nothing when check-alive-timeout is set
to 0, but meta_window_check_alive_on_event() was relying on it to reset
the events_during_ping. Without this events_during_ping was just
counting up until the threshold was reached and the window was marked as
not alive, preventing further pointer events from being sent to the
window.

Fix this by not doing anything in meta_window_check_alive_on_event() if
check-alive-timeout is 0, similar to meta_display_ping_window().

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3142
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3367>
2023-11-08 09:02:32 +00:00
Carlos Garnacho
8cae7ff0f6 core: Ignore locked modifiers in keycombo machinery
Locked modifiers should probably not have an effect on keybindings
while toggled. this is most relevant for modifiers that can be
either/both pressed or locked (e.g. Caps Lock key), if used in
keybindings.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3369>
2023-11-08 08:07:41 +00:00
Carlos Garnacho
38228da550 clutter: Add ClutterModifierSet argument to key event constructor
This struct contains the pressed/latched/locked set of modifiers applying
to the event, and may be filled in by backends generating those events.
Other places where we forward modified key events, state may be normally
obtained from the original event.

Since this constructor is used in a variety of places, this commit
updates them all in one go.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3369>
2023-11-08 08:07:41 +00:00
Sebastian Keller
145cac3a37 surface-actor: Fix leak when setting non-empty clip region
When 655b4a9c75 ported this to MtkRegion, it removed the unref of the
copied region after setting it in the shaped texture.

Fixes: 655b4a9c7 ("Port to MtkRegion")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3140
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3365>
2023-11-06 20:30:37 +01:00
Corentin Noël
a772c709aa wayland/surface: Make MetaWaylandSurface public
Only expose the method to get the associated MetaWindow.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3340>
2023-11-04 01:12:11 +00:00
Sebastian Wick
5dbb6c31e9 cogl: Rename COGL_PIXEL_FORMAT_G_16 with COGL_PIXEL_FORMAT_R_16
Mechanical rename. The format already describes the first two (rg/xy)
components.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3276>
2023-11-04 00:11:52 +00:00
Sebastian Wick
764d5dd67b cogl: Rename COGL_PIXEL_FORMAT_G_8 with COGL_PIXEL_FORMAT_R_8
Mechanical rename. The format already describes the first (r/x)
component.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3276>
2023-11-04 00:11:52 +00:00
Sebastian Wick
4e088cac0e core/window: Propagate focus appearance to all ancestors
The loop in meta_window_propagate_focus_appearance breaks if any
ancestor has attached_focus_window == focus_window but further ancestors
might still have a different attached_focus_window.

Continue the loop until the root ancestor instead.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2913
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3356>
2023-11-03 14:20:39 +00:00
Sebastian Wick
6f6f16c2b1 tests/wayland-test-client-utils: Sync event serial in same dispatch
If multiple sync events are send in the same dispatch, a further call to
wait_for_sync_event will get stuck. Fix this by keeping track of the
latest sync event serial in the display and always compare against that.

This also means sync event sequences must start at 0 and increase by 1.
The wayland-x11 interop test is the only one where that wasn't already
the case.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3358>
2023-11-03 12:02:29 +00:00
Bilal Elmoussaoui
c79332a5f8 build: Remove no longer existing config options
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3349>
2023-11-03 11:36:07 +00:00
Bilal Elmoussaoui
57cfd1ab75 cleanup: Remove unneeded ifdef
As it is just a comment

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3349>
2023-11-03 11:36:07 +00:00
Bilal Elmoussaoui
7a6a821ed0 cogl: Drop unnused experimental API config
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3349>
2023-11-03 11:36:07 +00:00
Bilal Elmoussaoui
c683d971a1 compositor: Move region_to_cairo_path helper where it is used
The helper is X11 specific and only used once in that file. Moving
it there would help us in the future to build without cairo if x11 is disabled

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3292>
2023-11-03 11:27:52 +00:00
Bilal Elmoussaoui
9f58fb121f wayland: Rename peek_cairo_region to peek_region
So that grep 'cairo_' won't show these false positives and it is no longer
a cairo_region anymore.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3292>
2023-11-03 11:27:52 +00:00
Bilal Elmoussaoui
655b4a9c75 Port to MtkRegion
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3292>
2023-11-03 11:27:52 +00:00
Bilal Elmoussaoui
7c98910488 mtk: Add a Region type
Currently, we use cairo_region_t despite it being a thing wrapper around pixman_region_32
In order to push for a cairo-less and wayland only build in the future, replace
cairo_region_t with a thin wrapper that is almost a copy of the upstream cairo implementation

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3292>
2023-11-03 11:27:52 +00:00
Bilal Elmoussaoui
058afb67f4 actor/frames: Check if frame bounds existing before copying them
Avoids a failure once we port to MtkRegion as we ensure that the region is not NULL

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3292>
2023-11-03 11:27:52 +00:00
Bilal Elmoussaoui
f84733f791 meta/stage: Check if the swap region is not empty before transforming it
As cairo_region_create_rectangles would return NULL if n_rects=0 but the upcoming
commits which port to MtkRegion disallows that

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3292>
2023-11-03 11:27:52 +00:00
Sebastian Wick
c645b6c6fa tests/wayland-unit-tests: Make toplevel_apply_limits easier to follow
Use the wait_for_sync_point method instead of the convoluted callback
and state handling.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3348>
2023-11-03 10:34:27 +00:00
Sebastian Wick
8c3c29d0c0 tests/wayland-test-utils: Keep track of process exit
Whenever a MetaWaylandTestClient exists without success the calling test
will fail. This fixes a bunch of cases where the test would get stuck
waiting for some event from the client when it already died and won't be
able to send the event.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3348>
2023-11-03 10:34:27 +00:00
Sebastian Wick
10a840c92d kms/impl-device: Handle NULL gamma updates
We should not ever get one right now, but if we do, a NULL update means
we bypass the gamma LUT.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3309>
2023-11-01 13:16:15 +00:00
Sebastian Wick
e21f839776 tests/dbus-runner: Detect nested invocations to skip mocking
The test and dist CI jobs run wrap the meson calls in dbus-runner to
avoid setting up dbus servers and mocking services for every test but
the dbus-runner invocation from meson test didn't actually skip all the
setup.

This nested mocking also doesn't work because the system bus is assumed
to be the host system bus and not a mocked one.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2618>
2023-11-01 10:55:04 +00:00
Jonas Ådahl
e848f86514 tests/dbus-runner: Forward logind methods when not in KVM
This means one can run meta-dbus-runner.py effectively mocking
everything relevant except logind itself, meaning one can run from a TTY
and get permission to mode set etc, while still mocking things like
gsd-color, colord, etc.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2618>
2023-11-01 10:55:04 +00:00
Jonas Ådahl
a174819b32 tests/dbus-runner: Move logind helper into a separate file
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2618>
2023-11-01 10:55:04 +00:00
Bilal Elmoussaoui
2c4968fb41 cogl: Port Primitive away from CoglObject
- The associated CoglAttribute's are now stored in GPtrArray as suggested
by carlosg in
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193?commit_id=19b619073b3c7d311c64e0a997558f943b38c94a#note_1849281
- cogl_primitive_set_attributes was dropped for "simplicity"
especially that nothing uses it.
- As this is the last remaining CoglObject subclass, the commit also drops
all the CoglObject related macros/types

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
b044e26e62 cogl: Drop no longer used user data helpers
This also drops the test-object conform test as it doesn't do anything
interesting and the gobject qdata functionnality is already well tested
across the platform

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
9b9e12edb2 cogl: Port Node/Pipeline/PipelineLayer away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
739c59fefc cogl: Port Buffer* away from CoglObject
Make CoglBuffer an abstract class and inherit the various Cogl*Buffer types from it.
As none of the subclasses is overriding the vtable functions, they were not turned into
vfuncs but plain function pointers in CoglBuffer.
We still use _cogl_buffer_initialize until we port the various params into actual construct-only
properties, similar to the previous commit for CoglTexture.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
863163cc6e cogl: Port Texture* away from CoglObject
- Make Texture a parent GObject class and move the vtable funcs as vfuncs
instead of an interface as we would like to have dispose free the TextureLoader.
- Make the various texture sub-types inherit from it.
- Make all the sub-types constructors return a CoglTexture instead of their respective
specific type. As most of the times, the used functions accept a CoglTexture,
like all the GTK widgets constructors returning GtkWidget.
- Fix up the basics of gi-docgen for all these types.
- Remove CoglPrimitiveTexture as it is useless: It is just a texture underhood.
- Remove CoglMetaTexture: for the exact same reason as above.
- Switch various memory management functions to use g_ variant instead of the cogl_ one

Note we would still want to get rid of the _cogl_texture_init which is something
for the next commit

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
4792db371a cogl/cleanup: Stop using CoglHandle
We use a GParamSpecPointer for CoglPipeline until that
gets ported from CoglObject

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
bbdc0b42fc cogl: Port Program away from CoglObject
This also switches from using CoglHandle to CoglProgram where
appropriate
which allowed dropping a duplicated function that had the wrong
signature...

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
3aaae11d6b cogl: Port Shader away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
c1e6948e42 cogl: Port Bitmap away from CoglObject
We still need to use set_qdata_full as CoglBitmapPixbuf would free
the data itself by unrefing the pixbuf

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
d71fe5c55e cogl: Port OnscreenTemplate away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
df8ae83040 cogl: Port Indices away from CoglObject
Also renames Indices.get_type to Indices.get_indices_type to avoid
a conflict with the generated Object.get_type function

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
f0923aab44 cogl: Port Attribute away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
312d5c367e cogl: Port Snippet away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
748c1fb9f4 cogl: Port FrameInfo away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
f2c55d6479 cleanup: Remove header only functions
The functions are defined only in the header file and don't have
an actual implementation

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3352>
2023-10-28 12:37:31 +02:00
Michel Dänzer
f128bb4db1 Remove unused _clutter_stage_window_get_wrapper
Unused since 89daa8d4fa ("wayland: drop wayland backend").

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3178>
2023-10-26 09:49:29 +00:00
Sebastian Wick
cfb3a20215 core/window: Don't mark comment as documentation
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3347>
2023-10-25 20:45:10 +00:00
Bilal Elmoussaoui
98bd2aa2c2 clutter: Move cairo pixel format to cogl
As Cogl already defines a pixel format enum, it makes sense to move such
endian dependant pixel format there

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3086>
2023-10-25 20:03:08 +00:00
Bilal Elmoussaoui
c0fdf0a470 clutter: Drop set_source_color helper
The helper doesn't do anything that makes it worth
to be exposed as public API. End-users, such as GNOME Shell could have
an in-tree helper if they end up using it that much.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3086>
2023-10-25 20:03:08 +00:00
Sebastian Wick
9a6ddd2dff window: Add a target workspace for raise_and_make_recent
The shell might raise and make windows recent for another workspace when
an app gets activated on another workspace. Making the windows only
recent on the current workspace thus results in inconsistent focus when
another window of the same app is closed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3315>
2023-10-25 13:44:27 +02:00
Florian Müllner
13d9edc687 wayland/client: Add make_desktop() method
There are existing extensions that implement desktop icons as
a combination of a GTK program and a small extension to make
the wayland window behave as if it was of type DESKTOP on X11.

That's quite painful, as it requires reimplementing WM behavior
that is already implemented in mutter itself (stacking, stickiness,
skip-taskbar, ...), as well as modifying gnome-shell to consider
the window in addition to "real" DESKTOP windows (workspace-switch
animations, ctrl-alt-tab, ...).

In addition to that, other extensions may also have special handling
of DESKTOP windows, and their code cannot easily be monkey-patched
to handle "alternative" desktop icons.

This whole game of whack-a-mole can easily be avoided by allowing
desktop-icons extensions to mark their desktop windows as DESKTOP,
so do just that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3305>
2023-10-24 19:25:24 +00:00
Florian Müllner
6a22b52579 window: Consider stickiness changes on feature recalc
Some properties like the window type can affect the stickiness.
Make sure workspaces are updated in that case to pick up the
change.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3305>
2023-10-24 19:25:24 +00:00
Florian Müllner
b9008ee83d window: Handle layer of DESKTOP windows
Assigning the corresponding stack layer of DESKTOP windows is
currently X11 specific, because there is no way for wayland
clients to set the DESKTOP window type.

This is about to change, so move the code to the generic layer
handling.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3305>
2023-10-24 19:25:24 +00:00
Alexandros Frantzis
3a5ecca348 wayland: Send keyboard modifiers after the enter event
Change the order of events to adhere to the Wayland specification for
wl_keyboard.enter, which mandates:

> The compositor must send the wl_keyboard.modifiers event after
> this event.

Mutter currently sends the modifiers event before the enter event,
which may break applications that require information about the focused
surface in order to properly handle the modifiers.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2231
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3341>
2023-10-24 11:18:30 +03:00
Bilal Elmoussaoui
12c85002e9 clutter: Depend on gdk-pixbuf only for tests
As clutter doesn't use any of it APIs by itself

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3097>
2023-10-23 16:32:35 +00:00
Bilal Elmoussaoui
8ae7ec08b4 mutter: Explicitly depend on gdk-pixbuf
As it is used by MetaBackgroundImageCache

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3097>
2023-10-23 16:32:35 +00:00
Bilal Elmoussaoui
138767fa7c cogl: Drop unnused functions
These functions ends-up calling gdk-pixbuf for loading textures/bitmaps
from a file and they don't seem to be used anywhere.

These changes are only useful with the following up commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3097>
2023-10-23 16:32:35 +00:00
Peter Hutterer
7a44b112c1 input-capture: Add more barrier tests, mostly for invalid barriers
Remove the warning to info since we now expect it to happen and add a
set of barrier edge cases that we expect to fail.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3319>
2023-10-23 06:57:45 +00:00