Reham Younis wrote:

>Hi,
>I am working on a project in which we are trying to
>upgrade its old GUI based on x lib pure calls to GTK
>(gtk-1.2).
>The problem is that I am creating a gtk drawing area
>which is used for drawing with x calls drawing
>functions. Things are working fine,except for
>GdkPixmap. It seems that for some reasons, using
>configure event with gdkpixmap doesnt work! The expose
>event works perfect,but when it tries to configure
>only a black area appears after the configure event is
>fired. Here is the code:
>
>gint expose_event (GtkWidget *widget, GdkEventExpose
>*event, gpointer data)
>{
>//HWindow is a struct that has a GdkPixmap as a
>member.
>HWindow *win = (HWindow*) data;
>
>//widget is the drawing area
>
>gdk_draw_pixmap (widget->window,
>widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
>win->pixmap,
>event->area.x,event->area.y,
>event->area.x,event->area.y,
>event->area.width,event->area.height);
>
>return FALSE;
>}
>
>gint config_event (GtkWidget *widget,GdkEventConfigure
>*event, gpointer data)
>{
>HWindow *win= (Hwindow*)data;
>if (win->pixmap)
>       gdk_pixmap_unref(win->pixmap);
>
>win->pixmap = gdk_pixmap_new(widget->window,
>       widget->allocation.width,
>       widget->allocation.height,
>       -1);
>gdk_draw_rectangle (win->pixmap,
>widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
>TRUE,
>widget->allocation.x,widget->allocation.y,
>
*BUG* here: pass 0,0 as x,y

>
>widget->allocation.width,widget->allocation.height);
>
>}
>

1. Are you sure your gc *widget->style->fg_gc[GTK_WIDGET_STATE 
(widget)]* contains the color
you need ? Create and use your own gc. This's not the problem, but...
2.  This one looks like your problem.
You need to pass 0,0 as *x*, *y* coords to gdk_draw_rectangle, cause you 
may got
allocation.x > allocation.width (the width of your pixmap), allocation.y 
 > allocation.height (the
height of your pixmap).

Olexiy


_______________________________________________
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to