1
0
Fork 0
Commit graph

28239 commits

Author SHA1 Message Date
Jonas Ådahl
c41657bc4f wayland/activation: Remove token from hash table on timeout
When an activation times out, we'll be signalled two signals on the
startup sequence object: "timeout", and "complete".

Normally, the "complete" signal is emitted when a startup sequence is
completed succesfully by it being used for activation, and in this case,
the xdg_activation implementation should remove the sequence from the
startup notification machinery.

However, in the timeout case, we should not remove it, as the startup
notification machinery itself will deal with this. If we would, we'd end
up with use-after-free issues, as the sequence would be finalized when
removed the first time.

To avoid this, just clean up the Wayland side in the "timeout" signal
handler, leaving the "complete" signal handler early out if it was
already handled by it.

This avoids crashes like:

  0) g_type_check_instance (type_instance=type_instance@entry=0xdd6740)
  1) g_signal_handlers_disconnect_matched (instance=0xdd6740, ...)
  2) meta_startup_notification_remove_sequence (sn=0x4cc890,
                                                seq=0xdd6740) at
       ../src/core/startup-notification.c:544
  3) startup_sequence_timeout (data=0x4cc890, ...) at
       ../src/core/startup-notification.c:504
  4) g_timeout_dispatch (...) at ../glib/gmain.c:4933

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2081>
2021-11-24 15:20:59 +01:00
Jonas Ådahl
a2cf75ccd5 startup-notification: Fix naming of handle ID
It was named the same as the callback function itself, which was
confusing. ADd the `_id` suffix, which is the convention.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2081>
2021-11-24 15:20:59 +01:00
Jonas Ådahl
734ae26ff7 core/close-dialog: Don't pass DISPLAY
We set it via setenv(), and might not have the MetaX11Display at hand.
This fixes a crash when the stuck-client dialog (using zenity) appears
without any X1 client having appeared.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2081>
2021-11-24 15:20:59 +01:00
Sebastian Keller
b28a6e50a0 tests: Add test for maintaining constraints after client resizes
This test ensures that windows that were resized such that they extend
beyond the screen will be moved to be fully on the screen (if possible).

This has been working on X11 since forever, but on Wayland only since
the last commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2103>
2021-11-23 00:51:01 +00:00
Sebastian Keller
0e736af301 window: Ensure constraints after a Wayland client resize
The client may have changed the window size in a way that it now
violates some of the constraints. To ensure constraints are applied
again after a client resize we need to queue a mutter side resize. This
will apply the constraints and send the new size to the client.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1956
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2103>
2021-11-23 00:51:01 +00:00
Sebastian Keller
d66e3e2d8a window/wayland: Detect client resizes with pending non-resizes
The previous code was trying to detect client resizes by only
considering resizes without any pending configurations as client
resizes. There can however be pending configurations that do not involve
resizing, such as ones triggered by state changes. These may also stay
unacknowledged by the client until the next size change. This was
causing client resizes after showing the window (and therefore changing
its status to focused) to not be detected as client resize.

Fix this by checking whether the queue has any configuration with size
changes rather than just whether it is empty.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2023
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2103>
2021-11-23 00:51:01 +00:00
Sebastian Keller
67033b0acd wayland/window-configuration: Fix maximized check in fixed size check
This was always true and therefore resulting in all configurations being
considered as having a size, even when they don't change the size, such
as a state change.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2103>
2021-11-23 00:51:01 +00:00
Quentin PAGÈS
f41c03fcda Update Occitan translation 2021-11-22 09:24:33 +00:00
Fabio Tomat
8e6360670d Update Friulian translation 2021-11-22 07:45:58 +00:00
Jonas Ådahl
4bb8b2a9f3 util: Remove unused logging functions
They are tunneled through g_message() now.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2094>
2021-11-21 20:53:33 +00:00
Jonas Ådahl
e280589661 util: Implement meta_verbose() using meta_topic()
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2094>
2021-11-21 20:53:33 +00:00
Jonas Ådahl
59166d745e util: Implement meta_topic() using g_message()
This will get us things like timestamps.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2094>
2021-11-21 20:53:33 +00:00
Jonas Ådahl
8c8bbb8008 util: Remove push/pop no msg prefix logging
Used to log multiple line entries. Just make continue prefix things, no
need to mess with maybe-prefixing; it'll just complicate using some less
custom logging functionality.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2094>
2021-11-21 20:53:33 +00:00
Jonas Ådahl
cbdd62c197 kms/impl-device: Report 'full' change if we removed connectors
If some connectors disappeared, but the rest didn't change, we missed
actually removing the ones that disappeared, as we incorrectly assumed
nothing changed. Fix this by only assuming nothing changed if 1) we
didn't add any connector, and 2) we have the same amount of connectors
as before the hotplug event. The connector comparison checking makes
sure we report changes if anything of the still available connectors
changed.

Fixes: a8d11161b6
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2007
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2097>
2021-11-18 17:55:22 +01:00
Jonas Ådahl
c765730af7 kms/crtc: Always log whether we updated CRTC state
Change a few early-outs to handle the state changes without returning.
This means we'll get to log the result in all cases, which might help
debugging.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2097>
2021-11-18 17:55:22 +01:00
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