1
0
Fork 0
Commit graph

8031 commits

Author SHA1 Message Date
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