Resizing of GdkWindows containing Imlib images



Hello,

I initalize a Window the following way

   GtkWidget *show = gtk_window_new(GTK_WINDOW_TOPLEVEL);
   gtk_widget_set_usize (show, W, H);
   gtk_widget_set_uposition (show, 0, 0);
  
   gtk_widget_set_events(show, 
			 gtk_widget_get_events (show) | 
			 GDK_BUTTON_MOTION_MASK |
			 GDK_POINTER_MOTION_HINT_MASK |
                         GDK_POINTER_MOTION_MASK |
			 GDK_BUTTON_PRESS_MASK );

   gtk_widget_realize (show);
   g_return_val_if_fail ( show->window, -1 );
   gtk_widget_show (show);
   gdk_window_set_hints(show->window, 0, 0, 0, 0, 0, 0, GDK_HINT_MIN_SIZE);
   gtk_signal_connect(GTK_OBJECT (show),
                     "key_press_event",
                      GTK_SIGNAL_FUNC(PictureKeyPressed), data);
   gtk_widget_set_app_paintable (show, TRUE);   
   gtk_signal_connect(GTK_OBJECT (show),s
                      "configure_event",
                      GTK_SIGNAL_FUNC(ConfigureCallback), data);

Later on I draw several pixmap into it which where rendered using GdkImlib
in the recommended way:

  GdkPixmap *pp, *m = NULL;
  int        x, y;

  gdk_window_resize(show->window, im->rgb_width, im->rgb_height);
  gdk_imlib_render(im, im->rgb_width, im->rgb_height);
  pp  = gdk_imlib_move_image(im);
  gdk_window_set_back_pixmap(show->window, pp, 0);
  gdk_window_clear(show->window); 
  gdk_imlib_free_pixmap(pp);
  gdk_window_show(show->window);
  gdk_flush();

Doing it this way was successful in former times and I've got the
window resized to the dimensions of the ImLib image.

Unfortunately I can't say starting from which version this doesn't work.
I use the Debian Package of ImLib 1.9.3 (Note: the Debian maintainer
got it from CVS because he had trouble with 1.9.2) but I expect the
problem more in GTK+ which is version 1.1.16.

Moreover a very curious thing is, that the image is updated "anywhere"
in my further code of paul

  http://www.physik.uni-halle.de/~e2od5/debian/paul.html  or
  ftp://tower.physik.uni-halle.de/pub/debian-maintain/paul/paul-0.0.7.tar.gz

That means, if I switch images of different size in image viewer mode
they seem to be OK.  (Note:  Debugging session has shown, that the image
size isn't updated when leaving the displaying function ApplyPicture()
in screen.c which is mainly a copy of the code above, that means after
gdk_flush() the window has the size of the image viewed before the
active image, but afterwards it is resized correctly.  I couldn't find
the point when the correct resizing was done.)

When using the animation mode the images show really strange behaviour:
The active image is warped to dimensions of the previous image.  Just
before the next image will be displayed a short flash of the correct
image will be shown and then this is overiden with the warped next
image.  This is the effect of the second portion of code shown above.

Any explanation for this strange behaviour?

Kind regards

     Andreas.



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