1
0
Fork 0
Commit graph

31939 commits

Author SHA1 Message Date
Jonas Ådahl
22f67d107d 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>
2024-05-07 09:18:01 +00:00
Keyu Tao
8c39a25459 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>
2024-05-07 09:18:01 +00:00
Jonas Ådahl
57e16cf010 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>
2024-05-07 08:59:50 +00:00
Jonas Ådahl
6819296e81 ci: Build our own gtk3 containing unreleased bug fix
Contains https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/7139 which
is needed for test suite improvements.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3700>
2024-05-07 08:59:50 +00:00
Bilal Elmoussaoui
fc623c1ed1 build: Enable -Werror=shadow and fix related issues
Mostly renames or removing already defined types

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3378>
2024-05-06 15:54:16 +00:00
Sebastian Wick
e509fc7f00 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>
2024-05-03 18:24:27 +00:00
Sebastian Wick
7a9883d5bb window: Move implement_showing for the next commit
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3731>
2024-05-03 18:24:27 +00:00
Jonas Ådahl
52d5758f1b tests/wayland: Add test for mapping clone of obstructed window
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3731>
2024-05-03 18:24:27 +00:00
Jonas Ådahl
b69fc15543 tests/wayland: Run with G_MESSAGES_DEBUG=all
Helpful when debugging tests.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3731>
2024-05-03 18:24:26 +00:00
Jonas Ådahl
3dbe3668e6 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>
2024-05-03 14:39:07 +00:00
Marco Trevisan (Treviño)
31165c2d86 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

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3727>
2024-05-03 12:38:01 +00:00
Marco Trevisan (Treviño)
b422393bbc 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

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3727>
2024-05-03 12:38:01 +00:00
Marco Trevisan (Treviño)
2a88a3eb96 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.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3727>
2024-05-03 12:38:01 +00:00
Daniel van Vugt
f3a52551f1 backends/native: Remove unused meta_kms_device_add_fake_plane_in_impl
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3676>
2024-05-02 09:34:46 +00:00
Daniel van Vugt
14e18de90d 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>
2024-05-02 09:34:46 +00:00
Daniel van Vugt
b620dbb188 kms/impl-device: Add function meta_kms_impl_device_has_cursor_plane_for
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3676>
2024-05-02 09:34:46 +00:00
Michel Dänzer
dd32f3b3be 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>
2024-04-30 17:14:56 +00:00
Michel Dänzer
b67f94ca7e 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>
2024-04-30 17:14:56 +00:00
Florian Müllner
3155cf514c 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>
2024-04-29 18:41:18 +00:00
Leônidas Araújo
0f11ef6c12 Update Brazilian Portuguese translation 2024-04-29 18:00:41 +00:00
Hugo Carvalho
d9207ee496 Update Portuguese translation
(cherry picked from commit d9fe1988e7)
2024-04-28 20:15:36 +00:00
Carlos Garnacho
243890a688 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>
2024-04-26 19:15:06 +00:00
Carlos Garnacho
fb8ac5dff7 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>
2024-04-25 14:33:28 +00:00
Mart Raudsepp
669d21daa2 x11: Drop obsolete libXrender dependency
It seems only the iconcache used to use it, but this is gone since
commit d16ddc42ce.
Even before that, the Xrender usage was removed in commit 556e7694de,
albeit leaving a redundant include <X11/extensions/Xrender.h> in its
place then, which comes from libXrender.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3716>
2024-04-22 10:16:31 +00:00
Robert Mader
6a81d5f0bb 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>
2024-04-22 11:39:31 +02: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
Carlos Garnacho
5ca10c31d1 wayland: Follow seat's input focus client for clipboard 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
Carlos Garnacho
743fb6df30 wayland: Add meta_wayland_seat_get_input_focus_client() call
This call is meant to replace meta_wayland_keyboard_get_focus_client(),
since we will always have a MetaWaylandSeat with an input focus (or not),
but we may or may not have a MetaWaylandKeyboard.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3707>
2024-04-19 14:42:31 +00:00
Sebastian Wick
cad9a65b07 clipboard-manager: Cancel selection transfers
When there is a new owner but there is no matching mime type we clear
the saved mimetype and the saved clipboard but an outstanding async
meta_selection_transfer_async can set the saved clipboard.

Abort the async transfer when we have a new owner.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3678>
2024-04-19 14:31:01 +00:00
Sebastian Wick
ce32d2b77a clipboard-manager: Make sure we always have mimetype
The precondition checks in meta_selection_source_memory_new can return
NULL if the mimetype is NULL but callers expect the error to be set when
NULL is returned.

Let's just make sure we never call it with a NULL mimetype.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3678>
2024-04-19 14:31:01 +00:00
Carlos Garnacho
5dfed8a431 wayland: Preserve serial for all pressed keys
The current code checking keyboard serials for popup/grab
validation is a bit simple, tracking one key press exclusively.
This may break expectations if a client uses a serial
corresponding to a previous key that is still pressed.

Keep track of the serials corresponding to all pressed keys,
and ensure these are reset across focus changes, since the
validity of those serials is already outdated. The code does
still keep track of a single (last) key release serial, since
the validity lifetime is somewhat underdefined with those if
we keep track of multiple keys simultaneously.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3267
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3644>
2024-04-19 13:50:08 +00:00
Jonas Ådahl
73990f011f window: Set the initial suspend state to 'hidden'
Instead of initializing to 'suspended', which will send the `SUSPENDED`
xdg_toplevel state, set it to hidden at first. If the window is placed
on an inactive workspace, it'll eventually enter the 'suspended' state,
but will have had some time in non-suspended state to get map, even if
not visibly.

This fixes inital suspended state when mapping a window maximized.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3229
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3475>
2024-04-19 13:33:42 +00:00
Jonas Ådahl
cf176df006 window: Add internal meta_window_should_show() API
This, in contrast to meta_window_should_be_showing() reports whether a
window should be showing despite not being showable. This is useful to
know the intended visibility state that should happen in the immediate
future.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3475>
2024-04-19 13:33:42 +00:00
Jonas Ådahl
c5caa4afb5 tests/wayland/client-utils: Add optional xdg-shell v6 support
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3475>
2024-04-19 13:33:42 +00:00
Jonas Ådahl
f23e1218e3 tests/wayland/client/utils: Add way to mark surface as opaque
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3475>
2024-04-19 13:33:42 +00:00
Jonas Ådahl
594cdc5b49 tests/wayland/client-utils: Track xdg_toplevel state
This allows tests to check whether a state is set or not at any given
time.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3475>
2024-04-19 13:33:42 +00:00
Jonas Ådahl
69c7ca02f4 tests/wayland: Replace wl_display_dispatch() with helper
In most cases, we just want to fail the test if dispatching fails, so
add a helper that does that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3475>
2024-04-19 13:33:42 +00:00
Jonas Ådahl
4d8f6af487 test/wayland/client-utils: Add 'painted' signal
This is emitted when a client painted and committed new surface content.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3475>
2024-04-19 13:33:42 +00:00
Jonas Ådahl
2d18b976c1 tests/wayland/client-utils: Add GObject parent instance field
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3475>
2024-04-19 13:33:42 +00:00
Jonas Ådahl
eab06bcf24 window: Move out 'showable' check from should_be_showing_on_workspace()
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3475>
2024-04-19 13:33:42 +00:00
Jonas Ådahl
33ff998a10 tests/wayland/utils: Add method to synchronize with windows being shown
Can be used to wait for a window to be "shown", meaning it'll be added
to the stack and will be part of the next frame (assuming it's actually
not obscured etc).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3475>
2024-04-19 13:33:42 +00:00
Jonas Ådahl
fd6d86d33d window: Add documentation to should_be_showing(_on_workspace)()
It's a bit unclear whether "should be shown" takes ability to actually
immediately show into account. Make this clear in a function doc
comment.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3475>
2024-04-19 13:33:42 +00:00
Sebastian Keller
e4763d00e8 x11/window: Update comment and variable name to reflect current behavior
d991961ae changed this code from client rect to buffer rect to account
for the fact that for SSD windows the decorations are now included in
the bounding region, but it kept the variable name as client_area and
the comment was also still referring to the client rect.

Fixes: d991961ae ("x11: Use input region from frame window for decorated windows")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3697>
2024-04-19 13:18:39 +00:00
Sebastian Keller
6bd920b355 x11/window: Use correct bounding rect to determine NULL input region
When updating the input region we check whether the input shape reported
by XShape matches the bounding region of a window to determine when it
was not set by the client. We would then use a NULL input region instead
which always matches the full size of the window. The code however was
using the client rect for this comparison, which does not include the
window frame. Since d991961a the frame is considered part of the input
region.

This meant that for SSD windows where the input region would match the
bounding region, we would not detect that and fail to set the input
region to NULL, but instead set it to the reported input shape.

Usually this would not be the case due to the GTK frame window having
shadows and a resize region, but in the presence of an issue that causes
GTK to wrongly detect _GTK_FRAME_EXTENTS as not supported, GTK would not
draw shadows or set an input shape. And due to GTK not updating its
input shape, there would be no further calls to
meta_window_x11_update_input_region() after the initial one.
The input region would therefore remain at the fixed size from the
initial call. This was causing windows to become click-through outside
of the region corresponding to their initial size after being resized.

Fixes: d991961ae ("x11: Use input region from frame window for decorated windows")
Related: https://gitlab.gnome.org/GNOME/gtk/-/issues/6558
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3404
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3697>
2024-04-19 13:18:39 +00:00
Sebastian Keller
2e38ec6ce1 frame: Assume a size of 0 when extent properties are undefined
Previously the function would exit early, never changing the out value
which is usually passed in uninitialized. This would however only happen
in the presence of another issue leading to the properties being
undefined. We can still be a bit more defensive against this though.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/3404
Related: https://gitlab.gnome.org/GNOME/gtk/-/issues/6558
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3697>
2024-04-19 13:18:39 +00:00
Michel Dänzer
c25f6f2ded wayland/buffer: Pass g_object_unref to g_ptr_array_new_with_free_func
The release_points array holds pointers to MetaWaylandSyncPoint objects.

Fixes leaking references (and ultimately the underlying memory) for the
array elements.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3442
Fixes: e8b890ab53 ("wayland: Implement linux-drm-syncobj-v1")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3710>
2024-04-19 10:32:38 +00:00
Fabio Tomat
a1d2cc5c64 Update Friulian translation 2024-04-18 08:09:27 +00:00
Carlos Garnacho
c087d9b746 clutter: Make low-level picking function private to ClutterStage
It's now only called within it, inside other higher-level accessors
to update picking based on actor/view/event changes. This can now be
made a private call.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3696>
2024-04-17 14:28:14 +00:00