1
0
Fork 0
Commit graph

32134 commits

Author SHA1 Message Date
Bilal Elmoussaoui
bfd7f9d549 build: Split X11 server & client dependencies
Allows xwayland=true x11=false to be built with less dependencies
Also removes some unused x11 dependencies on the frame client & cogl

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3853>
2024-06-30 15:09:00 +02:00
Bilal Elmoussaoui
a172c0f0dd clutter: Remove uneeded dependencies
Clutter doesn't interact with x11/wayland/libwacom directly

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3853>
2024-06-30 15:09:00 +02:00
Bilal Elmoussaoui
decf43d3b4 tests: Add missing wayland-client dependency
It was pulled indirectly from clutter, see next commit

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3853>
2024-06-30 15:09:00 +02:00
Bilal Elmoussaoui
e52e38d8fb ci: Add a Xwayland without x11 job
As we expect various distros to switch to this build in the future,
having a CI test build for it would ensure things keep working as
expected

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3853>
2024-06-30 15:09:00 +02:00
Bilal Elmoussaoui
820a7ad813 build: Allow building xwayland without x11
Co-authored-by: Jonas Ådahl <jadahl@gmail.com>
Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/3553

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3853>
2024-06-30 15:08:55 +02:00
Corentin Noël
4134d12789 meta/plugin: Annotate dialog creation virtuals as return full
The two dialog creation virtual functions returned by these functions have to
be unreferenced by the caller (and are actually unreferenced in other places in
the code).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3790>
2024-06-29 12:04:31 +00:00
Carlos Garnacho
01444e803f clutter: Specify that input-only grabs are started inactive in API
Add the _inactive suffix, so that the state of these objects is clear.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3747>
2024-06-28 22:49:45 +00:00
Carlos Garnacho
8e5f3a1f83 clutter: Add API to create inactive ClutterGrabs, and activate them explicitly
This gives greater control to the callers on the place where a grab is being
activated, this may make a difference in the handling of crossing events
triggered through it, e.g. by having callers rely on having already obtained
a ClutterGrab prior to handling the resulting effects.

The "input only" grab has also been turned inactive by default, in order to
to have the ClutterGrab pointer available for checks at the MetaWaylandEventHandler
focus changing methods triggered through grab activation.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3463
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3747>
2024-06-28 22:49:45 +00:00
Jeffrey Knockel
5ba364a947 constraints: Allow resize of windows moved above screen
If the titlebar of a window has been moved above the screen by a user
via an unconstrained move, then any constrained user resize following
this move will cause the window to jump below the top of the screen or
cause other glitchy behavior.

This commit removes the constraint that the titlebar of a window must be
below the top of the screen for any resize that is both (1) triggered by
a user and (2) is a resize that affects only the left, right, or bottom
edges of the window.  This allows users to move a window partially above
the screen and then resize the window to be wider or resize the bottom
edge of the window to make it taller or shorter.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1206
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3764>
2024-06-28 20:49:10 +00:00
Shiki Okasaka
4b1411696e clutter: Use character offsets for specifying the surrounding text
clutter_input_focus_set_surrounding() expects cursor and anchor positions
to be provided in character offsets.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3440
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3719>
2024-06-28 19:25:48 +00:00
Jonas Ådahl
fbab46c880 display: Fix fallback MetaX11Display typedef
It was missing a _.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3851>
2024-06-28 18:51:10 +00:00
Jonas Ådahl
ae0b8a71dc x11-keybindings: Include config.h
This unbreaks building here. The compilation error was due to
MetaX11Display having an incorrect typedef in a now preprocessed out
part, which will be fixed in a later commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3851>
2024-06-28 18:51:10 +00:00
Orko Garai
f214eb5134 Use byte offset for cursor_end/anchor value sent in preedit_string.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3845>
2024-06-28 17:23:30 +00:00
Michel Dänzer
94f3bbd94b wayland/surface: Can't send scale events with NULL surface->resource
The committed state can't have any children sub-surfaces either, so
just bail.

Fixes: ae403f2e94 ("wayland: Use new highest scale monitor tracking for fractional_scale_v1")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3552

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3849>
2024-06-28 16:17:05 +02:00
Bilal Elmoussaoui
b6fb8d87f4 x11/display: Keep track of stage input region
It makes more sense for Mutter to track that instead of gnome-shell
allowing gnome-shell to no longer have an ifdefed struct field

Context:
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3362#note_2151381

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3776>
2024-06-27 16:31:56 +02:00
Bilal Elmoussaoui
fd9957b81a keybindings: Move X11 bits to a separate header
Reduces the noise in terms of ifdef and makes it much easier
to spot which X11 bits are still mixed in the generic
keybindings file

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3776>
2024-06-27 16:31:56 +02:00
Bilal Elmoussaoui
beae45a060 build: Expose some features as variables in pkgconfig
Allows gnome-shell or other compositors to detect which features
were built when building libmutter automatically without having to
expose various build options themselves

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3776>
2024-06-27 16:31:56 +02:00
Bilal Elmoussaoui
5a6b0fcee3 build: Conditionally include xlib libraries for Meta gir file
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3776>
2024-06-27 16:31:56 +02:00
Bilal Elmoussaoui
0ff6afab2a ci: Disable X11 for Wayland-only builds
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3776>
2024-06-27 16:31:56 +02:00
Bilal Elmoussaoui
7c41468ba3 build: Add a X11 option
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3776>
2024-06-27 16:31:56 +02:00
Bilal Elmoussaoui
831b563a3c context/main: Disable X11 specific arguments
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3776>
2024-06-27 16:31:56 +02:00
Bilal Elmoussaoui
08a3c57aad build: Only install group.h header when built with x11
Also rename the header to file to be consistent with other x11-only
headers

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3776>
2024-06-27 16:31:56 +02:00
Bilal Elmoussaoui
c8ba4f1cda x11/group: Make various functions private
Nothing uses them and they are X11 only

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3776>
2024-06-27 16:31:56 +02:00
Bilal Elmoussaoui
f7131b2b2f keybindings: Guard X11 calls
This is absolutely not a great commit. As the keybindings could use a
decent
refactoring, see https://gitlab.gnome.org/GNOME/mutter/-/issues/3363 for
more details.
And as this is the last remaining item in getting a wayland-only build,
I think
it is a good 'comporomise' for the time being and makes it clear which
bits of code are
used in x11-only code paths.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3776>
2024-06-27 16:31:56 +02:00
Bilal Elmoussaoui
33d490f472 stack-tracker: Add missing headers includes
Required when building without x11

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3776>
2024-06-27 16:31:56 +02:00
Bilal Elmoussaoui
0814d5029d x11: Introduce a meta-x11-types header
Used to define x11 only types. Future commits will introduce
a way for compositors to detect if they can use x11 features or not

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3776>
2024-06-27 16:31:56 +02:00
Bilal Elmoussaoui
50058b79d1 x11: Don't expose MetaFrame type
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3776>
2024-06-27 16:31:56 +02:00
Sebastian Wick
6ee7c2da7c tests/stacking: Do not wait after move action
Moving a window is a compositor action and happens immediately. Waiting
here is pointless. Make sure instead that the action happens immediately
by asserting the position.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3842>
2024-06-27 14:00:02 +00:00
Sebastian Wick
4e82896533 tests/stacking: Use wait_size for resizes
wait and wait_configure after a single resize is useless and a race.
Resize is a client side action which doesn't result in a configure and a
wait doesn't sync for a resize as well.

Sometimes the resize is paired with another action, such as maximize,
fullscreen or show. In those cases a configure will be generated and a
previous resize is accounted for.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3842>
2024-06-27 14:00:02 +00:00
Sebastian Wick
be46852292 wayland/dnd-surface: Chain up in the assigned vfunc
Commit e775052429 changed the code such that resetting the actor is done
when a surface role is assigned. The dnd surface assigned vfunc doesn't
chain up which means the code to reset the actor is never hit and the
dnd surface never shows up.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3540
Fixes: e775052429 ("wayland/actor-surface: Reset the actor on role-assignment")
2024-06-26 18:37:34 +00:00
Jonas Ådahl
0c014a23b4 doc/coding-style: Update guidelines for floating point numbers
The old guidelines aren't compatible with -Wfloat-conversion.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3822>
2024-06-25 20:48:24 +02:00
Jonas Ådahl
422ee4515d Compile with -Wfloat-conversion
This means we'll get warnings whenever a floating point value looses
precision, e.g. gets implicitly casted to an integer. It also warns when
implicitly casting double's to float's, which arguably is less of a
problem, but there are no warning for just float/double to int.

This would have caught
https://gitlab.gnome.org/GNOME/mutter/-/issues/3530.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3822>
2024-06-25 20:48:24 +02:00
Jonas Ådahl
d5bc883712 clutter/paint-nodes: Remove radius field from blur node
It wasn't used.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3822>
2024-06-25 20:45:27 +02:00
Michel Dänzer
fab78d951a wayland/actor-surface: Don't sync actor state for frozen actors
This ensures that sub-surfaces remain visible during the fade-out
animation of their window.

Fixes: be4bf8da9c ("wayland/surface: Keep applied sub-surface branch node linked up")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3508
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3840>
2024-06-25 13:35:46 +00:00
Michel Dänzer
03f3c18d27 window-actor/wayland: Sync actor state when actor is thawed
This is currently redundant, but will be needed with the next commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3840>
2024-06-25 13:35:46 +00:00
Carlos Garnacho
a48a149c61 backends: Use floating point checks in MetaViewportInfo
In these checks, it's an important detail to preserve subpixel information
in order to correctly determine whether the coordinates are inside or
outside a view.

Otherwise, small enough motion towards the left/top might get rounded
to 0, be seen as "inside the view", and the pointer coordinates be allowed
to escape the viewport constraints.

This was figured out by Pascal Nowack before me, with a difference of
minutes. Credit where credit is due.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3530
Fixes: 6c972546f1 ("mtk: Add Rectangle.contains_point")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3820>
2024-06-25 01:44:30 +02:00
Carlos Garnacho
32cb2ee720 mtk: Add mtk_rectangle_contains_pointf()
This variant works on floating point coordinates, in order
to avoid undesired effects with rounding.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3820>
2024-06-25 01:44:30 +02:00
Georges Basile Stavracas Neto
de2aac7a3d src/seat-impl: Keep device variable alive for longer
In meta_seat_impl_remove_virtual_input_device(), the 'device'
variable is first removed from MetaSeatImpl, then a "device
removed" event is generated with it.

The problem here is that, if this is the last reference of
'device', the removal from MetaSeatImpl will destroy it. Then
the freed variable will be used to create the "device removed"
event, which is a use-after-free situation.

Fix that by owning an extra ref to 'device' as long as the
function is executing. Do this by declaring a g_autoptr
variable with the extra ref. This g_autoptr variable is cleaned
up by the end of the function, which achieves the desired effect.

Spotted by Coverity.

CID: #1594046
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3835>
2024-06-24 12:04:08 +00:00
Bilal Elmoussaoui
cb4b31f858 clutter: Don't generate unused keys_by_name table
Spotted by codeql

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3837>
2024-06-22 23:53:49 +00:00
Bilal Elmoussaoui
43dabfc8d1 clutter: Remove unused static function
Detected through codeql

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3837>
2024-06-22 23:53:49 +00:00
Bilal Elmoussaoui
6e1c761330 Remove unused variables
Detected through codeql

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3837>
2024-06-22 23:53:49 +00:00
Florian Müllner
42e5c7bd9c Bump API version
It has been a while since we branched, and there have been enough
divergence already to justify a bump.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3836>
2024-06-22 15:01:25 +02:00
Michel Dänzer
eb8c2f600a kms/impl-device: Use priv->path in _open_non_privileged_fd
This can work even if priv->device_file == NULL, e.g. with a secondary
GPU with no displays connected.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3833>
2024-06-21 21:39:41 +00:00
Sebastian Wick
4eacf97678 wayland/surface: Send unmapped signal when the surface goes away
This was the intention anwyway but it didn't work properly because
GObject::dispose removes all signal handlers and we unmap surfaces in
WaylandShellSurface::finalize. Move all the unmanaging and unmapping to
the dispose vfunc where we can still run all the signal handlers.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3501
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3783>
2024-06-21 22:07:45 +02:00
Sebastian Wick
3e7b1d9cbd wayland: Handle unmapping surfaces
Right now the unmapped signal doesn't always fire which means we didn't
see a surface that's being unmapped in these code paths before. In
particular the resource, window and role can be gone. Handle those
cases.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3783>
2024-06-21 22:07:42 +02:00
Sebastian Wick
dbdc8dd958 wayland/activation: Keep around all pending activation reuqests
Instead of throwing away and not finishing a previous request, let's
queue up all activation requests until a window becomes mapped or
unmanaged.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3798>
2024-06-21 18:44:25 +00:00
Sebastian Wick
750459ddfe wayland/activation: Activate existing window with activations only
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3798>
2024-06-21 18:44:25 +00:00
Sebastian Wick
b9ba34ac6f wayland/activation: Fix signal callback signature
Parameter notify signals have a GParamSpec as second parameter.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3523
Fixes: c166b3fc5 ("wayland/activation: Apply xdg-activation request when window gets mapped")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3798>
2024-06-21 18:44:25 +00:00
Jonas Ådahl
b41d1437a7 tests/backend: Make test device removal function name consistent
The add function is add_test_device(), but the remove one was
remove_device(). Lets add a test_ to the former to make them consistent.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3812>
2024-06-21 17:22:20 +00:00
Jonas Ådahl
465af4b2d3 build: Make native backend mandatory for all tests
This allows us one less level of indentation of all the tests. It is not
entirely true, the X11 backend test case script can run without it, but
it isn't valuable enough to run without the native backend being enabled
to complicate building.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3812>
2024-06-21 17:22:20 +00:00