1
0
Fork 0
Commit graph

10653 commits

Author SHA1 Message Date
Florian Müllner
c4f43b65ed build: Replace deprecated meson functions
The `dep.get_<type>_variable()` methods have been deprecated in
favor of the generic `dep.get_variable()` method.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2702>
2022-11-19 02:21:05 +01:00
Jonas Ådahl
db2387d7f8 tests/clutter: Use a 800x600 10 Hz virtual monitor
This matches what CI did, and will hopefully help make some tests that
rely on timings less flaky.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2701>
2022-11-18 19:46:09 +01:00
Jonas Ådahl
22d08501a8 cursor-renderer/native: Fix cursor sprite CRTC scale
The CRTC cursor sprite scale was incorrectly assumed to be always 1.0
when using the default not-scale-monitor-framebuffer mode. This is
harmless in most cases, as most clients provide HiDPI capable cursors,
but for the ones that didn't, we'd end up drawing their cursors
unscaled, when using the cursor planes.

Fix this by using the "texture scale" which is what is intended for
this.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2477
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2698>
2022-11-18 11:26:30 +00:00
Jonas Ådahl
a1d14a6176 cursor-renderer/native: Don't put opaque buffers in cursor plane
Cursor planes tend to be ARGB8888 and support no other format (ideally
we should not hard code this, but un-hard-coding that is for another
day), and if we put e.g. a XRGB8888 buffer in there, it'll either result
in the gbm_bo allocation failing (it doesn't allow USE_CURSOR with any
other format) or mode setting failing if using  dumb buffers directly.
In the former case, we'll fall back to OpenGL indefinitely, and in the
latter, we'll have failed mode sets as long as we try to set the invalid
cursor buffer as the cursor plane.

Change things to process all buffers that are not ARGB8888 using the
scale/rotate machinery we already have, turning XRGB8888 into ARGB8888.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2477
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2698>
2022-11-18 11:26:30 +00:00
Bilal Elmoussaoui
6b77532a23 window: Move surface property to it subclasses
As we have specific window types per display server,
having it in the parent class makes building without wayland
harder to achieve

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2418>
2022-11-17 11:30:56 +00:00
Bilal Elmoussaoui
c3a01e4e18 core: Untangle meta_window_shared_new
The constructor used to take Wayland/X11 specific types which makes
building without Wayland/X11 not possible.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2272
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2418>
2022-11-17 11:30:56 +00:00
Jonas Ådahl
58e89b3a5d tests/clutter: Use the headless backend
One test depends on a pointer event having been emitted so that the
stage has a focused pointer; make sure that has happened.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2699>
2022-11-17 10:25:37 +00:00
Jonas Ådahl
b15be5e287 backend/native: Don't assume passed error points to anything
It's common practice to not require a non-NULL error passed to `GError
**error` arguments, so do not make that assumption here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2699>
2022-11-17 10:25:37 +00:00
Sebastian Wick
d6d6dc65c1 window-actor/wayland: Do not crash when there is no monitor
When all monitors are blanking or after suspending there might not be
any monitors temporarily. We can't draw a black background when we don't
know the size of the monitor it's fullscreen on but it's fine because
there actually is no monitor.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2508
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2695>
2022-11-15 22:46:30 +01:00
Sebastian Krzyszkowiak
e331e38a19 shaped-texture: Reset pipelines after setting a texture with new size
Attaching a new buffer with a different size than the old one means
that the viewport needs to be recalculated.

Not doing this caused the viewport to be incorrectly applied when
viewport_src_rect remained the same after attaching such buffer.
Pipeline reset usually happens when applying a new viewport,
but it doesn't happen when the viewport values remain the same.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2689>
2022-11-13 18:02:30 +00:00
Robert Mader
7e838b1115 wayland/outputs: Implement wl_output v4
This version adds the name and description events already present
in xdg_output.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2692>
2022-11-10 13:45:05 +01:00
Robert Mader
1b1eed0dbd wayland/outputs: Implement wl_output v3
This version adds a release event, allowing clients to tell the
server that it can clean up the related wl_resource.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2692>
2022-11-10 13:45:05 +01:00
Carlos Garnacho
e43234f464 backends: Use Clutter API to get dimensions at MetaInputMapper
We can now ask the ClutterInputDevice about its physical size, instead
of resorting to udev.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2617>
2022-11-09 10:46:55 +00:00
Carlos Garnacho
b040964025 backends/x11: Implement get_dimensions() in X11 input devices
We can get the information from X11 itself, so do the calculations to return
the device physical size.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2617>
2022-11-09 10:46:55 +00:00
Carlos Garnacho
21fb6cc412 backends/native: Implement get_dimensions() in native devices
We already poked the libinput device size, so use that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2617>
2022-11-09 10:46:55 +00:00
Carlos Garnacho
a37bec258c backends: Drop MetaInputSettings vfunc to figure out trackballs
These now have a capability, so we don't need this vfunc anymore.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2617>
2022-11-09 10:46:55 +00:00
Carlos Garnacho
23c931ff18 backends/x11: Avoid usage of udev in MetaInputSettingsX11
Use device capabilities instead.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2617>
2022-11-09 10:46:55 +00:00
Carlos Garnacho
7dd25b62ed backends/native: Avoid direct udev usage in MetaInputSettingsNative
Use device capabilities to figure out whether configuration applies to
a device or not.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2617>
2022-11-09 10:46:55 +00:00
Carlos Garnacho
46643b895c backends: Use capabilities to figure out trackballs in MetaInputSettings
Port these configuration methods to use capabilities, instead of using the
internal vfunc.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2617>
2022-11-09 10:46:55 +00:00
Carlos Garnacho
5471b866b3 backends/x11: Set trackball/trackpoint capabilities
Use gudev to detect these capabilities in input devices.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2617>
2022-11-09 10:46:55 +00:00
Carlos Garnacho
d274d4359f backends/native: Set up trackball/trackpoint capabilities
Use udev to detect these features in input devices.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2617>
2022-11-09 10:46:55 +00:00
John Wudrick
d889aad7cf window: Update ongoing edge resistance flags with input
Fix a recent regression where edge resistance flags where no
longer updated during the move/resize operation.

Fixes: bd6b14a843 (window: Throttle window move grab updates)

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2492
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2687>
2022-11-08 05:01:49 +00:00
Jonas Ådahl
ac093dc651 wayland/xdg-shell: Send xdg_popup.popup_done when position invalid
A client may provide a positioner that places the window outside of its
parent. This isn't allowed, according to spec, so we hide the window and
log a warning. This, however, leads these affected clients with an
incorrect view of what is mapped or not, meaning it becomes harder to
recover.

Fix this by sending xdg_popup.done when we hide the popup due to an
invalid position. Don't error out the client, let the bug slide, as
that's a less jarring experience for existing applications that
reproduce this than being disconnected, which practically feels like a
crash.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2408
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2645>
2022-11-06 13:06:37 +00:00
Jonas Dreßler
28982ade94 gesture-tracker: Never reject sequences in Wayland sessions
In constrast to x11, Wayland has sane handling for touch events and
allows the compositor to handle a touch event while the clients are
already seeing it. This means we don't need the REJECTED state on
Wayland, since we can also grab sequences after the client has seen
them.

So disallow moving sequences to the REJECTED state on Wayland.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2508>
2022-11-04 19:09:56 +00:00
Jonas Dreßler
fc1b4ae149 gesture-tracker: Only track actions which are actually enabled
Tracking disabled actions doesn't make sense, these will never recognize
anyway.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2508>
2022-11-04 19:09:56 +00:00
Robert Mader
d313c8f4fe Revert "wayland/pointer-constraints: Fix window check on subsurfaces"
This reverts commit 50288d1ead.

The fix is uncomplete and causes crashes under certain circumstances.
As we are close to the next point release let's revert it for now.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2685>
2022-11-03 13:17:40 +01:00
Jonas Ådahl
ec18a1d7ae tests/dbus-runner: Add way to launch custom services
This will be used by CI to launch wireplumber inside the D-Bus session
started by meta-dbus-runner.py.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2678>
2022-11-01 21:04:21 +00:00
Jonas Ådahl
562024f746 plugin/default: Don't load properties when getting locale proxy
This cuts away between 7 and 40 ms from the startup of tests.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2678>
2022-11-01 21:04:21 +00:00
Jonas Ådahl
1efb93e145 profiler: Allow enable tracing via env var
This is helpful to e.g. trace e.g. launching.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2678>
2022-11-01 21:04:21 +00:00
Jonas Ådahl
ca2057da9a Move MetaProfiler from the backend to core
It's not really a backend thing, and we'll want to profile e.g. loading
the backend too, so create it very early and destroy it very late and
let MetaContextMain own it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2678>
2022-11-01 21:04:21 +00:00
Robert Mader
50288d1ead wayland/pointer-constraints: Fix window check on subsurfaces
`get_window()` is not implemented by the subsurface role, returning
`NULL`, breaking constrains for subsurfaces.
While the `get_window()` behaviour could change in the future, for now
use `get_toplevel_window()` which does what we need here while avoiding
possible regressions.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2223
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2681>
2022-11-01 17:04:16 +01:00
Łukasz Spintzyk
c57a500ccb backend/native: Create MetaRenderDevice on_gpu_added when it does not exists
Fixes GNOME/mutter#2481

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2676>
2022-11-01 11:13:38 +01:00
Salman Malik
986d3be7ac virtual-stream: Paint stage properly with/without cursor
This change ensures that when the painted stage is
written out to the buffer, it respects the clients
desire to either desire to either embed the cursor
in the view or not.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2142
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2629>
2022-10-24 19:38:08 +00:00
Salman Malik
abc8555463 virtual-stream: Fix always embedded cursor
This change fixes the issue where the cursor is always
embedded in the frames even when the client has requested
the cursor information be sent as metadata in the stream.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2629>
2022-10-24 19:38:08 +00:00
msizanoen1
b61b0478f7 xwayland: Always require X11 authentication
This reverts commit eac227a203.

Currently, Flatpak applications can bypass the X11 permission setting
and access the X server through abstract sockets because X11 authentication
is not enforced for the current user ID.

Fix this by always requiring X11 authentication for Xwayland. This also
means applications without XAUTHORITY set to the file with Mutter's
Xwayland credentials cannot connect to X, including apps launched from
VT or SSH.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2633>
2022-10-21 14:06:28 +00:00
Sebastian Keller
184055b2bb window/x11: Ignore the _NET_WM_BYPASS_COMPOSITOR = 1 hint
We already detect all the cases that allow a window to be properly
unredirected. Using this hint to bypass some of those checks only causes
windows that can not be unredirected properly to get unredirected
regardless.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2434
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2651>
2022-10-21 12:58:07 +00:00
Sebastian Keller
46fc94b67f surface-actor-x11: Only unredirect fullscreen windows for full damage
When deciding if a window should be unredirected because it was causing
fullscreen damage in the past, it was not considered whether the window
is still fullscreen. This could result in a floating window being
unredirected if it was chosen for unredirection because of
_NET_WM_BYPASS_COMPOSITOR = 1 and was previously fullscreened for >= 100
frames, long enough to change does_full_damage, before getting
unfullscreened.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2434
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2651>
2022-10-21 12:58:07 +00:00
Jonas Ådahl
cefa4044d1 Revert "wayland-keyboard: Don't send pressed keys on enter"
Back in 2014 sending pressed keys to Wayland clients caused issues,
because at least Xwayland didn't handle that gracefully, causing issues
like ghost-pressed keys. A way it was reproduced was quickly alt-tab:ing
to and from a Firefox window, which would cause the File menu bar
incorrectly appearing.

While this was reported to the Xwayland component back then, it was,
probably by mistake, assumed to be an issue in mutter, and mutter
stopped sending pressed key events on enter.

The following year, Xwayland was eventually fixed, but the work around
in mutter has been kept around until it was again noticed as an
inconsistency between compositor implementations.

Lets remove the work around, and follow the spec, again.

This reverts commit c39f18c2d4.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2457
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2657>
2022-10-19 15:19:34 +00:00
Jonas Ådahl
ed8275ec33 wayland/seat: Don't double-disable input classes
We'd set the capabilities to 'none', meaning all previously enabled
device classes would be disabled. That means we shouldn't re-disable
them directly after.

This ensures '..disable()' is only called once for every '..enable()'.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2657>
2022-10-19 15:19:34 +00:00
Jonas Ådahl
bd6b14a843 window: Throttle window move grab updates
There is no point in moving a window at the input event refresh rate,
when the end result will only be used once per update, thus, throttle
the move done during grabs to once per stage update.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2233
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2652>
2022-10-18 18:12:03 +00:00
Jonas Ådahl
11a50fffa2 window: Throttle resize-grab updates to stage updates
With high frequency mouse devices, we would send very many configure
events per each update cycle, which had the end result that some clients
constantly re-allocating and redrawing their buffers far too often, if
they did this in direct response to xdg_toplevel configure events.

Lets throttle the interactive resize updates to stage updates, to avoid
having these clients doing the excessive buffer reallocation.

This also removes some old legacy X11 client resize throttling, that
throttled a bit arbitrarily on 25 resizes a second; it is probably
enough to throttle on stage updates for these clients.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2652>
2022-10-18 18:12:03 +00:00
José Expósito
5fa1a8cf42 backends/native: Send lores scroll in the middle of the detent
Some mice send a value slightly lower than 120 for some detents. The
current approach waits until a value of 120 is reached before sending a
low-resolution scroll event.

For example, the MX Master 3 sends a value of 112 in some detents:

              detent                   detent
    |                        |                       |
                        ^    ^                    ^
                        112  REL_WHEEL            224

As illustrated, only one event was sent but two were expected. However,
sending the low-resolution scroll event in the middle plus the existing
heuristics to reset the accumulator solve this issue:

              detent                   detent
    |                        |                       |
                ^          ^             ^          ^
                REL_WHEEL  112           REL_WHEEL  224

Send low-resolution scroll events in the middle of the detent to solve
this problem.

Fix https://gitlab.gnome.org/GNOME/mutter/-/issues/2469

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2668>
2022-10-18 17:28:32 +00:00
José Expósito
92a90774a4 virtual-input-device/native: Emit discrete scroll when the source is a wheel
Previously, when scroll was received in a remote session, it was handled
as continuous scroll.

This generated issues with clients without high-resolution scroll
support as the code path in charge of accumulating scroll until 120 is
reached was not used and therefore discrete scroll events were not being
generated.

Handle scroll generated in a remote session as discrete scroll when the
source is CLUTTER_SCROLL_SOURCE_WHEEL to fix this issue.

Fix https://gitlab.gnome.org/GNOME/mutter/-/issues/2473

Fixes: 9dd6268d13 ("wayland/pointer: Send high-resolution scroll data")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2664>
2022-10-18 08:16:11 +00:00
Max Zhao
87e1d72cd4 wayland: Fix null pointer deference in meta_get_first_subsurface_node.
In fcfe90aa, multiple for loops were replaced with
META_WAYLAND_SURFACE_FOREACH_SUBSURFACE.

However, this substitution was not side-effect free, and introduced a
null-pointer dereference risk as shown in the example below:

Old:

    for (n = g_node_first_child (surface->subsurface_branch_node);
         n;
         n = g_node_next_sibling (n))
      {
        if (G_NODE_IS_LEAF (n))
          continue;

        meta_wayland_surface_update_outputs_recursively (n->data);
      }

n is checked for NULL during each loop in the condition expression.
Therefore, when `G_NODE_IS_LEAF (n)` is called, `n` is guaranteed not to
be NULL. Note also that g_node_first_child is also NULL-safe since it
performs a NULL check internally.

New:

    META_WAYLAND_SURFACE_FOREACH_SUBSURFACE (surface, subsurface_surface)
      meta_wayland_surface_update_outputs_recursively (subsurface_surface);
    =
    for (GNode *G_PASTE(__n, __LINE__) = meta_get_first_subsurface_node ((surface)); \
     (subsurface = (G_PASTE (__n, __LINE__) ? G_PASTE (__n, __LINE__)->data : NULL)); \
     G_PASTE (__n, __LINE__) = meta_get_next_subsurface_sibling (G_PASTE (__n, __LINE__)))

In the new logic `subsurface` is still checked for NULL in the loop
condition. However, in the new loop init:

    ...
    meta_get_first_subsurface_node (MetaWaylandSurface *surface)
    ...

    n = g_node_first_child (surface->subsurface_branch_node);
    if (!G_NODE_IS_LEAF (n))
    ...

The above implementation performs a `G_NODE_IS_LEAF` call, which
performs a dereference on `n`, without first checking for NULLs.

This NULL dereference triggers the following gnome-shell crash:

    Core was generated by `/usr/bin/gnome-shell'.
    Program terminated with signal SIGSEGV, Segmentation fault.
    #0  meta_get_first_subsurface_node (surface=0x55d589623450) at ../src/wayland/meta-wayland-surface.h:399
    #1  pointer_can_grab_surface (pointer=0x7f6dc4012700, surface=0x55d589623450) at ../src/wayland/meta-wayland-pointer.c:1306
    #2  0x00007f6ddb94d509 in meta_wayland_pointer_can_grab_surface (pointer=<optimized out>, surface=surface@entry=0x55d589623450, serial=serial@entry=996) at ../src/wayland/meta-wayland-pointer.c:1321
    #3  0x00007f6ddb950d05 in meta_wayland_seat_get_grab_info (seat=seat@entry=0x55d586c24f20, surface=0x55d589623450, serial=996, require_pressed=require_pressed@entry=0, x=x@entry=0x0, y=y@entry=0x0)
        at ../src/wayland/meta-wayland-seat.c:467

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2655>
2022-10-17 12:38:21 +00:00
Jonas Ådahl
a331d4e45a window: Type check some wm functions
These might get called from JS, so avoid crashing on bogus calls.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5952
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2661>
2022-10-17 11:41:55 +00:00
Robert Mader
4079afe0c7 surface-actor-wayland: Fix assumption in get_current_primary_view
Unlike the multi-view path, the optimized/single-view one doesn't check
if the surface-actor is really present on the view. That is the case
whenever it's hidden - e.g. when the window is minimized.

Fixes 3b7137cb35

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2662>
2022-10-15 21:45:10 +02:00
Daniel van Vugt
100c02e514 drm-buffer: Clarify misleading error message on drmModeAddFB2 failure
The real error is more likely to do with the drmModeAddFB2 failure than
the format not being compatible with drmModeAddFB.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2379
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2656>
2022-10-13 16:06:57 +08:00
Jonas Ådahl
21cddbae95 tests/wayland-fullscreen: Also test toggling fullscreen
This tests that unfullscreen makes the black background disappear, and
that fullscreening again makes it re-appear.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2338>
2022-10-10 18:16:51 +00:00
Jonas Ådahl
19df8888fb tests/wayland-fullscreen: Check surface size
In the test in question, it should be smaller than the window geometry,
since the black background makes the window geomerty larger than the
surface.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2338>
2022-10-10 18:16:51 +00:00
Sebastian Wick
6db67c3f21 tests: Add ref-test for Wayland fullscreen client
The ref-test makes sure the actual content is centered and everything
not covered by the actual content is black.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2338>
2022-10-10 18:16:51 +00:00