Re: Notebooks in Gtk+ v1.2.x



Ok, I may have spoken prematurely. I keep getting a SEGFAULT on the following line of code:

        gtk_widget_grab_focus( GTK_WIDGET(current->glarea));

where 'current' is a global variable of typDrawingArea * (see struct definition below). I have defined a local varible of type typDrawingArea and then assigned its memory address to 'current'.

gdb indicates the object cast is wrong.

        Program received signal SIGSEGV, Segmentation fault.
        [Switching to Thread 1024 (LWP 14198)]
0x40103fc0 in gtk_type_check_object_cast () from /usr/lib/libgtk-1.2.so.0
        (gdb) backtrace
#0 0x40103fc0 in gtk_type_check_object_cast () from /usr/lib/libgtk-1.2.so.0
        #1  0x0804ab24 in CreateMainWindow () at OpenGL_notebook.c:836
#2 0x080499ce in main (argc=1, argv=0xbffffd54) at OpenGL_notebook.c:149
        (gdb)gtk_widget_grab_focus(GTK_WIDGET(current->glarea));

I am using the struct from my first message:

        typedef struct {
          GtkWidget  *notebook_page;
          GtkWidget  *glarea;
          gint        page_number;
          GLfloat     xRot;
          GLfloat     yRot;
          GLfloat     zRot;
          GLfloat     zoom;
          gint        current;
        } typDrawingArea;


Thanks again for your help.

cheers
Jim Parker

On 2003.01.23 10:57 Carlos Pereira wrote:


Jim,

I think you are in the right track.

If I understand well, you have a master window
with a notebook controlling multiple slave windows,
each one with an independent drawing area.

Generally speaking, each window must know all the information
about itself, in a structure (object) and the master must know
the address of all the windows, in a list (of course this
is a over simplification).

My app has multiple (unlimited) top windows, each one
with its own OpenGL drawing area, which in turn draws
multiple (unlimited) layers, each one with its own
set of objects, lights, OpenGL parameters, etc.

My architecture is slightly different from yours,
because all my top_windows are masters, while you
chose a master-slave design, but the general principles
are the same.


Carlos
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




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