1
0
Fork 0
Commit graph

1837 commits

Author SHA1 Message Date
Jonas Ådahl
ccb6a7e84f monitor: Allow vendor/product/serial to return NULL
Same applies to MetaOutput. The reason for this is to make it possible
to more reliably know when there was EDID telling us about these
details. This will be used for colord integration.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
2022-09-01 14:31:40 +00:00
Carlos Garnacho
9d558e334c wayland: Unlink surface listener when freeing token
If the token ended up consumed and freed, we might leave a dangling
destroy listener after freeing the token struct.

Fixes: ed516dde89 (wayland: Add destruction listener to activation token surface)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2594>
2022-08-25 11:15:01 +02:00
Carlos Garnacho
ed516dde89 wayland: Add destruction listener to activation token surface
In the timespan between an activation token being created and the
token being used by the activated application, the surface that started
the activation request may end up destroyed/disposed.

In that case, the token would be left with a stale surface pointer,
maybe causing crashes later on. Set up a destroy notification listener
so that we do know to unset the token surface if that situation arises,
this will result in Mutter not considering the token activatable, thus
maybe issuing the "Application needs attention" notification if the
activated surface did not immediately get focus. In any case this is
better than a compositor crash.

A typical situation where this may happen is "Open With..." dialogs,
since those don't live long after launching the application.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2390
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2592>
2022-08-23 22:56:42 +02:00
Carlos Garnacho
9c402bd091 wayland: Ensure to remove destroy listener for MetaWaylandBuffer
Avoid the chance of invalid memory access by leaving the wl_listener
behind when handling the destroy notification.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2588>
2022-08-23 17:06:07 +00:00
Carlos Garnacho
f4f39d3a2c wayland: Ensure to unlink destroy listeners for subsurfaces
There is some surface tracking going on here, and all notify handlers
are possibly leaving the linked wl_listener behind. Ensure it is unlinked
in all destroy notification functions.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2588>
2022-08-23 17:06:07 +00:00
Carlos Garnacho
51064c1b4e wayland: Ensure to unlink destroy listeners after destruction
This is missed in some wl_listeners added
through wl_resource_add_destroy_listener(). Ensure this is done consistently
for all notify functions.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2588>
2022-08-23 17:06:07 +00:00
Carlos Garnacho
0d47b467f6 wayland: Fix thinko in paired tablet loop filter
This condition is inverted of how it should be. Since pad focus relies
on grouped devices lookups (e.g. pads not grouped with a tablet do not
focus surfaces), this fixes issues in pad focus and event propagation to
wayland clients.

Fixes: fff3654941 - wayland: Check input device capabilities in tablet seats
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2573>
2022-08-13 00:39:54 +02:00
Jonas Ådahl
5f96194e9e window/wayland: Always update the monitor when updating
If the window didn't have a size, it would still have a monitor, and
when we are asked to update, we must update, as the old monitor might
not be kept around, leaving us vulnerable to use after free.

Avoid not updating the monitor by using the stored IDs (preferred, or
previous) to find suitable logical monitors, with the primary monitor
being the last fallback unless we're completely headless.

This fixes the assert

  !window->monitor ||
  g_list_find (meta_monitor_manager_get_logical_monitors (monitor_manager),
               window->monitor)

in meta_window_update_for_monitors_changed() being hit when a Wayland
window has been created, but not mapped, when a hotplug happens.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2554>
2022-08-11 11:32:42 +00:00
Jonas Ådahl
24965a78da window: Make monitor from rect finder helper more clearly named
The function finds a suitable logical monitor given the window
rectangle; this wasn't all that clear from the name
"calculate_main_logical_monitor".

This is in preparation for finding a new logical monitor using things
other than the geometry of the window.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2554>
2022-08-11 11:32:42 +00:00
Robert Mader
01a4ec1841 wayland/outputs: Report actual monitor transform
Now that we support Wayland buffer transforms in all cases, we can
properly report them to outputs.
Also make sure we resend the output geomerty on transform changes.

This partly reverts commit bda9c359

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/344>
2022-08-05 20:30:50 +02:00
Robert Mader
385df73276 wayland/cursor-surface: Pass buffer-transform to cursor sprite
This was previously forgotten, effectively disabling pre-rotated
hardware cursors.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/344>
2022-08-05 20:30:50 +02:00
Jonas Ådahl
a07fd4ee66 wayland/dma-buf: Only try to query KMS device on native backend
This fixes a crash when using the nested backend and DMA buf Wayland
clients.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2553>
2022-08-04 09:38:47 +02:00
Jonas Ådahl
2cb7499735 wayland: Add single pixel buffer support
The "single pixel buffer" Wayland protocol extension provides a way for
clients to create 1x1 buffers with a single color, specified by
providing the color channels (red, green and blue) as well as the
alpha channel as a 32 bit unsigned integer.

For now, this is turned into a 1x1 texture. Future potential
improvements is to hook things up to the scanout candidate logic and
turn it into a scanout capable DMA buffer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2246>
2022-08-02 12:19:42 +00:00
Jonas Ådahl
34475e7e98 wayland/dma-buf: Always send modifiers if AddFB2() is supported
To Wayland clients, it doesn't matter how we configure our onscreen
buffers, since they don't necessarily have the same bandwidth issues
related to mode setting, whichis the primary reason why we disable
modifiers using the udev rule, so simply check whether importing with
modifiers will work at all and advertise modifiers if so is the case.

This might help avoid issues using legacy non-modifiers path in drivers.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2546>
2022-08-02 10:04:52 +00:00
Jonas Ådahl
1844dcc08e wayland/dma-buf: Get backend via MetaContext
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2546>
2022-08-02 10:04:52 +00:00
Jonas Ådahl
bd4dd6b1e8 wayland/compositor: Add MetaContext getter
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2546>
2022-08-02 10:04:52 +00:00
Robert Mader
9e71278488 Revert "wayland/surface: Swap 90 and 270 degree transforms"
As testing of direct scanout revealed, `META_MONITOR_TRANSFORM`
does actually match `WL_OUTPUT_TRANSFORM` enums. The fact that
things rendered correctly with 90/270 degree values swapped
was because other parts of the stack got the interpretation
wrong, most notably `meta_rectangle_transform()`.
Thus lets revert this change and fix the stack accordingly.

This reverts commit 8d9bbe109b.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2459>
2022-07-26 18:41:43 +00:00
Michel Dänzer
d928b6baa6 wayland: Clean up tablet manager state
Fixes memory leak:

==995170== 936 (40 direct, 896 indirect) bytes in 1 blocks are definitely lost in loss record 15,090 of 15,641
==995170==    at 0x48445EF: calloc (vg_replace_malloc.c:1328)
==995170==    by 0x4B211D0: g_malloc0 (gmem.c:155)
==995170==    by 0x4A56693: meta_wayland_tablet_manager_new (meta-wayland-tablet-manager.c:109)
==995170==    by 0x4A56693: meta_wayland_tablet_manager_init (meta-wayland-tablet-manager.c:126)
==995170==    by 0x4A3FA95: meta_wayland_compositor_new (meta-wayland.c:626)
==995170==    by 0x49C7FA7: meta_context_start (meta-context.c:412)
==995170==    by 0x10F065: main (mutter.c:148)

Fixes: 745cb67988 ("wayland: Initialize the MetaWaylandTabletManager")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2527>
2022-07-25 14:55:59 +00:00
Michel Dänzer
f3cd2b8ce7 wayland: Clean up output state
Fixes memory leak:

==995170== 383 (96 direct, 287 indirect) bytes in 1 blocks are definitely lost in loss record 14,733 of 15,641
==995170==    at 0x483F7B5: malloc (vg_replace_malloc.c:381)
==995170==    by 0x4B21178: g_malloc (gmem.c:125)
==995170==    by 0x4B395C0: g_slice_alloc (gslice.c:1072)
==995170==    by 0x4B0766D: g_hash_table_new_full (ghash.c:1071)
==995170==    by 0x4A4A8B4: meta_wayland_compositor_update_outputs (meta-wayland-outputs.c:483)
==995170==    by 0x4A4ABAB: meta_wayland_outputs_init (meta-wayland-outputs.c:716)
==995170==    by 0x4A3FA65: meta_wayland_compositor_new (meta-wayland.c:620)
==995170==    by 0x49C7FA7: meta_context_start (meta-context.c:412)
==995170==    by 0x10F065: main (mutter.c:148)

v2:
* Use meta_backend_get_monitor_manager. (Jonas Ådahl)

Fixes: 9a4783e364 ("Integrate the monitor manager with wayland")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2527>
2022-07-25 14:55:59 +00:00
Michel Dänzer
806e64dcb0 wayland: Clean up presentation-time state
Fixes memory leak:

==995170== 288 (96 direct, 192 indirect) bytes in 1 blocks are definitely lost in loss record 14,607 of 15,641
==995170==    at 0x483F7B5: malloc (vg_replace_malloc.c:381)
==995170==    by 0x4B21178: g_malloc (gmem.c:125)
==995170==    by 0x4B395C0: g_slice_alloc (gslice.c:1072)
==995170==    by 0x4B0766D: g_hash_table_new_full (ghash.c:1071)
==995170==    by 0x4A4F973: meta_wayland_init_presentation_time (meta-wayland-presentation-time.c:222)
==995170==    by 0x4A3FB04: meta_wayland_compositor_new (meta-wayland.c:635)
==995170==    by 0x49C7FA7: meta_context_start (meta-context.c:412)
==995170==    by 0x10F065: main (mutter.c:148)

Fixes: dccc60ec3e ("wayland: Implement stub presentation-time")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2527>
2022-07-25 14:55:59 +00:00
Michel Dänzer
b329dce070 wayland: Clean up xdg-activation state
Fixes memory leak:

==995170== 240 (48 direct, 192 indirect) bytes in 1 blocks are definitely lost in loss record 14,428 of 15,641
==995170==    at 0x48445EF: calloc (vg_replace_malloc.c:1328)
==995170==    by 0x4B211D0: g_malloc0 (gmem.c:155)
==995170==    by 0x4A3CDB3: meta_wayland_activation_init (meta-wayland-activation.c:383)
==995170==    by 0x4A3FB0C: meta_wayland_compositor_new (meta-wayland.c:636)
==995170==    by 0x49C7FA7: meta_context_start (meta-context.c:412)
==995170==    by 0x10F065: main (mutter.c:148)

Fixes: ec390b68c5 ("wayland: Implement the xdg-activation protocol")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2527>
2022-07-25 14:55:59 +00:00
Michel Dänzer
4ddefb9a69 wayland: Clean up scheduled_surface_associations hash table
Fixes memory leak:

==995170== 192 (96 direct, 96 indirect) bytes in 1 blocks are definitely lost in loss record 14,260 of 15,641
==995170==    at 0x483F7B5: malloc (vg_replace_malloc.c:381)
==995170==    by 0x4B21178: g_malloc (gmem.c:125)
==995170==    by 0x4B395C0: g_slice_alloc (gslice.c:1072)
==995170==    by 0x4B0766D: g_hash_table_new_full (ghash.c:1071)
==995170==    by 0x4A3F3A4: meta_wayland_compositor_init (meta-wayland.c:477)
==995170==    by 0x4E1F509: g_type_create_instance (gtype.c:1929)
==995170==    by 0x4E03DFC: g_object_new_internal (gobject.c:2011)
==995170==    by 0x4E0538C: g_object_new_with_properties (gobject.c:2181)
==995170==    by 0x4E05D40: g_object_new (gobject.c:1821)
==995170==    by 0x4A3F8C4: meta_wayland_compositor_new (meta-wayland.c:590)
==995170==    by 0x49C7FA7: meta_context_start (meta-context.c:412)
==995170==    by 0x10F065: main (mutter.c:148)

Fixes: 8df2a1452c ("wayland: Notify actively of xwayland window/surface associations")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2527>
2022-07-25 14:55:59 +00:00
Michel Dänzer
39fd32c362 wayland: Disconnect signals when Wayland compositor object is finalized
Fixes potential use-after-free during mutter shutdown, e.g.:

==993876== Invalid read of size 8
==993876==    at 0x4A4FCA3: meta_wayland_presentation_time_ensure_feedbacks (meta-wayland-presentation-time.c:373)
==993876==    by 0x4A3F07F: on_presented (meta-wayland.c:282)
==993876==    by 0x661B7E9: ??? (in /usr/lib/x86_64-linux-gnu/libffi.so.8.1.0)
==993876==    by 0x661A922: ??? (in /usr/lib/x86_64-linux-gnu/libffi.so.8.1.0)
==993876==    by 0x4DFF4BC: g_cclosure_marshal_generic_va (gclosure.c:1648)
==993876==    by 0x4DFE948: _g_closure_invoke_va (gclosure.c:893)
==993876==    by 0x4E17498: g_signal_emit_valist (gsignal.c:3406)
==993876==    by 0x4E176BE: g_signal_emit (gsignal.c:3553)
==993876==    by 0x51D9DB5: clutter_stage_view_notify_presented (clutter-stage-view.c:1226)
==993876==    by 0x499ACD2: frame_cb (meta-stage-view.c:83)
==993876==    by 0x499ACD2: frame_cb (meta-stage-view.c:43)
==993876==    by 0x50CAA41: notify_event (cogl-onscreen.c:175)
==993876==    by 0x50CAA41: _cogl_onscreen_notify_complete (cogl-onscreen.c:545)
==993876==    by 0x4A877F5: meta_onscreen_native_notify_frame_complete (meta-onscreen-native.c:211)
==993876==  Address 0x24b7be58 is 296 bytes inside a block of size 344 free'd
==993876==    at 0x484217B: free (vg_replace_malloc.c:872)
==993876==    by 0x4E1F88B: g_type_free_instance (gtype.c:2001)
==993876==    by 0x49C793C: meta_context_dispose (meta-context.c:675)
==993876==    by 0x4E037E0: g_object_unref (gobject.c:3636)
==993876==    by 0x4E037E0: g_object_unref (gobject.c:3553)
==993876==    by 0x10F145: glib_autoptr_clear_GObject (gobject-autocleanups.h:27)
==993876==    by 0x10F145: glib_autoptr_clear_MetaContext (meta-context.h:32)
==993876==    by 0x10F145: glib_autoptr_cleanup_MetaContext (meta-context.h:32)
==993876==    by 0x10F145: main (mutter.c:126)
==993876==  Block was alloc'd at
==993876==    at 0x483F7B5: malloc (vg_replace_malloc.c:381)
==993876==    by 0x4B21178: g_malloc (gmem.c:125)
==993876==    by 0x4B395C0: g_slice_alloc (gslice.c:1072)
==993876==    by 0x4B39C29: g_slice_alloc0 (gslice.c:1098)
==993876==    by 0x4E1F544: g_type_create_instance (gtype.c:1901)
==993876==    by 0x4E03DFC: g_object_new_internal (gobject.c:2011)
==993876==    by 0x4E0538C: g_object_new_with_properties (gobject.c:2181)
==993876==    by 0x4E05D40: g_object_new (gobject.c:1821)
==993876==    by 0x4A3F864: meta_wayland_compositor_new (meta-wayland.c:585)
==993876==    by 0x49C7FA7: meta_context_start (meta-context.c:412)
==993876==    by 0x10F065: main (mutter.c:148)

Fixes: 2ce3a050f0 ("wayland: Wire up presentation-time machinery")
Fixes: 8cff3b84f7 ("wayland/compositor: Process frame callbacks on 'after-update'")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2527>
2022-07-25 14:55:59 +00:00
Michel Dänzer
709d06e89e wayland/surface: The same sub-surface is not a valid sibling
The Wayland protocol documentation at
https://wayland.app/protocols/wayland#wl_subsurface:request:place_above
says:

 The reference surface must be one of the sibling surfaces, or the
 parent surface. Using any other surface, including this sub-surface,
 will cause a protocol error.

v2:
* Leave it as a single line. (Georges Basile Stavracas Neto)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2525>
2022-07-21 17:03:12 +02:00
Michel Dänzer
ddb7f84291 wayland/surface: Simplify is_child & is_sibling
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2525>
2022-07-21 17:03:12 +02:00
Carlos Garnacho
ffac294520 clutter: Pass anchor position to ClutterInputFocus
Some implementations may need this (namely, the one that drives
the Wayland protocol), so pass this along from the IM events.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2517>
2022-07-19 11:04:56 +00:00
José Expósito
9dd6268d13 wayland/pointer: Send high-resolution scroll data
Upgrade the seat protocol to version 8 and change the scroll handler to
support new clients.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1962>
2022-07-14 22:29:56 +00:00
Dor Askayo
f037c9df66 wayland/dma-buf: Don't require modifiers support for scanout tranche
When building the list of formats to be sent as part of the scanout
tranche, avoid requiring modifier support by the DRM driver for
formats relying on implicit modifiers (DRM_FORMAT_MOD_INVALID).

Specifically, the previous check required the DRM driver to have
advertised some modifier support for the given format in its
IN_FORMATS KMS plane property, regardless of modifier it was. If it
hadn't, the format was left out of the list of formats to be sent
in the scanout tranche.

When no formats remained to be sent in the scanout tranche, the
tranche simply wasn't sent.

This resulted in the scanout tranche never being sent for GPUs where
modifiers aren't supported. In those cases, no formats are advertised
using the IN_FORMATS property, and thus the list of formats to be sent
in the scanout tranche remained empty.

Since Mesa doesn't use scanout-compatible buffers for native Wayland
clients unless specifically requested to do so using the "scanout"
tranche flag, it effectively means that direct scanout of native
Wayland clients wasn't supported for GPUs without modifiers support.

Sending a tranche with formats paired with the implicit modifier
(DRM_FORMAT_MOD_INVALID) is both allowed by the protocol and is
already done by default for GPUs with modifiers support, unless the
experimental support for explicit modifiers is enabled in Mutter.

So instead of requiring modifiers to be supported for each format
being evaluated for the scanout tranche, when processing formats
which rely on implicit modifiers, only check if the format in
question is supported by the DRM driver for scanout on the primary
plane.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2510>
2022-07-12 18:53:30 +03:00
Robert Mader
1a56a53909 wayland/actor-surface: Consider clones in is_on_logical_monitor()
While the check for `clutter_actor_has_mapped_clones` clearly indicates
an intention to take clones into account, the following code
does not do so, likely because it predates the introduction of
`clutter_actor_is_effectively_on_stage_view()`.

Switch to that newer API in order to take clones into account. This
avoids unnecessary `wl_surface_send_enter()` and `wl_surface_send_leave()`
events when entering the overview, reducing client work.

This also avoids unnecessarily allocating a `cairo_region_t`.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2502>
2022-07-11 18:18:56 +00:00
Robert Mader
57881ba612 wayland/subsurface: Move actor unparenting back to rebuild_surface_tree()
Unparenting the surface actor when the subsurface object is destroyed
has several issues:
 - subsurface actors can be unparented while a close animation is
   still ongoing, breaking the animation for e.g. Firefox.
 - adding and removing the actor to/from the parent is not handled in
   one place, making the code harder to follow.
 - if the destroyed subsurface had children of its own, they potentially
   stick around until a surface-tree rebuild. This makes the Firefox
   hamburger menu not close with the "compositor" backend.

Move the unparenting back to
`meta_window_actor_wayland_rebuild_surface_tree()` and instead just
notify the parent of a state change, if it still exist. This will ensure
a correct mapping between the subsurface node tree and the flat surface
actor list. In case of the closing animation the parent will already be
removed and the call is skipped.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2501>
2022-07-11 17:23:10 +00:00
Dor Askayo
cd68d5b26c wayland/surface: Remove leftover function declarations
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2485>
2022-07-01 16:05:33 +00:00
Michel Dänzer
4af54225de wayland/dma-buf: Free feedback in surface_feedback_surface_destroyed_cb
Fixes leak:

==14889== 2,168 (16 direct, 2,152 indirect) bytes in 1 blocks are definitely lost in loss record 15,308 of 15,584
==14889==    at 0x48445EF: calloc (vg_replace_malloc.c:1328)
==14889==    by 0x4BAC1D0: g_malloc0 (gmem.c:155)
==14889==    by 0x4AAFF60: meta_wayland_dma_buf_feedback_new (meta-wayland-dma-buf.c:298)
==14889==    by 0x4AAFFE0: meta_wayland_dma_buf_feedback_copy (meta-wayland-dma-buf.c:317)
==14889==    by 0x4AB16B6: ensure_surface_feedback (meta-wayland-dma-buf.c:1121)
==14889==    by 0x4AB1848: dma_buf_handle_get_surface_feedback (meta-wayland-dma-buf.c:1169)
==14889==    by 0x66F77E9: ??? (in /usr/lib/x86_64-linux-gnu/libffi.so.8.1.0)
==14889==    by 0x66F6922: ??? (in /usr/lib/x86_64-linux-gnu/libffi.so.8.1.0)
==14889==    by 0x5318750: ??? (in /usr/lib/x86_64-linux-gnu/libwayland-server.so.0.20.0)
==14889==    by 0x5313B99: ??? (in /usr/lib/x86_64-linux-gnu/libwayland-server.so.0.20.0)
==14889==    by 0x5316649: wl_event_loop_dispatch (in /usr/lib/x86_64-linux-gnu/libwayland-server.so.0.20.0)
==14889==    by 0x4AA7C19: wayland_event_source_dispatch (meta-wayland.c:110)

Fixes: 64e6bedb6b ("wayland/dma-buf: Add support for scanout surface feedback")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2469>
2022-06-16 10:24:42 +00:00
Jonas Ådahl
ccde353fb3 wayland/pointer-confinement: Scale region with the geometry scale
Without applying the geometry scale, to both the region and the minimum
edge distance, the confinement area becomes too small and offset on
HiDPI setups.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2110
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2460>
2022-06-13 18:38:51 +00:00
Jonas Ådahl
6d46ffccbc pointer-constraints: Move min edge distance from backend to Wayland
The min distance to the right/bottom edge depends on Wayland concepts
(wl_fixed_t) and eventually geometry scale. Move the logic the Wayland
side of the pointer constraints machinery to avoid the backend trying to
figure this out without the proper data.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2460>
2022-06-13 18:38:50 +00:00
Jonas Ådahl
71ea01f54c wayland/surface-role: Make geometry scale API return int
Geometry scale are always ints, callers always assumed they were ints,
but they were doubles. Make them ints.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2460>
2022-06-13 18:38:50 +00:00
Robert Mader
11fc5b6c6c tests/wayland: Add more requests to test driver protocol
Add `sync_effects_completed()` and `verify_view()` in
order to allow Wayland test clients to trigger verifications
and add convenience functions to use them to client-utils.

Notes:
- `sync_effects_completed()` works in two stages in order
  to ensure it doesn't race with window effects. By the time
  `sync_effects_completed()` is processed, an effect could
  already have ended or not yet been scheduled. Thus we
  defer a check for pending effects to the next paint cycle,
  assuming that by then they should have been scheduled.
- `meta_ref_test_verify_view()` internally triggers the
  `paint` signal for the stage which is why it can not be run
  in the after-paint signal handler.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1055>
2022-06-03 09:03:10 +00:00
Robert Mader
8d9bbe109b wayland/surface: Swap 90 and 270 degree transforms
Our internal interpretation of output transforms is not in line with
the Wayland spec. Wayland describes them as the transform that a
compositor will apply to a surface to compensate for the rotation
or mirroring of an output device - counter-clockwise.

Mutter in turn interprets it the other way around. One could
argue it does the same but clock-wise - or it interprets the transform
from the viewpoint of the content, not the device.

In either way, the difference is that 90 and 270 degree values are
switched. Thus swap these accordingly when we translate from
`WL_OUTPUT_TRANSFORM` to `META_MONITOR_TRANSFORM`.

See: https://gitlab.freedesktop.org/wayland/weston/issues/99
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1055>
2022-06-03 09:03:10 +00:00
Jonas Ådahl
7bf4f850b8 wayland/dma-buf: Remove no longer used mesa macro duplication
We're bumped the required mesa version, so we don't need to keep this
around anymore.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2417>
2022-06-02 08:59:13 +00:00
Jonas Ådahl
83ed7b7dfd xwayland: Remove stray newline
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2364>
2022-05-31 12:00:55 +00:00
Jonas Ådahl
c9e7cf4ea1 xwayland: Add API to send signal to the Xwayland process
Will be used for test cases to fake-crash the Xwayland process.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2364>
2022-05-31 12:00:55 +00:00
Jonas Ådahl
bdb34401c5 xwayland: Only warn on X IO errors when X11 is mandatory
This avoids warnings when we're just slightly unlucky when Xwayland went
away due to inactivity.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2364>
2022-05-31 12:00:55 +00:00
Jonas Ådahl
e1033951ef wayland: Add getter for XWayland manager object
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2364>
2022-05-31 12:00:54 +00:00
Florian Müllner
fabad0be9c wayland: Remove unnecessary COMPOSITOR_GRAB checks
Since the new ClutterGrab API replaced the old plugin-modal hook,
the event-route is never set to COMPOSITOR_GRAB.

The code in question already checks whether the stage has a grab,
so we can just remove old checks.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2436>
2022-05-28 10:25:29 +00:00
Fernando Monteiro
d4bdd8b56f wayland: Remove Gtk primary selection protocol
This has been replaced for primary selection protocol from
wayland-protocols.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2184>
2022-05-18 20:15:08 +00:00
Fernando Monteiro
11bc19fbe8 wayland: Drop xdg-shell v6 protocol
There is no need to have this protocol as we already
have support for the xdg-shell stable.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2207>
2022-05-18 19:29:08 +00:00
Jonas Ådahl
75ec27966d wayland/buffer: Only query Wayland EGL buffer if display bound
It's not allowed to call eglQueryWaylandBuffer() if the call to
eglBindWaylandDisplay() failed, and will result in an assert being hit
in mesa if called.

Avoid that by keeping track whether we succeeded to bind, and only
attempt to realize a legacy EGL wl_buffer if binding succeeded.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2415>
2022-05-17 10:09:27 +00:00
Carlos Garnacho
f361e8032c wayland: Avoid repeated NULL preedit string updates
Simply signal preedit string changes from/to NULL once, in order
to avoid unwanted activity in the client side. We do still need to
send the preedit once each .done event, if there is one, in order
to behave according to the protocol when it matters the most.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2395>
2022-04-30 15:10:17 +00:00
Robert Mader
aa8d2d6fff wayland/dma-buf: Remove redundant error check
`meta_egl_*` functions are assumed to set an error on failure.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2386>
2022-04-29 20:27:56 +00:00
Robert Mader
c8095b4306 wayland/dma-buf: Only advertise supported formats
Analogous to how we use `eglQueryDmaBufModifiersEXT()` to query
supported modifiers, use `eglQueryDmaBufFormatsEXT()` to ensure
we only advertise formats supported by both the compositor and the
driver.

If there is no overlap, don't advertise `zwp_linux_dmabuf_v1` at
all.

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

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2386>
2022-04-29 20:27:56 +00:00
Carlos Garnacho
cd0c47a25a clutter: Shuffle handling of IM reset on button presses
Unfortunately we cannot do this generically since the target of the
button/touch press does matter, e.g. tapping on the OSK, or clicking
the IBus candidates window. These situations should not trigger a
reset.

So be more selective about the situations where button/touch presses
trigger an IM reset, in the case of ClutterText these are still clicks
inside the actor, for Wayland's text-input it is when clicking the
surface that has text_input focus.

For all other situations where clicking anywhere else might make
sense to trigger an IM reset are covered by the focus changing paths,
that also ensure a reset before changing focus between surfaces/actors.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1961
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2384>
2022-04-23 15:04:30 +02:00