1
0
Fork 0
Commit graph

7936 commits

Author SHA1 Message Date
Jonas Dreßler
4cad96ed24 clutter/actor: Cache the visible paint volume
If no actors have changed their positions and we're only repainting
because a window needs a repaint, the paint volumes of all actors
remain unchanged. There is no reason to redo those paint volumes on every
stage update.

So introduce caching and invalidation logic for the visible_paint_volume
that allows us to avoid a ton of matrix multiplications that right now
are happening for the whole mapped actor tree on every redraw.

Note that this removes two places where the visible paint volume is set
to an empty paint volume: This is a compromise so that we can keep
around the cached pv when hiding and showing an actor, it does "regress"
one case though: When hiding -> moving -> showing an actor, we'll now
include the old paint volume of the actor in the redraw clip on show (even
though redrawing that old region is not necessary, the actor was hidden
after all). This results in a bit of overpaint in this very specific case,
but for the sake of simplicity let's not care about that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2679>
2023-06-06 11:41:00 +00:00
Robert Mader
64feb2e5f0 clutter/actor-box: Avoid rounding compensation for empty boxes
Empty boxes should not be enlarged to non-empty boxes, otherwise we
potentially confuse tests where we expect a zero-sized actor to also be on
zero stage views.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2679>
2023-06-06 11:41:00 +00:00
Pascal Nowack
30a5178204 clutter/clutter-stage: Get rid of an unused variable warning
When building mutter with -Ddebug=false, a warning appears, that
`ClutterStagePrivate *priv` is unused.
Simply remove this variable and directly use `stage->priv` in
`CLUTTER_NOTE` to get rid of this warning.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3046>
2023-06-02 12:22:18 +02:00
Bilal Elmoussaoui
9a6ee5d7c7 clutter: Drop unnused cairo specific APIs
The APIs are not used by Mutter and GNOME Shell, so they should be safe to remove

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3040>
2023-06-01 16:10:13 +00:00
Georges Basile Stavracas Neto
52579c545b clutter/text: Use named pipelines
Cleanup the static color pipeline in favour of using named
pipelines. This is a more modern approach, and helps when
tearing down CoglContext.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3007>
2023-05-23 12:47:07 +00:00
Georges Basile Stavracas Neto
8f6ebe4800 clutter/text: Don't paint background
The background is already painted by clutter_actor_paint_node(),
there's no need to (re)paint the background.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3007>
2023-05-23 12:47:07 +00:00
Georges Basile Stavracas Neto
28774a23aa clutter/text: Plug a pipeline leak
ClutterText paints selected text using the selection_paint()
function. This function has to main branches of execution:
when the position is in the selection bound, or not. In the
former, we are leaking the CoglPipeline created by copying
the default color pipeline.

Unref the copied pipeline after using it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3007>
2023-05-23 12:47:07 +00:00
Georges Basile Stavracas Neto
0e8356936c clutter/actor: Move root node to ClutterStage
For now, it goes the "easy" way of creating the root node and
immediately painting and destroying it. From now on, the main
root node is created only by ClutterStage itself.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3007>
2023-05-23 12:47:07 +00:00
msizanoen1
ab835787bd clutter/actor: Publish get_relative_transformation_matrix
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2726>
2023-05-22 14:44:33 +00:00
msizanoen1
f671cec514 clutter/paint-volume: Do not use nearest rounding for actor bounds
This ensures clipped redraw work properly with transformed actors.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2726>
2023-05-22 14:44:33 +00:00
msizanoen1
ddc5de610b clutter/actor: Introduce notify_transform_invalid
This allows clients to maybe avoid triggering a redraw if they don't know
beforehand if the transform would actually change.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2726>
2023-05-22 14:44:33 +00:00
Jonas Ådahl
61b42e5303 build: Use / operator instead of join_paths everywhere
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2985>
2023-05-04 12:35:38 +00:00
Sebastian Keller
5b26db8ae8 clutter: Remove struct paddings
Due to clutter being a private library we don't need worry about ABI
compatibility.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2986>
2023-05-04 12:11:26 +00:00
msizanoen1
4048562961 stage: Keep queued actor redraw clip volumes separate
This aims to reduce the amount of pixels that have to be redrawed on the
screen on a clipped actor redraw in case using the union of two
different clips in a surface will substantially increase the redrawn
area.

This should not result in excessive memory consumption as callers of
`clutter_actor_queue_redraw_with_clip` are expected to ensure that the
redraw clip rectangles are adequately deduplicated.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2965>
2023-05-03 08:53:36 +00:00
Marco Trevisan (Treviño)
17414fd242 clutter: Remove class paddings
mutter-clutter is a private library that is only used by the shell and
not meant to be ABI/API compatible in between versions, so there's no
need to add padding to classes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2903>
2023-05-02 19:48:03 +00:00
Jonas Ådahl
429cc9a674 clutter/backend: Allow unsetting input method
This is needed by GNOME Shell to remove itself as a input method
implementation during its shutdown sequence. We can't do it ourself
later because at mutters own shutdowns equence, the GNOME Shell
Javascript context has by that time already been teared down.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2934>
2023-04-18 14:04:41 +00:00
Robert Mader
87b3843615 clutter/stage-view: Add destroy signal
It will be used in the next commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2823>
2023-04-17 09:16:10 +00:00
Robert Mader
ff246a2dc8 clutter/frame: Add API to query minimal render time of a frame
It will be used to schedule Wayland frame events independently from both
update and presentation time, as the former may happen multiple times
frame and the later not at all.

For frame events we want a timing that is just late enough to ensure
that a following commit by a Wayland client will not get included into
the current frame any more.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2823>
2023-04-17 09:16:10 +00:00
Georges Basile Stavracas Neto
81c9c43d26 clutter/stage: Assign frames to paint context
When rendering through the 'paint-view' handler, assign the frame
to the paint context. Otherwise, when rendering outside of the
frame clock schedule, don't.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2804>
2023-04-07 12:19:23 +02:00
Georges Basile Stavracas Neto
82b037e74c clutter/paint-context: Allow assigning a ClutterFrame
This is not yet used, but next commits will need to assign a frame
to the paint context whenever painting onscreens.

Assigning a frame to the paint context is a one-way operation, and
treats multiple assignments strictly as a programming error.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2804>
2023-04-07 12:19:23 +02:00
Corentin Noël
eeee654031 cursor-tracker: Enhance the documentation and increase annotation coverage
Add the (optional) parameters when they are actually supported and at least add
the minimal documentation on functions.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2951>
2023-04-07 11:30:40 +02:00
Sebastian Keller
679d2fb4e0 build: Don't disable checks in release builds
Both Clutter and Cogl use g_return(_val)_if_fail() to safeguard
introspected API. Release builds were dropping these checks, which could
result in a much more crashy experience, especially when considering
extensions, but also due to bugs in the shell code itself.

This won't affect any major distro, because they all use "plain" builds.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2930>
2023-03-24 12:51:49 +00:00
Emmanuele Bassi
bc9cad5124 clutter: Safely transform paths to strings and vice versa
GValues containing objects and strings can be set to NULL, which means
the transformation functions from ClutterPath to string and vice versa
must be NULL-safe.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2625
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2929>
2023-03-21 13:47:51 +00:00
Jonas Ådahl
7eec97626d clutter/frame-clock: Warn if frame clock is disposed while dispatching
This shouldn't happen, but warn anyway to be a bit more helpful if
things go bad.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2901>
2023-03-18 13:52:10 +00:00
Florian Müllner
4a97da3675 cally: Use g_string_free() return value
glib now warns if the return value is not used, so use the API as
intended instead of assigning the character data separately before
freeing the GString.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2889>
2023-03-04 19:31:52 +00:00
Jonas Ådahl
f9802ca2a4 clutter/frame-clock: Debug log frame drops per second if there were any
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2855>
2023-03-02 01:39:16 +01:00
Jonas Ådahl
135ed27d27 clutter/frame: Allow setting a backend release function
The one set by the native backend is empty, but it will be used later.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2855>
2023-03-02 01:39:16 +01:00
Jonas Ådahl
7b634df379 renderer-view/native: Allocate backend specific ClutterFrame
This will carry an on-demand created MetaKmsUpdate.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2855>
2023-03-02 01:39:16 +01:00
Jonas Ådahl
678dc3243f clutter/stage-view: Allow stage view to allocate frame
This will be used to allow the native backend to allocate a KMS update
that'll be used for one frame.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2855>
2023-03-02 01:39:16 +01:00
Jonas Ådahl
b80e84dea6 clutter/frame-clock: Allow frame clock listener iface allocate frame
This will allow the frame clock listener to allocate larger structs
where it can keep e.g. backend specific frame state.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2855>
2023-03-02 01:39:16 +01:00
Jonas Ådahl
71b787f169 stage-view: Add short cut to clutter_frame_clock_update_now()
Stage view users can schedule updates at ease with
clutter_stage_view_schedule_update(), but couldn't schedule update
"now". Make that easy too by adding
clutter_stage_view_schedule_update_now().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2854>
2023-03-01 23:57:32 +00:00
Jonas Ådahl
cc2bbb25ba frame-clock: Don't delay schedule_now() if already scheduled
If we call schedule(), which will schedule an update some time in the
future, and then schedule_now(), we should reschedule the frame clock to
update immediately, and not some time in the future.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2854>
2023-03-01 23:57:32 +00:00
Jonas Ådahl
b2579750a7 cogl: Remove legacy OpenGL driver support
This means the two Cogl drivers left are OpenGL >= 3.1 and GLES >= 2.0.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2672>
2023-02-21 18:09:28 +00:00
Jonas Ådahl
e5195c08a4 clutter: Remove some unused macros
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2672>
2023-02-21 18:09:28 +00:00
Carlos Garnacho
e58f716fb1 clutter: Pass source device onto crossing event generation machinery
For motion-induced crossing events, this will be the device that generated
the motion. For code-induced crossing events (e.g. grabs or actors disappearing)
this will be none.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2828>
2023-02-09 14:38:39 +01: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
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