GtkIconHelper: Add set_window()

This is a hint on where the icon will be drawn. It
will allow us to pre-allocate cairo surfaces for the right
target.
This commit is contained in:
Alexander Larsson 2013-06-24 14:05:27 +02:00
parent 6a4f82a1f4
commit 5d8fd4ee24
2 changed files with 16 additions and 0 deletions

View File

@ -26,6 +26,8 @@ G_DEFINE_TYPE (GtkIconHelper, _gtk_icon_helper, G_TYPE_OBJECT)
struct _GtkIconHelperPrivate { struct _GtkIconHelperPrivate {
GtkImageType storage_type; GtkImageType storage_type;
GdkWindow *window;
GdkPixbuf *orig_pixbuf; GdkPixbuf *orig_pixbuf;
GdkPixbufAnimation *animation; GdkPixbufAnimation *animation;
GIcon *gicon; GIcon *gicon;
@ -50,6 +52,7 @@ _gtk_icon_helper_clear (GtkIconHelper *self)
g_clear_object (&self->priv->orig_pixbuf); g_clear_object (&self->priv->orig_pixbuf);
g_clear_object (&self->priv->animation); g_clear_object (&self->priv->animation);
g_clear_object (&self->priv->rendered_pixbuf); g_clear_object (&self->priv->rendered_pixbuf);
g_clear_object (&self->priv->window);
if (self->priv->icon_set != NULL) if (self->priv->icon_set != NULL)
{ {
@ -76,6 +79,17 @@ _gtk_icon_helper_invalidate (GtkIconHelper *self)
g_clear_object (&self->priv->rendered_pixbuf); g_clear_object (&self->priv->rendered_pixbuf);
} }
void
_gtk_icon_helper_set_window (GtkIconHelper *self,
GdkWindow *window)
{
if (window)
g_object_ref (window);
g_clear_object (&self->priv->window);
self->priv->window = window;
}
static void static void
gtk_icon_helper_finalize (GObject *object) gtk_icon_helper_finalize (GObject *object)
{ {

View File

@ -70,6 +70,8 @@ GtkIconHelper *_gtk_icon_helper_new (void);
void _gtk_icon_helper_clear (GtkIconHelper *self); void _gtk_icon_helper_clear (GtkIconHelper *self);
void _gtk_icon_helper_invalidate (GtkIconHelper *self); void _gtk_icon_helper_invalidate (GtkIconHelper *self);
void _gtk_icon_helper_set_window (GtkIconHelper *self,
GdkWindow *window);
gboolean _gtk_icon_helper_get_is_empty (GtkIconHelper *self); gboolean _gtk_icon_helper_get_is_empty (GtkIconHelper *self);