As I under Know you need a top level window first than fo your Drawing window you need child type container i do not know if GdkDrawable is such typ main_window container drawable also you need a gtk_main() loop else happens noting. I thing the the seg fault is in the gdk_window_new call. This call should have only one parameter I suggest for starting. Take glade as a graphical interface to gtk make very small samples an let generate the code by glade have a look on that code to see what can be done. Glade generates a lot of code normaly no neccessary in all applications here is short glade starting code GtkWidget* create_window1 (void) { GtkWidget *window1; GtkWidget *vbox1; GtkWidget *handlebox1; GtkWidget *menubar1; GtkWidget *handlebox2; GtkWidget *button1; GtkWidget *notebook1; GtkWidget *empty_notebook_page; GtkWidget *label1; GtkWidget *label2; GtkWidget *label3; GtkWidget *statusbar1; window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_set_name (window1, "window1"); gtk_object_set_data (GTK_OBJECT (window1), "window1", window1); gtk_widget_set_usize (window1, 500, 300); gtk_window_set_title (GTK_WINDOW (window1), _("window1")); vbox1 = gtk_vbox_new (FALSE, 0); gtk_widget_set_name (vbox1, "vbox1"); gtk_widget_ref (vbox1); gtk_object_set_data_full (GTK_OBJECT (window1), "vbox1", vbox1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (vbox1); gtk_container_add (GTK_CONTAINER (window1), vbox1); handlebox1 = gtk_handle_box_new (); gtk_widget_set_name (handlebox1, "handlebox1"); gtk_widget_ref (handlebox1); gtk_object_set_data_full (GTK_OBJECT (window1), "handlebox1", handlebox1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (handlebox1); gtk_box_pack_start (GTK_BOX (vbox1), handlebox1, FALSE, FALSE, 0); menubar1 = gtk_menu_bar_new (); gtk_widget_set_name (menubar1, "menubar1"); gtk_widget_ref (menubar1); gtk_object_set_data_full (GTK_OBJECT (window1), "menubar1", menubar1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (menubar1); gtk_container_add (GTK_CONTAINER (handlebox1), menubar1); gnome_app_fill_menu (GTK_MENU_SHELL (menubar1), menubar1_uiinfo, NULL, FALSE, 0); handlebox2 = gtk_handle_box_new (); gtk_container_add (GTK_CONTAINER (handlebox2), button1); notebook1 = gtk_notebook_new (); gtk_widget_set_name (notebook1, "notebook1"); gtk_widget_set_name (handlebox2, "handlebox2"); gtk_widget_ref (handlebox2); gtk_object_set_data_full (GTK_OBJECT (window1), "handlebox2", handlebox2, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (handlebox2); gtk_box_pack_start (GTK_BOX (vbox1), handlebox2, FALSE, FALSE, 0); button1 = gtk_button_new_with_label (_("button1")); gtk_widget_ref (notebook1); gtk_object_set_data_full (GTK_OBJECT (window1), "notebook1", notebook1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (notebook1); gtk_box_pack_start (GTK_BOX (vbox1), notebook1, TRUE, TRUE, 0); empty_notebook_page = gtk_vbox_new (FALSE, 0); gtk_widget_show (empty_notebook_page); gtk_container_add (GTK_CONTAINER (notebook1), empty_notebook_page); label1 = gtk_label_new (_("label1")); gtk_widget_set_name (label1, "label1"); gtk_widget_ref (label1); gtk_object_set_data_full (GTK_OBJECT (window1), "label1", label1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label1); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), label1); empty_notebook_page = gtk_vbox_new (FALSE, 0); gtk_widget_show (empty_notebook_page); gtk_container_add (GTK_CONTAINER (notebook1), empty_notebook_page); label2 = gtk_label_new (_("label2")); gtk_widget_set_name (label2, "label2"); gtk_widget_ref (label2); gtk_object_set_data_full (GTK_OBJECT (window1), "label2", label2, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label2); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 1), label2); empty_notebook_page = gtk_vbox_new (FALSE, 0); gtk_widget_show (empty_notebook_page); gtk_container_add (GTK_CONTAINER (notebook1), empty_notebook_page); label3 = gtk_label_new (_("label3")); gtk_widget_set_name (label3, "label3"); gtk_widget_ref (label3); gtk_object_set_data_full (GTK_OBJECT (window1), "label3", label3, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (label3); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 2), label3); statusbar1 = gtk_statusbar_new (); gtk_widget_set_name (statusbar1, "statusbar1"); gtk_widget_ref (statusbar1); gtk_object_set_data_full (GTK_OBJECT (window1), "statusbar1", statusbar1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (statusbar1); gtk_box_pack_start (GTK_BOX (vbox1), statusbar1, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (window1), "destroy", GTK_SIGNAL_FUNC (gtk_main_quit), return window1; } MFG Günther Sachin Dharmapurikar wrote:
Dear friends, I am a beginer and working with GDK. I want to display a gdk window. For that I wrote a small program as follows: -------------------------- start.c ---------------------------------- #include<gtk/gtk.h> #include<gdk/gdk.h> int main(int argc, char *argv[]) { GdkDrawable *window; GdkWindowAttr attr; gint mask=0xFE20; window = NULL; // Initialization of the Attributes attr.title="T"; // I want title "T" attr.event_mask=0x3FFE; // Complete event mask attr.x = 0; // To initialize window at 0,0 attr.y= 0; attr.width = 400; // To specify the dimensions 400x400 attr.height = 400; attr.wclass = GDK_INPUT_OUTPUT; attr.window_type = GDK_WINDOW_TOPLEVEL; // End of initialization gdk_init(&argc,&argv); window = gdk_window_new(window,&attr,mask); gdk_window_show(window); return 0; } --------------------------- start.c ------------------------------ This start.c file I compiled with the GCC using comindline as, gcc start.c -o start `gtk-config --cflags --libs` The program compiled without warnings or errors but, when I execute start I get a segmentation fault. I am screwed a lot by this progam. Can anyone send me the runnable code. Waiting for response Bye... Sachin _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list gnome org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
-- R=I+S Rapp Informatik Systeme GmbH Rosenbühlstr. 24 D-89182 Bernstadt Tel: +49 (0)7348-7755 Fax: +49 (0)7348-6086 E-MAIL mailto: guenther rapp-informatik de WEB www.rapp-informatik.de
Attachment:
guenther.vcf
Description: Card for günther