1
0
Fork 0
Commit graph

29791 commits

Author SHA1 Message Date
Carlos Garnacho
67a69709b9 core: Make "adding ignored serials" private API
This sounds unnecessary from shell code, and possibly even harmful.
Make this API private and move it into the X11 parts where it belongs.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2828>
2023-02-09 14:38:39 +01:00
Carlos Garnacho
3356823ca2 x11: Reset ignored crossing serials from X11 code
They are only ever set and ignored from X11 code, we can also move
this bit of sloppy/mouse mode handling to the X11 parts.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2828>
2023-02-09 14:38:39 +01:00
Carlos Garnacho
b321d545b1 x11: Bypass GTK on XFixesSelectionNotify
In GTK this is only used for GTK clipboard/DnD selections, and
finding out whether there is a compositing manager in charge.
In Mutter, we manage our own clipboard/DnD selections, and don't
perform any rendering through GTK in the Mutter process.

So there's no special reason to let these events go through GTK,
and (related to xwayland-on-demand?) there may be race conditions
in the handling of the second feature.

There's a chance this race condition may be in Mutter, but it
does not sound worth to chase this race condition when we can
let GTK ignore these events. And it does not make sense to "fix"
gtk3 for this Mutter-only condition, when we intend to eventually
avoid it.

So, take the easy path and ignore these events.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2617
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2831>
2023-02-09 13:04:22 +00:00
Erico Nunes
523b27e267 cogl/onscreen: Discard depth/stencil before swapping buffers
Marking the the depth/stencil as discarded before swapping buffers for
the screen signals the GPU that we don't need to keep them around for
the future.
This helps performance by reducing memory bandwidth usage in some GPUs
which may optimize to not write those buffers back to memory at all
after rendering, when they would just be cleared right after that
anyway.
It is not necessary to mark buffers as discarded after swapping buffers.
This should have no effect according to the spec (since that is going to
be followed by new rendering commands which make the buffer valid again)
and removing that has shown no impact in performance tests.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2091>
2023-02-08 15:01:34 +00:00
Erico Nunes
5fedd065c9 cogl/framebuffer: Remove requirement to discard color buffer
cogl_framebuffer_discard_buffers required that the color buffer is
passed, although users might want to discard e.g. just depth and/or
stencil buffers.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2091>
2023-02-08 15:01:34 +00:00
Sebastian Wick
63522de4d0 tests/stacking: Change primary monitor handling
The first monitor in stacking tests is the primary monitor but that
doesn't have to stay this way forever. Instead of special casing the
name "primary" to refer to whatever monitor happens to be the primary
monitor, we add an `assert_primary_monitor` command to verify that the
monitor that should be the primary monitor actually is.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2748>
2023-02-07 17:52:19 +01:00
Sebastian Wick
4727609d2b tests/stacking: Move string to gboolean conversion to a helper
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2748>
2023-02-07 17:48:33 +01:00
Sebastian Wick
462c1115fe tests/stacking: Add a multi-monitor stacking test
New add_monitor command for adding secondary monitors. Support setting
the workspaces-only-on-primary preference.

The stacking test tests the focus and stacking for multiple monitors
with workspaces-only-on-primary=true. The default_focus changes
previously broke this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2748>
2023-02-07 15:45:28 +01:00
Sebastian Wick
1920d55ef9 tests/stacking: Test stacking order with raise-on-click = false
Makes sure the focus changes but the stacking stays the same. Also
checks that the stacking and focus on a workspace stays the same when
changing between them.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2748>
2023-02-07 15:40:08 +01:00
Sebastian Wick
f6d96a6118 tests/stacking: Add support for moving the cursor and clicking
Also test that clicking on a window will focus and raise it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2748>
2023-02-07 15:16:39 +01:00
Jake Dane
619fc55408 desktop: Remove obsolete desktop file
The X-GNOME-Bugzilla-* entries in the desktop file were for use by
bug-buddy, a GNOME 2 technology that's been gone for over a decade.
These entries are obsolete and the desktop file can be removed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2621>
2023-02-06 15:19:17 +00:00
Keyu Tao
c1ab3f39d7 wayland/outputs: Fix potential crash when output has no monitor
bind_output() creates output interface resource, but does not
set implementation for it when wayland_output->monitor is NULL.
However, when the wayland library is running wl_closure_invoke(),
it expects the implementation to be non-NULL, and if not, it just
segfaults mutter by NULL pointer dereference.

This commit tries to address this issue by setting an implementation
when wayland_output->monitor is NULL. This could help prevent crash
when resuming from suspend or hotplugging displays.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2570
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2827>
2023-02-06 21:37:04 +08:00
Carlos Garnacho
d8ef1b5b8b build: Make dependency order consistent when generating introspection
Add first the internal/local dependencies, then the external dependencies.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2826>
2023-02-05 12:38:22 +00:00
Carlos Garnacho
83e505408c build: Change dependency order building libmutter-test introspection
The order of dependencies influences the order of -L arguments to gcc/ld,
we should put our private library first, so that introspection prefers
looking up libraries in private paths than public ones.

This could bring problems in API updates of the libmutter-test library,
since introspection would still prefer the old installed one.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2826>
2023-02-05 12:38:22 +00:00
Yosef Or Boczko
5303c01dfc Update Hebrew translation 2023-02-05 09:02:14 +00:00
Sebastian Wick
e38002b206 workspace: Do not raise default focus window with raise-on-click
This avoids raising a window when switching input methods or returning
from the overview when it is unwanted with raise-on-click disabled.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2545
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2742>
2023-02-03 17:09:12 +00:00
Jonas Ådahl
7fecda6a7a tests: Add public test monitor API
This will allow gnome-shell perf tests to create and destroy virtual
test monitors whenever it needs to.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2824>
2023-02-03 15:29:28 +00:00
Jonas Ådahl
d3db3157bb tests: Make libmutter-test.so introspected
This allows perf test cases in gnome-shell to use the public API.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2824>
2023-02-03 15:29:28 +00:00
Jonas Ådahl
13ca367311 tests/ref-test: Don't use gidoc for private function
This will silence some introspection warnings that would otherwise
happen when we start doing that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2824>
2023-02-03 15:29:28 +00:00
Jonas Dreßler
f6da583d06 tests/clutter/event-delivery: Add tests for implicit grabbing
Add a few tests to make sure all the hairy details of crossing behavior etc
don't fall apart again.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
2023-02-03 12:10:22 +00:00
Jonas Dreßler
065ae39d61 clutter: Add CLUTTER_EXPORT_TEST define
Just like in mutter, add a define for exporting functions so that they
can be used in tests. This will be useful in the next commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
2023-02-03 12:10:22 +00:00
Jonas Dreßler
dbf56621ff clutter/text: Use implicit grab instead of grabbing all events
Clutter has implicit grabbing now, so no need for grabbing all events
using clutter_stage_grab() anymore.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
2023-02-03 12:10:22 +00:00
Jonas Dreßler
d374feb55f events: Make MetaGestureTracker work with the action event delivery
ClutterActions now no longer receive their events via
clutter_actor_event(), instead they get special treatment by the stage
now. Make the MetaGestureTracker work with this and stop emitting events
directly to Clutter via clutter_actor_event(), but instead let them get
through to Clutter (but still not to Wayland).

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
2023-02-03 12:10:22 +00:00
Jonas Dreßler
53b6d4abb1 clutter/gesture-action: Let lower layers cancel gesture on stage grab
Since the last commit, ClutterStage automatically cancels an implicit
grab (including all its ClutterActions) when a conflicting ClutterGrab
appears.

This means we no longer have to look out for GRAB_NOTIFY crossings in
ClutterGestureAction and can instead depend on the sequence_cancelled()
vfunc for this.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
2023-02-03 12:10:22 +00:00
Jonas Dreßler
debbd88f8c clutter/stage: Cancel parts of implicit grabs when ClutterGrabs happen
A ClutterGrab takes precedence over implicit grabs, so when one happens,
let's check which part of the implicit grab tree is inside the new
ClutterGrab. Cancel and remove the parts which aren't, and if nothing
is in there anymore, cancel the whole implicit grab.

Emitting crossing events correctly here is getting quite tricky:

- When the implicit grab didn't get cancelled by the ClutterGrab, we
simply want to emit all GRAB_NOTIFY crossings to the implicit grab, as
we do with all other crossings.

- When the implicit grab did get cancelled and the new ClutterGrab wants
to emit ENTER crossings, we want those to be emitted to the actual
targets, so cancel the implicit grab before emission.

- In the last case where the implicit grab did get cancelled and the new
ClutterGrab wants to emit LEAVE crossings, those should be emitted to
the implicit grab again, so we cancel the grab only after the emission
of those.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
2023-02-03 12:10:22 +00:00
Jonas Dreßler
2dd851d9f4 clutter: Add a GRABS debug flag
Now that we have two kinds of grabs, the intricacies of event delivery
got slightly more complicated. So this seems like a good point to
introduce a new GRABS debug flag that gives an overview of which grabs
are currently in effect.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
2023-02-03 12:10:22 +00:00
Jonas Dreßler
9d1c212a04 clutter/actions: Implement new sequence_cancelled vfunc
Now that we have more robust API to get notified about points that got
cancelled, make use of it to cancel ClutterGestureActions and
ClutterClickActions.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
2023-02-03 12:10:22 +00:00
Jonas Dreßler
cf2d44d2c2 clutter: Notify ClutterActions about sequences that were cancelled
We're almost there, everything is in place to notify ClutterActions
about a sequence getting pulled away under its feet.

The only thing that's missing is the actual notification to actions now,
so let's do that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
2023-02-03 12:10:22 +00:00
Jonas Dreßler
b3de224406 clutter/stage: Allow claiming sequence outside of event handling context
Another baby step just like the last commit: This commit takes care of
the opposite case: An action handling a sequence event stops further
emission of events to actors.

Since sequences remain around for longer than the context of just a
single event, it makes sense to provide a way to "claim" those sequences
even when outside of event handling context, so introduce API for that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
2023-02-03 12:10:22 +00:00
Jonas Dreßler
6939bed55c clutter/stage: Make sequences exclusive to actors vs actions
As soon as any event of a sequence is handles/stopped during emission,
all actors and actions that would have gotten to see it afterwards have
a big problem: If that event was a TOUCH_END event, the actor/action is
forever going to think that this touch is still active.

For ClutterActions, we're going to handle this by introducing a way to
send them a notification when stuff like this happens.

As a baby step towards all that, make event emission exclusive to actors
as soon as any actor stopped an event.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
2023-02-03 12:10:22 +00:00
Jonas Dreßler
bac66fcbc4 clutter: Implicitly grab on button and touch event sequences
We'll soon introduce a new gesture tracking framework which heavily
depends on ClutterActions seeing all events of a sequence. For this to
work, a larger change to event delivery is needed: Implicit grabbing of
all events for button and touch press->motion->release sequences to
ensure ClutterActions continue receiving events for the whole sequence.

This commit takes care of that: At the start of an event sequence we
collect all the event-handling actors and actions to a GArray that lives
in the  PointerDeviceEntry, and then deliver all events belonging to
that sequence to the same actors/actions until the sequence ends.

To avoid events getting pulled from under our feet when mutters event
filter returns CLUTTER_EVENT_STOP, this also introduces private API
(maybe_lost_implicit_grab()) on ClutterStage so that we can't end up
with stale sequences.

Note that this also slightly changes behavior when it comes to event
delivery to actions: Because we now store actions separated from their
actors, any action returning CLUTTER_EVENT_STOP now stops event
propagation immediately. That was different before, where we'd emit
events to all actions of the actor and only then stop propagation.

Note that this isn't handling ClutterGrabs correctly right now,
this will be a little tricky, so we'll take care of that in a future
commit.

To handle actors getting destroyed or unmapped during a grab, listen to
notify::grab on the deepmost actor in the implicit grab tree. This gives
us a notification when any actor inside the tree goes unmapped.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
2023-02-03 12:10:22 +00:00
Jonas Dreßler
d795710a14 clutter: Move emitting events to ClutterActions to the stage
A fairly small refactor, move the emission of events to actions from
clutter_actor_event() to stage level.

We do this because in the future we'll need to know on stage level
whether events were handled by an actor or by an action.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
2023-02-03 12:10:22 +00:00
Jonas Dreßler
c6b3c90e41 clutter/actor: Introduce private function to peek actions
We'll need to take a look at the actions of actors twice for every
single event emission once we move emission to the stage, let's not copy
around lists for that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
2023-02-03 12:10:22 +00:00
Jonas Dreßler
4358f8da7c clutter: Reuse GPtrArray for event emission
_clutter_actor_handle_event() currently allocates a new GPtrArray on the
heap for every single event emission, let's avoid this by keeping an
array around in ClutterStage and reusing that.

This is moving the last few bits of event emission into ClutterStage,
which will be useful when we introduce implicit grabbing in subsequent
commits.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
2023-02-03 12:10:22 +00:00
Jonas Dreßler
a62ae73478 clutter: Propagate PROXIMITY events up and down the tree
There's no real reason to keep those events exclusive to the stage, some
actors or actions might want to get notified about proximity events too,
so propagate them like any other event.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
2023-02-03 12:10:22 +00:00
Jonas Dreßler
0f0466fa8e clutter: Make the stage the central instance emitting events
Right now and due to loads of refactorings lately, the event emission
paths are a bit cluttered (ha ha ha) around in Clutter. For example the
event target actor gets set in clutter-main.c, but event emission is
actually managed by ClutterStage these days.

Since we'll introduce implicit grabbing of touch/button-press sequences
soon, let's shuffle things around a bit to make that easier:

Move event emission to the stage, it now gets a ClutterEvent without any
extra context like the target actor from clutter-main. The stage then
looks up the target actor itself and emits the event to the appropriate
actors in the scenegraph. A special path is introduced for emitting
crossing events, because here the event-receiving actors don't follow
the "capture+bubble from pointer actor to grab actor" rule.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
2023-02-03 12:10:22 +00:00
Jonas Dreßler
ccb49f75e4 clutter/actions: Never stop crossing events
Crossing events should never be stopped during event emission. We
already have a check that enforces this in clutter_actor_event(), but
ClutterActions still sometimes try to stop crossing events from
propagating.

Improve that situation and return CLUTTER_EVENT_PROPAGATE when handling
crossings in ClutterActions, too.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2342>
2023-02-03 12:10:22 +00:00
Sebastian Wick
ec58e74cc5 window: Keep proportional position in meta_window_move_between_rects
The previous logic tried to keep the position of the top left corner of
the window relative to the top left corner of the monitor. This allowed
the window to move out of the target monitor. This change keeps the
proportions of the distance between the window and the monitor borders
instead if possible. Otherwise it keeps the relative position of the
center of the window clamped to [0,1] to make sure the window lands on
the right output.

This also slightly changes what monitor is considered to be on: the
monitor which contains the center of the window and, if the center is on
no monitor, the monitor wich overlaps the most with the window.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2591>
2023-02-01 22:58:34 +00:00
Fran Dieguez
cd1ab57e68 Update Galician translation 2023-02-01 21:51:39 +00:00
Robert Mader
120e21db7c wayland/surface: Reenable WL_SURFACE_ERROR_INVALID_SIZE check
This partly reverts f9857cb8 but leaves an exception for cursor
surfaces in place, as some apps/toolkits will likely not get updated
anytime soon to ensure cursor themes comply with the Wayland spec.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2815>
2023-02-01 17:42:04 +00:00
Daniel van Vugt
733aa0e3b7 onscreen/native: Only hold on to scanout buffers in next_fb and current_fb
So we can remove the additional `next_fb` and `current_fb` pointers from
`MetaOnscreenNativeSecondaryGpuState`.

Some non-scanout buffers also need to be held in the case of GL blitting
which completes in the background. Those are referenced from the scanout
buffers themselves to ensure the source buffers live just as long.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2087>
2023-02-01 16:56:34 +00:00
Sebastian Wick
8e4111fe82 project: Add __pycache__ to .gitignore
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2822>
2023-02-01 16:19:02 +00:00
Sebastian Wick
17c52854b7 default-plugin: Handle unmanaging windows in switch_workspace
Also add a regression metatest.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2559
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2782>
2023-02-01 16:21:55 +01:00
Niels De Graef
fbe7a8df3a clutter: Fix ClutterMainContext leaking events
There's still a possibility that some events remain within the
`ClutterMainContext` when it's being unref-ed for the last time (as seen
on asan logs). Make sure they get freed by using
`g_async_queue_new_full()` and specifying the appropriate destroy
function.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2817>
2023-02-01 13:16:29 +00:00
Niels De Graef
6ff7f43fcf backends: Don't leak GSettingsSchema
`g_settings_schema_source_lookup()` is marked with `(transfer full)` so
make sure we actually free the struct at the end of the function.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2817>
2023-02-01 13:16:29 +00:00
Niels De Graef
019267a044 tests/test-runner: Don't leak tests array
Make sure we properly free the array and its string elements

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2817>
2023-02-01 13:16:29 +00:00
Niels De Graef
1a814250c0 tests/meta-context-test: Free D-Bus call results
Don't leak the resulting `GVariant`.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2817>
2023-02-01 13:16:29 +00:00
Robert Mader
678bc69e72 clutter/frame-clock: Clamp next_update_time to the current time
Calculating a timestamp from the past distorts the dispatch lateness
calculation, leading to an inflated max_render_time, which again
increases the likelyhood of next_update_time being in the past.

Fixes 99850f4645

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2819>
2023-02-01 12:21:44 +00:00
Jonas Ådahl
be649bdad2 tests/native-pointer-constraints: Remove extra semicolon
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2814>
2023-02-01 08:40:53 +01:00
Jonas Ådahl
2c15a9569e tests/cogl: Remove extra semicolon
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2814>
2023-02-01 08:40:53 +01:00