1
0
Fork 0
Commit graph

2099 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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