Why do I have a grey square instead of a red square?



Greetings,

Why do I get a grey square instead of a red square? What's wrong here?

static gint configure_event( GtkWidget *widget, GdkEventConfigure *event )
{
  int x,y;
  
  if(pixmap)
    gdk_pixmap_unref(pixmap);
  if(pixmap_red)
    gdk_pixmap_unref(pixmap_red); //Formulas
  
pixmap = gdk_pixmap_new(widget->window, //Generate first pixmap
                          widget->allocation.width,
                          widget->allocation.height,
                          -1);

  pixmap_red = gdk_pixmap_new(widget -> window, //Generate second pixmap
  			      20,20,-1);
  
   
  gdk_color_parse("red",&color_red); //Parse Red
 
  x = gdk_color_alloc (system_colormap,&color_red);//Allocate it
   printf ("Value %d\n",x); //Returns 1
   
   gc_red = gdk_gc_new(pixmap_red); //Create the gc
  gdk_gc_set_foreground(gc_red, &color_red); //Set the foreground
  return TRUE;


static gint expose_event (GtkWidget *widget, GdkEventExpose *event) //Event
{
  int x;
  gdk_draw_pixmap(widget->window, //Draw first pixmap (b+w Pixmap)
                  widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
                  pixmap,
                  event->area.x, event->area.y,
                  event->area.x, event->area.y,
                  event->area.width, event->area.height);
  gdk_draw_pixmap(widget->window, //Draw the second one.
                  gc_red,
                  pixmap_red,
                  20,20,
                  20,20,
                  20, 20);
  
  return FALSE;
}

-- 
GnuPG Key available at http://www.jluehr.de.vu/public_key.asc



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