32956 Commits

Author SHA1 Message Date
Carlos Garnacho
18c8efcd42 wayland: Lock touch sequence info on first entered surface
Even though the touch moved to being set up in CLUTTER_ENTER, it
is still meant to lock onto the pressed surface, we however will
receive crossing events if the touch moves between actors/surfaces,
triggering warnings when the touch info registration is attempted
on the already existing touch sequence.

The reasons to handle this in CLUTTER_ENTER still apply, so ensure
the touch info for the sequence does not previously exist to avoid
the warning.

Fixes: 2e82a2049f ("wayland: Register touchpoint info on CLUTTER_ENTER")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4166>
2024-12-05 22:35:26 +00:00
Carlos Garnacho
f637b8b12c wayland: Drop invalidate focus flags
This is not necessary anymore, so far can be dropped.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4166>
2024-12-05 22:35:26 +00:00
Carlos Garnacho
5cb8773409 wayland: Emit wl_touch.cancel in seat focus handling
We try to emit wl_touch.cancel in the situations where grabbing input
would take input away from the wl_touch interface. This however does
not play fine with grabs induced by wayland interfaces (e.g. xdg popups).

A more natural place to handle this is the MetaWaylandSeats' default
input handler, specifically the focus() vmethod. Here, we may know if the
focus surface matches the current surface as picked by MetaWaylandTouch,
and if it does not, either a grab or another input handler stole input
away from the default event handler.

A case where this will notably not happen anymore is in the transition
to a xdg_popup grab, since the grabbing client will still be handling
input, and touch input will not be unfocused away despite the transition
to a grab.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3752
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4166>
2024-12-05 22:35:26 +00:00
Carlos Garnacho
c9fa30c55b wayland: Handle reentrancy invalidating touch foci
The hashtable containing per-sequence touch info may change while
invalidating the focus, so grab a copy first of the existing sequences.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4166>
2024-12-05 22:35:26 +00:00
Carlos Garnacho
f28f31fc32 wayland: Fix updating pointer cursor on Drag and Drop
The logic to allow src/wayland to update the pointer cursor changed
to bypassing grabs in commit e69e4fa6, since it is nowadays the
responsibility of the DnD source to update the pointer cursor in reaction
to the negotiated action.

This is not entirely correct, and was done at the expense of regressions.
Change the logic so we explicitly check for a DnD grab existing, or use
the active focus instead (i.e. grab-aware). This fixes the regression, and
keep DnD cursor icons working.

This is a partial revert of commit e69e4fa6dbbd62677de61bcd2f5f3bec515e79ce.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3460
Fixes: e69e4fa6db ("Revert "wayland: Check focus surface to set a pointer cursor"")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4166>
2024-12-05 22:35:26 +00:00
Joan Torres
0095e7d50a clutter/color-state-params: Improve create transform snippet
Make create_transform_snippet method more consistent.

Abstract TransferFunction struct: convert it to ColorOpSnippet.

This transform snippet will be defined by these ColorOpSnippets.
These ColorOpSnippets are similar to the prescriptive DRM API for
color transformation.

A standard transform snippet would have as ColorOpSnippets:
  1. eotf
  2. luminance_mapping
  3. color_space_mapping
  4. inv_eotf

Update uniforms the same way the transform snippet is defined.

Update color transform key to consider how the transform snippet is
generated.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4144>
2024-12-05 22:24:05 +00:00
Joan Torres
7f8df9d9a1 clutter/color-state-params: Add new_from_primitives
When creating a new color state from the primitives Colorimetry, EOTF
and Luminance; it is needed to previously check their tags to properly get
their values and avoid UB.

This check is duplicated and is a bit unreadable.

Using this new function helps keeping readability.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4144>
2024-12-05 22:24:05 +00:00
Joan Torres
2e2a91a14b clutter/color-state-params: Make get white chromaticity func generic
Change the name of the func to xyY_to_XYZ which explains more and allows
reusing it in the following commits.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4144>
2024-12-05 22:24:05 +00:00
Joan Torres
7e847b555b clutter/color-state: Abstract color state and add Params subclass
Most of the implementation at color state was specific to a color state
generated from parameters so move it to a new class Params.

In the next commits a new color state ICC class will be added.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4144>
2024-12-05 22:24:05 +00:00
Joan Torres
403c8a7b63 clutter/color-state: When equals don't add color transform pipeline
The EOTFs snippets were only added when color states were not equal.

It makes more sense to only add the whole color transformation pipeline
in that case.

This makes the assumption to always append EOTFs snippets.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4144>
2024-12-05 22:24:05 +00:00
Jonas Ådahl
c3cc1338ec renderer/native: Change an explicit unref to autoptr
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3900>
2024-12-05 19:12:09 +00:00
Jonas Ådahl
c11c654f0d screen-cast: Check whether modifier is implicit via helper
This avoids another native backend macro check.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3315
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3900>
2024-12-05 19:12:09 +00:00
Jonas Ådahl
6dcc5e9a6b screen-cast: Query format modifiers via CoglRenderer
This moves some backend specific code to the actual backend.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/3315
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3900>
2024-12-05 19:12:09 +00:00
Jonas Ådahl
2205181da8 cogl/renderer: Add API to get the implicit modifier
This allows avoiding having to depend on libdrm in places that are
otherwise independent of the backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3900>
2024-12-05 19:12:09 +00:00
Jonas Ådahl
01dcec31b0 cogl/renderer: Add way to filter modifiers by external-only
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3900>
2024-12-05 19:12:09 +00:00
Jonas Ådahl
4bf04585d2 render-device/gdm: Make query format modifier filter loop more generic
This will allow adding more filters more easily.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3900>
2024-12-05 19:12:09 +00:00
Jonas Ådahl
157c4af11e screen-cast/stream-src: Put type definition higher up
Type definition (G_TYPE_DEFINE..()) should be above all other code; only
type definitions etc should be above.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3900>
2024-12-05 19:12:09 +00:00
Jonas Ådahl
e3f743facc cogl/renderer: Add API to query DRM format modifiers
Will be used to do explicit modifier buffer allocation via the Cogl API.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3900>
2024-12-05 19:12:09 +00:00
Jonas Ådahl
78cfbb57eb cogl/renderer: Remove stray newline
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3900>
2024-12-05 19:12:09 +00:00
Jonas Ådahl
8509b74532 Make DMA buffer allocation format and modifier aware
This makes DMA buffer allocation in all layers take an array of possible
modifiers to allocate using, or zero modifiers if implicit modifiers
should be used.

The format hard coding previously used is moved to the screen cast code,
or in case of the (unused by default) shadow buffer buffers use the same
format as the the CoglOnscreen.

This also means the CoglDmaBufHandle and MetaDrmBuffer got taught how to
distinguish between planes. It's mostly unused in practice, so rather
untested.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3900>
2024-12-05 19:12:09 +00:00
Jonas Ådahl
a4ddba44e9 onscreen/native: Move DRM modifier querying to MetaRenderDevice
It's only implemented by the GBM render device backend, and uses EGL,
thus does not distinguish scanout capable modifiers.

A filter enum is added to Cogl, since it'll be used via the Cogl API,
but the actual Cogl API isn't added yet.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3900>
2024-12-05 19:12:09 +00:00
Michel Dänzer
a8fe1fd625 crtc-kms: Use clutter_stage_view_schedule_update in _kms_set_gamma_lut
Instead of clutter_stage_schedule_update. There's no need to schedule
updates for stage views other than of the CRTC passed in.

As a bonus, this avoids a crash when a virtual monitor is removed.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3719
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4148>
2024-12-05 09:36:07 +00:00
Jonas Ådahl
24083e1e58 stage: Clear update_scheduled field when update discarded
clutter_stage_schedule_update() sets the field `update_scheduled` to
`TRUE` as an optimization to make redundant updates a no-op. This failed
if there was a pending event and if the stage was not yet mapped.

What happened is:

 * clutter_stage_schedule_update() is called
   - ClutterStage::update_scheduled is set to TRUE
   - frame clock scheduled
 * frame clock dispatches
   - frame is discarded early, no actual stage update happens
 * device is created (e.g. virtual device from remote desktop session)
   - `device-added` event reaches ClutterStage::event_queue
 * stage is shown
   - clutter_stage_schedule_update() is called
     - ClutterStage::update_scheduled is TRUE
     - ClutterStage::event_queue has events in it
     - These two conditions means clutter_schedule_update() becomes a
       no-op

At this point, no more updates will happen from
clutter_stage_schedule_update().

Fix this by resetting `ClutterStage::update_scheduled` to `FALSE` even
if the frame was discarded due to the stage not yet being mapped.

A test case is added that replicates the above descibed events.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3804
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4152>
2024-12-05 00:19:12 +00:00
Jonas Ådahl
904c39116e tests/test-shell: Allow skipping showing the stage
To allow tests to emulate GNOME Shell behavior, where the stage showing
is delayed. Do so by adding the `"options"` property to the plugin
object type. The property expects a vararg GVariant, and supports
the `"show-stage"` (boolean) vararg entry.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4152>
2024-12-05 00:19:12 +00:00
Jonas Ådahl
a23d08c754 Add way to pass construct time options to plugin
This is needed to allow tests to manipulate the behavior of the test
shell plugin during startup. Since the plugin is created and started
when the MetaDisplay is created, it needs to be handled via MetaContext,
by setting the options after creating the context, but before starting.

For simplicity reasons, make the options an opaque GVariant, passed via
a an `"options"` property when the plugin object is created, if the
passed options is non-NULL. Only passing the options when non-NULL
allows for backward compatibility.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4152>
2024-12-05 00:19:12 +00:00
Bilal Elmoussaoui
03c36f94bb cogl/buffer: Don't store "vfuncs" in the struct
This was done during the move to a GObjectified Buffer instance, but in
the future when we will move the DriverVtable to an abstract class, this
would annoy us.

Given that those functions are only used internally in three instances,
just replace them with the actual logic of checking whether tu use
malloc fallback path or not.

Helps https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4132

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4137>
2024-12-04 23:51:18 +02:00
Georges Basile Stavracas Neto
13f6dcc098 clutter/paint-nodes: Use g_clear_object()
Minor cleanup.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4160>
2024-12-03 01:17:50 +00:00
Georges Basile Stavracas Neto
4aef995f72 clutter/stage: Delegate color state to root node
As the title says. Another step towards moving the color state
management to the paint node tree. Will help with ClutterSnapshot
transition.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4160>
2024-12-03 01:17:50 +00:00
Georges Basile Stavracas Neto
551db47b4c clutter/actor: Push/pop color state in actor node
Instead of ClutterActor doing that manually in the paint routines
manually, delegate that to the actor node. This will help with the
move to ClutterSnapshot.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4160>
2024-12-03 01:17:50 +00:00
Bilal Elmoussaoui
6d37dbdc40 cogl/winsys: Drop unnused functions
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4162>
2024-11-30 17:05:02 +00:00
Georges Basile Stavracas Neto
4f71551f66 frames: Cleanup unused function argument
It's unused.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4161>
2024-11-30 13:34:14 -03:00
Nick Diego Yamane
19e319b3b4 wayland/xdg-toplevel-drag: Expose the protocol
Signed-off-by: Nick Diego Yamane <nickdiego@igalia.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4107>
2024-11-29 20:51:52 -04:00
Nick Diego Yamane
b3c80016c3 wayland/xdg-toplevel-drag: Use the new grab API in meta_window_drag_begin
Signed-off-by: Nick Diego Yamane <nickdiego@igalia.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4107>
2024-11-29 20:51:52 -04:00
Nick Diego Yamane
0c42ddefad wayland/xdg-toplevel-drag: Disable show/hide effects
This disables the visibility change effects for the dragged window,
which makes it feel a bit smoother.

TODO: Double-check whether this is indeed desirable. Note: ChromeOS imp
does this and Chromium-X11 used to do this at client side.

Status:

- [x] Basic window drag triggering
- [x] Exclude the dragged window from event targets
- [x] Event forwarding (window drag vs wayland grabs)
- [x] Offset calc relative to toplevel geometry
- [x] Attach already mapped windows
- [x] Properly support not-yet-mapped windows
- [x] Disable visibility change animations
- [ ] Dnd events stream adaptations

Signed-off-by: Nick Diego Yamane <nickdiego@igalia.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4107>
2024-11-29 20:51:52 -04:00
Nick Diego Yamane
0111f0de14 wayland/xdg-toplevel-drag: Plumb xdg-toplevel-drag to core/compositor
- Event stream adaptations. When there is a toplevel-drag in place, do:
  - Send wl_data_source.dnd_finished and end the session successfully
  - Send wl_data_source.cancelled and end the MetaWindowDrag when ESC key
    is pressed.
- Modify MetaWaylandDataDevice such that, when a toplevel-drag is
  running, it does:
  - Propagate motion events, so that they can be processed further by
    MetaWindowDrag.
  - Ends the associated MetaWindowDrag upon release event.
- Hook up the window mapping process in MetaWindowWayand, such that:
  - the initial position of the window attached to the ongoing
    toplevel-drag instance can be calculated and set.
  - the appropriate gravity and flags can be set when calling MetaWindow's
    meta_window_move_resize_internal, which allows it for example to be
    moved freely (unconstrained) as per current dragging cursor.

Status:

- [x] Basic window drag triggering
- [x] Exclude the dragged window from event targets
- [x] Event forwarding (window drag vs wayland grabs)
- [x] Offset calc relative to toplevel geometry
- [x] Attach already mapped windows
- [x] Properly support not-yet-mapped windows
- [x] Disable visibility change animations
- [x] Dnd events stream adaptations

Signed-off-by: Nick Diego Yamane <nickdiego@igalia.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4107>
2024-11-29 20:51:52 -04:00
Nick Diego Yamane
66cfbf03c9 wayland/xdg-toplevel-drag: Add the protocol implementation
- For already mapped windows, the window drag session is started
  straight away;
- For about-to-be-mapped window (ie: undocking window use case):
  - The "shown" signal for the dragged window triggers the actual
    MetaWindowDrag once it's mapped.
  - MetaWindowWayland now handles the case of toplevel-drag and position
    the window about to be mapped according to the toplevel-drag
    parameters.
- While attached to a toplevel-drag, the window state is updated to:
  - Actor's "reactive" state is set to false, which in practice excludes
    it from the possible drag target list;
  - WindowActor's "tied to drag" state is set to true, which results in
    initial placement constraints to be skipped, so newly created
    (detached) windows can be freely dragged around.
- Toplevel drag session ends upon:
  - dnd drop and cancellation.
  - xdg_toplevel_drag_v1 object destruction (client-side).
  - data source destruction.

Status:

- [x] Basic window drag triggering
- [x] Exclude the dragged window from event targets
- [x] Event forwarding (window drag vs wayland grabs)
- [x] Offset calc relative to toplevel geometry
- [x] Attach already mapped windows
- [x] Properly support not-yet-mapped windows
- [ ] Disable visibility change animations
- [ ] Dnd events stream adaptations

Signed-off-by: Nick Diego Yamane <nickdiego@igalia.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4107>
2024-11-29 20:51:52 -04:00
Nick Diego Yamane
1cb46f203c wayland/xdg-toplevel-drag: Support non-grabbing mode in MetaWindowDrag
- This adds a new ClutterActor parameter to meta_compositor_drag_window
  and meta_window_drag_begin such that it's possible to inject an
  external grab actor, which is then used to implement a "non-grabbing"
  mode that allow a MetaWindowDrag to be used in conjunction, for
  example, with a Wayland drag-and-drop session;
- This new API is going to be used to implement the toplevel drag
  protocol in a subsequent commit.

Signed-off-by: Nick Diego Yamane <nickdiego@igalia.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4107>
2024-11-29 20:35:15 -04:00
Nick Diego Yamane
848612b08f wayland/xdg-toplevel-drag: Add destroy signal to data source
It will be used by xdg-toplevel-drag protocol implementation.

Signed-off-by: Nick Diego Yamane <nickdiego@igalia.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4107>
2024-11-29 20:31:24 -04:00
Nick Diego Yamane
3047b2ce26 wayland/xdg-toplevel-drag: Add MetaWindowActor tied_to_drag state
- Skip placement constraints when it is set.
- Required to properly support about-to-be-mapped windows, which get
  "detached" when dragged out of its original owning window.

Signed-off-by: Nick Diego Yamane <nickdiego@igalia.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4107>
2024-11-29 20:31:24 -04:00
Nick Diego Yamane
3e0fd4b26b wayland/xdg-toplevel-drag: Expose meta_wayland_xdg_surface_get_window_geometry
Signed-off-by: Nick Diego Yamane <nickdiego@igalia.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4107>
2024-11-28 18:08:48 -04:00
Jonas Ådahl
85d2d49499 wayland/surface: Unconditionally set scanout destination rect
The cogl_scanout_get_dst_rect() fell back on the buffer dimensions as
the destination rectangle when nothing was explicitly set. This,
however, is not necessarily correct. For example, if a buffer is larger
the CRTC resolution, but the surface is scaled to exactly match the CRTC view,
the expected destination size should match the CRTC resolution, not the
buffer dimension, which would be the case if no explicit destination was
set.

In meta_wayland_try_aquire_scanout() we're in a good position to
determine the destination rect in the CRTC primary plane, since we have
all the prerequisits, i.e. that the surface effectively covers the whole
CRTC, the actor allocation box (the non-black border part), the scale
and transform of the view.

This tweaks the CoglScanout API a bit to make it explicit that the
dst_rect must be unconditionally provided, and removes the fallback to
the buffer dimension as the destination rectangle, which sometimes
resulted in a destination rectangle being larger than the primary plane
itself, resulting in clipping and incorrect scaling.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3773
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4147>
2024-11-27 20:18:31 +00:00
Jonas Ådahl
d1ec1d7c61 wayland/surface: Fix bounding box rect when calculating scanout
The "dst_rect" calculated is in "CRTC space", meaning the bounding box
used for calculating it should be the view layout dimension, scaled by
the view scale and transform by the view transform. Previously it was
only transformed, not scaled. While fixing this, rename the variables to
make it a bit more clear what coordinate space they are expected to be
in.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4147>
2024-11-27 20:18:31 +00:00
Jonas Ådahl
2149427f4a wayland/buffer: Also pass src/dst rect when trying to scanout EGLImage
Do the same as in the DMA buffer case, and just pass it forward.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4147>
2024-11-27 20:18:31 +00:00
Ikey Doherty
f385b276d8 compositor/plugins: Ensure libdefault has valid RPATH
Correct dependency analysis for required DT_NEEDED entries is
made difficult due to the lack of DT_RPATH, despite all other
installed libraries in the build setting an RPATH.

Whilst it is true dlopen() still works, this is only because
libmutter is already linked to the main executable, which in turn
links to the private libraries via DT_RPATH.

Signed-off-by: Ikey Doherty <ikey@serpentos.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4150>
2024-11-26 20:24:34 +00:00
Alessandro Astone
7f89e5b881 wayland: Invalidate focus from all touch inputs too
This allows drag-and-drop within the same surface with touch input.

Test case: drag-and-drop a file into a directory in Nautilus.
Prior to this change that would only work if the finger first leaves
then re-enters the surface.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4091>
2024-11-22 18:45:25 +00:00
Jocelyn Falempe
e44620c86e renderer/native: Add BGRX8888 format to the default list
On big endian machine, the native 32bits format is
DRM_FORMAT_BGRX8888, so add this format to the list.

Tested on a s390x VM, using virtio-gpu driver.

Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4088>
2024-11-22 14:21:31 +00:00
Jocelyn Falempe
18085b0e40 cogl/egl: Choose config only if needed
In try_create_context(), if COGL_EGL_WINSYS_FEATURE_NO_CONFIG_CONTEXT
is set, don't try to choose an egl config.

Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4088>
2024-11-22 14:21:31 +00:00
Takao Fujiwara
fb86d5d5b0 wayland/text-input: Reset surrounding text values by focus change
For zwp_text_input_v3_set_surrounding_text(), the protocol specifies:

"If the client is unaware of the text around the cursor, it should
not issue this request, to signify lack of support to the compositor."

Mutter currently doesn't clear its stored surrounding text when the
input focus changes, re-using the existing text for the newly focused
client. This already seems problematic, but since clients aren't
supposed to set surrounding text to NULL or an empty string if they
don't have one (and instead should simply avoid calling
`set_surrounding_text()`), this is clearly a bug in Mutter.

Fix it by unsetting the stored surrounding text when removing input
focus from a client.

Fixes: 33088d59db ("wayland/text-input: Pass char based offset to ClutterInputFocus")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3604>
2024-11-20 22:54:54 +00:00
Michel Dänzer
a516090014 backend/native: Handle NULL priv->startup_render_devices
In add_drm_device, calling g_hash_table_insert with NULL for the hash
table (which happens for any device added after mutter finished starting
up) would presumably just drop the key/value pointers on the floor,
leaking the string & MetaRenderDevice object referenced by them. Fixing
this should help for the referenced issue.

In meta_backend_native_take_render_device, g_hash_table_steal_extended
would presumably return FALSE (and log a warning), so the behaviour would
be "correct" by chance.

Issue: https://gitlab.gnome.org/GNOME/mutter/-/issues/3785
Fixes: 58c3734d78e9 ("backend/native: Prepare render devices earlier than KMS")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4136>
2024-11-20 19:38:58 +00:00
Michel Dänzer
206ec7b46b wayland/cursor-surface: Schedule update for frame events
Without this, frame events may never be sent for the cursor surface if
nothing else happens to schedule an update.

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

v2:
* Use meta_wayland_surface_get_main_monitor. (Sebastian Wick)
v3:
* Move some local variable initializers to the declarations in
  meta_wayland_cursor_schedule_update. (Sebastian Wick)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4113>
2024-11-20 19:27:26 +00:00