1
0
Fork 0
Commit graph

10064 commits

Author SHA1 Message Date
Jonas Ådahl
28a5946a28 tests/wayland-unit-tests: Remove unnecessary message check
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2167>
2022-03-04 14:48:25 +00:00
Jonas Ådahl
cb424b68e6 tests/wayland-unit-tests: Make some function names less generic
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2167>
2022-03-04 14:48:25 +00:00
Jonas Ådahl
546b94545e window: Make a better guess at initial monitor
We'd guess the initial monitor before it was actually calculated by
looking at the initial geometry. For Wayland windows, this geometry was
always 0x0+0+0, thus the selected monitor was always the primary one.

This is problematic if we want to provide initial more likely
configurations to Wayland clients. While we're not doing that yet, it'll
be added later, and this is in preparation for that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2167>
2022-03-04 14:48:25 +00:00
Jonas Ådahl
17e239246a window: Add function to calculate current bounds
This will later be used to tell Wayland clients about a size they
shouldn't exceed.

If the window doesn't have a main monitor, this function does nothing
and returns FALSE.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2167>
2022-03-04 14:48:25 +00:00
Jonas Ådahl
213f0d8dd3 window/wayland: Pass x,y,width,height as rectangle
Will make the number of variables a bit more managable.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2167>
2022-03-04 14:48:25 +00:00
Carlos Garnacho
e736b04deb clutter: Remove "source" event union fields
These are no longer used, drop the last places that modify those
in event structs and remove them.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2311>
2022-03-04 10:58:28 +00:00
Carlos Garnacho
5dd818cf1a tests: Move away from clutter_event_get_source()
The target actor as seen by the stage is equivalent, so use that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2311>
2022-03-04 10:58:28 +00:00
Carlos Garnacho
9b6253bf3f wayland: Move away from clutter_event_get_source()
Instead ask the stage about the target actor, which is equivalent
and ensured to be up-to-date.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2311>
2022-03-04 10:58:28 +00:00
Carlos Garnacho
52002d042e core: Move away from clutter_event_get_source()
Instead ask the stage for the target actor for the given device/sequence.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2311>
2022-03-04 10:58:28 +00:00
Robert Mader
8f91d831ee wayland/dma-buf: Fix typos in struct name
Fixes 7acecb1c72

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2297>
2022-03-04 09:16:28 +00:00
Robert Mader
5b9abecc1b wayland/dma-buf: Add missing wl_array_release()
So we don't leak the array.

Fixes 7acecb1c72

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2297>
2022-03-04 09:16:28 +00:00
Ivan Molodetskikh
bcf6ee5e55 Name unnamed sources
These names show up in GLib traces in sysprof, so let's make sure they
exist.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1928>
2022-03-04 10:10:05 +03:00
Bilal Elmoussaoui
7717383deb meson: Allow to build without gnome-desktop
gnome-desktop is used to retrieve the monitor vendor name which in some
use cases is not needed  as it brings a bunch of gnome-desktop unwanted
dependencies.
The change makes mutter fallback to an "Undefined" vendor name if it is
built without gnome-desktop

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2317>
2022-03-03 15:07:38 +00:00
Alfonso Sánchez-Beato
8ccbb32f71 egl: Fix number of configs returned in meta_egl_choose_all_configs
Return in meta_egl_choose_all_configs() the actual number of
configurations returned by eglChooseConfig(), which are not
necessarily the same number as those from eglGetConfigs().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2303>
2022-03-03 08:18:56 +00:00
Jonas Dreßler
672696f823 dnd: Notify about events during compositor grab from event filter
Since the introduction of ClutterGrabs, MetaDnd now no longer gets
notified about input events on the stage during grabs (for example while
the alt-tab popup is shown) and thus can't move the grab feedback actor
anymore.

To fix this, forward events to MetaDnD directly from
meta_display_handle_event() when a ClutterGrab is in effect.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2308>
2022-03-02 15:12:23 +00:00
Jonas Dreßler
8a11069dca events: Only get MetaWaylandCompositor once
We get the MetaWaylandCompositor a bunch of times, but we can do with
getting it only once and then also replace the is_wayland_compositor()
checks with a if (wayland_compositor).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2308>
2022-03-02 15:12:23 +00:00
Carlos Garnacho
32332fd53d wayland: Handle xdg_activation_v1_activate on non XDG activation tokens
The XDG activation support was missing interoperability with other
startup sequences, notably those coming from other means than XDG
activation.

In order to play nice with X11 startup sequence IDs, we not just
have to check for the startup ID being in the general pool, but
we also need to fallback into X11-style timestamp comparison so the
window ends up properly focused.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2314>
2022-02-28 17:34:27 +01:00
Olivier Fourdan
fe41e69eea wayland/xdnd: Use multiple DnD X11 peers
When a drag and drop occurs from an X11 client to a Wayland native
client, mutter uses an internal X11 window as a peer for the DnD  drop
site.

That internal X11 window is moved and resized to match the Wayland
native windows as the drag destination moves.

When moving from one Wayland native window to another Wayland native
window, the same X11 window is used, and as a result no DND enter/leave
events is emitted.

In that case, the drop may occur on the wrong Wayland native window,
because no new XdndEnter/XdndLeave event were emitted.

To avoid that issue, use a pair of X11 windows instead of just one and
alternate between the two when repicking a new drop surface, so that
moving from a Wayland surface to another will always generate the
expected enter/leave events that we rely on.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2136
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2305>
2022-02-25 11:35:35 +01:00
Dor Askayo
2a5506170a core: Initialize g_autofree with NULL
This prevents build warnings about use of potentially uninitialized
variables.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2301>
2022-02-23 20:48:10 +00:00
Bilal Elmoussaoui
26790f7f39 wayland/keyboard: Remove unnused define
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2306>
2022-02-22 11:05:36 +01:00
Carlos Garnacho
1ad98879b7 core: Mark both directions in rings/strips as (un)handled altogether
If going on a direction has a keycombo associated and the other does
not, it does not make sense to let the wayland bits handle pad
ring/strip events that only go in one direction.

Ensure that's the case, and also while figuring out the ring/strip
direction based on the initial events.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1886
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2001>
2022-02-14 15:24:27 +00:00
Carlos Garnacho
952caf6b71 core: Refactor strip/ring direction guessing in action handling
Make it all happen in meta_pad_action_mapper_handle_action(), since
we'll need better handling here than just "return FALSE".

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2001>
2022-02-14 15:24:27 +00:00
Carlos Garnacho
101cae03f3 core: Handle mixture of keycombo/no action in pad rings/strips
When generating the action label, we expect both directions of these
features to have consistent settings (either both get a keycombo, or
they don't) or these just return NULL altogether.

Since one of the directions has an action associated, this is
misleading, so be more lenient at the time of generating the action
label.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2001>
2022-02-14 15:24:27 +00:00
Carlos Garnacho
7bf10de538 wayland: Warn and fix accounting on missed CLUTTER_TOUCH_END events
If we happen to handle a CLUTTER_TOUCH_BEGIN without a corresponding
CLUTTER_TOUCH_END at MetaWaylandTouch, we would still attempt to
reuse the older MetaWaylandTouchInfo, resulting in an assert triggered
as there is a stale touch reference on the previous surface.

Warn in place and create a new touch info struct to still fix the
broken surface accounting, instead of finding out the hard
way after the surface is destroyed. The assert is preserved to ensure
the accounting does not sneakily break anymore/further.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/584
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2251>
2022-02-14 13:54:33 +00:00
Daniel van Vugt
b7f7b82b89 onscreen/native: Warn instead of crashing if the frame_info queue is empty
Some Ubuntu systems with mutter 40 and 41 report `maybe_update_frame_info`
crashes with SIGSEGV when `frame_info == NULL`.

The same was reported by @rmader as happening "after wakeup" in testing
(https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441#note_1301588)
although the Ubuntu reports show it's not related to that MR.

Fixes: https://launchpad.net/bugs/1960585
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2282>
2022-02-14 10:51:18 +00:00
Jonas Ådahl
ca5488c3d6 monitor-manager: Don't introspect "monitor-privacy-screen-changed"
It passes a MetaLogicalMonitor, which isn't introspected right now, so
skip it completely. The entry point to the UI is handled via
MetaDisplay, so it isn't needed.

This fixes the following warning:

<unknown>:: Warning: Meta: (Signal)monitor-privacy-screen-changed: argument object: Unresolved type: 'MetaLogicalMonitor'

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2287>
2022-02-14 10:01:54 +00:00
Jonas Ådahl
2a624dbd1e monitor-manager/native: Emit privacy-screen-changed signal later
Make sure the monitor and output state is up to date when we emit the
privacy-monitor-changed signal, otherwise the signal emission code will
try to look up out of date state.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2119
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2280>
2022-02-14 09:29:48 +00:00
Florian Müllner
7ff52b6128 wayland/gtk: Only perform allowed titlebar gestures
The window functions "work" regardless of whether the client allows
the behavior or not. That is, it's up to the caller to not call
maximize and friends when the action isn't allowed.

Add appropriate checks, which should make the titlebar_gesture()
behavior identical to titlebar actions for server-side decorations.

https://gitlab.gnome.org/GNOME/mutter/-/issues/2139

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2281>
2022-02-10 20:00:15 +01:00
Konstantin Kharlamov
338eea7a37 backends/native/meta-seat: Sync keyboard LEDs when changing layout
Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/633
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2279>
2022-02-10 08:11:56 +00:00
Jonas Ådahl
5588f2a21c tests: Decrease boiler plate needed for adding more tests
Structure tests in a list of dictionaries, instead of requiring each
test to have its own executable(...) and test(...) statement. The
intention of this is to make it easier to add more test cases.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2262>
2022-02-09 09:04:09 +00:00
Jonas Ådahl
afca974405 tests: Move monitor test utils into libmutter-test.so
It already was built into it without any symbols exported, but also
duplicated in test cases that used it. Make it so that the built in
functions are exported, with prefixes, and make all tests use the
exported functions. While at it, make things go via MetaContext or
MetaBackend depending on how early in initialization things are run.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2262>
2022-02-09 09:04:09 +00:00
Jonas Ådahl
3fc0d8b81d tests/build: Remove duplicated meta-gpu-test.c file inclusion
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2262>
2022-02-09 09:04:09 +00:00
Jonas Ådahl
15b8f89c02 tests: Move ref test framework to libmutter-test.so
Will make it available to most tests without having to explicitly
include.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2262>
2022-02-09 09:04:09 +00:00
Jonas Ådahl
bd18af1a0d tests/build: Sort sources list
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2262>
2022-02-09 09:04:09 +00:00
Jonas Ådahl
195766cb69 tests: Add helper for creating virtual test monitors
This uses virtual monitors in the headless backend, in contrast to the
ones used by the monitor configuration tests which use the nseted
backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2262>
2022-02-09 09:04:09 +00:00
Jonas Ådahl
b7f23c1baf tests/utils: Add helper to find a window given a title
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2262>
2022-02-09 09:04:09 +00:00
Jonas Ådahl
b522e3cecd tests/wayland: Move test client helper into a utils file
This will make it easier to run Wayland test cases from other test
executables.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2262>
2022-02-09 09:04:09 +00:00
Carlos Garnacho
d90adfe303 backends: Keep cursor hidden on tablet input on Wayland
Tablets have their own cursor, in order to avoid confusions just
hide the regular pointer like we do on touchscreens, so there's
the illusion that there is a single cursor.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/75
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
2022-02-08 14:34:47 +00:00
Carlos Garnacho
a870e6b38d backends/x11: Update MetaBackend on ClutterEvent processing
This should fix wonky handling of last used device and pointer
visibility on X11. At least does on --nested under presence of
touchscreen/tablet.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
2022-02-08 14:34:47 +00:00
Carlos Garnacho
13330f34f3 backends: Add private call to update MetaBackend from a device
We update some details like the last used device and pointer visibility
from events, but this is done inconsistently on X11 since the
ClutterEvents are created and pushed from an additional place.

Make these updates happen on a private call, that will be called from
these places in X11.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
2022-02-08 14:34:47 +00:00
Carlos Garnacho
f5c0bcbf9c backends: Split handling of pointer visibility on events
This was done as part of the "last updated device" changes, separate
that as we want different checks and policies.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
2022-02-08 14:34:47 +00:00
Carlos Garnacho
f852e5ab2b backends: Make meta_backend_update_last_device() private
This is now handled entirely in the backend, no need to export this
function.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
2022-02-08 14:34:47 +00:00
Carlos Garnacho
d72bacb3cd backends/x11: Drop handling of XI_DeviceChange
Even though it's great that XI2 has an event to notify about device
changes, this is something we can let the MetaBackend code handle
consistently for all backends, since looking for the source device
works everywhere.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
2022-02-08 14:34:47 +00:00
Carlos Garnacho
4e85e0e1b3 core: Drop handling of updates to the last used device
This is now done in the backend for the Wayland case, so we can
drop this update here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
2022-02-08 14:34:47 +00:00
Carlos Garnacho
9708d04f7e backends: Check for updates in the last used device after dispatching events
Instead of relying in the device being updated from different parts of our
machinery for different backends, hook this up to our own event dispatching.
This will allow dropping all other places where this is done.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
2022-02-08 14:34:47 +00:00
Carlos Garnacho
ecafc489c1 backends: Move function definitions
These will be made private and called from different places. At the
moment there is no functional change here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
2022-02-08 14:34:47 +00:00
Carlos Garnacho
3ab59175c8 backends/native: Fix cursor renderer assignment for tablet devices
We create a cursor renderer per device for those at
meta_seat_native_handle_event_post() with PROXIMITY_IN events, but
the MetaWaylandTabletTool handles the event before that, and goes
with a NULL cursor renderer.

Make MetaBackend::get_cursor_renderer() on the native backend create
those cursor renderers on demand, and only handle PROXIMITY_OUT in
handle_event_post() to dispose those. This makes MetaWaylandTabletTool
happily get a cursor renderer again.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
2022-02-08 14:34:47 +00:00
Carlos Garnacho
a88c9b9ff2 wayland: Use default cursor on tablet tools
Now that we "replace" the pointer cursor on tablet input, have it
use the default cursor so it blends in better.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
2022-02-08 14:34:47 +00:00
Carlos Garnacho
f2ff9dcc01 backends: Unify cursor visibility checks
We are adding more to this logic, so make this check be its own
function that checks devices individually.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/285>
2022-02-08 14:34:46 +00:00
Jonas Ådahl
52ce81657d backend/native: Only disable dmabuf screen cast when not hw accelerated
We now only enable DMA buffer based PipeWire screen casting if a
format/modifier has been negotiated. This practically means a consumer
is aware about what is needed, and we should not try to predict that it
uses the DMA buffer the right way (i.e. not mmap:ing directly).

However, in case we're not hardware accelerated, we never want to
attempt to use DMA buffer screen sharing, as we want to avoid
compositing into a DMA buffer on such hardware as doing so can be very
slow.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2086>
2022-02-07 19:16:45 +00:00