On 6/25/07, Brian J. Tarricone <[EMAIL PROTECTED]> wrote:
> On Mon, 25 Jun 2007 15:13:30 -0600 Jim George wrote:
>
> >Is there some way I can obtain a GDK_CONFIGURE event from a GtkImage
> >widget? I tried putting the GtkImage inside a GtkEventBox and
> >connecting a handler to "configure-event", without success. I also
> >manually enabled GDK_STRUCTURE_MASK, even though GTK is supposed to do
> >that by default. I would like to know when the image size has changed,
> >so that I can assign a new GdkPixbuf to the GtkImage and draw to the
> >GdkPixbuf.
>
> AFAIR, configure events are only useful for toplevel windows.  You'll
> probably want to look at the size-request and/or size-allocate signals
> (on GtkWidget).
>
>         -brian

That's true (although GtkDrawingArea will emit it too). I tried using
size-request, and nothing happened (callback never got called).
size-allocate, however, 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.

Baah, maybe I should just stick to using a GtkDrawingArea instead...

-Jim
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to