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:

committed by
Marge Bot

parent
8310766845
commit
eda7588190
@ -223,7 +223,13 @@ meta_wayland_cursor_surface_dispose (GObject *object)
|
||||
cursor_sprite_prepare_at, cursor_surface);
|
||||
|
||||
g_clear_object (&priv->cursor_renderer);
|
||||
g_clear_object (&priv->cursor_sprite);
|
||||
|
||||
if (priv->cursor_sprite)
|
||||
{
|
||||
meta_cursor_sprite_set_prepare_func (META_CURSOR_SPRITE (priv->cursor_sprite),
|
||||
NULL, NULL);
|
||||
g_clear_object (&priv->cursor_sprite);
|
||||
}
|
||||
|
||||
if (priv->buffer)
|
||||
{
|
||||
@ -258,11 +264,9 @@ meta_wayland_cursor_surface_constructed (GObject *object)
|
||||
}
|
||||
|
||||
priv->cursor_sprite = meta_cursor_sprite_wayland_new (surface);
|
||||
g_signal_connect_object (priv->cursor_sprite,
|
||||
"prepare-at",
|
||||
G_CALLBACK (cursor_sprite_prepare_at),
|
||||
cursor_surface,
|
||||
0);
|
||||
meta_cursor_sprite_set_prepare_func (META_CURSOR_SPRITE (priv->cursor_sprite),
|
||||
(MetaCursorPrepareFunc) cursor_sprite_prepare_at,
|
||||
cursor_surface);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user