Painting a Pixel



Hi all,

I've done the following to create a window and paint a white
pixel in the window. I'm getting SIGSEGV from  gc =
gdk_gc_new_with_values(window, &values, GDK_GC_FOREGROUND);


#include <gdk/gdk.h>
#include <stdlib.h>

int main(int argc, char *argv[]) {

  GdkWindow *window;
  GdkGC *gc;
  GdkWindowAttr attr;
  GdkColor color;
  GdkGCValues values;

  gdk_init(&argc, &argv);

  attr.title = "Test";
  attr.x = 100;
  attr.y = 100;
  attr.width = 300;
  attr.height = 300;
  attr.wclass = GDK_INPUT_OUTPUT;
  attr.window_type = GDK_WINDOW_TOPLEVEL;

  color.red = 65535;
  color.blue = 65535;
  color.green = 65535;

  values.foreground = color;
  
  gc = gdk_gc_new_with_values(window, &values, GDK_GC_FOREGROUND);
  
  window = gdk_window_new(NULL, &attr, GDK_WA_TITLE|GDK_WA_X|GDK_WA_Y);
  
  gdk_window_show(window);

  gdk_draw_point(window, gc, 10, 10);

  gtk_main();

  return 0;
}

Any ideas?

Best regards,
-- 
Paulo J. Matos : pocm(_at_)mega.ist.utl.pt
Instituto Superior Tecnico - Lisbon    
Software & Computer Engineering - A.I.
 - > http://mega.ist.utl.pt/~pocm 
 ---	
	Yes, God had a deadline...
		So, He wrote it all in Lisp!




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