1
0
Fork 0
Commit graph

8421 commits

Author SHA1 Message Date
Bilal Elmoussaoui
764c3ef602 blur-effect: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
2024-01-10 09:28:08 +01:00
Bilal Elmoussaoui
9bd12d7e88 page-turn-effect: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
2024-01-10 09:27:46 +01:00
Bilal Elmoussaoui
581343dc9a deform-effect: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
2024-01-10 09:27:42 +01:00
Bilal Elmoussaoui
accff6b937 shader-effect: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
2024-01-10 09:26:20 +01:00
Bilal Elmoussaoui
7b32f06f44 colorize-effect: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
2024-01-10 09:25:03 +01:00
Bilal Elmoussaoui
99501482df offscreen-effect: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
2024-01-10 09:24:20 +01:00
Bilal Elmoussaoui
0760e90b0d keyframe-transition: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
2024-01-10 09:23:16 +01:00
Bilal Elmoussaoui
6e3223a0cc property-transition: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
2024-01-10 09:22:19 +01:00
Bilal Elmoussaoui
57fbc304f5 swipe-action: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
2024-01-10 09:21:14 +01:00
Bilal Elmoussaoui
1df56ca77a text-buffer: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
2024-01-10 09:21:05 +01:00
Bilal Elmoussaoui
a944889f49 tap-action: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
2024-01-10 09:20:31 +01:00
Bilal Elmoussaoui
64ad3abded rotate-action: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
2024-01-10 09:20:09 +01:00
Bilal Elmoussaoui
aa8ef78b17 pan-action: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
2024-01-10 09:20:07 +01:00
Bilal Elmoussaoui
d79f0ab9f3 snap-constraint: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
2024-01-10 09:19:18 +01:00
Bilal Elmoussaoui
7e7e9795fe bind-constraint: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
2024-01-10 09:19:14 +01:00
Bilal Elmoussaoui
1565756fea align-constraint: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
2024-01-10 09:19:05 +01:00
Bilal Elmoussaoui
ae23caa537 binding-pool: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
2024-01-10 09:18:47 +01:00
Bilal Elmoussaoui
e729e63963 settings: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
2024-01-10 09:18:30 +01:00
Bilal Elmoussaoui
d6b4c3a5d1 canvas: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
2024-01-10 09:18:27 +01:00
Bilal Elmoussaoui
e32268e181 constraint: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
2024-01-10 09:16:52 +01:00
Bilal Elmoussaoui
f96683a89f effect: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
2024-01-10 09:16:14 +01:00
Bilal Elmoussaoui
edfd489732 transition-group: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
2024-01-10 09:15:51 +01:00
Bilal Elmoussaoui
dc0a4c554a transition: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
2024-01-10 09:15:47 +01:00
Bilal Elmoussaoui
e9c1f1c642 timeline: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
2024-01-10 09:11:56 +01:00
Bilal Elmoussaoui
5fb78dfbad zoom-action: Use macros for subclassing boilerplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3387>
2024-01-10 09:11:52 +01:00
Robert Mader
5ffeb34251 build: Enable no-omit-frame-pointer for all non-plain builds
This is useful for local installations with e.g. the `release`
buildtype.
Further more, Fedora has been doing the same system wide and it
apparently was helpful in various ways, see also

Also add -mno-omit-leaf-frame-pointer, like Fedora.

https://blogs.gnome.org/chergert/2023/10/03/what-have-frame-pointers-given-us-anyway/

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3333>
2024-01-09 16:26:57 +00:00
Robert Mader
ee65ca791b build: Harmonize c_args handling
The slightly different styles in the different build files make it
harder to reason about or share c_args.

This notably ensures we never set any extra c_args for plain builds and
fixes the cc.get_supported_arguments() check in Cogl, Clutter and Mtk.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3333>
2024-01-09 16:26:57 +00:00
Bilal Elmoussaoui
aaa63c1e08 clutter: Remove no longer useful since tags
As they represent the pre-merge version of Clutter

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3489>
2024-01-09 15:23:04 +00:00
Bilal Elmoussaoui
346e9a7f2c docs: Remove remaining SECTIONs
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3489>
2024-01-09 15:23:04 +00:00
Bilal Elmoussaoui
00b4d4c4bc docs: Update more links to gi-docgen
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3489>
2024-01-09 15:23:04 +00:00
Bilal Elmoussaoui
e7a920f94d docs: Migrate remaining content to markdown
By stopping using gtk-doc annotations

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3489>
2024-01-09 15:23:04 +00:00
Bilal Elmoussaoui
fb959f3a5d clutter: Remove no longer useful gitignore
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3500>
2024-01-08 19:50:50 +01:00
Bilal Elmoussaoui
6b8c1c430e cleanup: Make clutter includes consistent
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3491>
2024-01-05 14:22:22 +01:00
Bilal Elmoussaoui
0f6df633fe cogl/pango: Drop PANGO_ENABLE_BACKEND usage
Dropped before Pango 1.46 which is the min required version
so the backward compatibility is no longer needed

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3491>
2024-01-05 14:22:22 +01:00
Bilal Elmoussaoui
9d7d25e9ee clutter/stage: Remove no longer used struct
Drops a cairo usage

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3486>
2024-01-04 14:00:26 +00:00
Daniel van Vugt
6db9a0d77e clutter/stage: Fix indentation check-code-style is complaining about
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3487>
2024-01-04 12:26:38 +00:00
Robert Mader
cb794329e7 clutter/stage-view: Remove superfluous return in void function
Fixes: 9d3e4fd402 ("clutter/stage-cogl: Use buffer age when view monitor is rotated")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3473>
2024-01-02 13:54:38 +00:00
Joan Torres
3a94822e75 clutter/actor: Set a minimum guessed scale
When running headlessly it fails guessing the scale to -1.0f making
the assertion g_assert (guessed_scale >= 0.5) fail.

Setting it to 1.f in that case fixes it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3464>
2023-12-22 15:44:37 +00:00
Bilal Elmoussaoui
6daa21c930 clutter: Remove unnused private functions
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3458>
2023-12-19 12:44:35 +00:00
Bilal Elmoussaoui
4d7dfb08c9 cally: Remove useless cally_actor_get_top_level_origin
Does nothing...

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3458>
2023-12-19 12:44:35 +00:00
Sebastian Keller
c86d8a23c3 clutter/actor: Don't write uninitialized out values on failed transform
clutter_actor_get_transformed_position() would write the uninitialized
values of v2 when clutter_actor_apply_transform_to_point() fails in
_clutter_actor_fully_transform_vertices() because the actor has not been
added to the stage yet.

When called from JS this would overwrite the zero initialized values
passed in from gjs. If the uninitialized values now happen to correspond
to one of the NaN float values used by mozjs to represent a pointer
type, this would lead to seemingly random crashes in mozjs code later
on.

Avoid this by using _clutter_actor_fully_transform_vertices() directly,
which allows us to check if it failed.

Related: https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/issues/469
Related: https://gitlab.gnome.org/GNOME/gjs/-/issues/591
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3453>
2023-12-15 15:08:22 +00:00
Daniel van Vugt
85f173d0d7 clutter: Pass 'radius' to public blur APIs instead of 'sigma'
Although they're in the same units, `radius` is easier to understand than
`sigma` and makes the public API independent of the blur algorithm used
behind the scenes. We now only keep the `sigma` terminology where the
implementation is Gaussian-specific.

The assumption that `sigma = radius / 2.0` is actually not new here. We
just move it from `_st_create_shadow_pipeline` (gnome-shell!1905) into
`clutter_blur_new`.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1908>
2023-12-14 18:12:55 +00:00
Bilal Elmoussaoui
90cff013a5 clutter: Remove unused enums
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3437>
2023-12-13 11:20:04 +00:00
Bilal Elmoussaoui
580d62b9b6 clutter: Remove unused Path related types
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3437>
2023-12-13 11:20:04 +00:00
Bilal Elmoussaoui
893e6e49b1 clutter: Drop unused private functions/defines
The commit also stops defining certain functions in a private header
when they are only used in the same file.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3437>
2023-12-13 11:20:04 +00:00
Bilal Elmoussaoui
4b7a29377b clutter: Drop remaining params nick/blurbs
Also the i18n macros from clutter as they are no longer used

Leftover from https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3101

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3437>
2023-12-13 11:20:04 +00:00
Bilal Elmoussaoui
3f09a86e7a clutter: Drop CLUTTER_PARAM_* defines
They are not used every where making the codebase very incosistent
So just drop the current usages

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3437>
2023-12-13 11:20:04 +00:00
Florian Müllner
5291be8f30 clutter/actor: Allow specifying the layout manager for an actor type
Some actors have a well-defined layout manager other than FixedLayout.

If they do, we can handle the layout manager creation at the
ClutterActor instantiation, like GTK does for widget layout managers.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3445>
2023-12-07 18:02:11 +00:00
Ivan Molodetskikh
e63a5369d0 clutter/frame-clock: Add output name to span descriptions
Lets you tell spans for multiple monitors apart in profilers.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3417>
2023-12-06 16:12:58 +00:00
Ivan Molodetskikh
77413ed9a0 clutter/frame-clock: Store output name
Will be used in a subsequent commit for including the output name in
COGL_TRACE plot names.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3417>
2023-12-06 16:12:58 +00:00
Ivan Molodetskikh
39e3415912 clutter/actor: Adjust trace actor name for better filtering
Tracy can filter its statistics by user text, in our case by span
description. It's useful to filter by actor type and name, and not so
much by the pointer. So, remove it, and also reduce the amount of
punctuation.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3417>
2023-12-06 16:12:58 +00:00
Ivan Molodetskikh
b0691d581a clutter/stage: Add trace span to paint_to_framebuffer
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3417>
2023-12-06 16:12:58 +00:00
Ivan Molodetskikh
58ee1dfdc8 clutter/stage-view: Add trace span to before_swap
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3417>
2023-12-06 16:12:58 +00:00
Ivan Molodetskikh
72bbb1416e clutter/timeline: Add trace spans
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3417>
2023-12-06 16:12:57 +00:00
Ivan Molodetskikh
ce836e37e8 clutter: Add trace spans to event handling
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3417>
2023-12-06 16:12:57 +00:00
Sebastian Keller
dfe4d218f1 clutter/actor: Make get_transformed_paint_volume() transfer full
Transfer none was achieved using a stack GArray in the stage which
would get resized to 0 at the end of every frame to "free" it.
In the case of direct scanout however, painting the next frame only
happens after leaving fullscreen again. Until then the array just kept
growing and because GArrays don't reallocate when shrunk, this memory
remained allocated even after leaving fullscreen.

There is no cache benefit from storing paint volumes this way, because
nothing accesses them after their immediate use in the calling code.
Also the reduced overhead from avoiding malloc calls seems negligible as
according to heaptrack this only makes up about 2-3% of the temporary
allocations.

Changing this to transfer full and removing the stack array simplifies
the code and fixes the "leak".

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3191
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3442>
2023-12-06 14:07:39 +00:00
Jonas Ådahl
ae3a20a0a0 clutter/paint-nodes: Use g_clear_object() in a few places
It's possible now that they are GObject's.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3443>
2023-12-06 13:45:03 +00:00
Jonas Ådahl
7152779ae0 clutter/stage-view: Remove unused double buffered shadow fb
It was for a failed expriment that tried to mmap() dmabuf memory and
find damaged regions to decrease the amount that was eventually used to
write to an onscreen, but mmap:ing is only fast enough on intel, and
it's only relevant on various server GPUs. For it to be achievable, we
need to render to system memory in a way that we don't need to copy it
out of OpenGL, but that's currently not possible.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3443>
2023-12-06 13:45:03 +00:00
Jonas Ådahl
d8ff97ebf6 clutter/stage-view: Pass around view when creating shadow fb
Instead of passing around the CoglContext, pass around the view, which
can be used to fetch the CoglContext. We'll use it for more stuff later.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3443>
2023-12-06 13:45:03 +00:00
Jonas Ådahl
b282097834 clutter/stage-view: Rename offscreen pipeline vfunc
It doesn't really "set it up", it just sets the transform according to
the renderer view state. We'll do more setup outside, so lets rename it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3443>
2023-12-06 13:45:03 +00:00
Jonas Ådahl
008f2642ca clutter/enums: Add trailing comma in colorspace enum
Would make it easier would we add more colorspaces later on.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3443>
2023-12-06 13:45:03 +00:00
Sebastian Wick
0f1c5223ff clutter: Add ClutterContext to clutter-types.h
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3443>
2023-12-06 13:45:03 +00:00
Jonas Ådahl
501d19656e context: Make ClutterContext a GObject and move to separate file
This is a step in cleaning up the Clutter context management. By making
it a GObject it's easier to add e.g. properties and features that helps
with introspection.

For now, this means the context creation is changed to go via a
"constructor" (clutter_create_context()). This is so that the global
context singleton can be mantained outsid of ClutterContext, until it
can be removed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2016>
2023-12-05 14:39:25 +00:00
Jonas Ådahl
d96e458d93 clutter: Remove unused sync-to-vblank setter
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2016>
2023-12-05 14:39:25 +00:00
Jonas Ådahl
1209320cd2 clutter/context: Remove left-over locking declarations
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2016>
2023-12-05 14:39:25 +00:00
Jonas Ådahl
f14b5da387 clutter/backend: Remove 'finish_init()' vfunc
The original purpose of being able to report errors is no longer
relevant, since the Clutter backend is now practically a thin wrapper
around the actual backend, which has already dealt with error reporting.
Thus move this to the regular constructor path.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2016>
2023-12-05 14:39:25 +00:00
Jonas Ådahl
579532f644 clutter: Rename ClutterMainContext to ClutterContext
The intention for ClutterContext is to be more or less the MetaContext
or CoglContext equivalent. Lets rename the type so that it becomes more
consistent with the other similar types.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2016>
2023-12-05 14:39:25 +00:00
Ivan Molodetskikh
edbc9a2086 clutter/pick-stack: Add an allocation check to calculate_clear_area ()
We might pick an actor that needs relayout. I've seen this happen inside
hiding / unmapping in particular. In this case, calculate_clear_area ()
will call clutter_actor_get_abs_allocation_vertices () which in turn
will force a relayout. However, this is not what we want, because:

1. We don't want to run layout during picking.
2. If the actor needs an allocation, then the pick stack could not have
   used an up-to-date allocation, because it is not computed. Therefore
   this clear area would use a potentially completely different
   allocation than the one stored in the pick stack.

Thankfully, clear area seems to be used as a cache/optimization, so
let's just avoid computing it if the actor is not allocated.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3425>
2023-12-01 15:36:32 +00:00
Ivan Molodetskikh
2d1fc65b3a Adjust COGL_TRACE names to improve automatic processing
In profilers with a timeline or flame graph views it is a very common
scenario that a span name must be displayed in an area too short to fit
it. In this case, profilers may implement automatic shortening to show
the most important part of the span name in the available area. This
makes it easier to tell what's going on without having to zoom all the
way in.

The current trace span names in Mutter don't really follow any system
and cannot really be shortened automatically.

The Tracy profiler shortens with C++ in mind. Consider an example C++
name:

SomeNamespace::SomeClass::some_method(args)

The method name is the most important part, and the arguments with the
class name will be cut if necessary in the order of importance.

This logic makes sence for other languages too, like Rust. I can see it
being implemented in other profilers like Sysprof, since it's generally
useful.

Hence, this commit adjusts our trace names to look like C++ and arrange
the parts of the name in the respective order of importance.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3402>
2023-11-22 11:46:07 +00:00
Daniel van Vugt
f74fe6bd67 clutter/actor: Handle _clutter_actor_get_debug_name(NULL)
NULL actor pointers seem to arise sometimes in `clutter_stage_update_device`
when using a touchscreen, but that's only fatal with `CLUTTER_DEBUG=event`.
So just handle NULL where it was crashing: `_clutter_actor_get_debug_name`.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3413>
2023-11-21 13:41:24 +00:00
Sebastian Keller
aed55e0808 clutter/input-only-action: Don't override finalize with dispose
This was resulting in the GObject never being properly finalized,
leading to a leak.

Fixes: e917b7de4 ("clutter/stage: Add input-only grabs")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3411>
2023-11-20 12:10:52 +01:00
Carlos Garnacho
5780c10002 clutter: Check source device mode to figure out logical device in events
We look in various ways for the logical device on pointing events, in order
to assign tablet events their own device, detached from the ClutterSeat
pointer.

While this pans out on the native backend, it does not quite match with
X11 behavior where these events do drive the Virtual Core Pointer, this
results in a variety of buglets deriving from this mismatch.

Use the ClutterInputMode instead, to figure out whether the device is
physical and attached to the VCP (The default on X11), or the device is
floating thus should emit events on its own (The new stock behavior on
native backend since the previous commit), and behave accordingly
to what was specified by backend code.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7144
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3114
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3122
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3156
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3393>
2023-11-17 20:49:18 +00:00
Carlos Garnacho
819d62cde2 clutter: Centralize repick handling due to transform changes
Since we just queue up repicks, we can improve the mechanism
added at commit 4d76a21029 this so it's less ad-hoc.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3385>
2023-11-17 20:24:41 +00:00
Carlos Garnacho
9f00572762 clutter: Defer repick on transform changes
Avoid an immediate repick, and queue it instead so it happens
for all devices on the next frame clock step.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3385>
2023-11-17 20:24:41 +00:00
Ivan Molodetskikh
47814fab71 Remove COGL_TRACE_BEGIN in favor of BEGIN_SCOPED
Scoped traces are less error prone, and they can still be ended
prematurely if needed (this commit makes that work). The only case this
doesn't support is starting a trace inside a scope but ending outside,
but this is pretty unusual, plus we have anchored traces for a limited
variation of that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3396>
2023-11-15 13:57:43 +00:00
Bilal Elmoussaoui
371d28a766 cleanup: Stop allowing deprecated Cogl API usage
Allow only specific files to use those deprecated APIs making
it easier to find where deprecated APIs are still in use
and avoid introducing new usages without being noticed

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3400>
2023-11-15 13:13:00 +01:00
Bilal Elmoussaoui
7de0707dfa clutter/cleanup: Stop disabling deprecated API usage warnings
As we have stopped using the deprecated APIs all over clutter, so let us
enforce that newly introduced code doesn't use code that gets depreccated
in the future

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3400>
2023-11-15 13:12:13 +01:00
Bilal Elmoussaoui
f5dac3a5d9 build: One config file to rule them all
Group all the three config files from clutter/cogl/meta into one
and also remove unnused configurations and replace duplicated ones

This also fixes Cogl usage of HAS_X11/HAS_XLIB to match the expected
build options

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3368>
2023-11-15 12:00:19 +00:00
Florian Müllner
dc8de3bfd5 clutter/keyval: Fix keyval_name() transfer annotation
clutter_keyval_name() returns a pointer to a static array, not
newly allocated memory. Add a transfer annotation to indicate
that callers must not free the returned memory.

While add it, make the return value const to stress further that
callers shouldn't touch the returned memory.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3386>
2023-11-14 16:28:09 +00:00
Bilal Elmoussaoui
03235773be clutter/cleanup: Drop PaintNodes serialization
Currently, nothing uses the dumped json of the paint nodes tree. So
let us drop them in a separate commit so it can easily be reverted
if someone ends up wanting to build a tool to consume and inspect
the JSON.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3354>
2023-11-14 16:52:37 +01:00
Bilal Elmoussaoui
306ff81004 clutter: Drop ClutterUnits
As nothing uses it now that ClutterScript was dropped

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3354>
2023-11-14 16:13:19 +01:00
Bilal Elmoussaoui
8a3181f741 clutter: Make json-glib a debug only dependency
Currently, json-glib is used for two things:
- For loading scripts, nothing seems to use that in real life other
than some tests
- For debugging paint nodes

For now, the PR drops the first use case and only require json-glib
if it is a debug build

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3354>
2023-11-14 16:13:18 +01:00
Zander Brown
4bc73ba9f4 clutter/layout-meta: Become one with ClutterChildMeta
Now ClutterContainer is gone there is no reason for this split to exist,
simply merge the two types together

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3384>
2023-11-14 10:27:51 +00:00
Zander Brown
db4bbf6899 clutter/container: Drop ClutterContainer
Finally drop the type itself

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3384>
2023-11-14 10:02:21 +00:00
Zander Brown
c42fa34b01 clutter/actor: Rename ::actor-{added,removed} to ::child-{added,removed}
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3384>
2023-11-14 09:59:52 +00:00
Zander Brown
7113ecd86c clutter/actor: Take responsibility for ::actor-{added,removed}
These signals have de facto been ClutterActor signals for some time now,
simply move them in from ClutterActor

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3384>
2023-11-14 09:57:39 +00:00
Zander Brown
e1cdeb0319 clutter/layout-manager: Consume Actors not Containers
We don't actually need the host to be a container, so simply work on
actors saving us a few casts.

This'll simplify dropping ClutterContainer entirely later, and
StViewport/ShellWindowPreviewLayout will also need to be updated for the
new signatures

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3384>
2023-11-14 09:57:39 +00:00
Zander Brown
d0ebfa792d clutter/bin-layout: We don't need to store the container
We never do anything with it, just let it pass straight to the parent
implementation

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3384>
2023-11-14 09:57:39 +00:00
Florian Müllner
b611569b26 clutter/bin-layout: Remove custom alignment properties
The layout manager takes the generic ClutterActor expand/align
properties into account. Everyone should already use those instead
of the custom layout/child properties, so removing them should have
little fallout, while making for a nice cleanup.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3382>
2023-11-10 00:24:26 +01:00
Zander Brown
84c3a3fbef clutter/script-parser: Drop support for child properties
Which means ClutterContainer is no longer special cased, removing one of
it's final users.

In practice ClutterScript is unused anyway.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3377>
2023-11-09 18:11:00 +00:00
Bilal Elmoussaoui
3184986897 clutter/text: Remove deprecated prop/signal
Shell doesn't use them and they have been deprecated for very long time

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3379>
2023-11-09 16:42:24 +00:00
Bilal Elmoussaoui
2b871765f0 clutter/actor: Remove depreceated macros
Nothing uses them outside of mutter, so hurry up and remove them!

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3379>
2023-11-09 16:42:24 +00:00
Bilal Elmoussaoui
8c4d3d0516 clutter/cleanup: Remove unnused ClutterShader type
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3379>
2023-11-09 16:42:24 +00:00
Bilal Elmoussaoui
81c75b3157 clutter/swipe-action: Remove deprecated swept signal/vfunc
Also update the test to use swipe signal instead. Nothing seems to
use the signal from GNOME Shell side though

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3379>
2023-11-09 16:42:24 +00:00
Bilal Elmoussaoui
d311ff4a67 clutter/docs: Remove no longer existing vfuncs docs
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3379>
2023-11-09 16:42:24 +00:00
Bilal Elmoussaoui
1bb2f5f7b9 clutter: Drop Timeline.new constructor
Nothing uses it nowadays except GNOME Shell for tests but goes through g_object_new so it is fine

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3181>
2023-11-09 15:07:30 +00:00
Bilal Elmoussaoui
6032be04a0 clutter: Drop Event.get_source
It was marked as deprecated for ~5 years and nothing uses it nowadays
so drop it

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3181>
2023-11-09 15:07:30 +00:00
Bilal Elmoussaoui
9374f259a4 clutter: Drop GestureAction.get_threshold_trigger_egde
People should use get_threshold_trigger_edge instead.
Nothing seems to use it so it is safe to drop

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3181>
2023-11-09 15:07:30 +00:00
Zander Brown
9018432b0d clutter/actor: Correct color space accessor annotations
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3375>
2023-11-09 14:45:50 +00:00
Carlos Garnacho
38228da550 clutter: Add ClutterModifierSet argument to key event constructor
This struct contains the pressed/latched/locked set of modifiers applying
to the event, and may be filled in by backends generating those events.
Other places where we forward modified key events, state may be normally
obtained from the original event.

Since this constructor is used in a variety of places, this commit
updates them all in one go.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3369>
2023-11-08 08:07:41 +00:00
Carlos Garnacho
2e897fccd5 clutter: Add clutter_event_get_key_state() getter
This function may be used on key events to obtain the fully
detailed pressed/latched/locked modifiers that apply when the
event is received. No events have this detailed information
yet.

This API call may be compared to the clutter_event_get_state_full()
that existed in the past, although this getter has a stronger
predilection to it applying exclusively to key events.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3369>
2023-11-08 08:07:41 +00:00
Robert Mader
b17246458a clutter/paint-context: Stop copying NULL-regions
Unlike `cairo_region_copy`, `mtk_region_copy()` does not accept NULL
pointers.

Fixes: 655b4a9c75 (Port to MtkRegion)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3361>
2023-11-03 18:09:14 +01:00
Bilal Elmoussaoui
655b4a9c75 Port to MtkRegion
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3292>
2023-11-03 11:27:52 +00:00
Bilal Elmoussaoui
2c4968fb41 cogl: Port Primitive away from CoglObject
- The associated CoglAttribute's are now stored in GPtrArray as suggested
by carlosg in
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193?commit_id=19b619073b3c7d311c64e0a997558f943b38c94a#note_1849281
- cogl_primitive_set_attributes was dropped for "simplicity"
especially that nothing uses it.
- As this is the last remaining CoglObject subclass, the commit also drops
all the CoglObject related macros/types

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
9b9e12edb2 cogl: Port Node/Pipeline/PipelineLayer away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
739c59fefc cogl: Port Buffer* away from CoglObject
Make CoglBuffer an abstract class and inherit the various Cogl*Buffer types from it.
As none of the subclasses is overriding the vtable functions, they were not turned into
vfuncs but plain function pointers in CoglBuffer.
We still use _cogl_buffer_initialize until we port the various params into actual construct-only
properties, similar to the previous commit for CoglTexture.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
863163cc6e cogl: Port Texture* away from CoglObject
- Make Texture a parent GObject class and move the vtable funcs as vfuncs
instead of an interface as we would like to have dispose free the TextureLoader.
- Make the various texture sub-types inherit from it.
- Make all the sub-types constructors return a CoglTexture instead of their respective
specific type. As most of the times, the used functions accept a CoglTexture,
like all the GTK widgets constructors returning GtkWidget.
- Fix up the basics of gi-docgen for all these types.
- Remove CoglPrimitiveTexture as it is useless: It is just a texture underhood.
- Remove CoglMetaTexture: for the exact same reason as above.
- Switch various memory management functions to use g_ variant instead of the cogl_ one

Note we would still want to get rid of the _cogl_texture_init which is something
for the next commit

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
586c43d5a9 clutter/cogl: Use more of memory management helpers
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
75023d96bc cogl: Port Renderer away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
4792db371a cogl/cleanup: Stop using CoglHandle
We use a GParamSpecPointer for CoglPipeline until that
gets ported from CoglObject

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
bbdc0b42fc cogl: Port Program away from CoglObject
This also switches from using CoglHandle to CoglProgram where
appropriate
which allowed dropping a duplicated function that had the wrong
signature...

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
3aaae11d6b cogl: Port Shader away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
c1e6948e42 cogl: Port Bitmap away from CoglObject
We still need to use set_qdata_full as CoglBitmapPixbuf would free
the data itself by unrefing the pixbuf

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
4afc187062 cogl: Port MatrixStack away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
d71fe5c55e cogl: Port OnscreenTemplate away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
df8ae83040 cogl: Port Indices away from CoglObject
Also renames Indices.get_type to Indices.get_indices_type to avoid
a conflict with the generated Object.get_type function

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
f0923aab44 cogl: Port Attribute away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
9d71949b26 cogl: Port SwapChain away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
312d5c367e cogl: Port Snippet away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
0f54700101 cogl: Port Display away from CoglObject
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3193>
2023-10-29 21:16:24 +00:00
Bilal Elmoussaoui
f84e789e4a clutter: Drop LayerNode.new constructor
My motivation was at first to replace cairo_rectangle_t with graphene_rect_t
but noticed nothing uses it anywhere: Shell/Kiosk/Gala; so it is safe
to just drop and people could still use the new_to_framebuffer ctor
and handle setting up things themselves if needed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3240>
2023-10-26 17:31:13 +00:00
Michel Dänzer
4238a4c30b Remove unused _clutter_stage_window_set_title
Never used in mutter AFAICT.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3178>
2023-10-26 09:49:29 +00:00
Michel Dänzer
f128bb4db1 Remove unused _clutter_stage_window_get_wrapper
Unused since 89daa8d4fa ("wayland: drop wayland backend").

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3178>
2023-10-26 09:49:29 +00:00
Michel Dänzer
adb53e5745 Remove unused _clutter_stage_get_default_window
Unused since 28cb025190 ("clutter: Remove DELETE event, signal and vfunc").

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3178>
2023-10-26 09:49:29 +00:00
Michel Dänzer
4263db65e3 Remove unused clutter_set_allowed_drivers
Unused since d1c62d882a ("clutter: Do not read settings from ini file").

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3178>
2023-10-26 09:49:29 +00:00
Michel Dänzer
d2058255b3 Remove unused CBZ_L2T_INTERPOLATION
Never used in mutter AFAICT.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3178>
2023-10-26 09:49:29 +00:00
Michel Dänzer
e00424f4dd Remove unused _clutter_bezier_clone_and_move
Never used in mutter AFAICT.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3178>
2023-10-26 09:49:29 +00:00
Michel Dänzer
f045475b7f Remove unused _clutter_bezier_adjust
Never used in mutter AFAICT.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3178>
2023-10-26 09:49:29 +00:00
Bilal Elmoussaoui
98bd2aa2c2 clutter: Move cairo pixel format to cogl
As Cogl already defines a pixel format enum, it makes sense to move such
endian dependant pixel format there

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3086>
2023-10-25 20:03:08 +00:00
Bilal Elmoussaoui
b65f333483 clutter: Drop cairo_clear helper
It is used once in gnome-shell, so it is better to just move it content
there.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3086>
2023-10-25 20:03:08 +00:00
Bilal Elmoussaoui
c0fdf0a470 clutter: Drop set_source_color helper
The helper doesn't do anything that makes it worth
to be exposed as public API. End-users, such as GNOME Shell could have
an in-tree helper if they end up using it that much.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3086>
2023-10-25 20:03:08 +00:00
Bilal Elmoussaoui
12c85002e9 clutter: Depend on gdk-pixbuf only for tests
As clutter doesn't use any of it APIs by itself

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3097>
2023-10-23 16:32:35 +00:00
Michel Dänzer
8f27ebf87e clutter/frame-clock: Start next update ASAP after idle period
For frame updates in response to sporadic user interaction, this results
in input → output latency somewhere between the minimum possible and the
minimum plus the length of one display refresh cycle (assuming the frame
update can complete within a refresh cycle).

Applying a max_render_time based deadline which corresponds to higher
than the minimum possible latency would result in higher effective
minimum latency for sporadic user interaction.

This was discovered by Ivan Molodetskikh, based on measurements
described in https://mastodon.online/@YaLTeR/110848066454900941 .

v2:
* Set min_render_time_allowed_us = 0 as well, to avoid unthrottled
  frame events. (Robert Mader)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3174>
2023-10-17 19:09:10 +02:00
Michel Dänzer
9f8283a95a clutter/frame-clock: Simplify next_presentation_time_us calculation
When more than one refresh interval has passed since
last_presentation_time_us.

I honestly can't tell if the previous calculation was correct or not,
but I'm confident the new one is, and it's simpler.

v2:
* ASCII art diagram didn't make sense anymore, try to improve
  (Ivan Molodetskikh)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3330>
2023-10-17 17:45:10 +02:00
Ivan Molodetskikh
2ffd1b1663 clutter/stage: Fix trace being non-scoped
While integrating Tracy, gcc caught its variable being unused here.
Bugfixes start flowing even before any actual profiling!

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3313>
2023-10-06 08:38:54 +04:00
Robert Mader
a3b4d2dfc9 clutter/paint-volume: Avoid amplifying small floating-point errors
In order to avoid adding whole pixels to paint boxes in case of small
floating point errors.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3286>
2023-10-03 14:41:26 +00:00
Robert Mader
703bbe0e99 clutter/actor: Cache stage-relative instead of absolute modelviews
The absolute modelview contains OpenGL coordinates, which have a higher
chance to not be invertible or, when doing so, introduce rounding
errors. These again often result in relative transforms becoming 3D
instead of 2D, making us miss optimized code paths down the line.

Thus cache stage-relative matrices instead, improving correctness and
possibly performance.

While on it also add some fast paths for cases where we can skip
calculating inverted matrices altogether and change variable names to be
more precise.

Fixes: dfd58ca8f1 ("clutter/actor: Extend caching in apply_relative_transformation_matrix")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3286>
2023-10-03 14:41:26 +00:00
Pascal Nowack
6a2b9d6d43 clutter/frame-clock: Fix unused variable warning
When CLUTTER_ENABLE_DEBUG is not defined, then CLUTTER_NOTE is defined
as an empty block of code. As a result of that, jitter_us is in that
situation unused, and a compiler warning about this unused variable
appears.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3275>
2023-09-14 12:50:23 +00:00
Robert Mader
dfd58ca8f1 clutter/actor: Extend caching in apply_relative_transformation_matrix
Apart from a few edge cases we can avoid walking the tree and transform
to the ancestor coordinate space by multiplying the actor stage-relative
matrix with the inverse of the ancestor's stage-relative matrix.

Since the stage-relative matrices are cached, this reduces the number of
matrix multiplications we do in many situations considerably.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3259>
2023-09-12 10:16:58 +00:00
Carlos Garnacho
89e11e8335 clutter: Fix source device in crossing ClutterEvents
This used to be the HW device that triggered the crossing (i.e.
the mouse moving the pointer, etc), or the logical device if the
crossing event happened through other means than input device
events, e.g. relayouts.

The move to ClutterEvent constructors went a bit too far in
the simplifications and broke these expectations for input-generated
crossing events.

Make this event constructor behave like the other events: receive
a source device, and figure out the corresponding logical device from
there. Also pass the source device as it'd be expected, in the
input-induced crossing event generation paths.

Fixes: a8c62251f8 ("clutter: Port stage crossing events to new constructors")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2981
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3256>
2023-09-07 17:01:30 +00:00
Carlos Garnacho
4269f85bcc clutter: Add stage method to iterate over active input
The stage has the knowledge about input that is ongoing over it
(incl. things like styli and touchpoints). Add an iterator API
for these devices/touchpoints, so they can be used for calculations
and heuristics in other places of the code.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3059>
2023-09-03 20:59:16 +00:00
Jonas Dreßler
aa6888e6bd clutter/event: Set logical input device for IM events
So far, we expected all events to have input devices set on them, IM events
lost theirs with commit 6aa42d6dad. This somewhat made sense, because IM
events are not backed by any actual device, they are generated by us in
response to eg. an OSK key press.

To fullfil the assumption that all devices at least have a logical input
device set, pass the seat to the clutter_event_im_new() constructor and then
set the device to the logical keyboard device. The source_device we leave
empty, since there is no actual physical device that this event came from.

Fixes: 6aa42d6dad
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3236>
2023-09-03 19:38:07 +00:00
Jonas Dreßler
540cdc0d93 clutter/stage: Don't set implicit_grab_cancelled to TRUE if there are none
The assertion for !implicit_grab_cancelled in the
`grab_actor == old_grab_actor` case of
clutter_stage_notify_grab_on_pointer_entry() is meant to do a simple
sanity-check to ensure the grab machinery is working as intended: During a
seat grab, all input gets delivered to the tree inside the grab, and all
implicit grabs outside of that tree are cancelled.

When a new seat grab on the same actor as the existing one happens, we run
through the cancellation machinery for implicit grabs anyway, so we might as
well check that the assumption mentioned above holds true: By asserting that
no implicit grabs were cancelled, we know that no implicit grabs exist
outside of the existing seat grab tree.

This assertion is slightly over-eager though due to the way we set
implicit_grab_cancelled: We initialize it to TRUE in the
entry->press_count > 0 case and then only set it to FALSE once we find an
implicit grab that may remain active. If there are no implicit grabs though
(while entry->press_count is still >0), we never set implicit_grab_cancelled
to FALSE, triggering the assertion in question even though no implicit grabs
got cancelled.

There's two possible solutions for this: Either dropping the assertion, or
refactoring it so it observes the situation where the implicit grabs were
already undone. This commit implements the latter.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2700

Fixes: debbd88f8c ("clutter/stage: Cancel parts of implicit grabs when ClutterGrabs happen")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3216>
2023-09-03 10:15:46 +00:00
Jonas Dreßler
a243050bab clutter/stage: Fix an indentation mistake
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3216>
2023-09-03 10:15:46 +00:00
Daniel van Vugt
025e5d5327 Remove unused *.pc.in
It seems *.pc are instead now entirely generated from meson.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3226>
2023-08-31 09:47:50 +00:00
Daniel van Vugt
491e2875aa clutter: Mutter-clutter requires mutter-mtk
Because the public headers of the former reference the latter.

Fixes: 765a918a62
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6969
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3225>
2023-08-31 14:20:00 +08:00
Bilal Elmoussaoui
1abef24154 mtk: Move Rectangle.from_graphene_rect from Meta
And drop the clutter helper

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3128>
2023-08-30 16:46:14 +02:00
Bilal Elmoussaoui
152fdc89fc clutter: Drop _clutter_util_rectangle_offset
It is only used once so there is no need to port it to Mtk

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3128>
2023-08-30 16:46:14 +02:00
Bilal Elmoussaoui
a93471eb90 mtk: Move Rectangle.to_graphene_rect from Meta
Also drops the clutter equivalent

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3128>
2023-08-30 16:46:14 +02:00
Bilal Elmoussaoui
565acaed9c mtk: Move Rectangle.intersect from Meta
Also replaces it usage everywhere & remove the Clutter helper. Note the
tests were not moved yet to mtk.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3128>
2023-08-30 16:46:14 +02:00
Bilal Elmoussaoui
6f66dd9944 mtk: Move Rectangle.union from Meta
Similar to Rectangle.equal. The clutter helper was not used.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3128>
2023-08-30 16:46:13 +02:00
Bilal Elmoussaoui
9b2cba4e86 mtk: Move Rectangle.equal from Meta
Moves equal the equal function and removes the clutter equivalent. The
tests were not moved until all the remaining helper functions are moved.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3128>
2023-08-30 16:46:13 +02:00
Bilal Elmoussaoui
c1703337e4 clutter: Remove no longer needed cairo includes
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3128>
2023-08-30 16:46:13 +02:00
Bilal Elmoussaoui
06b5cb0761 clutter: Replace cairo_rectangle_int_t with MtkRectangle
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3128>
2023-08-30 16:46:13 +02:00
Sandro Bonazzola
ff4d87727b Update license access method
Dropped obsolete Free Software Foundation address pointing
to the FSF website instead as suggested by
https://www.gnu.org/licenses/gpl-howto.html
keeping intact the important part of the historical notice
as requested by the license.

Resolving rpmlint reported issue E: incorrect-fsf-address.

Signed-off-by: Sandro Bonazzola <sbonazzo@redhat.com>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3155>
2023-08-30 08:48:23 +02:00
Bilal Elmoussaoui
b004d1c577 cleanup: Drop empty vfuncs overrides
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3209>
2023-08-29 23:38:32 +00:00
Carlos Garnacho
70a987f7e7 clutter: Do not trigger repick during relayout
This is at best pointless, since the relayout will change pointer
picking conditions, and buggy at worst, since the actor being
relayout is not at an state that it can be asked during picking.

This specifically fixes warnings like:

Can't update stage views actor <unnamed>[<Gjs_ui_workspacesView_WorkspacesDisplay>:0x5601dd557050] is on because it needs an allocation.
Can't update stage views actor <unnamed>[<Gjs_ui_workspacesView_WorkspacesView>:0x5601edcf6aa0] is on because it needs an allocation.
Can't update stage views actor <unnamed>[<Gjs_ui_workspace_Workspace>:0x5601ee163dc0] is on because it needs an allocation.
Can't update stage views actor <unnamed>[<Gjs_ui_workspace_WorkspaceBackground>:0x5601ee1c85b0] is on because it needs an allocation.
Can't update stage views actor <unnamed>[<ClutterActor>:0x5601ee4db280] is on because it needs an allocation.
Can't update stage views actor <unnamed>[<Gjs_ui_windowPreview_WindowPreview>:0x5601ee1840c0] is on because it needs an allocation.
Can't update stage views actor <unnamed>[<Gjs_ui_workspace_Workspace>:0x5601ebe1d1b0] is on because it needs an allocation.
Can't update stage views actor <unnamed>[<Gjs_ui_workspace_WorkspaceBackground>:0x5601edbd3420] is on because it needs an allocation.
Can't update stage views actor <unnamed>[<ClutterActor>:0x5601ee3cd630] is on because it needs an allocation.
Can't update stage views actor <unnamed>[<StLabel>:0x5601ee685730] is on because it needs an allocation.
Can't update stage views actor <unnamed>[<ClutterText>:0x5601ed5b5f20] is on because it needs an allocation.

When trying to dismiss the overview with a 3fg touchpad gesture
while the pointer is over a window clone.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6935
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3220>
2023-08-28 20:07:43 +00:00
Jonas Ådahl
b21294dcac clutter/actor: Add cloned/decloned signals
This are called when a clone directly attaches to an actor. While not
reliable to know whether a particular actor is cloned or not, one can at
least this way get notified about whether an actor in particular is
cloned.

This can be useful for e.g. the MetaWindowActor, as it's what's most
likely cloned, e.g. for alt-tab views etc.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3019>
2023-08-24 19:57:57 +00:00
Christian Hergert
150a9e35ad clutter: Add va_marshallers for stage signals
Adds va_marshallers to the ClutterStage signals. This allows for better
stack traces to be retrieved when profiling. Additionally, since the
generic marshaller was using GBoxedCopy/GBoxedFree functions for the
GValue usage, the previous code was acquiring a global reader/writer
lock in GObject via g_boxed_free() usage.

With G_SIGNAL_TYPE_STATIC_SCOPE, the generated marshallers can avoid
the additional copy/free on the instance.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3204>
2023-08-24 16:04:27 +00:00
Carlos Garnacho
7a4c98438a clutter: Ensure pick on CLUTTER_PROXIMITY_IN
Same reasoning holds than with touchpad gesture events in the
previous commit, this will be the first event seen from a specific
device and will require early handling, or crashes may follow.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3198>
2023-08-22 09:15:35 +00:00
Carlos Garnacho
26c2633b2c clutter: Update device on touchpad gesture events
With commit be3bca01a7 in place, we now possibly skip early calls
to clutter_stage_repick_device() happening early during initialization.
These were also indirectly the ones that eventually ended up in
the first call to clutter_stage_pick_and_update_device() actually
initializing the PointerDeviceEntry.

With this no longer happening, we may end up with no PointerDeviceEntry
implicitly set up after initialization, which may fail if the first
event received from the seat pointer does not in fact trigger the
clutter_stage_pick_and_update_device() call necessary to make things
work from there on.

And this does indeed happen on touchpads, since the first input event
obtained after CLUTTER_DEVICE_ADDED is CLUTTER_TOUCHPAD_* instead
of CLUTTER_MOTION. This finds an unset PointerDeviceEntry and crashes
since the pointer device does still have no "presence" on the stage.

Fix this by making CLUTTER_TOUCHPAD_* events also trigger a
device update, so the fist event handled does always trigger the
necessary device update.

Fixes: be3bca01a7 ("clutter: Check that pointer has coordinates prior to repick")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2978
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3198>
2023-08-22 09:15:35 +00:00
Carlos Garnacho
13618014dd clutter: Regain full time precision in input-method generated events
Get the time in microseconds, instead of converting from milliseconds.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3190>
2023-08-21 15:11:15 +00:00
Carlos Garnacho
2e3550320a clutter: Make all events contain int64_t microsecond precision times
Make this something common to all events, as opposed to just some motion
events. The clutter_event_get_time() function now converts to milliseconds
from this data.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3190>
2023-08-21 15:11:15 +00:00
Carlos Garnacho
09ade38002 clutter: Drop ClutterEventPrivate struct
This is no longer necessary to wrap the public event data.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3190>
2023-08-21 15:11:15 +00:00
Carlos Garnacho
5bea0d759f clutter: Move input devices to ClutterAnyEvent
This data is commonplace enough that it makes sense to keep it
as generic event data. Make these fields take a hard refcount, like
the private data used to do, and drop these fields from the
ClutterEventPrivate struct.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3190>
2023-08-21 15:11:15 +00:00
Carlos Garnacho
7d90338d29 clutter: Move tool to specific event structs
Move this field out of ClutterEventPrivate, and into the specific
event structs.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3190>
2023-08-21 15:11:15 +00:00
Carlos Garnacho
c1fc359e76 clutter: Move scroll deltas from ClutterEventPrivate to scroll event
This can now be done without API/ABI concerns.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3190>
2023-08-21 15:11:15 +00:00
Carlos Garnacho
7ab1a7111e clutter: Drop unused ClutterEventPrivate fields
These fields are now unused and may be removed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3190>
2023-08-21 15:11:15 +00:00
Carlos Garnacho
02e90f4358 clutter: Drop _clutter_event_get_platform_data()
This is not ever set, and unused in backends. This may be
safely removed.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3190>
2023-08-21 15:11:15 +00:00
Carlos Garnacho
7f7bcf1f5d clutter: Check ClutterEventFlags under clutter_event_is_pointer_emulated()
This function checks a field that is now never set. Make this function
useful again by checking CLUTTER_EVENT_FLAG_POINTER_EMULATED as these
events are now set.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3190>
2023-08-21 15:11:15 +00:00
Georges Basile Stavracas Neto
fdc3f3fec3 cogl/renderer: Pass pixel format to DMA-BUF constructor
In future commits, we will want to create DMA-BUFs with pixel
formats other than COGL_PIXEL_FORMAT_BGRX_8888. In preparation
for that, let's start passing a new pixel format parameter to
this function, and the corresponding winsys vfunc.

All callers of this function pass COGL_PIXEL_FORMAT_BGRX_8888
for now. Next commits will change that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3175>
2023-08-19 23:00:28 -03:00
Jonas Ådahl
03ee48094e clutter/stage: Add is-grabbed property
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3185>
2023-08-16 15:34:46 +00:00
Carlos Garnacho
be3bca01a7 clutter: Check that pointer has coordinates prior to repick
This might fail during initialization, or after first pointer
interaction on a pointer-less (e.g. touch-only) session.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2964
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3183>
2023-08-15 22:46:08 +00:00
Carlos Garnacho
88af55b857 clutter: Add boolean return value to clutter_stage_get_device_coords()
The device/sequence may not currently have a set of coordinates to return.
We correctly leave the out values uninitialized, but don't tell the upper
layers in any way.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3183>
2023-08-15 22:46:08 +00:00
Bilal Elmoussaoui
cd27cb5c85 cleanup: Fix various typos
Using the typos cli app

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3169>
2023-08-12 20:13:37 +00:00
Bilal Elmoussaoui
f2f9e63568 build/gi: Set header & pkgconfig names
So that the docs generated by gi-docgen contains them

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3087>
2023-08-12 19:34:20 +00:00
Carlos Garnacho
4d76a21029 clutter: Trigger repick on animation-less transform changes
We have a mechanism to trigger repick after animations on
clutter_actor_set_final_state(), but this will not happen if
animations are disabled.

In this case, shell transitions and other typically animatable
changes on the transform of actors will not naturally trigger
a pointer repick when those get instantly changed to the final
state, possibly preserving the cached state and missing the
just popped in actor altogether.

Trigger an instant repick on animation-less transform changes,
so that these situations are also handled correctly, and the
pointer drops the cached state and is able to find the new
actor.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2918
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3168>
2023-08-10 21:18:56 +00:00
Carlos Garnacho
d99407b2e8 clutter: Drop misguided assert
The clutter_seat_handle_event_post() function wants to handle
CLUTTER_DEVICE_ADDED/REMOVED to perform signal emission, but
checks (and asserts) that every event going through it has a
source device.

This is no longer quite true for IM events (they are attached
to the ClutterSeat's keyboard, not a HW device), so the assert
can now fire off (of course undesiredly).

But anyways, for events built through
clutter_event_device_notification_new() (the ones this function
is interested in, after all), it is already a precondition check
that the device is proper at the time of creating the event, so
asserting for it here is redundant.

We can drop this overly generic assert, this is already ensured
for the events that matter, anyways.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3167>
2023-08-09 14:40:58 +02:00
Carlos Garnacho
1d6d8d45d0 clutter: Update ClutterActorClass event vmethods to use ClutterEvent
With the ClutterEvent subtype structs sealed, this remains the only useful
struct type that is now usable on the Javascript side. Make all
ClutterActorClass event vmethods use ClutterEvent, and update all users
to this change.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3163>
2023-08-09 11:53:18 +00:00
Carlos Garnacho
46cb355799 clutter: Make ClutterEvent structs private
All ClutterEvent users have been changed to use getter methods
instead of direct field access. We may now make the ClutterEvent
union/structs entirely opaque by moving the definitions out of
public headers.

All future usage of ClutterEvent data should be done through
getter methods.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
2023-08-08 04:11:13 +02:00
Carlos Garnacho
440c249031 clutter: Use ClutterEvent getter methods
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
2023-08-08 04:02:54 +02:00
Carlos Garnacho
1708becaea cally: Use ClutterEvent getter methods
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
2023-08-08 04:02:54 +02:00
Carlos Garnacho
ded1a9b351 clutter: Use brand new event to contain compressed motion information
Avoid overwriting ClutterEvent fields, and build a new ClutterEvent from
the previous information.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
2023-08-08 04:02:54 +02:00
Carlos Garnacho
9dd2edac18 clutter: Add private call to describe an event
Move the string construction bits in the event logging happening in
MetaSeatImpl to a clutter_event_describe() call, so that it has more
freedom in fiddling with ClutterEvent internals, and may be potentially
reused in other places.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
2023-08-08 04:02:54 +02:00
Carlos Garnacho
97213041e8 clutter: Add getters/arguments for missed ClutterEvent fields
Add methods, and change the API of some rarely used methods, in order
to make all event info currently held/necessary accessible through
ClutterEvent getters, instead of direct field access.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
2023-08-08 04:02:54 +02:00
Carlos Garnacho
fec26f201a clutter: Drop all ClutterEvent setter functions
All events are now created through the dedicated constructors,
thus no post-creation event fiddling should be necessary.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
2023-08-08 04:02:54 +02:00
Carlos Garnacho
322b40ad39 clutter: Drop "state full" event getter and setter
The full decomposed modifier state is pretty much unused, relying
in keymap signals/properties to track latched modifiers state instead.
The events can be simplified without having this information, and if
it were ever needed in the future, it would be nicer that it had a
dedicated struct and didn't increase the number of arguments in
ClutterEvent constructors.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
2023-08-08 04:02:54 +02:00
Carlos Garnacho
b809023f4d clutter: Create full event copy when handling unfiltered IM key events
We need to change at least event flags in the event we reinject after
it was let through by the IM, in order to avoid doubly handling.
Create a full event copy from the original event parameters.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
2023-08-08 04:02:54 +02:00
Carlos Garnacho
c341bf5af9 clutter: Drop ClutterStage field from ClutterEvent
Avoid setting in ClutterEvents the stage they will end up
delivered through. This is now handled explicitly where it
matters.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
2023-08-08 04:02:54 +02:00
Carlos Garnacho
845277f7fb clutter: Make clutter_event_get_source() only about crossing events
Avoid peeking in the stage for loosely related actors, since the same
event could be handled by different actors across the picking stack.

This getter is also unused, so there's wiggle room here for changes.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
2023-08-08 04:02:54 +02:00
Carlos Garnacho
36fda95217 clutter: Get stage in ClutterClickAction through actor
Avoid accessing the event for this information.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
2023-08-08 04:02:54 +02:00
Carlos Garnacho
043ff8f98f cally: Avoid access to stage through ClutterEvent
Pass the stage explicitly, in order to avoid having to peek to it
through the event.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
2023-08-08 04:02:54 +02:00
Carlos Garnacho
a8c62251f8 clutter: Port stage crossing events to new constructors
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
2023-08-08 04:02:54 +02:00
Carlos Garnacho
6aa42d6dad clutter: Port ClutterInputMethod generated events to new constructors
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
2023-08-08 04:02:53 +02:00
Carlos Garnacho
a4639db847 clutter: Add new private set of event constructors
These constructors take all the necessary arguments to build the
event from the get go, so the callers are not left up with the task
of setting up the event struct data.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
2023-08-08 04:02:02 +02:00
Carlos Garnacho
d5938958c0 clutter: Drop ClutterBackend translate_event vmethod
Despite the attempt to make this a generic interface, this was
pretty much used only by the X11 backend, and now it ported away
from it.

This now stands unused and may be removed, in favor of backends
each creating and injecting events as they please.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
2023-08-08 03:59:43 +02:00
Carlos Garnacho
a08eea7f10 backends: Do not use clutter_event_[set|is]_pointer_emulated()
Add a new ClutterEventFlag to propagate this information, affecting
a few selected events on each backend.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
2023-08-08 03:58:42 +02:00
Carlos Garnacho
e648ef7980 clutter: Pass stage to emit_event()
Avoid poking at the event field, and use an explicit parameter.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
2023-08-08 03:58:42 +02:00
Carlos Garnacho
b52aa487c8 clutter: Change _clutter_process_event name/signature
Avoid using the ClutterEvent stage field, and pass the stage
explicitly. Also rename to clutter_stage_process_event(), so that
its ownership/namespace is clearer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
2023-08-08 03:58:42 +02:00
Carlos Garnacho
2e3d55c948 clutter: Change clutter_do_event() name/signature
It is a bit backwards that events contain information about
the stage they are being handled by. It makes more sense to
specify in the ClutterEvent handling entrypoint the stage
that will handle the event.

As a first step, add this ClutterStage argument, even though
the information is still carried through the event in order to
keep satisfying calls to the getter function.

This entrypoint has been also renamed to clutter_stage_handle_event(),
so that its ownership/namespace is clearer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
2023-08-08 03:58:42 +02:00
Bilal Elmoussaoui
a955f0e47c cleanup: Make include macro usages consistent
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3157>
2023-08-07 22:24:36 +00:00
Bilal Elmoussaoui
e0ed157e5d clutter: Remove empty private headers
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3157>
2023-08-07 22:24:36 +00:00
Bilal Elmoussaoui
ead9a3024c cleanup: Switch to pragma once
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3157>
2023-08-07 22:24:36 +00:00
Bilal Elmoussaoui
8008e365b3 clutter: Remove Settings::backend deprecated property
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3103>
2023-08-07 19:30:34 +00:00
Bilal Elmoussaoui
68b4cc661d clutter: Remove deprecated & unnused enums
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3103>
2023-08-07 19:30:34 +00:00
Bilal Elmoussaoui
185058456f clutter: Remove deprecated BoxLayout pack-start property
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3103>
2023-08-07 19:30:34 +00:00
Bilal Elmoussaoui
8d038789f6 clutter: Remove deprecated macros usage
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3103>
2023-08-07 19:30:34 +00:00
Daniel van Vugt
7c0caf5727 clutter/frame-clock: Limit jitter measurements to one frame interval (100%)
Measurements above 100% were originally allowed to show when frame skipping
was occurring so you didn't have to also check the frame rate. But that
also resulted in arbitrarily high jitter values being reported when
returning from idle. And those are frequent enough to look like a bug or
untrustworthy so let's not do that anymore.

Taking the remainder of a high jitter value is still a meaningful jitter
value.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2906
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3123>
2023-07-21 12:32:37 +00:00
Michel Dänzer
9c021b0bc2 clutter/frame-clock: Clamp recorded maxima to refresh interval
clutter_frame_clock_compute_max_render_time_us clamps to the refresh
interval anyway, so the only effect a higher recorded maximum can have
is to delay it falling below the refresh interval again.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3090>
2023-07-20 22:34:58 +00:00
Michel Dänzer
69afa7a142 clutter/frame-clock: Use single pair of maxima for render time estimate
Instead of separate pairs of short- and long-term maxima for each
measured step of the frame update process.

This should result in the render time estimate rising less often:
Previously it did whenever the measurement of any of at least 3 out of
4 steps reached a new maximum, even if that didn't result in a new
maximum for the whole update duration. Now it's only in the latter
case.

This should also result in a lower render time estimate (and thus
input→output latency) in general, since the variability of
measurements for each 3/4 steps doesn't always add up anymore. The flip
side of this is that it might result in missing a display refresh cycle
more often.

v2:
* Fix coding style in maybe_update_longterm_max_duration_us.
  (Robert Mader)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3090>
2023-07-20 22:34:58 +00:00
Bilal Elmoussaoui
b852bbba47 cleanup: Stop translating nick/blurb for pspecs
As those strings are intended to be used by some UI but nothing uses
that in reality except GStreamer.
So drop them similar to what GTK did at
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4717

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3101>
2023-07-19 11:33:59 +00:00
Robert Mader
42336f69cc clutter/backend: Fix core profile description
Cogl actually requests 3.1.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3065>
2023-07-19 10:39:54 +00:00
Jonas Ådahl
f4b76727db stage-view: Add API to inhibit cursor overlay painting
This adds some plumbing to get the "default" paint flags for regular
stage painting, where one either wants to paint the overlay, or not.

If inhibited, the 'no-cursors' paint flag is used, otherwise the 'none'
flag. This will be used to allow having a per stage view hw cursor
state.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
2023-07-17 23:42:38 +02:00
Jonas Ådahl
38d1666049 clutter/event: Set the constrained relative motion too
When a relative pointer motion gets constrained (e.g. a monitor edge or
barrier), save the constrained relative motion delta too.

This will later be used to send the remaining motion delta to input
capture clients.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2628>
2023-07-14 22:23:45 +00:00
Jonas Ådahl
a2bdce2c8e clutter/seat: Add seat name
This is similar to the existing seat-id that is part of MetaSeatNative,
but meant to be passed to created input capture seats.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2628>
2023-07-14 22:23:45 +00:00
Jonas Ådahl
e917b7de43 clutter/stage: Add input-only grabs
An input only grab is a ClutterGrab on the stage that doesn't have an
explicit actor associated with it. This is useful for cases where event
should be captured as if focus was stolen to some mysterious place that
doesn't have anything in the scene graph that represents it.

Internally, it's implemented using a 0x0 sized actor attached directly
to the stage, and a clutter action that consumes the events. An
input-only grab takes a handler, user data and a destroy function for
the user data. These are handed to the ClutterAction, which handles the
actual event handling.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2628>
2023-07-14 22:23:45 +00:00
Jonas Ådahl
b32ee7225d clutter/event: Add clutter_event_get_name()
This is useful for debug logging.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2628>
2023-07-14 22:23:45 +00:00
Daniel van Vugt
2305efa990 clutter/paint-volume: Don't over-enlarge 2D actorless paint volumes
A 2D actorless paint volume can't ever need `enlarge_for_effects` because
it has no depth. Clamping to the pixel boundary is sufficient in this case
and avoids extending volumes on the edge of the view into the next view.
Which then avoids unnecessary secondary monitor updates.

Paint volumes correctly become actorless where `clutter_actor_finish_layout`
calls `_clutter_paint_volume_transform_relative`.

Relates to: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6819

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3112>
2023-07-14 15:04:42 +00:00
Bilal Elmoussaoui
3590640932 clutter: Drop unnused private IDPool APIs
Nothing uses them

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3100>
2023-07-14 13:48:49 +00:00
Florian Müllner
9f46258ff9 clutter/actor: Make sure expand_set flags are set correctly
If an actor's expand properties haven't been set explicitly, its
expand flags are computed by traversing its children.

However we currently also traverse into children when explicitly
setting "expand" to FALSE, because that is the default value and
the properties are only marked as explicitly-set when the value
actually changed.

Fix this, so propagating expand flags can be stopped without
hacks like
```c
  g_object_set (actor, "x-expand", TRUE, NULL);
  g_object_set (actor, "x-expand", FALSE, NULL);
``

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3088>
2023-06-22 21:58:23 +02:00
Dor Askayo
e30eb78891 clutter/frame-clock: Treat GPU rendering duration of 0 as valid
This is expected for the common case of direct scanout of Wayland
buffers where transactions guarantee that all buffer fences are
signalled before a buffer is included in a frame.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3080>
2023-06-20 15:32:25 +00:00
Daniel van Vugt
e7a210d963 clutter/frame-clock: Add dispatch jitter to frame timing measurements
Dispatch jitter is how much the dispatch interval has changed between
frames. It's a measure of sampling smoothness for events that are occurring
at a higher rate than the screen is refreshing:

 * Mouse movement
 * Clients rendering at swap interval zero
 * Keyframe animation position

Zero jitter is ideal but will practically never happen, and a jitter value
of several thousand microseconds will be visible to the naked eye as stutter
even if you're maintaining a perfect frame rate.

To make the numbers easier to interpret we also log the jitter as a
percentage of the refresh interval.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3082>
2023-06-20 10:35:51 +00:00
Daniel van Vugt
be0aa2976e clutter/frame-clock: Avoid rapidly toggling dynamic max render time
This could happen when moving the cursor over GUIs that only redraw
in response to cursor movement. Mutter would experience alternating
cursor-only updates and page flips, and so the `max_render_time_allowed_us`
would jump between pessimised and optimised resulting in inconsistent
frame pacing.

Aside from fixing the smoothness problem this should also provide
lower latency cursor movement.

Fixes: https://launchpad.net/bugs/2023766
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3074>
2023-06-20 09:47:23 +00:00
Carlos Garnacho
c01580cec6 clutter: Remove some unused code
The drag actors were practically unused, and became wholly
unused API with commit eb6e1f694a. There is no provision for
using this in the future, so drop this internal API.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3058>
2023-06-15 16:27:48 +00:00
Carlos Garnacho
7716b62fa2 clutter: Separate ClutterInputFocus event processing and filtering
Currently, we let the same function handle key event filtering as they
are passed to the IM, and the IM events resulting in actions like text
commit or preedit changes.

Split these two aspects into filter/process functions, and port
ClutterText to it. MetaWaylandTextInput still handles everything in
a single place, but that will be split in later commits.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3044>
2023-06-13 14:21:41 +00:00
Jonas Ådahl
49e6ce459c backend: Dispatch initial burst of events synchronously on init
This will consist of device-added events, meaning before init finishes,
we can derive some state that depends on the set of input devices
available on startup, such as cursor visibility.

This avoids cursor visibility switching between hidden and visibility
during startup.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3070>
2023-06-12 18:16:01 +00:00
Jonas Ådahl
060c4c2dfc clutter/seat: Add API to initialize pointer position
This is different from "warping" as it doesn't necessarily result in a
pointer motion event. This can be helpful during initializing so we can
avoid faked pointer events that would otherwise need to be special cased
to not appear as actual pointer movements.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3070>
2023-06-12 18:16:01 +00:00
Robert Mader
c36f3f0101 clutter/actor: Some code-style fixes
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2679>
2023-06-06 11:41:01 +00:00
Jonas Dreßler
b408be0b1e clutter/actor: Return NULL instead of FALSE when type check fails
Fix a small oversight in clutter_actor_peek_stage_views(), it should return
NULL instead of FALSE when the check fails.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2679>
2023-06-06 11:41:01 +00:00
Jonas Dreßler
26344fb533 clutter/actor: Don't store a second stage-views list for the stage
The stage already maintains its own list of stage-views via
clutter_stage_peek_stage_views(), it's a bit superfluous to copy that list
around all the time into priv->stage_views of ClutterActor. Let's deal with
that by returning clutter_stage_peek_stage_views() when
clutter_actor_peek_stage_views() gets called for the stage.

In order to make sure ClutterActor::stage-views-changed still gets emitted
correctly for the stage, always emit that signal on the ClutterStage when
the stage views get invalidated. This now depends on the backend only
actually invalidating the views and calling
clutter_stage_clear_stage_views() when things have actually changed, but
that should be the case.

This needs a change in one of the stage-views tests, namely the one which
tests stage-view-changed emission on the stage: Here we now see an emission
of stage-views-changed, but that signal emission actually seems correct.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2679>
2023-06-06 11:41:01 +00:00
Jonas Dreßler
2ef4960b4f clutter/actor: Cache absolute modelview matrices
While we're now doing a fairly good job at not needing those matrices
all the time anymore, we still need it multiple times during every paint
cycle, so it definitely makes sense to introduce some caching here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2679>
2023-06-06 11:41:01 +00:00
Jonas Dreßler
4579e86330 clutter/actor: Avoid always traversing actor tree on finish_layout
With commit 5a565b4258, we changed
clutter_actor_finish_layout() to be not only about updating stage views,
but also take care of updating the visible_paint_volume, for that we
started doing a full tree traversal of all mapped actors.

This can be quite a performance issue, apparently especially on certain
ARM devices, where the simple tree traversal can take as long as 2ms.
This is precious time we need to paint our next frame, so lets do a bit
more work to avoid those useless traversals.

Fixes https://gitlab.gnome.org/GNOME/mutter/-/issues/2459

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2679>
2023-06-06 11:41:01 +00:00
Jonas Dreßler
261f516af4 clutter/stage: Avoid queueing stage updates when they're already queued
We're using clutter_stage_schedule_update() now from ClutterActor to kick
off the stage updating machinery when a redraw needs to happen.

This introduced a bunch of unnecessary calls to
clutter_stage_schedule_update() and thus
clutter_stage_view_schedule_update() when multiple actors request redraws
during the same stage update cycle, which is a very common case.

Cut off all those unnecessary calls by bailing out in
clutter_stage_schedule_update() when updates are already queued.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2679>
2023-06-06 11:41:00 +00:00
Jonas Dreßler
d2d730ec0b clutter/actor: Use GArray to store redraw clips
Using a list of heap allocated ClutterPaintVolumes adds quite a bit of
unnecessary overhead: It means for every single redraw clip we allocate a
list and a paint volume on the heap.

Let's avoid all those heap allocations by using a GArray with static
ClutterPaintVolumes instead.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2679>
2023-06-06 11:41:00 +00:00
Jonas Dreßler
699e1b305b clutter/actor: Refactor redraw clip to be centered around ClutterActor
So far our logic for queueing redraws goes like this: Actor notices that it
needs to redraw -> actor tells stage that it needs to redraw via
clutter_stage_queue_actor_redraw() -> stage collects more and more redraws
into a QueueRedrawList before the actual stage update happens -> when
that happens, the stage collects the actual redraw clips from the actors via
clutter_actor_get_redraw_clip().

The logic behind this QueueRedrawList was that by storing a list of
redraw entries on the stage, way we can avoid traversing the whole actor
tree one more time to build the redraw clip before the stage update.

These days we have clutter_actor_finish_layout() though, which is basically
exactly that, a whole actor tree traversal that happens before every stage
update.

Since we have that now, we might as well get rid of the whole dance back and
forth between ClutterStage and ClutterActor, and simply merge the logic to
queue redraws into the finish-layout step.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2679>
2023-06-06 11:41:00 +00:00
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
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
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
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
Sebastian Keller
cff631cb39 clutter/text: Don't call clutter_text_set_buffer() on finalize
clutter_text_set_buffer() tries to freeze/thaw notify, which is not
allowed during finalize and recent glib versions started warning about
this. This call can simply be removed, because the buffer is already set
to NULL on dispose, making the call in finalize redundant.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2566
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2790>
2023-01-25 22:10:03 +00:00
Jonas Ådahl
08b0e563d4 clutter: Pass 'ClutterFrame' in all stage update signals
That means before-update, prepare-paint, before-paint, paint-view, after-paint,
after-update. While yet to be used, it will be used as a transient frame
book keeping object, to maintain object and state that is only valid
during a frame dispatch.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2795>
2023-01-23 15:57:50 +01:00
Jonas Ådahl
c54b350313 clutter/frame: Turn into boxed type
This will allow us to pass a ClutterFrame in interfaces, including ones
that end up being introspected.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2795>
2023-01-23 12:19:54 +01:00
Jonas Ådahl
56da8418f9 clutter/frame: Carry target presentation time
This will be used, when available, to both check whether frames missed a
vsync cycle, or to calculate when page flips should be queued.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2795>
2023-01-23 12:19:54 +01:00
Jonas Ådahl
916b21674e clutter/frame-clock: Pass ClutterFrame via the frame clock interface
Let the ClutterFrame live for the whole frame, and be carried as an
argument to the frame clock listener interface functions.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2795>
2023-01-23 12:19:54 +01:00
Jonas Ådahl
1c574068e0 frame-clock: Store interface pointer in variable
It's accessed a few times, so keep it around.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2795>
2023-01-23 12:19:54 +01:00
Niels De Graef
768ec7b0c1 clutter/stage-view: Properly chain up finalize
Fix a silly copy-paste mistake. Since `GObject` is the parent class,
chaining up to `dispose()` from within your `finalize()`
implementation just leads to a little memory leak and nothing worse.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2799>
2023-01-22 18:49:15 +01:00
Carlos Garnacho
9e0b5b1886 clutter: Avoid string translation to find text direction
Use Pango and Harfbuzz for the task, getting the default language,
then its scripts, then their directions. We pick the first valid
horizontal direction, resorting to LTR as a fallback.

Related: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/5385
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2780>
2023-01-13 11:46:13 +00:00
Daniel van Vugt
a09b5ecd7a clutter/frame-clock: Remove extraneous whitespace
It's causing code review warnings whenever another MR tries to change
the same source file.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2784>
2023-01-06 17:27:14 +08:00
Bilal Elmoussaoui
6aeb9eef4e clutter: Add keyval helpers
Infrastructure for adding meta_accelerator_name

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2407>
2022-12-22 15:13:54 +01:00
Bilal Elmoussaoui
8207df77e8 clutter: Generate keynames table
Infrastructure to provide a meta_accelerator_name and
avoid libmutter clients from depending on GTK for that.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2407>
2022-12-22 15:13:54 +01:00