backends: Add MetaCursorSprite::texture-changed signal
As wayland implements the cursor role, it consists of a persistent MetaCursorSprite that gets the backing texture changed. This is inconvenient for the places using MetaCursorTracker to track cursor changes, as they actually track MetaCursorSprites. This signal will be used to trigger emission of MetaCursorTracker::cursor-changed, which will make users able to update accordingly. https://bugzilla.gnome.org/show_bug.cgi?id=754806
This commit is contained in:
parent
b1a0bf8916
commit
bcbcd6a68c
1 changed files with 14 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue