Problems using GtkWindow configure_event to resize a GdkPixbuf



I have a GtkImage in a GtkWindow that I am animating
by toggling a GtkImage between two GdkPixbufs, via
gtk_image_set_from_pixbuf(). As a "double-buffering"
approach allowing me to quickly alter the pixels, it
seems to work fine (let me know if there is a better
approach). The only problem I have is when trying to
resize the GdkPixbufs and GtkImage fromthe App's main
window's configure_event.

Which surprised me, as my approach had always worked
well with GtkPixmaps. 

Basically, after resize of the GtkWindow, the
GdkPixmap seems to resize "just a little too big" for
the window, so that the window the resizes again,
which in turn tells the GdkPixbuf to resize "a little
too big" again... ad-infinitum. Any resize turns in to
an endlessly growing window and GtkImage. I can force
the new pixbuf to be smaller... but I am confused that
I am not seeing the same happy result I had with
GtkPixmaps.

My guess is that it is either a "client-side" issue or
a GTK versus GDK issue, related to timing/translation.
But I am hoping some of you can give me the real
answer.

The code is spread all over the place, but in essence,
here is what I do to initialize:

- create a GtkWindow
- create an GtkHBox
- add the GtkHBox to the GtkWindow
- connect a function to the GtkWindow's
configure_event
- get the GtkWindow's size to create a GdkPixbuf
- use the GdkPixbuf to create a GtkImage
- add the GtkImage to the GtkHBox
- show all

The above pseudo-code seems great. But when I use the
configure_event to resize the GdkPixbuf (using the
usual "widget->allocation.width" and
"widget->allocation.height"), the bad feedback loop
starts.

Any suggestions for a proper way to do what I'm trying
to do? Thanks much!





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]