Re: Getting a GDK_CONFIGURE event from a GtkImage
- From: "Jim George" <jimgeorge gmail com>
- To: "Brian J. Tarricone" <bjt23 cornell edu>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Getting a GDK_CONFIGURE event from a GtkImage
- Date: Tue, 26 Jun 2007 11:28:48 -0600
On 6/26/07, Jim George <jimgeorge gmail com> wrote:
> >[...] caused an infinite loop, because I'm trying to
> >do the following:
> >
> >gboolean solar_cal_pixbuf_resize(GtkWidget *widget, GtkAllocation
> >*alloc, gpointer user_data)
> >{
> > GtkImage *img_widget = user_data;
> > GdkPixbuf *pixbuf = gtk_image_get_pixbuf(img_widget);
> > if (pixbuf) g_object_unref(pixbuf);
> > pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, alloc->width,
> >alloc->height);
> > gtk_image_set_from_pixbuf(img_widget, pixbuf);
> >}
> >
> >The call to gtk_image_set_from_pixbuf causes a size-alloc to be
> >emitted, leading to the infinite loop. I don't see why the
> >size-request signal is not being emitted.
>
> Just put a call to g_signal_handlers_block_by_func() before
> gtk_Image_set_from_pixbuf(), and then after, a call to
> g_signal_handlers_unblock_by_func(). There may be a more elegant way
> of handling that, but this'll work.
>
> -brian
Thanks, Brian, it works now.
I'll take that back, the handler keeps getting called even if I block
it before calling gtk_image_set_from_pixbuf. If I disconnect it, it
doesn't get called again. Seems like the allocate-event occurs with
some delay after gtk_image_set_from_pixbuf is called.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]