diff --git a/src/backends/meta-cursor.c b/src/backends/meta-cursor.c index 256b0ca56..ccd0ab017 100644 --- a/src/backends/meta-cursor.c +++ b/src/backends/meta-cursor.c @@ -37,6 +37,7 @@ enum { PREPARE_AT, + TEXTURE_CHANGED, LAST_SIGNAL }; @@ -266,11 +267,18 @@ meta_cursor_sprite_set_texture (MetaCursorSprite *self, int hot_x, int hot_y) { + if (self->texture == COGL_TEXTURE_2D (texture) && + self->hot_x == hot_x && + self->hot_y == hot_y) + return; + g_clear_pointer (&self->texture, cogl_object_unref); if (texture) self->texture = cogl_object_ref (texture); self->hot_x = hot_x; self->hot_y = hot_y; + + g_signal_emit (self, signals[TEXTURE_CHANGED], 0); } void @@ -365,4 +373,10 @@ meta_cursor_sprite_class_init (MetaCursorSpriteClass *klass) G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); + signals[TEXTURE_CHANGED] = g_signal_new ("texture-changed", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, NULL, + G_TYPE_NONE, 0); }