1
0
Fork 0
Commit graph

12211 commits

Author SHA1 Message Date
Carlos Garnacho
017eff6663 wayland: Avoid MetaWaylandKeyboard struct access
Use the MetaWaylandSeat focus, instead of peeking at MetaWaylandKeyboard
internals.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3627>
2024-03-01 14:37:58 +00:00
Carlos Garnacho
81df305645 wayland: Add MetaWaylandSeat input focus getter
This will be useful for MetaWaylandCompositor to get the
current input focus for keyboard and other related devices.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3627>
2024-03-01 14:37:58 +00:00
Sebastian Keller
9e77d45704 Revert "frames: Always initialize _MUTTER_FRAME_EXTENTS to zero"
The _MUTTER_FRAME_EXTENTS need to have the correct size before the
window is shown, otherwise the client window size will effectively have
the headarbar height subtracted when initially syncing the frame/client
geometries.

This reverts commit f10b3eac62.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3628>
2024-03-01 10:54:32 +01:00
Carlos Garnacho
c12991936e wayland: Let the tablet tool handle the handle_event() return value
This was being ignored, and the events propagated always. This may lead
to confusion with Clutter about who handled what, since shockingly the
events may be delivered to clients.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3317
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3625>
2024-02-28 22:46:03 +00:00
Carlos Garnacho
4c4c0b847d wayland: Do not claim tablet tool events as consumed without focus
If the tablet tool has no focus, it should let events go through.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3625>
2024-02-28 22:46:03 +00:00
Sebastian Wick
8234f5bc7e egl: Return success status from meta_egl_query_device_string
QueryDeviceString can successfully return NULL. The convention however
is that when NULL is returned, the error will be set.

This commit makes the returned string an output parameter which allows
us to return the success status and have the error set accordingly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3614>
2024-02-27 13:13:53 +00:00
Sebastian Wick
46619573e0 egl: Make sure GError gets set when we return FALSE
The convention is that when a function returns FALSE or NULL, the error
will be set. In this file we call set_egl_error but it might not set an
error. Code of the form

if (egl_do_thing (..., &error))
 use_error (error);

will crash in those cases.

This commit makes sure we always set the error even if EGL doesn't give
us an error.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3614>
2024-02-27 13:13:53 +00:00
Doğukan Korkmaztürk
a816470996 screen-cast-stream: Remove stale comments and an unused variable
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3592>
2024-02-27 12:38:01 +00:00
Marco Trevisan (Treviño)
839158ffd5 build/meta: Add explicit dependency on Gio-2.0 gir
We depend on Gio for many introspection features (GSettings, GFile...)
without this we'd end up not having many symbols being exposed.

And errors such as
  Warning: Meta: meta_display_add_keybinding: argument settings:
    Unresolved type: 'GSettings*'

As per previous commit we now have this dependency implicitly, but still
it's better to make it clearer in case Clutter would drop it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3620>
2024-02-27 10:35:06 +01:00
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