1
0
Fork 0
Commit graph

31204 commits

Author SHA1 Message Date
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
Sebastian Keller
c86d8a23c3 clutter/actor: Don't write uninitialized out values on failed transform
clutter_actor_get_transformed_position() would write the uninitialized
values of v2 when clutter_actor_apply_transform_to_point() fails in
_clutter_actor_fully_transform_vertices() because the actor has not been
added to the stage yet.

When called from JS this would overwrite the zero initialized values
passed in from gjs. If the uninitialized values now happen to correspond
to one of the NaN float values used by mozjs to represent a pointer
type, this would lead to seemingly random crashes in mozjs code later
on.

Avoid this by using _clutter_actor_fully_transform_vertices() directly,
which allows us to check if it failed.

Related: https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/issues/469
Related: https://gitlab.gnome.org/GNOME/gjs/-/issues/591
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3453>
2023-12-15 15:08:22 +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
49f76f1295 ci: Mark the regex to find chunks in code style checks as regex string
Fixes
    check-style.py:23: SyntaxWarning: invalid escape sequence '\+'
    check-style.py:24: SyntaxWarning: invalid escape sequence '\d'

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3454>
2023-12-15 14:49:57 +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
Daniel van Vugt
85f173d0d7 clutter: Pass 'radius' to public blur APIs instead of 'sigma'
Although they're in the same units, `radius` is easier to understand than
`sigma` and makes the public API independent of the blur algorithm used
behind the scenes. We now only keep the `sigma` terminology where the
implementation is Gaussian-specific.

The assumption that `sigma = radius / 2.0` is actually not new here. We
just move it from `_st_create_shadow_pipeline` (gnome-shell!1905) into
`clutter_blur_new`.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1908>
2023-12-14 18:12:55 +00: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
90cff013a5 clutter: Remove unused enums
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3437>
2023-12-13 11:20:04 +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
05cd7bc6cb cogl: Remove unused Buffer:usage-hint
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3437>
2023-12-13 11:20:04 +00:00
Bilal Elmoussaoui
bc44d2855b cogl: Initialize first_index_to_prune
I don't know how come that the compiler wasn't complaining about it till now

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3437>
2023-12-13 11:20:04 +00:00
Bilal Elmoussaoui
6b29371db3 cogl: Remove unused private functions
The commit also moves certain functions from the private header
as they are not used anywhere else and removes COGL_EXPORT
when the function is supposed to be private and is not used outside of
cogl

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3437>
2023-12-13 11:20:04 +00:00
Bilal Elmoussaoui
5d9e9707dd cogl: Remove unused CoglPipelineEvalFlags
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3437>
2023-12-13 11:20:04 +00:00
Bilal Elmoussaoui
893e6e49b1 clutter: Drop unused private functions/defines
The commit also stops defining certain functions in a private header
when they are only used in the same file.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3437>
2023-12-13 11:20:04 +00:00
Bilal Elmoussaoui
4b7a29377b clutter: Drop remaining params nick/blurbs
Also the i18n macros from clutter as they are no longer used

Leftover from https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3101

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
Peter Hutterer
ef8b2f2893 ci: Mark our git clone as a safe directory
fatal: detected dubious ownership in repository at '/builds/whot/mutter'
To add an exception for this directory, call:
	git config --global --add safe.directory /builds/whot/mutter

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3434>
2023-12-13 11:09:32 +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