Commit Graph

8176 Commits

Author SHA1 Message Date
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
Bilal Elmoussaoui
c710f14cc5 core: Replace gtk_get_default_locale usage
Clutter has an API to get the text direction but used to depend
on gtk3's translation domain. In order to avoid broken i18n
in case gtk3 is not installed, move the transtalable string to
clutter itself.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2407>
2022-12-22 15:13:54 +01:00
Michel Dänzer
a16df485db clutter: Reduce default clutter_max_render_time_constant_us to 1000
Now that dynamic max render time uses a new algorithm and takes dispatch
lateness into account, this seems worth a shot. We'll see how it works
out in the wild.

The net result compared to before these changes is still slightly higher
(by ~0.5 ms) minimum latency for me, as measured by
weston-presentation-shm. It should be less vulnerable to frame drops
though.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2500>
2022-12-17 23:45:19 +00:00
Michel Dänzer
ca341ef1ea frame-clock: Simplify dynamic max render time calculation
Store only two values per kind of duration: The short term and long term
maximum.

The short term maximum is updated in each frame clock dispatch. The long
term maximum is updated at most once per second: If the short term
maximum is higher, the long term maximum is updated to match it.
Otherwise, a fraction of the delta between the two maxima is subtracted
from the long term maximum.

Compared to the previous algorithm:

* The calculcations are simpler.
* The calculated max render time has a slow exponential drop-off (by at
  most a few milliseconds every second) instead of potentially abruptly
  dropping after as few as 16 frames.

This should fix https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4830
since the short term maximum should always include a sample from the
clock's second tick.

v2:
* Use divisor 2 instead of 4.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2500>
2022-12-17 23:45:19 +00:00
Michel Dänzer
99850f4645 clutter/frame-clock: Use dispatch lateness for dynamic max render time
Dispatch lateness is the difference between when we wanted frame clock
dispatch to run and when it actually started running. This can be up to
1ms even under normal circumstances due to process scheduling
granularity, or even higher under load.

This keeps track of dispatch lateness of the last 16 frame clock
dispatches, and incorporates the maximum into the dynamic render time
estimate.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2500>
2022-12-17 23:45:19 +00:00
Jonas Ådahl
71371750d2 clutter/input-device: Remove backend property
It will conflict with a MetaInputDevice property that'll have the same
name.

Wasn't set by the native backend anyway, so probably harmless.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
2022-12-17 13:52:51 +00:00
Robert Mader
cef925c37f clutter/actor: Make is_effectively_on_stage_view() match has_mapped_clones()
The clone handling did not take certain cases into consideration,
thus copy over some extra checks from `has_mapped_clones()`,
ensuring consistent behavior.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2671>
2022-12-16 16:27:33 +00:00
Jonas Ådahl
a897542876 clutter/actor: Stop transitions in children when removing
When we remove a child, we stop its transitions (animations), but we
didn't stop animations on grand children. What we did, however, was to
clear the stage views of the grand children, and this caused a bunch of
orphaned transitions (ClutterTimeline) and accompanied warnings.

Make it so that if we stop transitions, and clear stage views, also stop
transitions for the grand children. Detached children don't have a way
to continue animating anyway, since they have no stage view (thus frame
clock) to be driven by.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2716>
2022-11-25 10:26:52 +00:00
Jonas Dreßler
61cc31c3ce clutter/actor: Show on all stage-views when actors have no allocation
When a badly behaving ClutterActor implementation manages to invalidate
the allocation after the layout phase and before painting, we have no
idea where the actor should be painted without running the whole layout
machinery again.

For paint volumes in this case we pretend the actor covers the whole
stage and queue full-stage redraws. When updating stage-views, we're
also handling this case, but not in the most graceful way. Just like
with paint volumes, we should assume an actor without a valid allocation
is simply everywhere, so set priv->stage_views to all available stage
views in that case.

Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6054
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2694>
2022-11-25 10:06:14 +00:00
Jonas Dreßler
fe01e423a3 clutter/stage: Always queue events in _clutter_stage_queue_event()
We've been sending all events to clients immediately for quite some time
now, so this is only really impacting the Clutter scene graph, not
clients anymore.

That makes this behavior a somewhat unnecessary optimization (it was
useful at the time it was added, but it's not anymore), which will only
make our lives harder when we actually expect an event to be queued
(eg. in tests), so remove it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2697>
2022-11-22 20:31:42 +00:00
Bilal Elmoussaoui
bb5af3a6bd g-i: Drop unneeded since/stability annotations
They are no longer useful since the merge of cogl inside mutter

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2708>
2022-11-22 13:32:52 +01:00
Jonas Dreßler
4fa1dab918 clutter/main: Refactor to remove devices in a single place
As suggested by Carlos in a review of this MR, refactor the logic of
clutter_do_event() to have both adding and removing of devices from the
devices list in a single place.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2696>
2022-11-21 16:51:00 +00:00
Jonas Dreßler
edc226a04d clutter: Process device removing events immediately when they come in
Having the stage device list be responsible for delivering the
same events twice (first immediately to clients, then later to Clutter)
was expected to be tricky, a sneaky problem with it right now is the
following case:

While collecting events for a stage update cycle, we get three touch
events from the backend: TOUCH_BEGIN(seq=1) -> TOUCH_END(seq=1) ->
TOUCH_BEGIN(seq=1)

What we do right now when we see a TOUCH_BEGIN event is adding a device
to the stage right when it comes in from the backend. And when we see
a TOUCH_END, we remove the device from the stage not immediately but
only after it went through the queue.

In the case of the three events mentioned above, with the current
behavior, this will happen when they come in from the backend:

- TOUCH_BEGIN(seq=1): device gets added to the stage with seq 1, event
 gets queued
- TOUCH_END(seq=1): Nothing happens, event gets queued
- TOUCH_BEGIN(seq=1): we try to add device to the stage, but seq 1 is
 already there, event gets queued

Now when we go through the queue and see the TOUCH_END, the device with
seq 1 gets removed, but on the subsequent TOUCH_BEGIN, we won't add a
new device, so this event (and all events with seq=1 that are still in
the queue) is now ignored by Clutter because it has no device.

What we want to do here is to cut short once the TOUCH_END event comes
in: Process queued events immediately and make sure the device is
removed from the stage list before a new device can be added. Same goes
for any other events that will lead to devices getting removed.

Small note: Since this leads to clutter_stage_get_device_actor()
returning NULL, I was wondering why we never crash because of this:
Turns out _clutter_actor_handle_event() handles self = NULL just fine
without crashing...

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2696>
2022-11-21 16:51:00 +00:00
Jonas Dreßler
874a5a6d58 clutter: Also handle DEVICE_REMOVED events filtered out by event filter
With commit 6c17aa66c6 we made sure no
stale device entries might land in the stage device list. The same can
happen for pointer devices too in theory, in practice we never really
filter them out, but it's good to handle them here anyway.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2696>
2022-11-21 16:51:00 +00:00
Jonas Dreßler
2d85e84136 clutter: Move check for device type into remove_device_for_event()
We'll call this function from a few more places for the
CLUTTER_DEVICE_REMOVED case, so move the check for which devices are
valid into the function itself to avoid having to check everywhere.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2696>
2022-11-21 16:51:00 +00:00
Carlos Garnacho
c28ab9a5c1 clutter: Add clutter_input_device_get_dimensions()
This will be used to know the size of touchscreens and tablets
by poking the backends about it. This is intended to replace code
using udev nowadays.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2617>
2022-11-09 10:46:55 +00:00
Carlos Garnacho
3ca78fa44a clutter: Add capability flags for trackpoints and trackballs
The detection of these devices is nowadays scattered around using
udev. Add these capabilities so that we can move this detection to
seats.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2617>
2022-11-09 10:46:55 +00:00
Jonas Dreßler
c40feb33fa clutter/actor: Remove outdated comment
Updating of the paint volume used for culling these days happens
during the finish-layout stage, not while painting. Also we have
geometry-based, not paint-based picking anymore.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1492>
2022-11-04 18:47:27 +00:00
Jonas Dreßler
0aba87308a clutter/actor: Clarify things about the last painted paint volume a bit
Rename the `last_paint_volume` to `visible_paint_volume`: That avoids
confusion with the `had_effects_on_last_paint_volume_update` flag and
also makes it clear that this paint volume is the currently visible one.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1492>
2022-11-04 18:47:27 +00:00
Jonas Dreßler
675321a2e5 clutter/actor: Rename paint_volume_valid to has_paint_volume for clarity
Rename the paint_volume_valid flag to has_paint_volume in order to
better reflect what it's for.

The name "paint_volume_valid" implies that the paint volume can be
invalidated and thus sounds like it's involved with some kind of
caching. The flag that's actually involved with caching is
"needs_paint_volume_update", while "paint_volume_valid" is only meant to
store whether the actor has a paint volume to work with.

So rename paint_volume_valid to has_paint_volume to avoid confusion
about which flag is used for caching.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1492>
2022-11-04 18:47:27 +00:00
Jonas Dreßler
66d8f51da1 clutter/actor: Refactor updating of the paint volume
For clarity and for further improvements, introduce a separate function
to update the paint volume instead of doing that inside
_clutter_actor_get_paint_volume_mutable().

Also add a FIXME comment for a possible bug I noticed while working on
it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1492>
2022-11-04 18:47:27 +00:00
Jonas Dreßler
2541979f8e clutter/text: Replace cached paint volume with the one cached by actor
Since ClutterActor now properly caches its paint volume and ClutterText
tries hard to invalidate its own cached paint volume on every redraw
anyway (that's more often than ClutterActor invalidates its own paint
volume), we can simply rely on the caching of the paint volume done by
ClutterActor and invalidate that on every redraw.

So remove the private cached paint volume from ClutterText and all its
invalidation machinery.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1492>
2022-11-04 18:47:27 +00:00
Jonas Dreßler
830561405c clutter/actor: Clean up real_get_paint_volume() a bit
We can get rid of an indentation level and the "ret" variable here and
instead simply early-return when we need to.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1492>
2022-11-04 18:47:27 +00:00
Jonas Dreßler
93ba039b90 clutter/paint-volume: Mark a paint volume argument as const
The function _clutter_paint_volume_get_stage_paint_box() actually
doesn't modify the paint volume that's passed to it, so make that a bit
more clear by passing a const paint volume as the argument.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1492>
2022-11-04 18:47:27 +00:00
Jonas Dreßler
692a8a4d93 clutter/actor: Remove get_default_paint_volume() API
These days it's possible to chain up into the default get_paint_volume()
implementation again, which renders
clutter_actor_get_default_paint_volume() unnecessary. So remove that
function and move clutter_actor_update_default_paint_volume() back into
real_get_paint_volume() where it belongs.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1492>
2022-11-04 18:47:27 +00:00
Jonas Dreßler
7e7a639cc5 clutter/actor: Avoid some stage view updates
We traverse the whole screnegraph anyway these days in finish_layout(),
so no need for the whole "set the flag on parents even though we don't
need it" dance anymore.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2667>
2022-10-18 18:43:36 +00:00
Carlos Garnacho
714f01048e clutter: Demote the new clutter_stage_grab() precondition check
There do indeed seem to be places in our own code that trigger grabs on
actors before they are realized. It was not the intention to change the
practical preconditions for GNOME 43, so make it an even lower minimum
that every caller ought to match: That the actor is attached to the stage.

Further constraining of these preconditions will have to wait until
branching for new development.

Fixes: 9c79c7234 (clutter: Only allow grabs to be created on realized actors)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2670>
2022-10-18 17:57:42 +02:00
Carlos Garnacho
9c79c72341 clutter: Only allow grabs to be created on realized actors
The bare minimum that we can ask to an actor before creating a grab
on it is that it is realized (and thus, attached to the stage). Bail
out if that is not the case when creating a grab.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2669>
2022-10-18 12:16:37 +02:00
Carlos Garnacho
e3df7b3384 clutter: Undo actor grabs along with ::unrealize
If an actor is being unrealized or otherwise unparented, it's a good
indication that its grabs are now stale and possibly harmful. Ensure
these are dropped when the actor is unparented.

This is now an unlikely event, since there is code to also dismiss
grabs when a visible grabbed actor goes unmapped. But that may be
prevented from happening, or the ordering of circumstances allow a
grab to be created and an actor destroyed without going unmapped
first. This grab dismission on unmap stays as it matches the UI-level
expectatives that an actor must be visible to be grabbed.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2475
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2669>
2022-10-18 12:16:22 +02:00
Robert Mader
07ec482e28 clutter/actor: Do not report hidden actors as present on stage view
The stage view list does not get updated when an actor gets hidden in
order to avoid unnecessary work, such as scale changes. However, we
still want `is_effectively_on_stage_view` to report `FALSE` in this
case.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2662>
2022-10-15 21:45:10 +02:00
Florian Müllner
62fd18030f clutter/text: Add missing property getter/setter
The :input-purpose and :input-hints properties were added without
actually handling the get/set operations, whoops.

All code uses the (working) methods, so this only fixes expectations,
not an actual bug :-)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2659>
2022-10-14 13:21:38 +02:00
Jonas Ådahl
85ef0d1a46 compositor-view/native: Check that the actor covers the the view
If we have a window that match the size (i.e. will pass the "fits
framebuffer" low level check), that doesn't mean it matches the
position. For example, if we have two monitors 2K monitors, with two 2K
sized windows, one on monitor A, and one on monitor both monitor A and
B, overlapping both, if the latter window is above the former, it'll end
up bing scanned out on both if it ends up fitting all the other
requirements.

Fix this by checking that the paint box matches the stage view layout,
as that makes sure the actor we're painting isn't just partially on the
right view.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2387
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2624>
2022-09-20 18:47:06 +00:00
Ivan Molodetskikh
7972594d26 clutter/frame-clock: Fix dispatch lateness trace text
It was unfortunately broken by a variable overwrite in
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2161.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2630>
2022-09-20 18:18:25 +00:00
Dor Askayo
01846ffd91 clutter/frame-clock: Simplify early presented event handling
A few calculations and assignments are done unnecessarily when the
last next presentation time is invalid. This increases the cognitive
complexity of the function for no reason.

No change in behavior.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2486>
2022-09-02 13:54:30 +00:00
Robert Mader
b071a8366d clutter/stage-view: Add API to check if a shadowfb is used
As a more readable alternative to checking GObject properties.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2468>
2022-09-01 20:40:35 +00:00
Jonas Dreßler
8ad4056aa2 clutter/click-action: Don't stop release events if gesture is inactive
I don't see how this makes sense at all, ClutterClickAction really
shouldn't mess with BUTTON_RELEASE events that are not part of a
gesture.

So propagate those events instead of stopping them.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2552>
2022-08-25 00:28:41 +00:00
Jonas Dreßler
4fce0b974b clutter: Add source field to crossing events
The source field was removed from ClutterEvent with commit
b644ea1bce because the preferred way of
getting the event actor is now to use the device/sequence actor from the
stage directly.

With crossing events it's not that easy though, as crossing events
explicitly have a source and related actor that doesn't have to be the
same actor as the device actor. Since we kept around the "related" field
there anyway, let's also introduce a "source" field in
ClutterCrossingEvent and return that actor when get_source() is called
on a crossing event.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2551>
2022-08-24 22:43:54 +00:00
Jonas Dreßler
e5784bf885 clutter/actor: Add detail to ::event signal
Just like we did with the ::captured-event signal, add detail to the
::event signal too. At the first glance this might not seem necessary
since there are individual signals like scroll-event or touch-event that
get emitted at the same time, but these don't exist for touchpad gesture
events and others.

As an easy solution for that, just make it possible to use detail on the
event signal as we did with the caputured-event signal.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2431>
2022-08-24 22:19:15 +00:00
Dor Askayo
b4fff403b8 clutter/frame-clock: Ignore missing presentation timestamps
In some hardware configurations, presentation timestamps could be
missing from some page flip events, leading to a temporary loss of
vblank synchronization.

This occurs at least with AMD GPUs for atomic commits that only update
the cursor plane. [0]

In those cases, it's better to calculate the next update time
according to the last valid presentation timestamp instead of relying
on the dispatch lateness.

[0] https://gitlab.freedesktop.org/drm/amd/-/issues/2030

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2481>
2022-08-10 14:01:40 +00:00
Corentin Noël
8fcee7a8a5 clutter/stage: Add nullable annotation to get_*_actor methods
Allows to know when a NULL ClutterActor is possibly being returned.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2559>
2022-08-10 10:47:51 +00:00
Robert Mader
550f09a5e7 clutter/stage-view: Defer and accumulate redraw-clip on scanout
When taking the scanout path we still want to clear the
redraw-clip from the stage-view in order to ensure we skip
frames in `handle_frame_clock_frame()` if no new redraw-clip
was recorded.
This was not done previously as the accumulated redraw-clip was
needed for the next repaint, likely under the assumption that
scheduling a scanout repeatedly would be computationally cost-free.
This assumption does not hold in a VRR world.

In order to archive both, an accumulated redraw-clip for the next
paint and frame-skipping during scanout, introduce new API to defer
and accumulate redraw-clips until the next repaint.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2480>
2022-08-02 12:54:18 +02:00
Bilal Elmoussaoui
a73ae93d59 clutter: Remove all the since annotations
Since they are all refer to the days clutter used to be a separate
library

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2441>
2022-08-02 09:52:22 +02:00
Bilal Elmoussaoui
7b7e1c6fbd cally: Migrate to gi-docgen
Similar to the clutter commits
- Drop all the private structs documentations
- Make use of gi-docgen items linking as much as possible
- Use markdown formatting for code snippets

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2441>
2022-08-02 09:52:22 +02:00
Bilal Elmoussaoui
c8e63866f0 clutter: Migrate to gi-docgen
- Drop all the private structs documentations
- Make use of gi-docgen items linking as much as possible
- Use markdown formatting for code snippets

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2441>
2022-08-02 09:52:22 +02:00
Michel Dänzer
1f7527bbc4 clutter/frame-clock: Fix handling of equal next_presentation_time_us
This can happen with the native backend if the previous frame clock
dispatch didn't result in any KMS update, e.g. because it was triggered
by an input event, but the HW cursor didn't need updating on the stage
view. (This is likely to happen on some out of multiple stage views,
but might be possible even with a single stage view if the cursor isn't
visible)

We would previously delay next_presentation_time_us by one refresh
interval in this case, which could result in spuriously leaving one
refresh cycle unused.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2498>
2022-07-31 18:27:11 +00:00
Jonas Dreßler
f4416fa662 clutter/actor: Make has_pointer a counter instead of a bool
Somewhat long overdue... We've been supporting more than a single
pointer for quite a long time now, let's make sure things don't break if
two pointer devices enter the same ClutterActor: Count the number of
pointers an actor has instead of using a simple boolean value.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2348>
2022-07-27 08:57:07 +00:00