8455 Commits

Author SHA1 Message Date
Jonas Ådahl
24083e1e58 stage: Clear update_scheduled field when update discarded
clutter_stage_schedule_update() sets the field `update_scheduled` to
`TRUE` as an optimization to make redundant updates a no-op. This failed
if there was a pending event and if the stage was not yet mapped.

What happened is:

 * clutter_stage_schedule_update() is called
   - ClutterStage::update_scheduled is set to TRUE
   - frame clock scheduled
 * frame clock dispatches
   - frame is discarded early, no actual stage update happens
 * device is created (e.g. virtual device from remote desktop session)
   - `device-added` event reaches ClutterStage::event_queue
 * stage is shown
   - clutter_stage_schedule_update() is called
     - ClutterStage::update_scheduled is TRUE
     - ClutterStage::event_queue has events in it
     - These two conditions means clutter_schedule_update() becomes a
       no-op

At this point, no more updates will happen from
clutter_stage_schedule_update().

Fix this by resetting `ClutterStage::update_scheduled` to `FALSE` even
if the frame was discarded due to the stage not yet being mapped.

A test case is added that replicates the above descibed events.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3804
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4152>
2024-12-05 00:19:12 +00:00
Georges Basile Stavracas Neto
13f6dcc098 clutter/paint-nodes: Use g_clear_object()
Minor cleanup.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4160>
2024-12-03 01:17:50 +00:00
Georges Basile Stavracas Neto
4aef995f72 clutter/stage: Delegate color state to root node
As the title says. Another step towards moving the color state
management to the paint node tree. Will help with ClutterSnapshot
transition.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4160>
2024-12-03 01:17:50 +00:00
Georges Basile Stavracas Neto
551db47b4c clutter/actor: Push/pop color state in actor node
Instead of ClutterActor doing that manually in the paint routines
manually, delegate that to the actor node. This will help with the
move to ClutterSnapshot.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4160>
2024-12-03 01:17:50 +00:00
Peter Hutterer
327346f9ea clutter/stage: Don't compress motion from two different device tools
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4117>
2024-11-19 19:23:15 +00:00
Peter Hutterer
4de65bd836 clutter/stage: When compressing relative motion, append the axes
When using a tablet tool in relative mode motion compression may
apply. Doing so drops the axes from the event, leading to a segfault
later when we're trying to broadcast_axis() an event without axes.

Fix this by making sure we copy the axes over during motion compression.
All but the wheel are absolute so we can just take them from the new
event but if we do have wheel data add them together and where the wheel
changes direction skip motion compression.

We can take a few shortcuts here because the clutter implementation
guarantees exactly CLUTTER_INPUT_AXIS_LAST axes so we only need to
put in warning checks in case that ever changes.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3766
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4117>
2024-11-19 19:23:15 +00:00
Bilal Elmoussaoui
d92bb351da clutter: Remove duplicated ShaderType
As we have the exact same one in Cogl.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4127>
2024-11-12 10:01:29 +00:00
Bilal Elmoussaoui
1ba28bc6b4 cogl: Get rid of remaining MetaTexture usages
As that pseudo-interface no longer exists since the migration to
GObjectified CoglTexture.
Also moves cogl_meta_texture_foreach_in_region to the correct namespace.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4127>
2024-11-12 10:01:29 +00:00
Bilal Elmoussaoui
c143e8e303 cogl: Move get_rectangle_indices to it correct namespace
Keep the implementation in cogl-indices.c though as it is too much of
implementation details to be in cogl-context.c.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4127>
2024-11-12 10:01:29 +00:00
Bilal Elmoussaoui
45296416df cogl: Move blit_framebuffer to it correct namespace
As it belongs into CoglFramebuffer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4127>
2024-11-12 10:01:29 +00:00
Sebastian Wick
d4fcef04d6 clutter/offscreen-effect: Use better names for the painted PipelineNode
Using the type name makes it easier to spot what's going on with
COGL_DEBUG=show-source.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4037>
2024-11-06 10:51:55 +00:00
Sebastian Wick
4938987d97 clutter/paint-nodes: Avoid useless copying of the LayerNode pipeline
The constructor already copies the pipeline which means we can add a
snippet safely without affecting the parent pipeline, without creating
another copy.

Fixes: 6b07141f1a ("clutter/paint-nodes: Make paint nodes handle color transformations")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4037>
2024-11-06 10:51:55 +00:00
Bilal Elmoussaoui
a5be92e03d Use _once variant of g_[timeout_idle]
Nice helpers that were added in GLib 2.72, so safe to make use of as we
depend on 2.81.1 already.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4115>
2024-11-04 21:18:37 +00:00
Bilal Elmoussaoui
dabc13f7b8 clutter: Stop using get_default_backend helper
As it ends up using the global default context. So just call that
directly to easily spot the remaining usages of get_default_context.

Note that the helper will probably be removed later this cycle once the
remaining usages in meta & libst have been replaced with passing around
the context

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4077>
2024-10-30 08:32:46 +01:00
Bilal Elmoussaoui
696dfaa124 clutter/threads: Remove helper functions
See previous commit

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4077>
2024-10-30 08:32:46 +01:00
Bilal Elmoussaoui
d92893b6f3 clutter/threads: Remove _full functions variant
As they are not used anywhere, in the next commit
we will just remove the whole thing and use glib helpers directly as
there is nothing specific about ClutterThread anymore

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4077>
2024-10-30 08:32:46 +01:00
Bilal Elmoussaoui
40e7998669 clutter/pango: Avoid going through global context
As we have access to the actor context in most of the cases except for
render nodes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4077>
2024-10-30 08:32:46 +01:00
Bilal Elmoussaoui
93a05a0631 clutter/stage-window: Remove functions declarations
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4077>
2024-10-30 08:32:46 +01:00
Bilal Elmoussaoui
a0dc7d9f1c clutter/a11y: Remove unused AtkUtil implementation
Following what GTK 3 does in
https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gtk/a11y/gtkaccessibilityutil.c. It only overrides AtkUtil's vfuncs

In the future, we would very likely switch away from using Atk and
follow the path of GTK 4, but it is still to be decided whether
we want to communicate with the accessibility bus manually or use
something like accesskit

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4077>
2024-10-30 08:32:46 +01:00
Joan Torres
56d5b36b86 clutter/color-state: Fix of indentation and duplicated endline
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4108>
2024-10-25 17:30:23 +02:00
Joan Torres
24712ba3a8 clutter/color-state: Fix threshold on bt709 eotf
It was used the same threshold used at the inv eotf.
Use the right one getting it from the function.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4108>
2024-10-25 17:30:23 +02:00
Daniel van Vugt
817a951b24 clutter/frame-clock: Move "last" frame fields into structs
While in double buffering we only care about one previous presentation,
triple buffering will sometimes need to refer to the presentation from
two dispatches prior. So it might help to separate those frame stats
more clearly. This way each frame's dispatch and presentation times are
stored more cohesively such as to not be overwritten during overlapping
frame lifetimes.

Having two types of frame reference (dispatch and presentation) moving
at difference speeds meant that they could not be stored in a ring. Not
all dispatches become presentations and so storing them in a ring would
necessitate very complex conflict avoidance. Instead, a simple reference
counting model was used.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3961>
2024-10-21 08:47:36 +00:00
Daniel van Vugt
85f0f4e227 clutter/frame-clock: Notify on all empty frames
So that we maintain a perfectly balanced number of callbacks:

  dispatch == notify_ready + notify_presented

Otherwise you can't put any useful logic inside notify_ready and be sure
you're handling all the empty frames.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3961>
2024-10-21 08:47:36 +00:00
Bilal Elmoussaoui
54a7ffea81 clutter/pango: Follow coding style for function declarations
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4004>
2024-10-08 16:00:57 +00:00
Bilal Elmoussaoui
463c36880e clutter/pango: Rename types post merge
The rename didnt happen as part of the merge as various bits were
removed the commits after, reducing the amount of required changes

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4004>
2024-10-08 16:00:57 +00:00
Bilal Elmoussaoui
f60e9e5e0d clutter/pango: Use memory management macros
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4004>
2024-10-08 16:00:57 +00:00
Bilal Elmoussaoui
e0291b4e8f clutter/pango: Don't take a callback for dirty glyphs
As the callback had nothing to do wth the renderer

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4004>
2024-10-08 16:00:57 +00:00
Bilal Elmoussaoui
269c3723be clutter/pango: Simplify show_layout
As it is a private function now, make it take the color & target color
states
De-duplicating the setup function between ClutterText & ClutterTextNode

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4004>
2024-10-08 16:00:57 +00:00
Bilal Elmoussaoui
de7eb11ed8 clutter/pango: Remove no mipmap cache
As it is always disabled, given that nothing can change that externally, remove all of that

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4004>
2024-10-08 16:00:57 +00:00
Bilal Elmoussaoui
d75503d5f6 clutter/context: Free font map
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4004>
2024-10-08 16:00:57 +00:00
Bilal Elmoussaoui
7cae64fccd clutter/pango: Mark helpers as private
As they were public only for clutter to be able to use them
from pango. So simplify that

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4004>
2024-10-08 16:00:57 +00:00
Bilal Elmoussaoui
40dc151e82 clutter/pango: Remove FontMap type
It was created just to keep an instance of the corresponding renderer /
context
Instead, move those fields into ClutterContext.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4004>
2024-10-08 16:00:57 +00:00
Bilal Elmoussaoui
fe3192169a Merge CoglPango inside of Clutter
As that is where the whole text rendering integration happens
And would allow us to get rid of some over-abstraction in cogl-pango,
simplify
ClutterSnapshot integration as well

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4004>
2024-10-08 16:00:57 +00:00
Bilal Elmoussaoui
b6b004b437 cogl/pango: Make FontMap type private
It is an implementation detail, nothing really makes use of any of it
specific APIs

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4004>
2024-10-08 16:00:57 +00:00
Bilal Elmoussaoui
cdc43065e0 cogl/pango: Remove font map helper
It only calls into pangocairo API and only used inside clutter
so just call pangocairo API directly

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4004>
2024-10-08 16:00:57 +00:00
Marco Trevisan (Treviño)
9872512c8a clutter/actor: Use g_set_str to duplicate owned strings
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4071>
2024-10-08 15:35:44 +00:00
Marco Trevisan (Treviño)
5ef581d8bd clutter/actor: Use g_clear_pointer when possible
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4071>
2024-10-08 15:35:44 +00:00
Marco Trevisan (Treviño)
57fb071499 clutter/actor: Avoid double-checking on NULL during free
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4071>
2024-10-08 15:35:44 +00:00
Marco Trevisan (Treviño)
009ca767aa clutter/actor: Use more auto pointers
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4071>
2024-10-08 15:35:44 +00:00
Marco Trevisan (Treviño)
2aac24deac clutter/actor: Steal instead of duplicating the last token value
Instead of duplicating a string we own already we can just steal it from
the array that we're using.

This is safe since we're sure about the tokens GStrv length and we are
always stealing the last element, so there is no risk that g_strfreev
would eventually leak something.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4071>
2024-10-08 15:35:44 +00:00
Marco Trevisan (Treviño)
101126176a clutter/actor: Use autopointer for GStrv everywhere
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4071>
2024-10-08 15:35:44 +00:00
Marco Trevisan (Treviño)
1985d9ccdd clutter/actor: Avoid computing GStrv length for simple checks
No need to do a full iteration of the tokens or doing null-checks here
since g_strsplit() is not nullable, while there's no need to do a full
length check either.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4071>
2024-10-08 15:35:44 +00:00
Christian Hergert
61c722881d clutter: Classify ClutterStageWindow
Previously ClutterStageWindow was an interface with only one base
implementation (MetaStageImpl) which others inherit from.

This just makes it a class so that we can use _GET_CLASS() API instead of
the costly (by comparison) _GET_IFACE() vtable lookups.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4048>
2024-10-07 13:06:26 +00:00
Joan Torres
0ed0367d74 wayland/color-management: Add support for bt.709 TF
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4062>
2024-10-03 11:41:25 +02:00
Joan Torres
f671fea7b9 wayland/color-management: Add support for NTSC primaries
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4062>
2024-10-03 11:41:24 +02:00
Joan Torres
1d4061f21e wayland/color-management: When sending colorspace info send primaries too
clutter_primaries_to_wayland made sense when there only existed
ClutterColorspace. Now that ClutterPrimaries also exist, it makes more
sense to change that func to clutter_colorspace_to_wayland.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4062>
2024-10-03 11:40:51 +02:00
Sebastian Wick
077eb80a8d gir: Correct usage of the closure annotation
Quoting Ebassi https://www.bassi.io/articles/2023/02/20/bindable-api-2023/:

    Whenever you’re describing a function that takes a callback, you
    should always annotate the callback argument with the argument that
    contains the user data using the (closure argument) annotation

    You should not annotate the data argument with a unary (closure).

    The unary (closure) is meant to be used when annotating the callback
    type

Recently gobject-introspection became a bit more strict with this and
that generated some warnings:

    Warning: Cogl: invalid "closure" annotation: only valid on callback
    parameters

This commit fix all the closure annotations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4058>
2024-10-01 15:39:18 +02:00
Joan Torres
36f1a38c3b clutter/color-state: Compare chromaticity with 0.0001f epsilon
This follows the precision used by the color management protocol on
primaries.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4020>
2024-10-01 10:55:02 +00:00
Joan Torres
fcbd2e3840 clutter/color-state: Add support for gamma TF
This TF can't be defined as a TransferFunction enum because it needs a
gamma_exp value too.

Add to EOTFType enum a new type: EOTF_TYPE_GAMMA.

With this new type, now EOTFs are unions that can have either
a TransferFunction enum or a gamma_exp.

Set gamma_exp as uniform.

Add the support of it in the color management protocol.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4020>
2024-10-01 10:55:02 +00:00
Joan Torres
3b53f7cb6c clutter/color-state: Drop using default colorspace and default tf
Use the defaults explicitliy, which is SRGB for both.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4020>
2024-10-01 10:55:02 +00:00