Commit Graph

8056 Commits

Author SHA1 Message Date
Bilal Elmoussaoui
df8ae83040 cogl: Port Indices away from CoglObject
Also renames Indices.get_type to Indices.get_indices_type to avoid
a conflict with the generated Object.get_type function

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This specifically fixes warnings like:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3190>
2023-08-21 15:11:15 +00:00