Re: [gtk-list] Re: GDK, and `gdk_pixmap_create_from_xpm_d'



> here's the scheme: 
> 	step 1: create a drawing_area widget, initialize the 
> 		data that will have to be drawn unto it, 
> 		connect a couple of signals, 
> 		associate that data with the object 
> 		(gtk_object_set_data).
> 	step 2: show the widget
> 		this will first call whatever has been associated
> 		to the configure_event (drawing all the background
> 		stuff unto an offscreen pixmap, a pixmap which is
> 		also associated with the widget in it's user data),
> 		and afterwards it ought to call whatever has been
> 		connected to the expose_event (which simply draws
> 		the pixmap created into the configure_event unto
> 		the screen). 
> 	bummer: this scheme works up unto the configure_event handler,
> 		the expose_event handler is never called. 
> 		Prior to it's call, the following error is
> 		generated:

I tried something now, and when instead of drawing a pixmap
I simply draw a rectangle on my offscreen pixmap, then the
code does not break.

here some code snippets:

/* loading of the background image */
background = gdk_pixmap_colormap_create_from_xpm(NULL,
                 map, &dummymask, NULL, BACKGROUNDIMG);

/* from configure_event handler */
/* creating an offscreen pixmap */
pixmap = gdk_pixmap_new( widget->window, widget->allocation.width,
                 widget->allocation.height,  -1);

/* so working with a simple rectangle works
gdk_draw_rectangle( pixmap, gc, TRUE, 0, 0, 
                 widget->allocation.width, 
                 widget->allocation.height);
*/
/* but if one draws a pixmap on top of the other pixmap, boom, 
 * one gets an error message
 */
gdk_draw_pixmap( pixmap, gc,
                 background,
                 0, 0, 0, 0, widget->allocation.width,
                 widget->allocation.height);

/* from the expose_event handler */
gdk_draw_pixmap( widget->window,
                 widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
                 pixmap, 
                 ev->area.x, ev->area.y,
                 ev->area.x, ev->area.y,
                 ev->area.width, ev->area.height);


error-message:

Gdk-ERROR **: BadDrawable (invalid Pixmap or Window parameter)
  serial 754 error_code 9 request_code 62 minor_code 0


so if someone has a clue,
in the meantime, I'll try to solve it in another way perhaps... 

Nancy Mazur



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