1
0
Fork 0
Commit graph

8395 commits

Author SHA1 Message Date
Bilal Elmoussaoui
cbbf1b7b51 clutter/stage: Set accessible-role at construct time
Allows dropping the initialize override

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3917>
2024-08-07 22:46:16 +00:00
Bilal Elmoussaoui
cc4d72a343 clutter: Remove CloneAccessible
As it only sets the role, which we can set nowadays through a
property in ClutterActor

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3917>
2024-08-07 22:46:16 +00:00
Bilal Elmoussaoui
db05ef9c63 clutter/actor: Move few accessible bits from StWidget
As they are better fit in ClutterActor
The accessible_role is intentionally put in the public fields
as ClutterActorAccessible needs access to that without going
in recursion

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3917>
2024-08-07 22:46:16 +00:00
Bilal Elmoussaoui
f5c2b6949d clutter/actor: Better fallback for has_accessible
Check if the accessible field is set instead of always returning
True

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3917>
2024-08-07 22:46:16 +00:00
Bilal Elmoussaoui
471d8d913e clutter: Rename CallyText to TextAccessible
Moving it to the correct namespace and making it final & private
As there is nothing subclassing it

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3917>
2024-08-07 22:46:16 +00:00
Bilal Elmoussaoui
71f5d30d7f clutter: Rename CallyRoot to StageManagerAccessible
Moving it to the correct namespace and marking it as a private type
as it is not supposed to be replaced externally

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3917>
2024-08-07 22:46:16 +00:00
Bilal Elmoussaoui
3d22e4fe40 clutter: Rename CallyStage to StageAccessible
Moving it to the correct namespace and marking it a final private
type

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3917>
2024-08-07 22:46:16 +00:00
Bilal Elmoussaoui
02c6473175 clutter: Rename CallyClone to CloneAccessible
Moving it to the correct namespace and marking as final

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3917>
2024-08-07 22:46:16 +00:00
Bilal Elmoussaoui
7c5223dfc7 clutter: Rename CallyUtil to ClutterAccessibility
As nothing is supposed to use it oustide of Clutter, make
it private and final

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3917>
2024-08-07 22:46:16 +00:00
Bilal Elmoussaoui
e2e93353d9 clutter: Rename CallyActor to ActorAccessible
Moving it to the correct namespace

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3917>
2024-08-07 22:46:16 +00:00
Bilal Elmoussaoui
43f24b03e5 cally: Merge inside Clutter
Only do the build system bits, we would have to rename
the types and expose at least CallyActor as ClutterActorAccessible

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3917>
2024-08-07 22:46:16 +00:00
Bilal Elmoussaoui
1393140d41 cally: Move init utils to Clutter
The clutter API was calling the cally one anyways

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3917>
2024-08-07 22:46:16 +00:00
Bilal Elmoussaoui
8301272b8e clutter/actor: Add a get_accessible_type vfunc
Allows to avoid using the factories which simplifies the whole thing
and allows external type to create their own accessible types.

Copied from StWidget

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3917>
2024-08-07 22:46:16 +00:00
Bilal Elmoussaoui
1e387e9117 clutter/actor: Cache the accessible object
Helpful for merging Cally inside Clutter, see next commits

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3917>
2024-08-07 22:46:16 +00:00
Bilal Elmoussaoui
d4c73c8341 clutter/stage-manager: Emit accessibility events
Instead of making CallyRoot do that and have to duplicate the list
of stages internally...

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3917>
2024-08-07 22:46:16 +00:00
Bilal Elmoussaoui
135cd40928 clutter/stage: Emit accessibility focus state change
Allows us to get rid of CallyStage trying to track what is already
tracked in ClutterStage and simplify the whole thing

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3917>
2024-08-07 22:46:16 +00:00
Bilal Elmoussaoui
7571ae6f05 clutter/stage: Track is_active
Instead of doing that in both MetaStage & CallyStage.
This allows ClutterStage to also emits the relavant acessibility
bits directly without having a roundtrip through Cally

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3917>
2024-08-07 22:46:16 +00:00
Bilal Elmoussaoui
fb02197b4f cally/actor: Remove no longer useful notify_clutter vfunc
As ClutterText is the only one using that, so move the notify call there

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3917>
2024-08-07 22:46:16 +00:00
Bilal Elmoussaoui
d8fbaf4533 clutter/text: Emit accessibility state changes
Not everything can be easily moved, so only parts of it is done for now

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3917>
2024-08-07 22:46:16 +00:00
Bilal Elmoussaoui
e6a394ca10 clutter/actor: Emit accessibility states changes directly
Instead of making CallyActor listen to notify, adding an extra overhead
Helps with merging Cally inside of Clutter

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3917>
2024-08-07 22:46:16 +00:00
Bilal Elmoussaoui
288ad7206b clutter/actor: Make ActorFlags internal
And only expose a getter/setter for NO_LAYOUT flag
This reduces the possible ways users of the Actor API
can affect the internals and would make next commit
simpler

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3917>
2024-08-07 22:46:16 +00:00
Bilal Elmoussaoui
da2e931355 clutter/backend: Remove get_display vfunc
As there is no separate implementations anymore

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3915>
2024-08-05 15:47:29 +00:00
Bilal Elmoussaoui
b684dc0382 clutter/backend: Provide a default get_display implementation
As there is no on screen template checks done on the x11 backend implementation
so simplify that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3915>
2024-08-05 15:47:29 +00:00
Bilal Elmoussaoui
5277e33d37 cogl: Remove no longer used OnscreenTemplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3915>
2024-08-05 15:47:29 +00:00
Bilal Elmoussaoui
b07c772fc8 cogl: Rename Shader/Program constructors
Otherwise they end up as global functions instead of constructors
of their corresponding types. Helps with better docs

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3910>
2024-08-01 11:06:33 +00:00
Bilal Elmoussaoui
e90d2e845e cogl/glib-source: Remove no longer useful API
It was only useful when Cogl was a separate library

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3910>
2024-08-01 11:06:33 +00:00
Bilal Elmoussaoui
0f405e9270 Rename remaining usages of material to pipeline
material is almost no longer used in the code base and the
few remaining references makes it confusing when looking at parts
of the codebase. So rename the rest as well.

Note that this renames a DeformEffect property and the only extension
making use of it doesn't use the property so i think it is okay to do
so without deprecating the old property for a few releases

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3910>
2024-08-01 11:06:33 +00:00
Bilal Elmoussaoui
5f1ffb5304 cogl: Remove unused Primitive APIs
This also removes a clutter interactive test, but as those
tests don't serve that much any more for being no longer executed..

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3910>
2024-08-01 11:06:33 +00:00
Sebastian Wick
a71166618d clutter/color-state: Create blending ColorState from ColorState
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3905>
2024-07-31 23:36:13 +00:00
Sebastian Wick
6a8701c4db clutter/color-state: Optimize equality by checking pointer equality
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3905>
2024-07-31 23:36:13 +00:00
Sebastian Wick
2693cac83a clutter/color-manager: Add a method to get the default color state
This avoids re-creating new color states objects to the default state.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3897>
2024-07-24 21:33:30 +00:00
Sebastian Wick
b1370a483e clutter/color-state: Add a way to query if fp16 is needed for storage
Some color states, currently only the ones with linear transfer
characteristics, need at least half float formats for storing components
of that color state.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3897>
2024-07-24 21:33:30 +00:00
Sebastian Wick
6a2ce066b0 clutter/color-state: Add a helper to print the color state
And use it in MetaRendererNative.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3897>
2024-07-24 21:33:30 +00:00
Sebastian Wick
58cb44186d clutter/color-state: Adds an ID to ColorStates
The ID is required for the wayland protocol. In the future we might want
to spend a bit more effort to re-use existing color states when a new
one is requested and also try to re-use IDs instead of just counting up.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3897>
2024-07-24 21:33:30 +00:00
Sebastian Wick
75baecb3d9 clutter/pipeline-cache: Unify color state transform key hashing
This us re-using the hashing of color state transforms which is used for
the snippet cache.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3897>
2024-07-24 21:33:30 +00:00
Jonas Ådahl
1223f8df68 clutter/pipeline-cache: Return a copy of the pipeline
This means the pipeline can be manipulated after retrieving. This also
fixes a leak when adding pipelines to the cache, as we the pipeline
would take a ref, but when adding, we wouldn't clean up our own ref.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3897>
2024-07-24 21:33:30 +00:00
Jonas Ådahl
3359b67686 clutter/color-state: Handle adding snippet to pipeline
While no functional changes right now, this allows us to add extra hooks
like adding uniforms.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3897>
2024-07-24 21:33:30 +00:00
Jonas Ådahl
045f114fbe clutter/color-state: Move snippet cache to color manager
This gets rid of the GQuark and g_object_get_qdata() lookups.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3897>
2024-07-24 21:33:30 +00:00
Jonas Ådahl
cd2bf776b1 clutter: Add color manager type
This type is intended to carry color related state that is "global",
without having to add more and more things to ClutterContext.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3897>
2024-07-24 21:33:30 +00:00
Daniel van Vugt
55209cfb13 clutter/deform-effect: Hide G_STATIC_ASSERT from the g-ir-scanner
According to gmacros.h, G_STATIC_ASSERT is undefined for __GI_SCANNER__
because it causes confusion. Which is understandable, and so is the
complaint about the lingering G_STATIC_ASSERT after preprocessing.

This problem seems to be unique to just clutter-deform-effect.h because
it's the only header file containing a top-level G_STATIC_ASSERT. The
rest are all in C files.

Fixes: 138e5d4f54
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3591
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3898>
2024-07-23 14:08:52 +08:00
Bilal Elmoussaoui
138e5d4f54 cogl: Move TextureVertex to Clutter
The type is only used in ClutterDeformEffect, so move it there

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3895>
2024-07-22 17:36:10 +02:00
Bilal Elmoussaoui
f5c376e860 cogl: Move PrimitiveTexture functions to Texture
Since the move to GObject for CoglTexture, CoglPrimitiveTexture was
removed. So drop remaining of that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3885>
2024-07-15 21:42:38 +02:00
Sebastian Keller
2ae3012fd5 clutter/paint-nodes: Don't leak CoglColor on paint node creation
The pointer returned by cogl_color_copy() was not stored anywhere and
the allocation it was pointing to got leaked. However we also don't need
to use that function here and can just copy the struct values directly.

Fixes: dc52ccc75 ("cleanup: Port from ClutterColor to CoglColor")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3884>
2024-07-15 18:50:02 +02:00
Bilal Elmoussaoui
54748b7f1f cogl: Call init when creating a context from Clutter
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3857>
2024-07-15 14:39:23 +00:00
Bilal Elmoussaoui
24f46448ce cogl/pango: Take a context as a param when constructing a font map
Avoids using the get_context macro

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3857>
2024-07-15 14:39:23 +00:00
Jonas Ådahl
2a6e8f7188 clutter/stage-view: Add API to get output color state
Will be used for direct transforms from source to output color state.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:56:07 +02:00
Jonas Ådahl
20c7653d49 compositor-view/native: Don't scan out surface with color state mismatch
If the color state of a surface doesn't match the output, don't try to
scan it out, as it needs to pass through color state transformations to
look correct.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:56:07 +02:00
Jonas Ådahl
6b07141f1a clutter/paint-nodes: Make paint nodes handle color transformations
Either handle them directly, or when using the pipeline paint node, add
them on-demand if the color transformation capability isn't already set
by something else.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:56:07 +02:00
Jonas Ådahl
9b34aac441 clutter/text: Handle color state transformations
This uses the color state tracking in the paint context to add color
state transformations to the ClutterText actor.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:56:07 +02:00
Jonas Ådahl
2d48ca8aa1 clutter/paint-nodes: Copy instead of ref passed pipelines
A ClutterPipelineNode took a reference to the passed pipeline and used
it during the lifetime of the paint node. In theory this meant that a
paint node pipeline could be changed, and reused, affecting the previous
paint node drawing.

Referencing instead of copying also meant the ClutterPipelineNode isn't
able to itself manipulate the pipeline any further.

Fix both of these issues by copying, instead of adding a reference to,
the passed pipeline. While resulting in some additional allocation
over head, it means we can now eventually handle color transformations
automatically for ClutterPipelineNode's.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:56:07 +02:00
Jonas Ådahl
a1163385db paint-nodes: Sanity check color transform in blit nodes
Blitting cannot run with a shader, thus cannot do color state
transformations, so log a warning when that happens.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:56:07 +02:00
Jonas Ådahl
9a0fbbfa81 cogl/pango: Add argument to supply extra snippet
This will be applied to the pipeline used for drawing, and can be used
to include color state transformation snippets.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:56:07 +02:00
Jonas Ådahl
aaba08e5aa Set names of various Cogl pipelines
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:56:07 +02:00
Jonas Ådahl
0c653b4cf2 clutter/actor: Pass paint context in paint_node()
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:56:07 +02:00
Jonas Ådahl
15df584b7e clutter: Add color state pipeline capability enum
So far 'color-state' is added, intended to tag pipelines with color
state transformation capabilities. Color state transformation snippets
are tagged with it. Eventually handlers of pipelines will use this
information to on-demand decorate pipelines with color transformation
snippets.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:56:07 +02:00
Jonas Ådahl
4238512764 clutter: Introduce color transform aware pipeline cache
Color aware rendering needs shaders / pipelines that adapt to what
output they render to. For example if we want to render to a linear
BT.2020 intermediate framebuffer on one monitor, and a non-linear sRGB
direct target buffer on another, the shader for the same paint node or
content will depend on where they are going to be presented.

In order to help keeping track of what shader should target what
monitor, without having to regenerate them each time, introduce a
pipeline cache that knows how to handle differentiating between
transforming between different color state.

The cache is meant to handle caches for multiple pipeline users, where
each user might potentially want to keep track of multiple pipelines
itself. Lookup should be O(1), and in order to achieve this, separate
the cache into 3 levels.

The first level is the "pipeline group", where e.g. a ClutterContent
type allocates a group where it can store its pipelines. Each group has
a fixed number of "slots" where it can store a pipeline. Each slot has a
hash table where the key is derived from a color state transform, and
where the value is a CoglPipeline where the thame color state
transformation is expected to be handled.

A content will when painting know about its own color state, and the
target state it should render into, retrieve a cached pipeline for the
correct transform, or if the cache didn't have it, generate it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:56:06 +02:00
Jonas Ådahl
0c2fa8e9a8 clutter/stage-view: Add linear intermediate color space buffer
Allow compositing in a linear color space and do so either when forcing
it via the debug controls D-Bus API, or when the experimental HDR mode
is enabled.

This relies on paint nodes etc to actually transform everything into the
linear target color space, which isn't done yet, so enabling it right
now will cause a broken result. Yet, introduce this now, so that
painting can be fixed piece by piece.

Linear blending is automatically enabled on monitors where HDR is
enabled, as this makes it possible to use an linear color space when
blending content from different color spaces with different transfer
functions.

Linear blending requires extra precision, i.e. 16 bit per channel
in the intermediate buffer due how the values are distributed,
so only enable the experimental HDR mode if the Cogl context supports
half float formats.

By default, no intermadiate linear offscreen framebuffer is used.

To test, do e.g.

  ./tools/debug-control.py --toggle ForceLinearBlending

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:55:54 +02:00
Jonas Ådahl
b275af95b7 clutter/paint-context: Add content and target color state tracking
The initial target color state is the color state of the stage view
being painted to. If we're painting to an arbitrary framebuffer, it's
currently hard coded to sRGB/electrical.

The content color state is not set on construction, but when starting to
paint, it's set to the color state of the stage itself. Whenever an
actor is painted, it'll set the color state to the color state of
itself. The intention is that offscreen rendering pushes a target color
state that causes painting to it to not necessarily be in the stage view
color state.

Pass color state with offscreen framebuffer, as this avoids hard coding
sRGB in the lower level bits of paint contexts. It's still practically
hard coded, only that it's derived from somewhere else (e.g. the stage
or window actor).

Nothing is actually using this yet, but will eventually.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:51:30 +02:00
Jonas Ådahl
1a52108c17 clutter/stage-view: Add API to get view color state
This aims to provide the color state used for compositing for a specific
view. It's currently hard coded to default, but will eventually be
configured depending on the monitor and configuration. It's intended to
be used as a target color state for rendering with color awareness.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:51:17 +02:00
Jonas Ådahl
2bd8216eb1 clutter/color-state: Cache snippets
The cogl shader cache uses snippet pointers as cache keys, meaning even
if we generate two identical snippets; if they have different pointer
addresses, they'll generate separate cache entries. Handle this by
caching our snippets on the context.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:00:58 +02:00
Jonas Ådahl
d7bbc9712f clutter/color-state: Pass the ClutterContext when constructing
This will be used to cache pipeline snippets shared by multiple color
states.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:00:58 +02:00
Jonas Ådahl
4a07242fed clutter/color-state: Add color state transform helper
This helper generates shader snippets that converts pixels from one
color state to another. For example if there is content with sRGB color
state that should be converted to linear BT.2020 before being written to
the framebuffer, a shader that makes the pixel go through the following
steps will be generated:

 1. sRGB EOTF
 2. Luminance gain (hard coded for now)
 3. Color space mapping

The intention is that it should be possible to composite in a linear
color space, into an intermediate framebuffer, which is then passed
through an inverse EOTF to produce linear content in the output color
state.

When transforming from BT.2020/PQ to sRGB/sRGB, clamping to the sRGB
max luminance is done.

Cases where direct transform is also handled, i.e. where one doesn't go
via an linear intermediate buffer, in which case there might be both an
EOTF and an inverted EOTF in the same shader snippet to still do color
space mapping using optical color encoding. This will be used for e.g.
transforming cursor sprites.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:00:58 +02:00
Jonas Ådahl
8b425f4e85 clutter/actor: Make unsetting color state an explicit function
It makes things easier and more straight forward to handle.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:00:58 +02:00
Jonas Ådahl
af71749e75 clutter/color-state: Add transfer function
Another enum, defining SRGB gamma transfer function, and the PQ transfer
function. As with color spaces, add a 'default' that for now is treated
as if it was sRGB.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:00:58 +02:00
Jonas Ådahl
b74515b8cf clutter/actor: Default to 'default' color space
Do this so one can distinguish between "unspecified" and explicitly
sRGB.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:00:58 +02:00
Jonas Ådahl
9adbaa05b3 clutter/enums: Removing trailing whitespace
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:00:58 +02:00
Jonas Ådahl
563fff9c9c colorspace: Rename 'unknown' to 'default'
An unknown color space isn't very useful to have, as there is not very
actionable what to do with it. Rename it to 'default'. Later it'll be
used to an implicit color space, which in practice will be treated as
sRGB.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:00:58 +02:00
Jonas Ådahl
2ae5af62ea clutter/stage-view: Make shadow fbs use the onscreen pixel format
We'd use the "default" format otherwise; once the onscreen gets
something other than the hard coded format, we'll want to make sure we
use the same here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:00:58 +02:00
Jonas Ådahl
42d4287f20 clutter/actor: Make actors have a context
The context can be set via a property (currently unused) or via the
current global singleton as a fallback. It means API that acts on an
actor can avoid going via any globals.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:00:58 +02:00
Jonas Ådahl
2e02078638 clutter/actor: Fix indentation of color state getter/setter
They were different from all the other ones around it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
2024-07-09 18:00:58 +02:00
Bilal Elmoussaoui
a172c0f0dd clutter: Remove uneeded dependencies
Clutter doesn't interact with x11/wayland/libwacom directly

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3853>
2024-06-30 15:09:00 +02:00
Carlos Garnacho
01444e803f clutter: Specify that input-only grabs are started inactive in API
Add the _inactive suffix, so that the state of these objects is clear.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3747>
2024-06-28 22:49:45 +00:00
Carlos Garnacho
8e5f3a1f83 clutter: Add API to create inactive ClutterGrabs, and activate them explicitly
This gives greater control to the callers on the place where a grab is being
activated, this may make a difference in the handling of crossing events
triggered through it, e.g. by having callers rely on having already obtained
a ClutterGrab prior to handling the resulting effects.

The "input only" grab has also been turned inactive by default, in order to
to have the ClutterGrab pointer available for checks at the MetaWaylandEventHandler
focus changing methods triggered through grab activation.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3463
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3747>
2024-06-28 22:49:45 +00:00
Shiki Okasaka
4b1411696e clutter: Use character offsets for specifying the surrounding text
clutter_input_focus_set_surrounding() expects cursor and anchor positions
to be provided in character offsets.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3440
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3719>
2024-06-28 19:25:48 +00:00
Jonas Ådahl
422ee4515d Compile with -Wfloat-conversion
This means we'll get warnings whenever a floating point value looses
precision, e.g. gets implicitly casted to an integer. It also warns when
implicitly casting double's to float's, which arguably is less of a
problem, but there are no warning for just float/double to int.

This would have caught
https://gitlab.gnome.org/GNOME/mutter/-/issues/3530.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3822>
2024-06-25 20:48:24 +02:00
Jonas Ådahl
d5bc883712 clutter/paint-nodes: Remove radius field from blur node
It wasn't used.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3822>
2024-06-25 20:45:27 +02:00
Bilal Elmoussaoui
cb4b31f858 clutter: Don't generate unused keys_by_name table
Spotted by codeql

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3837>
2024-06-22 23:53:49 +00:00
Bilal Elmoussaoui
43dabfc8d1 clutter: Remove unused static function
Detected through codeql

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3837>
2024-06-22 23:53:49 +00:00
Georges Basile Stavracas Neto
5cfbe2528c clutter/cally-actor: Ensure accessible lives long enough
Inside the "if (clutter_actor_has_accessible (actor))" condition,
the 'atk_child' variable is set and a signal is emitted on it.
There is a classic ref/unref dance around the signal to guarantee
that 'atk_child' won't be destroyed.

However, this ref/unref dance doesn't work, because the unref is
done *before* the 'atk_child' variable is used again. So if this
was the last reference to it, it would have been destroyed in the
unref call, then used for another signal emission a few lines down.

That's a use-after-free.

Fix that by declaring the 'atk_child' variable with g_autoptr. This
delays the unref until the very end of the function, and is NULL safe.
Also add a sneaky assertion, just for extra safety.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3828>
2024-06-21 14:40:47 +00:00
Bilal Elmoussaoui
23a4261736 cally: Remove Actor.[add|remove]_actor vfuncs
They were not doing anything special other than forwarding the calls.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3814>
2024-06-18 15:59:09 +02:00
Bilal Elmoussaoui
03032805a6 cally: Move AtkAction from Actor to Text
Currently AtkActor iface is implemented by CallyActor as well
as a ton of infrastructure just for one action in ClutterText, the
activate action.

Instead, simplify the whole thing and move the AtkAction implementation
where it supposed to be.

This refactoring would help with merging Cally within Clutter in
the future

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3814>
2024-06-18 15:50:34 +02:00
Bilal Elmoussaoui
730783b670 clutter: Remove Color type
As it is no longer used now

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3544>
2024-06-13 15:25:40 +02:00
Bilal Elmoussaoui
531072d482 clutter: Implement interval progress for CoglColor
For that, rename clutter-graphene and use that C file to define all the
progress functions

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3544>
2024-06-13 15:25:40 +02:00
Bilal Elmoussaoui
dc52ccc75a cleanup: Port from ClutterColor to CoglColor
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3544>
2024-06-13 14:45:53 +02:00
Bilal Elmoussaoui
408cb6ee57 clutter: Drop Color.to_pixel
Keep the function around as Color.hash

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3802>
2024-06-12 16:25:18 +00:00
Bilal Elmoussaoui
74ece2ad92 clutter: Drop various Color constructors
The fields are writable, there is no need to provide a custom constructor.
This shapes the Color API to be similar to GdkRGBA

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3802>
2024-06-12 16:25:18 +00:00
Bilal Elmoussaoui
04842393aa clutter: Drop Color.from_pixel
Goes along with https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3367
Helps https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3544

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3802>
2024-06-12 16:25:18 +00:00
Jonas Ådahl
f19f8fcb16 clutter/frame-clock: Only update immediately after idle if vsynced
If the presentation time isn't known, e.g. if the monitor is virtual and
the actual presentation happens far away, the presentation time we
actually received tends to be the time a frame was presented to the next
layer, meaning practically immediately after painting.

When scheduling another update after that, don't assume that if the next
calculated update is not the immediate next update, schedule an update
sooner, as that will in such cases always be true, meaning we ended up
busy looping with constant frame updates being scheduled.

Fix this by only triggering that logic if the last presentation time was
actually vsync:ed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3803>
2024-06-12 15:11:04 +00:00
Bilal Elmoussaoui
27ecc9d1cd clutter/color: Stop falling back to PangoColor for X11 colors
As we don't really make use of that feature anyways. The
ClutterColor.from_string API is used by gnome-shell to retrieve the
following settings: cross-hairs-color, primary-color, secondary-color
which are always set in their hex representationby gnome-control-center.

Helps https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3544

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3796>
2024-06-12 14:32:14 +00:00
Marco Trevisan (Treviño)
44c0c311ba clutter/clone: Do not use global transformation for scaling clones
When cloning an actor we were applying a global scale to it, based on
the size of the clone itself and of the cloned actor.

This implied that the transformed size of the clone was not the one that
was set, but it was taking taking in account the actor scaling too.
So in practice we were scaling it twice.

While this had no visual implications it indeed was causing troubles
when a ClutterClone was reactive because in such case only the scaled
area of the scaled clone was considered reactive.

Assume you had an actor of 100x100 pixels, scaling it to a clone of
50x50 pixels:
 - The scale applied to the clone was 0.5
 - The transformed size of the clone was: 25x25 pixels
 - The clone was reactive only in that sub-area

To avoid this, never touch the clone transformation matrix, but only
transform it at paint time.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2959>
2024-06-01 11:11:32 +02:00
Bilal Elmoussaoui
6fbf5f0888 clutter: Drop unused const
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3762>
2024-05-21 09:38:35 +00:00
Georges Basile Stavracas Neto
638d3355b4 cogl: Drop CoglSwapChain
CoglSwapChain is currently unused, and doesn't hold any information
nor is used for anything in particular.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3759>
2024-05-20 11:45:31 +00:00
Corentin Noël
0ab5ff6eed clutter/transition: Do not call methods of a NULL ClutterAnimatable
Only call clutter_animatable_get_actor on a non-null object, otherwise set
the timeline actor to NULL directly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3750>
2024-05-16 08:00:23 +00:00
Carlos Garnacho
c087d9b746 clutter: Make low-level picking function private to ClutterStage
It's now only called within it, inside other higher-level accessors
to update picking based on actor/view/event changes. This can now be
made a private call.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3696>
2024-04-17 14:28:14 +00:00
Carlos Garnacho
4ab868154f clutter: Update all devices in a view in ClutterStage code
Avoid open-coding the process of figuring out the affected devices
on view changes and repick on those, in exchange for a ClutterStage
method to do this altogether.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3696>
2024-04-17 14:28:14 +00:00
Carlos Garnacho
5220bc61b4 clutter: Add ClutterStage function to repick from event
Instead of doing that in clutter-main.c code, move it together
with the rest of picking calls to ClutterStage.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3696>
2024-04-17 14:28:14 +00:00
Carlos Garnacho
22d0ff569a clutter: Drop clutter-wide clutter_stage_repick_device()
This is only called from a single place inside ClutterStage code,
drop this public internal function, and repick in place.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3696>
2024-04-17 14:28:14 +00:00
Jonas Dreßler
64a1da9363 clutter/input-method: Check for equality before notifying properties
ClutterInputMethods content hint or purpose will be set again (even to the
same values) whenever a wayland client sends us a new content type/purpose.
Gtk appears to always set a content purpose on wl_text_input changes, so we
currently set and notify the "content-purpose" property on every change in a
gtk text field.

Since the OSK is gnome-shell listens to this property and re-generates its
entire layout when the content-purpose prop gets notified, this is currently
causing lag/freezes on every keypress in the OSK in gnome-shell.

So ensure to not notify these properties in case they're equal and set the
properties in the same way as we usually set them instead of going via
GObject.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3645>
2024-03-16 12:32:49 +01:00
Jonas Dreßler
6612c4fe41 clutter/gesture: Allow only a single gesture to recognize globally
Gestures are independent from each other when they are on different
actors and when they don't have a conflict over input with each other: For
example a gesture on one window and a gesture on another window will
recognize at the same time perfectly fine right now.

For those gestures (let's call them "independent gestures") we don't want
to control how the conflicting input should be handled, i.e. whether one
gesture wins over another or whether both can be recognizing using the
same touchpoint (e.g. zoom+rotate on the same actor). Instead we want
to control whether they are allowed to start while another one is running.

For now, make it impossible for two gestures to recognize globally at
the same time in all cases. This helps prevent subtle bugs and makes life
easier for users of the API. We can introduce API for fine grained control
over the behavior later.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2389>
2024-03-15 00:08:02 +01:00
Jonas Dreßler
6f84fb0a24 clutter/stage: Store a list of all active gestures on the whole stage
With the next commit, we'll need a list of all gestures that currently are
active globally. Since actors and actions (and therefore also gestures) in
Clutter are bound to a stage, it makes sense for this list to exist on the
ClutterStage level.

The list itself is a simple GPtrArray (to allow for quick searches) that
doesn't reference the gestures and is not manipulated by the stage itself.
All manipulation of the array is left to ClutterGestures.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2389>
2024-03-15 00:08:02 +01:00