Commit Graph

28124 Commits

Author SHA1 Message Date
Jonas Ådahl
8546ca31ff kms/connector: Fix updating the state when drmConnector is NULL
When a docking station is disconnected, a few previously existing DRM
connectors may now be gone. When this happens, getting them via the
libdrm API results in NULL pointers returning, and we need to handle
this gracefully by making sure the connector state is properly updated.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2097>
2021-11-18 17:15:57 +01:00
Sebastian Keller
989cc2e247 tests: Add test for unfullscreening followed by immediate strut change
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2066>
2021-11-17 09:42:13 +00:00
Jonas Ådahl
028ed0685d tests/test-client: Add 'stop_after_next' and 'continue' commands
The 'stop_after_next' will execeute one command, then not return to the main
loop until a 'continue' command is passed. Commands will still be
processed between 'stop_after_next' and 'continue'.

This is intended to be used to induce race conditions.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2066>
2021-11-17 09:42:13 +00:00
Sebastian Keller
2eda6d0a7c tests/test-runner: Add commands to set and remove struts
This will be useful for tests that require strut changes to reproduce an
issue.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2066>
2021-11-17 09:42:13 +00:00
Sebastian Keller
6902a724ce window: Store unconstrained_rect everytime a size is requested
Currently the stored unconstrained_rect is only ever updated if there
was a move, resize or state change according to the move_resize_internal
implementation.  For Wayland windows however resizes or state changes
are done in two steps, first the new configuration is sent to the client
and then once client acknowledges it, it is set on the mutter side in
another move_resize_internal call. Only the second call would result in
the unconstrained_rect being updated.

This started causing problems when unfullscreening windows was
immediately followed by a strut change. These strut changes started
happening in gnome-shell due to the visibility of the panel now being
considered for the struts and the presence of a fullscreen causing it to
be hidden until unfullscreen. In this situation first the unfullscreen
would resize the window to its pre-fullscreen size as expected, but then
the strut change triggers another window resize. This window resize is
based on the stored unconstrained_rect, which is still at the fullscreen
size because the unfullscreen resize only has sent its configuration,
but it has not been acknowledged yet. As a result the strut change
causes a resize to the fullscreen size which due to the constraints now
looks like a maximized window.

To fix this always update the unconstrained_rect when the requested size
has changed, but not when a previous request has been acknowledged
unless it is originating from the client itself.

If this included the move_resize_internal call from acknowledging the
size as well, it would be possible for this to be delayed long enough on
the client side to overwrite an intermediate resize originating from
mutter. And if this did not include resizes originating from the client,
clients would not be able to set an initial window size.

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

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2066>
2021-11-17 09:42:13 +00:00
Sebastian Keller
8eb268fc3b window/wayland: Differentiate between requested and direct resizes
meta_window_wayland_finish_move_resize() is called for both, finishing
a resize that has been requested through/by mutter and for resizes
directly done by the client. This introduces a CLIENT_RESIZE flag to
differentiate the former from the latter. Having this distinction is
required to know what the last requested size by either the client or
mutter is while ignoring older requests that might only have been
applied now.

This excludes client resizes when there are still pending
configurations, because the resize is known to be only temporary.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2066>
2021-11-17 09:42:13 +00:00
Simon McVittie
a49c98d8d8 tests: Don't continue if setup commands fail
Because POSIX sh was, with hindsight, not a particularly well-designed
programming language, if we don't 'set -e', then we'll respond to failure
of a setup command such as cd by carrying on regardless.

Signed-off-by: Simon McVittie <smcv@debian.org>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2009>
2021-11-17 09:04:07 +00:00
Simon McVittie
7af1043865 tests: Don't use TestEnvironment
The assumption here seems to be that it's an overlay onto the
current environment which would make sense; but the implementation in
gnome-desktop-testing currently removes all other environment variables
(see GNOME/gnome-desktop-testing#1). This causes test failure when the
tests are run in Debian's autopkgtest framework, possibly because PATH
is cleared.

Signed-off-by: Simon McVittie <smcv@debian.org>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2009>
2021-11-17 09:04:07 +00:00
Piotr Łopatka
33529426a9 backend: Copy damage rectangles to secondary GPU when available
Systems with AMD GPUs do not take advantage of Mutter's zero-copy path
when driving DisplayLink screens. This is due to a very slow CPU access
to the zero-copy texture. Instead they fall back on primary GPU doing a
copy of the texture for fast CPU access. This commit accelerates texture
copy by working through damage regions only.

Tests on a 4K screen with windowed applications show significant
reduction of GPU utilisation.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2033>
2021-11-17 08:24:15 +00:00
Jonas Ådahl
b1c8ce110c meson: Add 'plain' test setup
This is useful if one wants to run 'meson test' inside
meta-dbus-runner.py. Doing so makes it possible to run e.g. 'meson test
--gdb'.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2093>
2021-11-16 23:54:46 +01:00
Daniel Mustieles
94e279310a Updated Spanish translation 2021-11-16 15:48:33 +01:00
Sebastian Keller
92c98d5522 clutter/timeline: Make the warning about detached actors more helpful
By including the debug name of the actor and the duration of the
animation the source of such detached actors can be more easily
determined.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2011
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2088>
2021-11-15 13:52:14 +00:00
Yaron Shahrabani
c693a7e58b Update Hebrew translation 2021-11-11 22:34:39 +00:00
Goran Vidović
830c53ed71 Update Croatian translation 2021-11-11 10:01:27 +00:00
Quentin PAGÈS
f84ece1bbc Update Occitan translation 2021-11-10 19:23:23 +00:00
Sebastian Keller
2c4db09355 docs: Update coding style link
The old one seems to have stopped working at some point due to all the
recent changes to the developer website.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2084>
2021-11-09 19:52:14 +01:00
Milo Casagrande
710e022cc8 Update Italian translation 2021-11-09 09:36:54 +00:00
Sebastian Keller
e25df6675a clutter/content: Mark optional parameters as such in annotation
The width and height parameters of clutter_content_get_preferred_size()
are optional, but were not marked as such. With a current gjs this will
result in a warning if a caller does not use them.

Found by Evan Welsh

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1945
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2079>
2021-11-08 15:46:09 +00:00
Hugo Carvalho
078ead6802 Update Portuguese translation 2021-11-07 22:27:21 +00:00
Fabio Tomat
a1f590a1ea Update Friulian translation 2021-11-07 17:07:15 +00:00
Jonas Ådahl
802d4e0cf8 clutter/actor: First clear all stage views before emitting they changed
If one would end up with an actor attached to mapped actor, where the
attached actor doesn't itself have an up to date stage view list while
listening on the stage for updating, when clearing the stage views of
the list, anything that would query the stage views list at this time
would end up accessing freed memory.

This could happen if

 1) An actor was added to a newly created container actor attached to
    the stage
 2) The actor got a timeline attached to it
 3) The actor was moved to a container that already was mapped
 4) A hotplug happened

After (1) both the container and actor would not have any stage views.
After (2) the timeline would listen on the stage for stage views
updates. After (3) the actor would still listen on the stage for stage
views updates. When (4) happened, the actor would be signalled when the
stage got its stage view cleared, at which point it would traverse up
its actor's tree finding an appropriate stage view to base its animation
on. The problem here would be that it'd query the already mapped
container and its yet-to-be-cleared stage view list, resulting in
use-after free, resulting in for example the following backtrace:

  0)  g_type_check_instance_cast ()
  1)  CLUTTER_STAGE_VIEW ()
  2)  clutter_actor_pick_frame_clock ()
  3)  clutter_actor_pick_frame_clock ()
  4)  update_frame_clock ()
  5)  on_frame_clock_actor_stage_views_changed ()
  6)  g_closure_invoke ()
  7)  signal_emit_unlocked_R ()
  8)  g_signal_emit_valist ()
  9)  g_signal_emit ()
  10) clear_stage_views_cb ()
  11) _clutter_actor_traverse_depth ()
  12) _clutter_actor_traverse ()
  13) clutter_actor_clear_stage_views_recursive ()
  14) clutter_stage_clear_stage_views ()
  ...

Avoid this issue by making sure that we don't emit 'stage-views-changed'
signals while the actor tree is in an invalid state. While we now end up
traversing tree twice, it doesn't change the Big-O notation. It has not
been measured whether this has any noticible performance impact.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1950
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2025>
2021-11-06 14:25:40 +00:00
Jonas Ådahl
5b35860b31 tests/stage-view: Verify stage view list length after updating
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2025>
2021-11-06 14:25:40 +00:00
Jonas Ådahl
666a30952c tests/stage-view: Disable animations
Animations may interfere with test cases, e.g. by triggering relayouts,
repaints, when not expected. Disable them, so that more precise test
cases can be added.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2025>
2021-11-06 14:25:40 +00:00
Jonas Ådahl
f1f2c96784 plugins/default: Add env var to disable animations
Intended to be used by tests, as animations may interfere with testing.
Eventually, a dedicated test plugin should be added, but it is out of
scope for this branch.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2025>
2021-11-06 14:25:40 +00:00
Yuri Chornoivan
69fcb3a146 Update Ukrainian translation 2021-11-05 18:57:46 +00:00
Ray Strode
6060b6a240 backends/x11: Fix key repeat of on-screen keyboard for second level keysyms
Certains keys (such as ~ and |) are in the keyboard map behind the
second shift level. This means in order for them to be input, the
shift key needs to be held down by the user.

The GNOME Shell on-screen keyboard presents these keys separately on
a page of keys that has no shift key. Instead, it relies on mutter
to set a shift latch before the key event is emitted. A shift latch
is a virtual press of the shift key that automatically gets released
after the next key press (in our case the ~ or | key).

The problem is using a shift latch doesn't work very well in the face
of key repeat. The latch is automatically released after the first
press, and subsequent repeats of that press no longer have shift
latched to them.

This commit fixes the problem by using a shift lock instead of a shift
latch. A shift lock is never implicitly released, so it remains
in place for the duration of key repeat.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2045>
2021-11-04 13:15:25 +00:00
Mark
8e1a125f70 startup: Optionally run (and exit with) a command
Treat the first non-option as a command, and any others as its CLI
arguments. Run the command with those arguments; communicate its exit
status (if nonzero); and exit with it. Document this added functionality
in the manpage and usage description.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1981
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1982>
2021-11-04 04:18:32 -05:00
Jason Gerecke
64ff1f20f8 input-mapper: Reverse sort order of display score comparator
The `guess_candidates()` function scores each display that an input
device could be mapped to and then uses the `sort_by_score()` comparator
to find the best option. The function expects the list to be sorted from
best to worst, but the comparator currently sorts them in the opposite
order. This causes the function to end up returning the _worst_ match
rather than the the best. This commit reverses the sort order of the
comparator so that the best display can be returned as intended.

Closes: #1889
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1934>
2021-11-02 17:17:21 +00:00
Carlos Garnacho
3d37602c54 clutter: Drop click count from button events
This does two things to frown upon:
- Modifies ClutterEvent structs, while the effort is to have those
  completely opaque, and readonly after creation from the input
  thread side.
- Stores state in the ClutterInputDevice struct, event though those
  are also considered static after creation, managed by the input
  thread, etc.

Stop doing that. This makes all events just forwarded as-is in
the ClutterStage/clutter-main.c code.

Handling of click count sounds like material for a ClutterGestureAction
(or perhaps ClutterClickAction), all of both callers now do it in place
at the moment, while gestures lack a better state tracking and management.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2024>
2021-10-29 00:27:18 +02:00
Carlos Garnacho
33ca5e3d80 tests: Drop dependency on click count
This call is being removed, in favor of in-place handling, or a
ClutterGestureAction eventually.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2024>
2021-10-29 00:27:18 +02:00
Carlos Garnacho
8c4c3f0308 clutter: Make ClutterClickAction independent of click count
This will trigger for every button press/release that is obtained,
regardless of the click count.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2024>
2021-10-29 00:27:18 +02:00
Carlos Garnacho
a084fc10f7 frames: Keep accounting of double clicks in place
Instead of relying on ClutterEvent information.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2024>
2021-10-29 00:27:18 +02:00
Carlos Garnacho
a235d03550 clutter: Carry accounting on double/triple clicks in ClutterText
Instead of using the ClutterEvent information.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2024>
2021-10-29 00:27:18 +02:00
Carlos Garnacho
6d0b7381da clutter: Move ClutterGestureAction to the handle_event vfunc
This will not try the captured-event shenanigans to emulate grab
behavior, instead relying on event delivery being influenced by
other grab mechanisms.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2024>
2021-10-29 00:27:18 +02:00
Carlos Garnacho
5133815cc1 clutter: Move ClutterClickAction to the handle_event vfunc
This will not try the captured-event shenanigans to emulate grab
behavior, instead relying on event delivery being influenced by
other grab mechanisms.

While at it, improve handling of additional touchpoints by
cancelling the click action right away, as the differences in
event handling make this unwanted behavior surface.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2024>
2021-10-29 00:27:18 +02:00
Carlos Garnacho
7885f6dbcc clutter: Add handle_event vfunc to ClutterAction
This will be the entry point for events into these actions.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2024>
2021-10-29 00:27:18 +02:00
Carlos Garnacho
0e57fd42e3 clutter: Add information about event phase in ClutterActions
These will stick to a single phase, instead of juggling capture and
bubble event handlers to do whatever they want.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2024>
2021-10-28 23:52:04 +02:00
Carlos Garnacho
2fc40da1cb clutter: Drop ClutterZoomGesture's zoom-axis property/methods
This can be done on the caller, seems rarely useful if at all.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2024>
2021-10-28 23:52:04 +02:00
Carlos Garnacho
85bcc48b53 clutter: Drop ClutterSwipeAction::swipe default vmethod
This is already empty, no need to do anything here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2024>
2021-10-28 23:52:04 +02:00
Carlos Garnacho
94abaf247b clutter: Drop default "zoom" action in ClutterZoomAction
Separate mechanism and effect, and let any ClutterZoomAction
users apply any necessary transformations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2024>
2021-10-28 23:52:04 +02:00
Carlos Garnacho
f4b26559d3 clutter: Drop default "rotate" action in ClutterRotateAction
Separate mechanism and effect, and let any ClutterRotateAction
users apply any necessary transformations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2024>
2021-10-28 23:52:04 +02:00
Carlos Garnacho
0ed9c6e524 clutter: Drop default action of Pan action
By default, the pan action performs matrix translations on the
child widget. Nobody wants that (or, nobody wants *just* that).
It's cleaner not to mix mechanism and effect in ClutterGestureAction
subclasses, so drop this base implementation, and change the signal
accumulator so it's more similar to event signals (not that it's
used any longer, anyway).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2024>
2021-10-28 23:52:04 +02:00
Quytelda Kahja
af6fb2a702 clutter: Fix event axes array indices in axis broadcasts
A clutter event's axes array is indexed by `ClutterInputAxis`.
However, a few lines accidentally use `ClutterInputAxisFlags` as
indices, reading incorrect values from elsewhere in memory. As a
result, broadcasted axis values for the tilt, rotation, and wheel
axes don't reflect actual event data.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1982
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2065>
2021-10-28 16:20:20 +00:00
Carlos Garnacho
5125f66afa core: Use b/w unicode for tablet mode OSD
This unicode was initially meant to be b/w, but fonts and pango
eventually had another plan and we ended up with color glyphs
being used here, so we get strings like "". Change the
unicode used to ensure these are simpler b/w glyhps like
"● ○ ○ ○" that are easier to read on the OSD (and maybe even a
bit less ugly).

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4733
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2064>
2021-10-28 10:56:26 +00:00
Carlos Garnacho
ab45ae18ff x11: Initialize struct early
Since we now use the common error paths, this could fallback at a point
where it was trying to free uninitialized memory.

CID: #1508193
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2063>
2021-10-27 14:12:35 +02:00
Rūdolfs Mazurs
774d7b46a8 Update Latvian translation
(cherry picked from commit 4ccdedfd99)
2021-10-26 19:15:06 +00:00
Erico Nunes
577c4711e1 backends: Enable partial update on clipped redraws
Mutter already calculates and tracks the damage rectangles to redraw
only areas of the screen that change since the last time a buffer was
used.
This patch extends this by using the EGL_KHR_partial_update extension to
inform the GPU in advance that only those areas will be changed, which
may allow for further optimization.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2023>
2021-10-26 16:56:39 +00:00
Erico Nunes
87965b5ce2 cogl: Add support for partial update
Add support for a cogl function to set the damage_region on an onscreen
framebuffer.
The goal of this is to enable using the EGL_KHR_partial_update extension
which can potentially reduce memory bandwidth usage by some GPUs,
particularly on embedded GPUs that operate on a tiling rendering model.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2023>
2021-10-26 16:56:39 +00:00
Robert Mader
331f08fc40 gschema: Turn experimental features into flags
Defining valid values makes
1. changing settings less error prone
2. sure they are discoverable.

This does reset the values once on update, but fortunately does *not*
change the way to set the values. Thus e.g. enabling fractional scaling
via terminal command still works as before and internet guides stay valid.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1961>
2021-10-26 16:24:41 +00:00
Robert Mader
49aa801454 gschema: Add "kms-modifiers" experimental feature description
To make it more discoverable. While on it, fix a typo.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1961>
2021-10-26 16:24:41 +00:00