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>
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>
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>
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>
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>
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>
- 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>
- 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>
- 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>
- 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>
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>
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>
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>
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>
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>
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>
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>
The cursor and anchor position of the surrounding text *must* be within
(or right before/after) the string that is submitted as surrounding text.
Everything else is a client error that we shouldn't accept and log as such.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3650>
meta_wayland_text_input_focus_delete_surrounding() is accessible from JS and
used by gnome-shell via ClutterInputMethod.delete_surrounding(). Mutter
should never crash on invalid function calls from JS, so g_return_if_fail()
instead of asserting in case the parameters are wrong here.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3650>
This allows to capture the next update of all stage views using
meta_backend_renderdoc_capture. Finer control over what stage view is
captured when can be added in the future.
Currently, renderdoc does not support the GL_OES_EGL_image extension
that we depend on for importing dma-bufs. This means that dma-buf
support is broken when mutter in launched with renderdoc.
One can hack up renderdoc to pretend to support GL_OES_EGL_image and
specifically EGLImageTargetTexture2DOES to restore the full mutter
functionality but renderdoc captures replay with a black rectangle where
those dma-buf buffers are being painted.
See:
https://registry.khronos.org/OpenGL/extensions/OES/OES_EGL_image.txthttps://registry.khronos.org/OpenGL/extensions/OES/OES_EGL_image_external.txt
It looks like the renderdoc maintainer does not want to merge support
for the extension: https://github.com/baldurk/renderdoc/pull/2845
We would only need support for dma-buf EGLImages which so it might be
possible to convince the maintainer.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4061>
In contrast to realtime scheduling, this doesn't risk us getting
SIGKILL:ed when the kernel is doing busy looping in
drmModeAtomicCommit() for some reason, but will according to testing,
right now, give us more or less the same benefit when it comes to
dispatch lateness and commit lateness.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4124>
Either prefer "normal" or "realtime", via an enum, instead of a boolean.
Also make it configurable with an env var
`MUTTER_DEBUG_KMS_SCHEDULING_PRIORITY`, which can be set to either
`normal` or `realtime`.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4124>
Overlays are always cursors, and "redraw overlay" doesn't communicate
that. Add "cursor" or "cursor overlay" to some functions to make it a
bit more obvious in a couple of places.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4066>
There were things hooked up (connecting signals, adding stage watches),
but it was a bit disorganized, with "adding watches" doing more, and
"init callbacks" being a bit vague. Split things up to
* setup view - hook up things that need to listen on a stage view
* setup cursor tracking - track cursor positions, sprite changes
* the rest - monitor changes etc
This also properly handles a race condition when we'll enable before the
idle callback creating the view from the virtual monitors is run.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4066>
The hardware cursor support in the cursor renderer now acts on a per
stage view basis, so no need to inhibit the hardware cursor, it isn't
going to try to put a hardware cursor on a virtual CRTC anyway.
Instead use overlay inhibitation to decide whether an cursor overlay
should be painted or not. Inhibit the overlay when hidden/metadata, but
not when embedded.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4066>
There's a workaround (ec18a559c687 ("monitor-manager: Ignore
tablet-mode-switch on initial config of native portrait mode panels")) for
panels that default to portrait mode, where touch mode is disabled, but
a touchscreen is present. This workaround gets applied when we receive
the first reading from the orientation manager.
Make sure this workaround is applied as expected by adding a test for it.
The test needs to be first in the list of orientation tests, because mutter
only applies the workaround on the first orientation event it receives.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4126>
The MetaWindowConfig can indicate whether the configuration reflects on
the initial configuration, before the window is first mapped.
Add a smaller helper (private) window function to create the appropriate
"type" of MetaWindowConfig depending whether the window was already
showed or not.
This is preparation work for the following commits where this function
will be used.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4076>