1
0
Fork 0
Commit graph

31911 commits

Author SHA1 Message Date
Florian Müllner
bfa4522a90
ci: Use meson introspect to generate artifact path
We currently assume that the `CI_COMMIT_TAG` variable matches the
version component of the generated dist tarball.

That is usually correct, but sometimes errors happen and a wrong
tag is pushed, and the real release uses something like "46.0-real".

Account for that by building the artifact path from `meson introspect`
and exporting it as environment variable.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3775>
(cherry picked from commit bcfbc7fa17)
2024-05-25 17:04:46 +02:00
Sebastian Keller
5a5a506f57 wayland/pointer-constraints: Don't steal regions for new constraints
meta_pointer_constraint_new() does not take ownership of the passed
regions but instead creates a copy, resulting in a leak in the calling
functions.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3749>
(cherry picked from commit 650ef9b57f)
2024-05-24 09:34:01 +02:00
Sebastian Keller
e466a1bccc wayland/pointer-constraints: Disconnect focus surface handler early
When meta_wayland_pointer_constraint_remove() is called, it can trigger
a meta_wayland_event_handler_invalidate_focus() via:

meta_wayland_pointer_constraint_destroy()
meta_wayland_pointer_constraint_disable()
meta_wayland_input_detach_event_handler()
meta_wayland_input_invalidate_all_focus()
meta_wayland_event_handler_invalidate_focus()

Which then would result in a "focus-surface-changed" signal which would
call meta_wayland_pointer_constraint_remove() a second time. This
happens after surface_remove_pointer_constraints() has already been
called in the first meta_wayland_pointer_constraint_remove() call,
leading to "data" being NULL.

To prevent this issue disconnect the signal handler before calling
meta_wayland_pointer_constraint_disable() when destroying a constraint.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3476
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3749>
(cherry picked from commit c3e626405f)
2024-05-24 09:34:01 +02:00
Sebastian Keller
eff6e48200 pointer-constraints/native: Fix typo in function name
The vfunc is named "constrain" not "constraint".

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3749>
(cherry picked from commit d4907a960c)
2024-05-24 09:34:01 +02:00
Sebastian Keller
e14bd837e1 pointer-constraints/native: Warp locked pointer to correct position
In case of empty regions (e.g. when locking the pointer) the pointer
was only forced to stay within the boundaries of its current pixel
(i.e. culling subpixel position), instead of the position where the
pointer lock did start.

Fixes: 07d24fe50 ("backends/native: Allow infinitely small pointer constraint regions")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3749>
(cherry picked from commit d686865918)
2024-05-24 09:34:01 +02:00
Sebastian Keller
6a2e8e43a7 pointer-constraints/native: Consider origin when checking constraints
Since 07d24fe50 regions are not translated to their on-screen
coordinates anymore, but are relative to the origin stored in the
constraint. This origin however was not considered when checking whether
the pointer was within the constraint region. This meant that the
constraint region would appear to always be placed at 0,0 instead of on
the surface.

Fix this by using the cursor position relative to the origin.

Fixes: 07d24fe50 ("backends/native: Allow infinitely small pointer constraint regions")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3409
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3749>
(cherry picked from commit c0537096c2)
2024-05-24 09:34:01 +02:00
Jonas Dreßler
9db8609623 wayland/popup: Only close popups if press count drops from 1 to 0
We close wayland popups when a button or touch release happens outside
of the grab, except we don't want to close them when that button release is
actually the release of the press that was opening the grab in the first
place.

We never see the press event that opened the grab, so the first event we
see is actually always a release. Make sure to not close the popup on that
event, and instead only close the popup if we see the press count drop from
1 to 0.

This fixes a bug where popup would close right after they open. To
reproduce, click to open a popup, hold pressed and move the cursor over
shell chrome, then release. Or alternatively test with a popup that gets
opened with a long-press gesture (eg. long touch long press on libadwaita
tabs), just doing the touch long-press and then release.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3631>


(cherry picked from commit 79a79b3450)
2024-05-23 22:02:33 +00:00
Sebastian Wick
044ac90378 tests/wayland-unit-tests: Make sure there are two workspaces
because we want to switch between two workspaces. In some configurations
there is only a single workspace at this point so trying to get current
workspace + 1 gets us a NULL pointer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3730>
(cherry picked from commit 301c154f02)
2024-05-23 20:24:34 +00:00
Jonas Ådahl
ae863e3e26 wayland/xdg-shell: Update min/max window size also on geometry changes
The internal representation of the min/max width of windows include what
is outside of the window geometry, so when the window geometry changes,
but the min/max size did not in the same commit, we'd be left with an
out of date min/max size, potentially causing windows to shrink when
configured.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3755>
(cherry picked from commit 97af5f8705)
2024-05-23 20:24:34 +00:00
Bilal Elmoussaoui
d9a4a5fcb2 Use gboolean consts instead of C bools
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3748>
(cherry picked from commit c13956fb9e)
2024-05-23 20:24:34 +00:00
Sebastian Keller
b34fbc3120 egl: Don't free source error after propagating it
local_error in meta_egl_query_device_string() is using g_autoptr,
meaning that it was getting freed after g_propagate_error(). This then
would result in error->message becoming invalid, causing crashes when
logging the error message later on.

Fixes: 8234f5bc7 ("egl: Return success status from meta_egl_query_device_string")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3758>
(cherry picked from commit 7a38e12ed0)
2024-05-23 20:24:34 +00:00
Jonas Ådahl
d3a73d1a2d ci: Create artifacts of meson logs in dist job
Tests sometimes fail there, but without logs it's hard to know why.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3754>
(cherry picked from commit eaf69fdea8)
2024-05-23 20:24:34 +00:00
Jonas Ådahl
dd735cde01 dbusmock/mocks-manager: Don't create a pipe for started templates
Just shovel the data through our own stdin/stdout, which will end up at
the right place (e.g. /dev/null).

This should hopefully solve `mutter-dist` failing due to a D-Bus method
call timeout in CI.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3757>
(cherry picked from commit e2e687c9db)
2024-05-23 20:24:34 +00:00
Corentin Noël
436541f6e2 clutter/transition: Do not call methods of a NULL ClutterAnimatable
Only call clutter_animatable_get_actor on a non-null object, otherwise set
the timeline actor to NULL directly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3750>
(cherry picked from commit 0ab5ff6eed)
2024-05-23 20:24:34 +00:00
Sebastian Keller
d8af06fe49 x11/window: Compare input shape to client rect when undecorating
When a window with an input shape on its decoration window becomes
undecorated and meta_window_x11_update_input_region() gets called via
notify::decorated, the buffer_rect of the window has not been updated
yet while the decorated property has. This would lead to us comparing
the input shape of the client window to the buffer_rect which still
includes the decoration window. This would fail to detect the common
case when the client window has no input shape set, leading to the input
region being set to the size of the client window rather than NULL. If
the window is then resized later, the input shape would remain at the
previous size.

This was not a problem before 6bd920b35, because then we were (wrongly)
always comparing to the client_rect.

Fix this by choosing the correct rect for comparison depending on
whether the window is decorated.

Fixes: 6bd920b35 ("x11/window: Use correct bounding rect to determine NULL input region")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3451
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3720>
(cherry picked from commit 1f1538be76)
2024-05-23 20:24:34 +00:00
Florian Müllner
7562231e2f core/anonymous-file: Support 0-sized files
There is nothing to allocate for a 0-sized files, and indeed
posix_fallocate() will error out if the passed len isn't greater
than 0.

Now that anonymous files are used to back the memory selection
source, this fixes unsetting the selection when the screen is
locked.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3752>
(cherry picked from commit da0bd303ad)
2024-05-23 20:24:34 +00:00
Jonas Ådahl
133a1b2e64 tests: Add test case for keybinding remove race
When a key binding is removed, and a trigger key sequence is dispatched
before the idle callback that resolves and updates the actual binding,
we should handle that gracefully.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3711>
(cherry picked from commit 22f67d107d)
2024-05-23 20:24:34 +00:00
Keyu Tao
93b16a5368 keybindings: Add refcounting to fix use-after-free for key handlers
Two new fields: ref_count and removed, are added to MetaKeyHandler, and
it would be freed only if the ref count has reached 0. When handler is
removed from key_handlers GHashTable, key_handler_destroy() would mark
removed as TRUE, and do an unref. handler->removed is checked in
get_keybinding, and binding with handler removed would not be used.

Also in MetaKeyBinding, it now has the ownership of the name field, to
avoid it being freed before logging. Create or copy a binding would
do a ref inc for handler, and free one would unref handler.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/1870.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3711>
(cherry picked from commit 8c39a25459)
2024-05-23 20:24:34 +00:00
Jonas Ådahl
67a7900cd3 window/wayland: Constrain sporadic client resizes immediately
When a client resizes on its own, make sure the new size is passed
through the window constraints machinery directly, to trigger any
potential window management rule that might apply.

Fix a couple of tests to make use of this behavior by introducing a new
'wait_size' command that waits until a window has been resized to a
expected size.

This replaces the fix introduced in 0e736af301 ("window: Ensure
constraints after a Wayland client resize").

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3700>
(cherry picked from commit 57e16cf010)
2024-05-23 20:24:34 +00:00
Sebastian Wick
ba918baa45 window: Start in the activate suspend state until mapped
Starting the timeout to move from hidden to suspended before the window
is mapped means we don't have a previous window configufration which we
need to get the new window configuration with the suspended state.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3731>
(cherry picked from commit e509fc7f00)
2024-05-23 20:24:34 +00:00
Sebastian Wick
9a95767865 window: Move implement_showing for the next commit
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3731>
(cherry picked from commit 7a9883d5bb)
2024-05-23 20:24:34 +00:00
Jonas Ådahl
ed637f63c1 tests/wayland: Add test for mapping clone of obstructed window
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3731>
(cherry picked from commit 52d5758f1b)
2024-05-23 20:24:34 +00:00
Jonas Ådahl
2c6993cfb6 tests/wayland: Run with G_MESSAGES_DEBUG=all
Helpful when debugging tests.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3731>
(cherry picked from commit b69fc15543)
2024-05-23 20:24:34 +00:00
Jonas Ådahl
90d38f6f87 ci: Run gnome-shell tests with the timeout multiplier set to 5
Sometimes the test runners are saturated with other work. Bump the test
timeouts by a multiplier of 5 with the hope that they now will be much
more likely to have time to finish in time.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3735>
(cherry picked from commit 3dbe3668e6)
2024-05-23 20:24:34 +00:00
Carlos Garnacho
50174677d2 wayland: Do not forget immediately of key press serials on key release
Prior to commit 5dfed8a431, the MetaWaylandKeyboard would always remember
the last key press serial, and consider it valid after the key was released,
as long as no other key presses/releases happened in between.

That commit improved things so that MetaWaylandKeyboard can track multiple
keys being pressed simultaneously, but also changed so that the serial for
a key press is immediately forgotten after the key press event was received.
This may break in situations like testing or keyboard macros where key
press and release is handled in a quick sucession, so the client reaction
to the key press (e.g. popping up a menu) might arrive too late.

Add a sort of spiritual successor to this handling, and make keyboard
press serials corresponding to the last key up forgotten at the next
key press/release received.

Fixes: 5dfed8a431 ("wayland: Preserve serial for all pressed keys")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3458
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3721>
(cherry picked from commit 243890a688)
2024-05-23 20:24:34 +00:00
Carlos Garnacho
582155a641 wayland: Track current tablet tool focus surface
We did not track the current surface (i.e. the logical focus) too
thoroughly, so there might be chances that a stale surface pointer
here becomes the focus. Track its destruction (like it's done at e.g.
MetaWaylandPointer) and unset the current surface early, in order
to avoid possible invalid memory access.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3372
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3715>
(cherry picked from commit fb8ac5dff7)
2024-05-23 20:24:34 +00:00
Robert Mader
073ed85007 wayland/surface: Fix sending preferred buffer transform
Fix an obvious copy paste error that slipped through the cracks.
Fortunately it doesn't have a visual impact for well behaving clients
but only makes us not hit direct-scanout paths, assuming no other bugs
in the stack.

Fixes: f21762ea6e (wayland: Add support for preferred_buffer_scale/transform)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3717>
(cherry picked from commit 6a81d5f0bb)
2024-05-23 20:24:34 +00:00
Michel Dänzer
2522f3762f kms/impl-device: Inhibit real-time scheduling when querying KMS state
On some setups, the kernel may keep the KMS thread busy for significant
amounts of time while querying KMS state, which could result in mutter
getting killed by the kernel, e.g. after hot-plugging displays.

Issue: https://gitlab.gnome.org/GNOME/mutter/-/issues/3479
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3763>
(cherry picked from commit 8a862b102c)
2024-05-23 19:49:39 +00:00
Michel Dänzer
0864f20753 Revert "wayland/surface: Check buffer size also for role-less surfaces"
This reverts commit 98c8c03729.

Although the spec technically doesn't allow this for role-less surfaces
either, it's difficult for clients to avoid it for surfaces which later
assume a cursor role, and there's consensus to allow it for the time
being:
https://gitlab.freedesktop.org/wayland/wayland/-/issues/194#note_1371674

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3471
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3743>
(cherry picked from commit 1c7ed16d05)
2024-05-23 19:49:39 +00:00
Michel Dänzer
91055faf33 color-manager: Call update_all_gamma from on_monitors_changed
This ensures that an up-to-date gamma LUT is applied for newly-enabled
monitors.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2480
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2546
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3439
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3742>
(cherry picked from commit 09a6ff6eb7)
2024-05-23 19:49:39 +00:00
Michel Dänzer
b359be6ffb color-manager: Move update_all_gamma helper up
Preparation for next commit, no functional change intended.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3742>
(cherry picked from commit 9ed00280f7)
2024-05-23 19:49:39 +00:00
Michel Dänzer
a95b19ebda wayland/surface: Keep applied sub-surface branch node linked up
Until this surface or its parent is finalized.

This makes sure that any `MetaWaylandSubsurfacePlacementOp` referencing
this surface for sibling will be applied as intended.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3737>
(cherry picked from commit be4bf8da9c)
2024-05-23 19:49:39 +00:00
Michel Dänzer
3df53268ab Revert "wayland/subsurface: Drop unapplied subsurface state on unmap"
This reverts commit 35d92e0fac.

This turned out to cause trouble, because it can prevent
MetaWaylandSurface::applied_state.subsurface_branch_node from ever
getting linked up for a sub-surface.

It shouldn't be necessary anyway, since permanently_unmap_subsurface /
wl_subcompositor_get_subsurface reset the sub-surface state as defined
by the protocol.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3737>
(cherry picked from commit 5749810ddb)
2024-05-23 19:49:39 +00:00
Michel Dänzer
37d1af515d wayland/subsurface: Hold surface reference in placement ops
Will be necessary with the next commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3737>
(cherry picked from commit ad22833cc3)
2024-05-23 19:49:39 +00:00
Michel Dänzer
f7b13fd74f wayland/subsurface: Make sure siblings are actually sub-surfaces
Without this check, is_sibling could spuriously return TRUE when neither
surface passed in was actually a sub-surface.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3737>
(cherry picked from commit ba93fcd30f)
2024-05-23 19:49:39 +00:00
Michel Dänzer
3c3e649a32 wayland/transaction: Check surface pointer validity in _ensure_entry
If a caller passes in NULL or a non-NULL value which doesn't point to
a valid MetaWaylandSurface object, this will hopefully point in the
direction of the cause.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3725>
(cherry picked from commit dd32f3b3be)
2024-05-23 19:49:39 +00:00
Michel Dänzer
519321252a wayland/subsurface: Hold sibling surface reference in placement ops
It was possible for the sibling surface to be already destroyed in
meta_wayland_transaction_add_placement_surfaces, in which case
g_object_ref would return NULL for it, and
meta_wayland_transaction_commit would then crash dereferencing a NULL
surface pointer.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3462
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3725>
(cherry picked from commit b67f94ca7e)
2024-05-23 19:49:39 +00:00
Echo J
003cb6d5ce wayland: Require ANDROID_native_fence_sync for enabling syncobj protocol
Mutter is currently enabling the protocol when the fence can't be
duplicated and it never signals the release of it (which is problematic
in some Mesa drivers like nouveau when used together with the nouveau
Vulkan driver because of the recent explicit sync support merge)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3744>
2024-05-23 19:04:53 +00:00
Florian Müllner
0388431b31 ci: Bump image
GLib 2.79.2 split out platform specific API into separate GIRs,
and gjs now warns when using affected API without the new import.

However our CI image still only includes the 2.79.1 development
release, so in order to allow gnome-shell to depend on a more
recent glib release, bump the image to pull in a newer version.

Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3288
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3723>
(cherry picked from commit 3155cf514c)
2024-05-23 19:00:37 +02:00
Leônidas Araújo
c23274cd23 Update Brazilian Portuguese translation 2024-05-15 12:48:10 +00:00
Marco Trevisan (Treviño)
35836f0f1a x11/window: Add proper type guard to x11-specific public API calls
These functions are specific for X11 windows only so we should check
if the passed window is an X11 one, not just a MetaWindow since we're
casting to the actual type at later point.

Fixes changes part of commit e1e6534eb
2024-05-03 16:09:00 +02:00
Marco Trevisan (Treviño)
f54579ad27 x11/window: Add type-check guard to meta_window_x11_get_group()
Since this is still public API we want to ensure that we don't cast
it directly without having checked its type
2024-05-03 16:09:00 +02:00
Marco Trevisan (Treviño)
a951c097dd x11/window: Do not try to compare a wayland active window with X11
If a window sends a configure stacking request, we were comparing the
active window with the event window even though they were different
client types (e.g. wayland and x11).

This was leading to a critical error, so let's handle this by ensuring
that the active window is of the same kind of the event window before
doing x11-specific checks. Behaving as different applications in case.
2024-05-03 16:09:00 +02:00
Daniel van Vugt
1a87e8e09b backends/native: Remove unused meta_kms_device_add_fake_plane_in_impl
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3676>
(cherry picked from commit f3a52551f1)
2024-05-03 00:27:39 +02:00
Daniel van Vugt
65069940a4 backends/native: Add fake cursor plane using impl_device's crtcs
Because `meta_kms_impl_device_simple_initable_init` is called in the
middle of `meta_kms_device_new`, the crtcs list for `MetaKmsDevice`
has not been populated yet. And thus the loop to detect missing
cursor planes and create fake ones never iterated. But the crtcs list
does already exist in `MetaKmsImplDevice` so iterate over that instead.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3264
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3676>
(cherry picked from commit 14e18de90d)
2024-05-03 00:27:39 +02:00
Daniel van Vugt
aa93da72d5 kms/impl-device: Add function meta_kms_impl_device_has_cursor_plane_for
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3676>
(cherry picked from commit b620dbb188)
2024-05-03 00:27:39 +02:00
Hugo Carvalho
d9fe1988e7 Update Portuguese translation 2024-04-28 20:15:31 +00:00
Florian Müllner
b57c80602d
Bump version to 46.1
Update NEWS.
2024-04-19 19:48:34 +02:00
Carlos Garnacho
1fdae4f856 wayland: Drop meta_wayland_keyboard_get_focus_client()
All its users did not necessarily depend on a MetaWaylandKeyboard
existing, so were ported to using the MetaWaylandSeat global input
focus. This may now be dropped.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3707>
2024-04-19 14:42:31 +00:00
Carlos Garnacho
9bdb00c459 wayland: Follow seat's input focus client for primary selections
The concept of "input focus" will exist regardless of a MetaWaylandKeyboard
being available or not, use the seat's focus for that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3707>
2024-04-19 14:42:31 +00:00