backends: Replace MetaCursorSprite::prepare-at with in-place function

Since this signal is in a hot path during input handling, it makes sense
not to have this be a signal at all, currently most of the time spent in
it is in GLib signal machinery itself.

Replace it with a function/user data pair that are set on the sprite
itself. Only the places that create an sprite are interested in hooking
one ::prepare-at behavior per sprite, so we can do with a single pair.

This makes meta_cursor_sprite_prepare_at() inexpensive enough.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1915>
This commit is contained in:
Carlos Garnacho
2021-07-05 16:19:05 +02:00
committed by Marge Bot
parent 8310766845
commit eda7588190
6 changed files with 48 additions and 27 deletions

View File

@ -1729,11 +1729,9 @@ static void
manage_root_cursor_sprite_scale (MetaDisplay *display,
MetaCursorSpriteXcursor *sprite_xcursor)
{
g_signal_connect_object (sprite_xcursor,
"prepare-at",
G_CALLBACK (root_cursor_prepare_at),
display,
0);
meta_cursor_sprite_set_prepare_func (META_CURSOR_SPRITE (sprite_xcursor),
(MetaCursorPrepareFunc) root_cursor_prepare_at,
display);
}
void