1
0
Fork 0
Commit graph

31945 commits

Author SHA1 Message Date
Sebastian Keller
1f1538be76 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>
2024-05-15 14:07:36 +00:00
Michel Dänzer
1c7ed16d05 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>
2024-05-15 09:15:07 +00:00
Florian Müllner
da0bd303ad 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>
2024-05-15 08:52:50 +00:00
Michel Dänzer
09a6ff6eb7 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>
2024-05-14 12:45:15 +00:00
Michel Dänzer
9ed00280f7 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>
2024-05-14 12:45:15 +00:00
Scrambled 777
1990f2349d Update Hindi translation 2024-05-12 13:10:29 +00:00
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