forked from AuroraMiddleware/gtk
picture: Avoid some unnecessary signal connections
We don't need to ever invalidate the picture size if the paintable tells us its size is static. Same for the contents.
This commit is contained in:
parent
817303a41e
commit
fd9879e5ff
@ -798,26 +798,36 @@ gtk_picture_set_paintable (GtkPicture *self,
|
|||||||
|
|
||||||
if (self->paintable)
|
if (self->paintable)
|
||||||
{
|
{
|
||||||
g_signal_handlers_disconnect_by_func (self->paintable,
|
const guint flags = gdk_paintable_get_flags (self->paintable);
|
||||||
gtk_picture_paintable_invalidate_contents,
|
|
||||||
self);
|
if ((flags & GDK_PAINTABLE_STATIC_CONTENTS) == 0)
|
||||||
g_signal_handlers_disconnect_by_func (self->paintable,
|
g_signal_handlers_disconnect_by_func (self->paintable,
|
||||||
gtk_picture_paintable_invalidate_size,
|
gtk_picture_paintable_invalidate_contents,
|
||||||
self);
|
self);
|
||||||
|
|
||||||
|
if ((flags & GDK_PAINTABLE_STATIC_SIZE) == 0)
|
||||||
|
g_signal_handlers_disconnect_by_func (self->paintable,
|
||||||
|
gtk_picture_paintable_invalidate_size,
|
||||||
|
self);
|
||||||
}
|
}
|
||||||
|
|
||||||
self->paintable = paintable;
|
self->paintable = paintable;
|
||||||
|
|
||||||
if (paintable)
|
if (paintable)
|
||||||
{
|
{
|
||||||
g_signal_connect (paintable,
|
const guint flags = gdk_paintable_get_flags (paintable);
|
||||||
"invalidate-contents",
|
|
||||||
G_CALLBACK (gtk_picture_paintable_invalidate_contents),
|
if ((flags & GDK_PAINTABLE_STATIC_CONTENTS) == 0)
|
||||||
self);
|
g_signal_connect (paintable,
|
||||||
g_signal_connect (paintable,
|
"invalidate-contents",
|
||||||
"invalidate-size",
|
G_CALLBACK (gtk_picture_paintable_invalidate_contents),
|
||||||
G_CALLBACK (gtk_picture_paintable_invalidate_size),
|
self);
|
||||||
self);
|
|
||||||
|
if ((flags & GDK_PAINTABLE_STATIC_SIZE) == 0)
|
||||||
|
g_signal_connect (paintable,
|
||||||
|
"invalidate-size",
|
||||||
|
G_CALLBACK (gtk_picture_paintable_invalidate_size),
|
||||||
|
self);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_queue_resize (GTK_WIDGET (self));
|
gtk_widget_queue_resize (GTK_WIDGET (self));
|
||||||
|
Loading…
Reference in New Issue
Block a user