1
0
Fork 0
Commit graph

10129 commits

Author SHA1 Message Date
Jonas Ådahl
20686f3354 tests/monitor-unit-tests: Remove left-over function declaration
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2030>
2022-01-25 16:25:48 +00:00
Jonas Ådahl
85a3ca3d17 tests: Add more monitor config policy parsing tests
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2030>
2022-01-25 16:25:48 +00:00
Jonas Ådahl
c611b64c53 monitor-config-store: Add way to define config store loading policy
This adds a way to define a way, at the system level, to define a policy
of how monitor configuration files are loaded.

The intended use case is to e.g. either prefer system level monitor
configurations before user levels, or only allow system level
configurations.

Examples:

Prefer system over user level configurations:

    <monitors version="2">
      <policy>
        <stores>
          <store>system</store>
          <store>user</store>
        </stores>
      </policy>
      <configuration>
        ...
      </configuration>
    </monitors>

Only allow system level configurations:

    <monitors version="2">
      <policy>
        <stores>
          <store>system</store>
        </stores>
      </policy>
      <configuration>
        ...
      </configuration>
    </monitors>

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2030>
2022-01-25 16:25:48 +00:00
Jonas Ådahl
6c4380ed41 monitor-config-store: Fix incorrect string comparison with empty string
strncmp() always return 0 if the passed length is 0. What this means is
that whatever the first string check happens to be, if the parsed XML
cdata was empty (e.g. if we got <element></element>), the first
condition would evaluate to true, which is rather unexpected.

Fix this by making sure the string length is correct first. Also move it
into a helper so we don't need to repeat the same strlen() check every
time.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2030>
2022-01-25 16:25:48 +00:00
Jonas Ådahl
b74e99b10b monitor-config-store: Make parsing a bit more forgiving
Allow unknown XML elements inside <monitors>. This makes extending in
the future easier.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2030>
2022-01-25 16:25:48 +00:00
Jonas Ådahl
2d7a8c3ce9 kms: Don't enter power saving via updates
The way device backends implement power saving differ, and power saving
needs to contain nothing incompatible in the same update. Make it
impossible to e.g. mode set, page flip, etc while entering power save by
not using MetaKmsUpdate's at all for this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
3472ff50ce tests/kms/device: Add power saving test
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
2e774e8e14 tests/kms: Check predicted state is correctly predicted
When we're predicting state, i.e. when having posted an update while
avoiding reading KMS state, copy the predicted state, update the actual
state, and check that the predicted state matches the newly updated one.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
2478000c73 kms: Properly predict power saving effect on tracked state
Entering power saving effectively disables CRTCs, and thus the CRTC id a
connector is associated with. Make sure that the tracked state reflects
this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
8ea49fe9d9 kms/connector: Add missing newline
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
0fab55dbc0 tests/kms/device: Add mode setting test
Checks that the relevant device state is correct after mode setting.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
feadaacfdd kms/connector: Add getter for preferred mode
This replaces a helper used in tests. The intention is to use it from
other tests, and seemed like a good fit to place it under the KMS
connector object itself.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
6a9e2e9e2d tests/kms-utils: Add helpers for common buffer sizes
This makes it more convenient to allocate and configure buffers covering
the whole primary plane given a mode.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
c35e8f5a51 kms: Concentrate update processing in MetaKmsDevice
It was a bit scattered, with it being split between MetaKms and
MetaKmsImpl, dealing with MetaKmsDevice and MetaKmsImplDevice
differentation. Replace this by, for now, single entry point on
MetaKmsDevice: meta_kms_device_process_update_sync() that does the right
thing.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
43a1ba3432 tests: Add KMS device tests
As other KMS tests, depends on being DRM master and vkms being loaded.

Currently consists of a sanity check that checks for the expected set of
connectors, CRTCs, planes, etc.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
23a530cb09 monitor-manager/native: Get CRTC gamma from cache if available
Right now gamma is set only via the D-Bus API (from gsd-color), but the
actual gamma isn't right after SetCrtcGamma(), meaning if one would call
GetCrtcGamma() right after setting it, one would get the old result.
Avoid this by getting the "current" CRTC gamma from the cache we manage.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
cd517216ae kms/impl-device: Clear fd source on prepare-shutdown
This ensures we won't receive any untimely page flip callbacks during
later phases of shutting down.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
4276e9ddd3 tests/kms-update: Add mode setting sanity tests
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
65073c145c tests/kms: Add basic plane assignment update tests
Test that adding a couple of plane assignments were correctly added to
the update.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
758e5e23fa kms/mode: Add width/height getters
This avoids some situations where one would otherwise need to fetch the
drm mode to check the dimensions.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
990267026a boxes: Add rectangle init macro
META_RECTANGLE_INIT() works like e.g. GRAPHENE_RECT_INIT() and similar
macros.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
de06d5d9e7 kms/update: Add init helper macros for fixed 16 rects
META_FIXED_16_INIT(), taking MetaFixed16's, and META_FIXED_16_INIT_INT()
taking integers, converting them to MetaFixed16.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
acd51a7e69 tests: Add some basic MetaKmsUpdate unit tests
Mostly rudimentary sanity testing.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
bf398a5f84 kms/update: Add getter for cursor plane assignment
To be used in tests.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
501b6f52d3 monitor-manager/native: Fix include macros
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Jonas Ådahl
daa945175b virtme-run: Forward some more environment variables
XDG_DATA_DIRS and LD_LIBRARY_PATH is needed to make sure non-system link
directories are respected, e.g. when using jhbuild.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
2022-01-25 15:47:03 +00:00
Florian Müllner
5b720a157c compositor/plugin-manager: Split start() from new()
In order to support dynamic imports, gjs added an implicit mainloop
that can drive the main context independently from other mainloops
like the one from GApplication or MetaContext.

That means that sources can now get dispatched to the main context
from the moment the plugin is started, resulting in a crash as the
association between compositor and plugin manager doesn't exist until
meta_plugin_manager_new() returns.

Make sure this doesn't happen by only starting the plugin after
meta_plugin_manager_new() has returned.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2242>
2022-01-25 15:15:13 +01:00
Marco Trevisan (Treviño)
8cf3485ab0 monitor-manager: Notify privacy screen changes on hotkey press
When privacy screen is changed and this happens on explicit user request
(that is not a setting change) we should notify about this via an OSD.

To perform this, we keep track of the reason that lead to a privacy
screen change, and when we record it we try to notify the user about.

When the hardware has not an explicit hotkey signal but we record a
change we must still fallback to this case.

Fixes: #2105
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1952>
2022-01-25 07:31:19 +00:00
Marco Trevisan (Treviño)
47d7bc7a13 backends/kms: Implement privacy screen handling and setting
Privacy screen events on connector are handled as notification events
that won't cause any monitors reconfiguration but will emit monitors
changed on DBus, so that the new value can be fetched.

We monitor the hardware state so that we can also handle the case of
devices with hw-switchers only.

In case a software state is available it means we can also support
changing the state, and if so expose the state as unlocked.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1952>
2022-01-25 07:31:19 +00:00
Marco Trevisan (Treviño)
4b0a10c562 backends/kms/update: Add ability to remove result listeners
We may need to remove a result listener once we've added it, and before
that it ha been processed, so add support for this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1952>
2022-01-25 07:31:19 +00:00
Marco Trevisan (Treviño)
fd1f6094c9 monitor-manager: Expose the privacy screen state on DBus current state
Expose each monitor state as two booleans, not to expose the whole flags

Related-to: GNOME/gnome-control-center#909
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1952>
2022-01-25 07:31:19 +00:00
Marco Trevisan (Treviño)
f96a167aea monitor-manager: Apply privacy monitor settings on changes
When both a setting change and a monitor change happens we need to
ensure that the monitor settings are applied.
This is currently only related to privacy settings, but will in future
also handle other monitor parameters such as brightness.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1952>
2022-01-25 07:31:19 +00:00
Marco Trevisan (Treviño)
55469fda78 settings: Read desktop privacy settings and monitor privacy-screen option
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1952>
2022-01-25 07:31:19 +00:00
Marco Trevisan (Treviño)
f231672084 monitor: Add support to privacy screen
Some monitors support hardware features to enable the privacy screen
mode that allows users to toggle (via software or hardware button) a
state in which the display may be harder to see to people not sitting
in front of it.

Expose then this capability to the monitor level so that we can get its
state and set it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1952>
2022-01-25 07:31:19 +00:00
Sebastian Wick
8ebdae8092 launcher: Use $XDG_SESSION_ID if available
In some cases mutter is started in the user scope from a TTY (for
example using toolbox). Using sd_pid_get_session fails because it's not
in the session scope so it falls back to the primary session
(sd_uid_get_display). We want to start mutter on the TTY we started
mutter on however. Instead of relying on the scope to figure out the
correct session we first look at $XDG_SESSION_ID which is set by
systemd_pam.so.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2254>
2022-01-24 18:09:44 +01:00
Robert Mader
dea9f8bbfe wayland/surface: Make ensure_cached_state() static
There is no reason for it to be public or have a return value.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2232>
2022-01-19 17:13:17 +00:00
Robert Mader
e3f0efa065 wayland/surface: Ensure to apply cached state
It is possible that we never create a cached state for a surface
even if it is synced. That is the case if `commit()` is never called.
We still need to call `apply_state()` in this case in order to run
e.g. `role_post_apply_state()` or `parent_state_applied` on subsurfaces.

So just ensure to initialize the cached state instead of bailing out.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2232>
2022-01-19 17:13:17 +00:00
Robert Mader
03434e566a wayland/subsurface: Ensure cached state recursivly gets applied on set_desync()
Subsurfaces can be effectively synced indirectly via their ancestors.
Right now such indirectly synced surfaces don't apply their cached
state when their ancestor effectively becomes desync as by the time
we call `parent_state_applied()` on them, they are considered as
desync.

Thus sligthly reoder things so when the ancestors becomes desync
and applies its state, those surfaces still count as synced and
will thus apply their cached state as well.

While on it, add a check to prevent `set_desync()` to have side
effects when the target surface is not currently synced.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2232>
2022-01-19 17:13:17 +00:00
Michel Dänzer
5127f7df56 native/cogl-utils: Add 10 bpc format support
Avoids assertion failure in meta_drm_buffer_gbm_fill_timings with direct
scanout of a 10 bpc EGL client surface (which works now with dma-buf
feedback).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2230>
2022-01-17 10:39:13 +00:00
Daniel van Vugt
6673fbcf68 onscreen/native: Remove a goto in DisplayLink fallback
At first glance the `goto` looks like a loop, or potentially an infinite
loop. It's not a loop because the mode has changed at that point to
`META_SHARED_FRAMEBUFFER_COPY_MODE_PRIMARY`. But we can make it more
obvious and avoid the need for a goto.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2240>
2022-01-17 10:03:17 +00:00
Jonas Ådahl
35fa75a085 clutter/backend/x11: Remove stray whitespace
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2014>
2022-01-17 09:48:51 +01:00
Jonas Ådahl
e4e0eaac9d clutter/backend/x11: Stop keeping track of the screen and root window
They are now only ever accessed via the actual X11 backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2014>
2022-01-17 09:48:51 +01:00
Jonas Ådahl
cf00ee9724 stage/x11: Get root window from the X11 backend
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2014>
2022-01-17 09:48:51 +01:00
Jonas Ådahl
c41d2a17da xkb-a11y/x11: Get X11 display from X11 backend
Instead of from ClutterX11.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2014>
2022-01-17 09:48:51 +01:00
Jonas Ådahl
4622bd7ca8 xkb-a11y/x11: Cleanup include macros
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2014>
2022-01-17 09:48:51 +01:00
Jonas Ådahl
7851e69bbf virtual-input-device/x11: Get X11 display and screen from X11 backend
Instead of from ClutterX11.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2014>
2022-01-17 09:48:51 +01:00
Jonas Ådahl
d796c40156 seat/x11: Get root window from X11 backend
Instead of going via ClutterX11.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2014>
2022-01-17 09:48:51 +01:00
Jonas Ådahl
b1fb8cbf57 backend/x11: Add API to get the X11 screen
Will be used to replace a similar ClutterX11 API.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2014>
2022-01-17 09:48:51 +01:00
Jonas Ådahl
440359e85f virtual-input-device/x11: Cleanup include macros
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2014>
2022-01-17 09:48:51 +01:00
Jonas Ådahl
39e1d5a214 stage/x11: Fetch the X11 display pointer from the X11 backend
This eliminates going through the clutter backend singleton.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2014>
2022-01-17 09:48:51 +01:00
Jonas Ådahl
5eae0c84ed stage-impl: Change the backend pointer to MetaBackend
A pointer to the real backend is more useful, so lets use that. This
affects various places that now need to fetch e.g. the clutter backend
via the real backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2014>
2022-01-17 09:48:51 +01:00
Jonas Ådahl
c0fb52cfe6 stage-impl: Move properties from the stage window here
The stage window is an interface, that added properties, that were only
then actually managed by MetaStageImpl. Shuffle things slightly, and let
the MetaStageImpl object deal with these things itself.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2014>
2022-01-17 09:48:51 +01:00
Jonas Ådahl
ed112fe0c6 keymap/x11: Store a MetaBackend pointer instead of ClutterBackend
What the keymap eventually is after, are things handled by the actual
backend (MetaBackendX11), so let it keep a pointer to that. This
eliminates some usages of globals.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2014>
2022-01-17 09:48:50 +01:00
Jonas Ådahl
eae1e532dd seat/x11: Make clutter backend variable naming more consistent
Name ClutterBackend pointers clutter_backend. That'll make things less
confusing when mixed with MetaBackend pointers.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2014>
2022-01-17 09:45:36 +01:00
Jonas Ådahl
fc3b80fc60 input-device/x11: Get X11 state from the X11 backend
Go directly to the X11 backend to get the root window and X11 display
connection. This eliminates some uses of clutter globals.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2014>
2022-01-17 09:45:36 +01:00
Jonas Ådahl
05b655e60f seat/x11: Add API to get backend
Will be used instead of going via globals by places that already has a
seat to fetch things from.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2014>
2022-01-17 09:45:36 +01:00
Jonas Ådahl
dfbe97a8e5 backend/x11: Add API to get the root window
Will later be used from here instead of via the clutter backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2014>
2022-01-17 09:45:36 +01:00
Jonas Ådahl
6f80c1e7b5 seat/x11: Keep a pointer to the backend
This adds a pointer to the backend and replaces places that fetched
backend resources via globals (mostly via clutter).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2014>
2022-01-17 09:45:36 +01:00
Jonas Ådahl
585befbf7d tests: Add test for constraining pointer on hotplug
It tests that if we go from (x is the pointer cursor)

    +--------+
    |        |
    |     X  |
    +--------+

to
             +----------------+
             |                |
             |                |
    +--------+                |
    |        |                |
    |     X  |                |
    +--------+----------------+

i.e. making sure that X ends up somewhere within the logical monitor
region.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2237>
2022-01-16 18:38:20 +00:00
Jonas Ådahl
d84f7971e4 tests/utils: Add meta_wait_for_paint() helper
This function queues a full stage redraw, then waits for every view to
receive the "presented" signal before returning.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2237>
2022-01-16 18:38:20 +00:00
Jonas Ådahl
57d1d82ead test/utils: Add helper to set custom monitors config
Make the existing implementation a wrapper to avoid changing monitor
config tests.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2237>
2022-01-16 18:38:20 +00:00
Jonas Ådahl
1f758dd78c test/utils: Make (WAYLAND_)DISPLAY passing to client optional
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2237>
2022-01-16 18:38:20 +00:00
Jonas Ådahl
1886785b3d test/utils: Make meta_test_client_do*() not crash on NULL error
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2237>
2022-01-16 18:38:20 +00:00
Jonas Ådahl
68fd9bf534 test/utils: Add vararg variant of meta_test_client_do()
To be used by wrapper that puts the error in a g_error().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2237>
2022-01-16 18:38:20 +00:00
Carlos Garnacho
5e3f89e342 backends: Do not try to move pointer onscreen in common code
This is now handled inside the input thread in the native backend,
and X11 has always done something similar to this. This common code
is no longer necessary.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2237>
2022-01-16 18:38:20 +00:00
Carlos Garnacho
70e44c281c backends/native: Ensure pointer is onscreen in input thread
It's slightly racy to have the main thread update the views and warp
the pointer, since the input thread may not be aware yet of the new
viewport layout.

Make the input thread clamp the pointer so it remains onscreen
instead, when the new viewports are obtained.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/64
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2237>
2022-01-16 18:38:20 +00:00
Björn Daase
75e220a1c1 boxes-tests: Make pointer declaration match code style
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2236>
2022-01-14 20:04:20 +01:00
Björn Daase
cbc6965b80 boxes: Make pointer declaration match code style
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2236>
2022-01-14 20:02:26 +01:00
Björn Daase
5f78e932a8 boxes: Fix grammar in warning
Spotted while debugging https://gitlab.gnome.org/GNOME/mutter/-/issues/64

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2236>
2022-01-14 19:12:02 +01:00
Björn Daase
ee96ba44f9 boxes: Remove double whitespace
Spotted while debugging https://gitlab.gnome.org/GNOME/mutter/-/issues/64

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2236>
2022-01-14 19:10:20 +01:00
Jonas Ådahl
812954b22c tests: Add ways to run privileged tests without KVM
These will be skipped by default, but can be run from a TTY for easier
debugging by doing:

    dbus-run-session -- meson test -C build --suite mutter/native/tty --setup plain

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2151>
2022-01-14 09:16:09 +00:00
Jonas Ådahl
06eb27d503 tests: Run KMS tests inside a QEMU virtual machine
This commit makes it possible to run test executables in a test
environment constructed of a virtual machine running the Linux kernel
with the virtual KMS driver enabled, and a mocked system environment
using meta-dbus-runner.py/python-dbusmock.

The qemu machine is configured to use 256M of memory, as the default
128M was not enough for the tests to pass.

Using qemu is also only made possible on x86_64; more changes are needed
for it to be runnable on aarch64, so add a warning if it was enabled on
any other architecture.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2151>
2022-01-14 09:16:09 +00:00
Jonas Ådahl
b5284e5ccc tests/dbus-runner: Add methods needed for taking control of a session
This is needed if one wants to run the test suite parts that need KMS or
evdev access in a virtual machine.

However, only initiate these methods if the meta-dbus-runner.py program
was launched with --kvm, as it's only suitable for using while running
as root in a virtual machine.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2151>
2022-01-14 09:16:09 +00:00
Jonas Ådahl
1cc786ffd3 launcher: Pass fallback session/seat ID when in test mode
When we test, we might not have a systemd session to rely on, and this
may cause some API we depend on to get various session related data to
not work properly. Avoid this issue by passing fallback values for these
when we're running in test mode.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2151>
2022-01-14 09:16:09 +00:00
Jonas Ådahl
8372af9cd7 tests/mock/logind: Add mock seat and session
Will be needed for KMS testing in KVM.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2151>
2022-01-14 09:16:09 +00:00
Jonas Ådahl
9538143fac dbus-runner: Add some high level logging
Will log about starting services and running test case.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2151>
2022-01-14 09:16:09 +00:00
Jonas Ådahl
8b628f0ae4 launcher: Fix indentation
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2151>
2022-01-14 09:16:09 +00:00
Jonas Ådahl
c8c9d49f79 Add rudimentary mode setting test
Add a test that uses vkms to test that mode setting works, and that
rendering works. It renders 10 frames in a row after mode setting, then
exits.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2151>
2022-01-14 09:16:09 +00:00
Jonas Ådahl
51368227f2 context/test: Add flag to test runner helper
This will later be used to allow skipping tests.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2151>
2022-01-14 09:16:09 +00:00
Jonas Ådahl
124a1582e1 native: Replace 'headless' property with 'mode' property
There will be another mode added later, 'test'; prepare for this by
changing the existing "mode" boolean ('headless') to a mode, which is
either 'default' or 'headless'. Checking the is_headless variable is
changed to using the function is_headless(), except for one place, being
VT switching, which in preparation is only allowed on the 'default'
mode. Other places where it makes sense, the conditions are changed to
switch statements.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2151>
2022-01-14 09:16:09 +00:00
Jonas Ådahl
a2382f3251 wayland/dma-buf: Don't warn if there was no render node
When running in KVM, the EGL driver supports querying the render node
path, but it returns NULL. Handle that better by falling back to
querying the device main device file, instead of falling back on v3 of
the protocol and logging a warning.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2151>
2022-01-14 09:16:09 +00:00
Jonas Ådahl
719a6c0006 egl: Don't set an error when there is none
Some API will return NULL or the equivalent; sometimes it's an error,
and sometimes it's not, and the way to check that is by looking at the
return value of eglGetError(). When we check this, don't set the GError
if it returned EGL_SUCCESS, as that indicates that the return value is
expected behavior, and not an error.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2151>
2022-01-14 09:16:09 +00:00
Carlos Garnacho
75f263ddb8 tests: Add tests for crossing events generated during ClutterGrab
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2068>
2022-01-11 16:13:39 +00:00
Carlos Garnacho
e9addb0ad7 clutter: Add ClutterSeat private API to grab devices
This will be necessary to string along ClutterGrab with backend
behavior, and mostly for the X11 backend so implement this pair
of vfuncs there.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2068>
2022-01-11 16:13:39 +00:00
Jonas Ådahl
bb6ae40a0f onscreen/native: Always free the next framebuffer on dispose
There was a sanity check that complained if there was still a "next
framebuffer" when disposing an onscreen. This is correct to complain
about under normal operation, as we always wait until receiving the page
flip callback before cleaning up the onscreen and their state.

However, when there are many hotplugs occurring, we might end up with
race conditions when the above sanity check is not valid: when we have
more than one monitor active, paint 1 one of them, but receive a hotplug
event before we paint the other(s), we will discard the already painted
onscreen before really issuing a page flip.

In this situation, we will have the "next framebuffer", but having that
is not a bug, it's a race condition, thus to not leak in this situation,
make sure to clean up the next framebuffer here too.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2081
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2225>
2022-01-09 23:03:02 +00:00
Jonas Ådahl
8e91c6295d renderer/native: Clear old KMS updates on views rebuild
If there are any pending updates, for example if we painted one of
multiple monitors but without having posted the update due to waiting
for another monitor to be painted, but before we paint all of them and
post the update, another hotplug event happens, we'd have stale pending
KMS update. When that update eventually would be processed, we'd try to
apply out-of-date updates which may contain freed memory.

Fix this by discarding any update when we're rebuilding the views. We
can be sure not to need any of the old updates since we're rebuilding
the whole content anyway.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1928
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2216>
2022-01-09 22:34:16 +00:00
Robert Mader
af08847126 Revert "backends: Don't include damage history in swap region"
This reverts commit a82dd68605.

It causes severe issues in multi monitor setups - lets back
out for now and reland a fixed version later.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2220>
2022-01-08 16:01:24 +01:00
Erico Nunes
a82dd68605 backends: Don't include damage history in swap region
Following the EGL_KHR_swap_buffers_with_damage specification, the
surface damage used by eglSwapBuffersWithDamage does not need to
contain the damage history.
Rework that to reduce the amount of rectangles that get passed to
the backend.

Also rework some of the regions that were using fb_clip_region and
missing the last scaling to support fractional scaling.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2089>
2022-01-07 21:53:09 +00:00
Robert Mader
ab17c98c94 wayland/surface: Implement WL_SURFACE_ERROR_INVALID_SIZE check
From the spec:
> This means that at commit time the supplied buffer size must be
> an integer multiple of the buffer_scale. If that's not the case,
> an invalid_size error is sent.

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

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2188>
2022-01-07 20:46:42 +00:00
Georges Basile Stavracas Neto
77d5c8c928 screen-cast/monitor-stream: Immediately record scanout frames
When the before-paint function is executed, it's only purpose
is to check if there's any scanout queue, and immediately
record it if any.

However, since [1], we regressed in this specific case with the
introduction of an idle callback in the before-paint function.
The regression only happens when the PipeWire stream is using
DMA-BUF buffers, and it would operate as follows:

 1. In before-paint, when there's a scanout available, we queue
    an idle callback to capture the monitor. The idle callback
    (almost always) executes after the scanout is pulled from
    the stage view

 2. meta_screen_cast_stream_src_maybe_record_frame() is called
    by the idle callback. In the DMA-BUF case, it then runs
    meta_screen_cast_monitor_stream_src_record_to_framebuffer()

 3. In meta_screen_cast_monitor_stream_src_record_to_framebuffer(),
    because the stage view doesn't have a scanout anymore, it
    ends up calling cogl_blit_framebuffer() with the stage view
    framebuffer. This is the regression bug.

This regression presents itself in the form of the screencast
stream showing the desktop when there's an unredirected fullscreen
application window running.

Revert before-paint - and only that - back to immediately capturing
any available scanout. Only record these frames when the target
buffer is a DMA-BUF handle. Nothing is captured on before-paint if
the stream is not using DMA-BUF, since the regular paint routine
will handle these frames regularly post-paint.

[1] https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1914

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2186>
2022-01-07 19:59:36 +00:00
Georges Basile Stavracas Neto
8fe45d7750 screen-cast/stream: Add DMABUF-only record flag
Next commits will reintroduce a certain behavior of stage
capturing that can only happen with DMA-BUF buffers. To
control this, add a new flag tp MetaScreenCastRecordFlags
for this behavior.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2186>
2022-01-07 19:59:36 +00:00
Jonas Ådahl
926c34cc89 wayland/dma-buf: Fix typo
A = was placed where a ; should have been placed. Caught by coverity.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2215>
2022-01-07 19:31:23 +00:00
Robert Mader
df3f81e709 compositor/native: Consider Wayland subsurfaces for scanout
If a Wayland subsurface is the topmost actor, consider in for
scanout as well. This will extend our scanout capabilities to apps
like Firefox

While on it, correct a unnessary type check to a NULL check.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2211>
2022-01-07 18:54:27 +00:00
Robert Mader
8abe876d15 window-actor: Add API to get the topmost surface actor
On Wayland a window actor may have more than one surface actor,
most importantly when subsurfaces are used.
Add a new function to request the one which is at the top -
it will be used in the next commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2211>
2022-01-07 18:54:27 +00:00
Jonas Ådahl
5523242eb9 wayland/dma-buf: Define fallback EGL_DRM_RENDER_NODE_FILE_EXT
If the EGL header is not new enough, it will not contain that relatively
new macro definition, so to avoid breaking compilation, define it
ourselves for now. Should be possible to remove after some time.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2214>
2022-01-07 18:25:41 +00:00
Jonas Ådahl
13f35ab064 window: Initialize saved_rect_fullscreen too
We save the window rect before going fullscreen to a dedicated variable,
so we can go back to the correct dimension. We also have a dedicated
variable for returning from other window states, e.g. maximized, and
this one we initialized when creating the MetaWindow. This meant that we
could always rely on this being up to date on X11 windows that were
mapped maximized or fullscreen.

What the commit that introduced the saved rect dedicated for going
unfullscreen missed was to initialize the new saved rectangle too when
creating the MetaWindow. This resulted in windows mapped as fullscreen
often ending up misbehaving when unfullscreening, as mutter would tell
them to unfullscreen to 0x0.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1786
Fixes: a51ad8f932
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2210>
2022-01-07 16:18:51 +00:00
Sebastian Keller
986d3043ab x11: Avoid memory waste and work when creating selection input stream
Since every input stream now uses its own window, the X property used to
transfer the data no longer has to be unique, so we can stop generating
those unique names. This avoids creating a new atom for every transfer
since those are never freed, neither on the shell nor on the server
side. Also don't unnecessarily duplicate other strings that are
(almost) never used and get them from the atom in the rare case when
they are needed.

Fixes https://gitlab.gnome.org/GNOME/mutter/-/issues/1328

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1812>
2022-01-07 02:21:28 +01:00
Sebastian Keller
dbd6e74d3c x11: Let selection input streams create their own window
When there are two (or more) concurrent XConvertSelection requests with
the same target, selection and window and the data is large enough for
SelectionNotify events to overlap. This can result in the affected streams
being considered completed without any data being transferred.

While regular mutter/shell code does not make use of concurrent
XConvertSelection requests with the same targets, some extensions might.
Such as for example a clipboard manager that like the built-in clipboard
manager tries to read the selection on owner-changed.

One potential solution would be to make sure the event is for the correct
property, but not all clients seem to support concurrent requests for the
same targets but different properties on the same window.

This commit instead changes the streams to use their own window which
seems to be more widely supported.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4034

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1812>
2022-01-07 02:21:28 +01:00
Sebastian Keller
d25175b91c x11: Always delete selection input stream property when flushing
This is a preparation for each input stream creating its own window. It
moves deleting the property from meta_x11_selection_input_stream_xevent
where it can run after the stream has been finalized to a spot where
the stream still exists. Use an error trap in case the property was not
set by the client, such as when the conversion failed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1812>
2022-01-07 02:10:05 +01:00
Mark
888e69d3a4 plugins/default: Fix broken switch_workspace()
Swap which windows are switched with which in the workspace switching
animation of the default plugin since this was backwards (resulting in
failures), but animate only those which are on either the current
workspace or the one to switch to. Have the animation span the entire
screen as intended.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2038
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2076>
2022-01-06 16:49:25 +00:00
Fernando Monteiro
12de68abf3 wayland: Drop deprecated text input
This has been replaced for text-input-v3.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2185>
2022-01-05 22:30:21 +00:00
Fernando Monteiro
a8bf9d8c68 wayland: Drop wl-shell protocol
This protocol is deprecated since a long time, so remove it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2183>
2022-01-05 21:43:29 +00:00
Jonas Ådahl
8a2fcf3be0 wayland: Use new KMS update test API to try acquiring scanout
This significantly increases the chance of a fullscreen surface buffer
being scanned out instead of being painted via composition. This is
assuming the client supports the DMA buffer feedback Wayland protocol.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2146>
2022-01-05 20:00:36 +00:00
Jonas Ådahl
a14923e993 kms: Add update test API
This API can be used to construct a MetaKmsUpdate with plane assignments
that in isolation will be tested against the current KMS state. How it
is tested depends on the KMS implementation; in the simple / legacy KMS
backend, the tests are identical to the current scanout requirements
(dimension, stride, format, modifiers, all must match), and with atomic
KMS, it uses the TEST_ONLY on a real constructed atomic mode setting
commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2146>
2022-01-05 20:00:36 +00:00
Jonas Ådahl
64e6bedb6b wayland/dma-buf: Add support for scanout surface feedback
Whenever a surface is promoted as a scanout candidate by
MetaCompositorNative, it'll get a CRTC set as the candidate CRTC.

When a client asks for DMA buffer surface feedback, use this property to
determine whether we should send a scanout feedback tranche.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1959>
2022-01-05 16:36:48 +00:00
Jonas Ådahl
4c54b36126 wayland/dma-buf: Move should_send_modifiers() to the top
It's very much an auxiliary method; lets move it to where it belongs,
according to HACKING.md.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1959>
2022-01-05 16:36:48 +00:00
Jonas Ådahl
43161c6660 compositor/native: Track what Wayland surface is a scanout candidate
For the current candidate, set the candidate CRTC on that surface. This
will later be used to send DMA buffer feedback for direct scanout purposes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1959>
2022-01-05 16:36:48 +00:00
Jonas Ådahl
9a47766a96 wayland/dma-buf: Add tranche priorities
Unused for now, but will be added to prioritize scanout tranches higher
than render only ones.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1959>
2022-01-05 16:36:48 +00:00
Jonas Ådahl
9c942a43d6 wayland/dma-buf: Make manager object a GObject
Will make certain operations easier, i.e. setting up a GQuark.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1959>
2022-01-05 16:36:48 +00:00
Jonas Ådahl
90076cf268 wayland/surface: Remove unnecessary NULL check
This check has caused repeated confusion, as there are no current code
paths where this can ever end up in the true-branch.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1959>
2022-01-05 16:36:48 +00:00
Jonas Ådahl
2a16a750c5 wayland/dma-buf: Always advertise non-modifier fallback
This is done to explicitly tell clients that the compositor supports
implicit modifier paths (i.e. using modifier unaware API).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1959>
2022-01-05 16:36:48 +00:00
Jonas Ådahl
7acecb1c72 wayland/dma-buf: Add basic support for DMA buffer feedback
This includes sending the default tranche, but so far only sends the
same for every surface feedback requested. Scanout tranche will be added
later.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1959>
2022-01-05 16:36:48 +00:00
Jonas Ådahl
1978e93f28 wayland/dma-buf: Prepare format/modifier map up front
As the format table is setup up front, it doesn't change when this
experimental feature setting change. Make the settings documentation
reflect that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1959>
2022-01-05 16:36:48 +00:00
Jonas Ådahl
51308a9d78 wayland/dma-buf: Add manager struct
It'll be used to store state related to DMA buffer Wayland support.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1959>
2022-01-05 16:36:48 +00:00
Jonas Ådahl
7ce481bf69 egl: Add eglQueryDisplayAttribEXT() helper
To be used to fetch the EGLDevice used for an EGL display.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1959>
2022-01-05 16:36:48 +00:00
Daniel van Vugt
44c09dcefe clutter: Remove unused time_us parameter from ClutterFrameListenerIface
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2161>
2022-01-05 15:57:45 +00:00
Daniel van Vugt
f5498950d3 tests/clutter/frame-clock-timeline: Loosen duration testing
The final tick of a timeline is >= its duration, but when using ticks that
are slightly in the future ("next presentation time") this means the final
tick will execute and complete the timeline up to one frame interval before
the timestamp of that final tick.

For the single clock test we now just check if the overall duration is
within one frame of the expected timeline duration.

The dual clock (switching) test needs a threshold of two frames because
starting each new clock creates a phase shift (error) of up to one frame.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2161>
2022-01-05 15:57:45 +00:00
Robert Mader
9ee03fe93b wayland: Fix some code style issues
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2202>
2022-01-03 20:12:41 +01:00
Robert Mader
6d1bd87b32 egl: Fix code style issue
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2202>
2022-01-03 20:12:41 +01:00
Robert Mader
f51cccbc29 wayland/surface: Fix code style issues
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2202>
2022-01-03 20:12:41 +01:00
Jonas Ådahl
32affbf05a wayland/dma-buf: Fix building without native backend
The usefullnes of Wayland without the native backend is questionable,
but since it's theoretically possible, make it at least compile again.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2202>
2022-01-03 19:24:36 +01:00
Jonas Ådahl
ae086a31dd device-pool: Remove duplicate include macro
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2202>
2022-01-03 19:24:36 +01:00
Jonas Ådahl
06c215c747 wayland/surface: Remove unnecessary resource user data changing
We're in the destructor, it's pointless to unset the userdata as we'll
never ever see a request being invoked with it ever again, since the
resource itself will be destroyed or marked as destroyed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2202>
2022-01-03 19:19:33 +01:00
Robert Mader
58f82d0624 texture-tower: Fix code style issues
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2199>
2022-01-03 14:38:09 +01:00
Robert Mader
cd781758eb surface-actor-x11: Fix code style issue
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2199>
2022-01-03 14:12:01 +01:00
Robert Mader
f99d3c01a4 shaped-texture: Fix code style issue
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2199>
2022-01-03 14:11:54 +01:00
Sebastian Keller
450ab0fdb9 window-group: Disable culling when rendering to non-stage-view buffer
When rendering to a buffer that is not the stage view buffer, we can not
know where the buffer will be displayed on the screen. As a result we
also can not know what translation would need to be applied to culling.

This was causing glitches when the gnome-shell magnifier was applying
offscreen effects. ClutterOffscreenEffect causes MetaWindowGroup to be
rendered to an offscreen buffer at an offset, because it draws to a
slightly larger texture with an accordingly translated origin. This
translation then later is canceled out again when the offscreen buffer
is drawn. To meta_actor_painting_untransformed() however which only sees
the translation used when drawing to the buffer this looked like the
window group was being rendered at the offset. This then lead to
redraw_clip getting translated accordingly, resulting in wrong
coordinates used for culling.

Similarly this was leading to issues when taking area screenshots while
at 1x zoom.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1678
Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4876
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2080>
2022-01-03 11:20:50 +00:00
Robert Mader
36481b8d21 gen_default_modes: Add more refresh rates to fallback modes
Refresh rates >60Hz become ever more common. In order to allow users
to keep hight refresh rates when not running at a natively advertized
resolution, add common refresh rates to our fallback modes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2189>
2022-01-03 10:48:29 +00:00
Robert Mader
fb9564b87b output/kms: Filter out duplicate fallback modes
Right now we often add a duplicate fallback mode that's almost
identical to the native mode. This adds unnecessary clutter to
UIs, thus filter out such modes.

In order to keep the code small, use `MetaCrtcModeInfo` directly
instead of recalculating the values. And to keep consistency, do
the same in the loop above.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2189>
2022-01-03 10:48:29 +00:00
Robert Mader
60d7cd82ba crtc-mode-xrandr: Take RR_DoubleScan and RR_Interlace flags into account
Otherwise we often advertise wrongly calculated modes.
Original patch from Jonas Ådahl and the xrandr project.

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

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2190>
2022-01-02 21:10:31 +00:00
Sebastian Keller
97dd5d8877 backends/x11: Fix memory leak in meta_x11_handle_event()
The event was leaked after it had been processed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2192>
2022-01-02 12:36:30 +00:00
Sebastian Keller
3941597485 window-actor/wayland: Fix child actor list leak on dispose
The list returned by clutter_actor_get_children() is caller owned.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2193>
2022-01-02 05:06:47 +01:00
Ievgen Popovych
b596de2680 wayland/window-configuration: Fix missing horizontal maximized check
Signed-off-by: Ievgen Popovych <jmennius@gmail.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2187>
2021-12-28 20:21:52 +02:00
Jonas Ådahl
fc1de74442 cursor: Hold reference to cursor tracker
This is so that it can unregister from it on tear down. The tracker owns
references to cursors too, but this cycle is already broken as the
backend calls 'g_object_run_dispose()' when tearing the cursor tracker
down.

Fixes a crash on shutdown.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2181>
2021-12-22 19:37:16 +01:00
Jonas Ådahl
287908e05a renderer/native: Don't clear GPU data with pending page flips
An incorrect assumption that after mode set there would be no pending
page flips was made. This meant that if there was a mode set, followed
by a page flip, if that page flip was for a CRTC on a now unused GPU,
we'd crash due to the renderer GPU data having already been freed. This
commit avoids that by keeping it alive as long as the page flips are
still in the air. It fixes crashes with backtraces such as

  0) meta_render_device_get_egl_display (render_device=0x0)
     at ../src/backends/native/meta-render-device.c:320
  1) secondary_gpu_state_free (secondary_gpu_state=0x1c8cc30)
     at ../src/backends/native/meta-onscreen-native.c:560
  2) meta_onscreen_native_dispose (object=0x1cb65e0)
     at ../src/backends/native/meta-onscreen-native.c:2168
  3) g_object_unref (_object=<optimized out>)
     at ../gobject/gobject.c:3540
  4) g_object_unref (_object=0x1cb65e0)
     at ../gobject/gobject.c:3470
  5) clutter_stage_view_finalize (object=0x1cbb450)
     at ../clutter/clutter/clutter-stage-view.c:1412
  6) g_object_unref (_object=<optimized out>)
     at ../gobject/gobject.c:3578
  7) g_object_unref (_object=0x1cbb450)
     at ../gobject/gobject.c:3470
  8) meta_kms_page_flip_closure_free (closure=0x1d47e60)
     at ../src/backends/native/meta-kms-page-flip.c:76
  9) g_list_foreach (list=<optimized out>, func=0x7fb3ada67111 <meta_kms_page_flip_closure_free>, user_data=0x0)
     at ../glib/glist.c:1090
 10) g_list_free_full (list=0x1cb4d20 = {...}, free_func=<optimized out>)
     at ../glib/glist.c:244
 11) meta_kms_page_flip_data_unref (page_flip_data=0x1c65510)
     at ../src/backends/native/meta-kms-page-flip.c:109
 12) meta_kms_callback_data_free (callback_data=0x227ebf0)
     at ../src/backends/native/meta-kms.c:372
 13) flush_callbacks (kms=0x18e2630)
     at ../src/backends/native/meta-kms.c:391
 14) callback_idle (user_data=0x18e2630)
     at ../src/backends/native/meta-kms.c

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2147>
2021-12-22 16:22:08 +00:00
Jonas Ådahl
4159c76a5b cursor-renderer/native: Clear GPU state before closing device
This ensures we don't have any left over cursor GPU buffers (via
gbm_bo's) after destroying the corresponding gbm_device (owned by
MetaRenderDevice).

Fixes crashes with backtraces such as

  1) meta_drm_buffer_gbm_finalize at ../src/backends/native/meta-drm-buffer-gbm.c:450
  4) invalidate_cursor_gpu_state at ../src/backends/native/meta-cursor-renderer-native.c:1167
  9) update_cursor_sprite_texture at ../src/wayland/meta-wayland-cursor-surface.c:70
 10) meta_wayland_surface_role_apply_state at ../src/wayland/meta-wayland-surface.c:1869
 11) meta_wayland_surface_apply_state at ../src/wayland/meta-wayland-surface.c:832
 12) meta_wayland_surface_commit at ../src/wayland/meta-wayland-surface.c:993
 13) wl_surface_commit at ../src/wayland/meta-wayland-surface.c:1158
 14) ffi_call_unix64 at ../src/x86/unix64.S:76
 15) ffi_call at ../src/x86/ffi64.c:525

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2147>
2021-12-22 16:22:08 +00:00
Jonas Ådahl
ada524265f backend: Return NULL cursor renderer if there is no seat
During tear down, if anything teared down after the seat tries to get
the cursor renderer, we'd crash trying to get it as the seat would
already be gone. Avoid this by returning NULL when there is no seat.

It's assumed that any path that will happen during tear down that relies
on getting the cursor renderer will gracefully handle it not being
present, e.g. by relying on the cursor rendering cleaning up itself.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2147>
2021-12-22 16:22:08 +00:00
Jonas Ådahl
c87779f62e cursor-tracker: Add missing newline
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2147>
2021-12-22 16:22:08 +00:00
Jonas Ådahl
25ed64b61d cursor-sprite: Register all cursor sprites with the cursor tracker
This will later be used to invalidate GPU state when closing device
nodes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2147>
2021-12-22 16:22:08 +00:00
Robert Mader
c498ae337f wayland/surface: Do not uncoditionally process surface damage
Most clients nowadays switched to buffer damage, most notably Mesa
and Xwayland. Thus lets avoid the extra cost of allocating three
`cairo_region_t`s and doing some calculations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2168>
2021-12-22 12:14:29 +00:00
Robert Mader
c166811695 wayland/surface: Use correct default viewport for surface damage
If no viewport is set, the neutral viewport is the surface size
without viewport destination size applied - i.e. transform and
scale applied to the buffer size. Change it accordingly, giving
us the same values we'd return in `get_width` in this case.

As result, this only changes cases where a viewport destination
size but no viewport source rectangle is set.

The change fixes exactly such cases, e.g. the Gstreamer Wayland
sink. Can be tested with: `gst-play-1.0 --videosink=waylandsink`.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2168>
2021-12-22 12:14:29 +00:00
Robert Mader
f4717d0ac5 wayland/surface: Switch order for calculating surface damage
Process surface damage in the right order, simplifying the
calculations.

No functional change intended.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2168>
2021-12-22 12:14:29 +00:00
Olivier Fourdan
56939abd2f cursor-renderer/native: Add a means to disable HW cursors
When dealing with a faulty hardware or bugs in the driver, it might be
interesting to force the use of software cursors for debugging purposes.

Add a debug environment variable MUTTER_DEBUG_DISABLE_HW_CURSORS to
disable hardware cursors and force using software cursors.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2046
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2150>
2021-12-20 10:41:28 +00:00
Marco Trevisan (Treviño)
65df817096 monitor-unit-tests: Check orientation changes with transformed panels
Ensure that orientation changes still work as expected when using a
panel that has some native transformation.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2090>
2021-12-20 10:08:13 +00:00
Marco Trevisan (Treviño)
54b36d77ab monitor-unit-tests: Take panel orientation transform in account
When checking panel orientation on logical monitors we should take
panel orientation transform to check it's properly applied, so ensure
that we're checking the right one.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2090>
2021-12-20 10:08:13 +00:00
Hans de Goede
cc9bb7c516 monitor-manager: Fix orientation changes on devices with 90° mounted panels
Commit 2289f56112 ("monitor-manager: Don't apply unneeded orientation
changes") added an early return to handle_orientation_change () in case
the transform is unchanged.

But this did not take the correction of the transform for devices
with 90° mounted panels into account causing a desired orientation
change to get skipped if the new orientation matches the corrected
logical orientation from the previous transform setting.

Fix this by calling meta_monitor_crtc_to_logical_transform () on the
transform before comparing it, matching the
meta_monitor_crtc_to_logical_transform () call in
create_for_builtin_display_rotation ().

Related: https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1233
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2090>
2021-12-20 10:08:13 +00:00
Robert Mader
6204769fdb surface-actor: Fix unobscurred_fraction calculation
This calculation wrongly applied a `x2 - x1` pattern.

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

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2169>
2021-12-19 23:46:11 +01:00
Jonas Ådahl
0df12ebee6 xwayland: Don't remove /tmp/.X11-unix/X0 when running tests
When Xwayland was not initalized, we'd still clean things up. What this
accidentally meant was that the uninitialized display number 0 was
cleanud up, which very likely was main display of the host session.

What this meant in practice was that /tmp/.X11-unix/X0 was often
removed, causing every Flatpak X11 application to fail to start until
Xwayland was restarted nad the X0 socket file was restored.

Fix this in two ways: firstly only shutdown Xwayland if we ever started
it, i.e. if the X11 display policy was not 'disabled'. This should fix
the issue most of the times. Secondly only clean up the socket if it was
ever initialized. This should fix things if the socket creation failed,
as if it did, the name would be set.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2162>
2021-12-19 16:52:45 +00:00
Jonas Ådahl
75d8fedcf5 tests/wayland/xdg-apply-limits: Uncomment assert
The test driver is needed for the test, so assert it was found.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1993>
2021-12-19 15:48:51 +00:00
Jonas Ådahl
6613c24f1a tests/wayland/xdg-apply-limits: Add missing whitespace
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1993>
2021-12-19 15:48:51 +00:00
Jonas Ådahl
618cc5050b tests/wayland-unit-tests: Fix some style issues
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1993>
2021-12-19 15:48:51 +00:00
Jonas Ådahl
3602762a18 tests/wayland-unit-tests: Add test case for remapping popup with subsurface
This test reproduces the crash in
https://gitlab.gnome.org/GNOME/mutter/-/issues/1828. It does not
reproduce with 'window-actor/wayland: Remove subsurface actors on
dispose' (dd416dd3e2). applied. This test case differs slightly
from the one that came with the dd416dd3e2 as in that it uses
withdrawn popup surfaces instead of explicitly client managed state.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1993>
2021-12-19 15:48:51 +00:00
Jonas Ådahl
8a43123765 xdg-shell/popup: Reset 'dismissed-by-client' state when remapping
A popup surface can be remapped multiple times using the same
wl_surface, if a new xdg_popup object is created. To properly handle
this, we need to reset the 'dismissed_by_client' boolean to false, as
otherwise we won't allow new buffer commits.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1993>
2021-12-19 15:48:51 +00:00
Jonas Ådahl
41e426af10 tests/wayland-unit-tests: Clean up toplevel_apply_limits() signal handler
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1993>
2021-12-19 15:48:51 +00:00
Jonas Ådahl
ed4e532690 tests/wayland-test-driver: Add sync event
Will be used to signal test cases.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1993>
2021-12-19 15:48:51 +00:00
Jonas Ådahl
a1d5c96e86 unit-tests: Print error when configuring context
More helpful than an assert.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1993>
2021-12-19 15:48:51 +00:00
Jonas Ådahl
d8521ffc56 tests/wayland-test-driver: Add surface argument to sync_point request
Will allow more "specific" sync points; will be used in the future by
new tests.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1993>
2021-12-19 15:48:51 +00:00
Jonas Ådahl
ed677f49ff context/test: Let g_test_init() consume argc/argv first
This allows passing e.g. -p /path/to/test to test executables.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1993>
2021-12-19 15:48:51 +00:00
Jonas Ådahl
d111c47c88 tests/wayland-unit-tests: Change to use headless backend
Change to use the headless backend with a virtual monitor, instead of
the nested backend. This means tests can create and use virtual input
devices, which isn't possible with the nested backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1993>
2021-12-19 15:48:51 +00:00
Jonas Ådahl
7992b46566 tests/invalid-xdg-shell-actions: Avoid flakyness
The roundtrip in the handle-configure function could in theory (and in
practice in the future) happen to receive another configure event. If we
send yet another invalid geometry the second time, we log one time too
many in the server, which fails the test. Avoid this by ignoring the
second configure event; it's enough to pass through the error handling
path once.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1993>
2021-12-19 15:48:51 +00:00
Jonas Ådahl
4469042e2a workspace: Downgrade abort() to a warning when getting index
Instead of crashing on invalid input, just log a warning and return -1.
This will hopefully result in less abort():y behavior with missbehaving
Javascript code.

Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4203
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2134>
2021-12-19 15:16:12 +00:00
Florian Müllner
525cb7e10e display: Add meta_display_list_all_windows()
We now have a use case in gnome-shell for getting a list of all
windows (including OR ones), but the existing API is private.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4751

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2163>
2021-12-16 16:35:15 +00:00
Florian Müllner
3643e0ba1e events: Bypass windows with modal transients
The expected behavior for modal dialogs is that the user
cannot interact with the parent window. However toolkits
like GTK and Qt can only implement that behavior for windows
within the same process.

Address this by enforcing that behavior in the compositor to
get "foreign" windows and other toolkits behave consistently.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4825

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2123>
2021-12-14 18:23:23 +01:00
Florian Müllner
ccf6bbc673 window: Add has_modals() function
We'll soon use that to enforce modal behavior for foreign transient
windows. It'll only be used inside mutter (for the time being), so
keep it private for now.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4825

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2123>
2021-12-14 18:23:23 +01:00
Florian Müllner
40d9d26229 window: Add has_attached_dialogs() function
We currently only expose a function to check whether a window *is* an
attached modal dialog, not whether it *has* any.

The latter is interesting as well, but the code currently lives in a
gnome-shell helper function. Mutter is in a better position to filter
out unmanaging windows though, so add corresponding API.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4825

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2123>
2021-12-14 18:23:23 +01:00
Florian Müllner
844445b807 window: Fix up comment
Whoops, someone sneaked in a stray verb ...

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4825

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2123>
2021-12-14 18:23:23 +01:00
José Expósito
cea5c47671 wayland/pointer: Return on scroll without client
Return early from handle_scroll_event if no client is focused to avoid
redundant calculations.

Refactor, no functional changes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1966>
2021-12-14 15:44:48 +00:00
José Expósito
d703ba56c3 wayland/pointer: Call wl_resource_get_version once
Call wl_resource_get_version once for each pointer resource.

Refactor, no functional changes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1966>
2021-12-14 15:44:48 +00:00
José Expósito
2e8aef6f8a backends/native: Refactor LIBINPUT_EVENT_POINTER_AXIS handling
Move the logic to handle LIBINPUT_EVENT_POINTER_AXIS events to its own
function (handle_pointer_scroll).

Refactor, no functional changes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1966>
2021-12-14 15:44:48 +00:00
Carlos Garnacho
d2998a8e41 wayland: Check keyboard serials for activation
We are using internal API that has the benefit of checking that the
focus surface still matches, but has the drawback that it does not
check the MetaWaylandKeyboard state.

In order to fix this, look for keyboard focus and serial matches
specifically when triggering activation.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2148>
2021-12-13 14:49:14 +00:00
Jonas Ådahl
d43cc776ef renderer/native: Allow forcing EGLStream backend
The GBM support in the NVIDIA driver is fairly new, and to make it
easier to identify whether a problem encountered is related to using GBM
instead of EGLStreams, add a debug environment variable to force using
EGLStream instead of GBM.

To force using EGLStream instead of GBM, use

    MUTTER_DEBUG_FORCE_EGL_STREAM=1

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2045
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2132>
2021-12-08 15:47:35 +00:00
Georges Basile Stavracas Neto
87a66830dc cogl: Drop cogl-wayland-server.h
This header only defines one function that doesn't exist anymore,
and nothing else. It can be safely dropped.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2145>
2021-12-07 18:34:00 -03:00
Jonas Ådahl
3eeecd42b0 tests/dbus-runner: Don't log to a loose ended pipe
We created pipes for the stdout of the spawned mock services. This
resulted in the pipe being filled if enough things were logged, as
nothing was reading from it. Change this to allow for two modes:
verbose - where output is logged to the parent stderr, as well as non-verbose
(default) - where things are logged directly to /dev/null.

This fixes frozen tests when running with --repeat and a high enough
repeat count.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2139>
2021-12-07 20:33:26 +00:00
Carlos Garnacho
eda7588190 backends: Replace MetaCursorSprite::prepare-at with in-place function
Since this signal is in a hot path during input handling, it makes sense
not to have this be a signal at all, currently most of the time spent in
it is in GLib signal machinery itself.

Replace it with a function/user data pair that are set on the sprite
itself. Only the places that create an sprite are interested in hooking
one ::prepare-at behavior per sprite, so we can do with a single pair.

This makes meta_cursor_sprite_prepare_at() inexpensive enough.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1915>
2021-12-07 20:04:08 +00:00
Carlos Garnacho
8310766845 backends: Upload xcursor texture only after invalidations and theme changes
Make realize_texture() return FALSE for the situations that we do not need
to push again the cursor texture.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1915>
2021-12-07 20:04:08 +00:00
Carlos Garnacho
5e93708d86 wayland: Mark sprite as invalid after cursor changes
This will be used to hint the backend that the cursor surface
might need uploading again.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1915>
2021-12-07 20:04:08 +00:00
Carlos Garnacho
508c08fa09 backends: Only reload sprite cursor on changes
Let the meta_cursor_sprite_realize() function return a boolean value
telling whether there was an actual change in the sprite cursor. E.g.
the surface/icon for it changed in between.

This is used in the native backend to avoid converting/uploading again
the cursor surface.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1915>
2021-12-07 20:04:08 +00:00
Carlos Garnacho
49045b2ab9 backends: Remove superfluous intermediate variable
Having this intermediate variable is not of much use anymore, remove
it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1915>
2021-12-07 20:04:08 +00:00
Carlos Garnacho
35b8346a33 backends/x11: Use clutter_do_event() for event delivery
It'll do some things that will be no longer optional here. So don't
avoid this step towards event emission.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1915>
2021-12-07 20:04:08 +00:00
Carlos Garnacho
a7fc74032e tests: Ensure pointer entered the stage at actor-event-hold test
This test is injecting input events without checking the correct stage/
device state. Wait for the pointer to enter the stage, so the event gets
correctly forwarded across.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1915>
2021-12-07 20:04:08 +00:00
Jonas Ådahl
70c6d28fca ScreenCast: Allow recording new streams on active sessions
This is useful if you have a session, and want to "hot-plug" new sources
over time; there is no point in having to create separate sessions for this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2131>
2021-12-07 19:23:52 +00:00
Jonas Ådahl
764c75d2fb screen-cast-session: Add is-active tracking
Will be used to determine one can start a new recording or not.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2131>
2021-12-07 19:23:52 +00:00
Jonas Ådahl
3c1f50a85e Move D-Bus interface files to dedicated directory
Place the XML files in data/dbus-interfaces.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2126>
2021-12-07 18:52:29 +00:00
Jonas Ådahl
d459df9a28 tests/test-client: Log to stderr
The test-client reports command results to stdout, so make sure to log
e.g. debug messages to stderr, so they don't interfere with the result
test-runner reads.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/450
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2095>
2021-12-07 18:15:06 +00:00
Carlos Garnacho
c07c50d189 wayland: Make the pointer leave non-alive surfaces
Listen to changes in MetaWindow::is-alive, so that the pointer
can logically leave the surface as soon as that happens. This
helps prevent flooding the client socket while it is stalled.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2122>
2021-12-07 17:15:21 +00:00
Carlos Garnacho
26676a829e core: Change behavior of "application is alive" checks
Change some things in these "app is alive" checks:
- The dialog timeout is separated from the ping timeout, in order
  to show it again at a constant rate after dismissing, despite in
  flight pings. It still shows immediately after the first failed
  ping.
- As we want to tap further into is-alive logic, MetaWindow now
  made it a property, that other places in code can fetch and
  subscribe.
- Motion events trigger ping (as long as there was none other in
  flight for the same window), and are counted between ping and
  pong, in order to preemptively declare the window as not alive
  before there is trouble with event queues being overflown.

This results in a separate logic between "the application does
not respond" and "we are showing the close dialog" so that the
former may get triggered independently.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2122>
2021-12-07 17:15:21 +00:00
Jonas Ådahl
29141afd0f xwayland: Handle the died callback being cancelled more gracefully
If we were cancelled, it could mean we teared down, meaning fetching
manager instances will attempt to fetch past freed instances. Handle
this by waiting with the fetching until we know we weren't cancelled.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2140>
2021-12-07 16:38:20 +00:00
Jonas Ådahl
ad0d70d5d5 wayland: Detach event source on tear down
No reason keeping it attached; would one continue using a main loop on
the default main context after tear down, we'd get callbacks causing
use-after-free issues.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2140>
2021-12-07 16:38:20 +00:00
Joan Torres
754c834590 Add method to show if in headless mode
MetaBackend can now show whether it is in headless mode or not
using a vfunc is_headless.

Fallback of is_headless returns FALSE.

MetaBackendNative implements is_headless returning its
is_headless property.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2130>
2021-12-07 16:03:10 +00:00
Fernando Monteiro
44aa6ab735 cogl: Remove cogl_texture_new_with_size
Replace the deprecated function with the suggested alternative.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2058>
2021-12-07 15:32:21 +00:00
Fernando Monteiro
612da58c72 cogl: Remove cogl_texture_new_from_sub_texture
This function is deprecated and must be replaced to the alternative.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2058>
2021-12-07 15:32:21 +00:00
Fernando Monteiro
0c5cf1ec58 tests: Rename 'material' variables to 'pipeline'
This should replace all usages of the material variable to
the pipeline variable.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2058>
2021-12-07 15:32:21 +00:00
Fernando Monteiro
29c62fabac cogl: Remove cogl_material_set_layer_point_sprite_coords_enabled
This function is deprecated and must be replaced to the alternative.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2058>
2021-12-07 15:32:21 +00:00
Fernando Monteiro
8285091585 cogl: Remove material_set_layer_filters
This function is deprecated and must be replaced to the alternative.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2058>
2021-12-07 15:32:21 +00:00
Carlos Garnacho
67a27a82d9 backends: Do not exclude devices from an output based on capability
This is a strange thing to do since MetaInputMapper also does take care of
devices with an output configured through settings, since we might have
devices that were configure through settings exclude other devices that
belong together with an output (e.g. a display-integrated tablet).

This was essentially here as a last resort to avoid matching two very
similar looking tablets to one of two very similar looking outputs. There
was a 50% chance already that the choice was wrong, and now these devices
can all be configured specifically through settings, so this shouldn't
be missed either.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2107>
2021-12-07 14:59:57 +00:00
Carlos Garnacho
e3702c8b9a backends: Only default to builtin panel on touchscreen devices
Non-display-attached tablets (e.g. Intuos) may find no match, which
should mean "use the span of all monitors", not "pick one for me".
Reserve this fallback to touchscreen devices, since these might
still benefit from it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2107>
2021-12-07 14:59:57 +00:00
Carlos Garnacho
04eda556e7 backends: Do not emit pointless signals remapping pad devices
The matrix and aspect ratio of the tablet is irrelevant on pads, and
it actually triggers warnings when trying change that on those devices:

gnome-shell:42536): mutter-CRITICAL **: 17:22:41.994: meta_input_device_native_get_mapping_mode_in_impl: assertion 'device_type == CLUTTER_TABLET_DEVICE || device_type == CLUTTER_PEN_DEVICE || device_type == CLUTTER_ERASER_DEVICE' failed

This is unnecessary to do on pad devices, these just need to be moved
together with their respective stylus.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2107>
2021-12-07 14:59:57 +00:00
Erik Massop
7bb0055acd plugins/default: Use local vars for refs
Since the completion callback (on_switch_workspace_effect_complete) sets
priv->tml_switch_workspace1 to NULL, the unref was trying to unref NULL,
and the reffed ClutterTimeline was not getting unreffed.

This could be triggered by rapidly switching workspaces, switching again
before the animation of the initial switch was done.

Found while working on #2038.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2120>
2021-12-07 13:57:58 +00:00
Pascal Nowack
d5f2ec6f1e backends/native: Stop freeing slow keys list twice
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1225
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2138>
2021-12-07 09:35:26 +01:00
Jonas Ådahl
65d8164833 backend: Expose get_monitor_manager() publicly
So that it can eventually replace the standalone singleton getter.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2128>
2021-12-03 15:43:40 +00:00