Hi, all.
 
On a FreeBSD 4.7 machine, I have tried the following code (see cvs diff result) and made VGUI work with GTK 2.0  and GtkGlarea 1.99.
 
Right now, there are two questions:
1. I have only a little experience with GTK. These changes are quick fixes only and I am not sure if they are compatible on other platforms.
2. Apparently, these changes should not overwrite the existing code (namely impl/gtk). How shall this GTK 2.0 toolkit be integrated into VGUI? My quick thought is to have a impl/gtk2 directory and modify cmake modules correpondingly.
 
If anyone has interest, I will be glad to commit the code and share thoughts.
 
Best Regards,
Gehua Yang
 
 
 
 
re gtk $ cvs diff -u
cvs server: Diffing .
Index: vgui_gtk_dialog_impl.cxx
===================================================================
RCS file: /cvsroot/vxl/vxl/core/vgui/impl/gtk/vgui_gtk_dialog_impl.cxx,v
retrieving revision 1.15
diff -u -r1.15 vgui_gtk_dialog_impl.cxx
--- vgui_gtk_dialog_impl.cxx    10 Mar 2003 07:11:25 -0000      1.15
+++ vgui_gtk_dialog_impl.cxx    18 Apr 2003 03:06:29 -0000
@@ -453,17 +453,17 @@
                          (GtkSignalFunc)color_changed_cb,
                          (gpointer)GTK_COLOR_SELECTION_DIALOG(colorw)->
                                     colorsel);
-      gtk_widget_reparent(GTK_COLOR_SELECTION_DIALOG(colorw)->main_vbox,hbox);
+      gtk_widget_reparent(GTK_COLOR_SELECTION_DIALOG(colorw)->parent_instance.vbox,hbox);
       gtk_widget_hide(GTK_COLOR_SELECTION_DIALOG(colorw)->ok_button);
       gtk_widget_hide(GTK_COLOR_SELECTION_DIALOG(colorw)->cancel_button);
       gtk_widget_hide(GTK_COLOR_SELECTION_DIALOG(colorw)->help_button);
 
       gtk_box_pack_start(GTK_BOX(hbox),
-                         GTK_COLOR_SELECTION_DIALOG(colorw)->main_vbox,
+                         GTK_COLOR_SELECTION_DIALOG(colorw)->parent_instance.vbox,
                          TRUE, TRUE, 0);
       gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, TRUE,
                          TRUE, 0);
-      gtk_widget_show(GTK_COLOR_SELECTION_DIALOG(colorw)->main_vbox);
+      gtk_widget_show(GTK_COLOR_SELECTION_DIALOG(colorw)->parent_instance.vbox);
       gtk_widget_show(hbox);
       wlist.push_back(color_entry);
     }
Index: vgui_gtk_utils.cxx
===================================================================
RCS file: /cvsroot/vxl/vxl/core/vgui/impl/gtk/vgui_gtk_utils.cxx,v
retrieving revision 1.11
diff -u -r1.11 vgui_gtk_utils.cxx
--- vgui_gtk_utils.cxx  4 Jan 2003 16:23:10 -0000       1.11
+++ vgui_gtk_utils.cxx  18 Apr 2003 03:06:29 -0000
@@ -15,6 +15,7 @@
 
 #include <vgui/vgui_gl.h>
 #include <gdk/gdkkeysyms.h>
+#include <gdk/gdktypes.h>
 #include <gtk/gtk.h>
 #include <gtkgl/gtkglarea.h>
 
@@ -143,17 +144,17 @@
       if (menu[i].short_cut.mod!=vgui_MODIFIER_NULL ||
          menu[i].short_cut.key!=vgui_KEY_NULL)
         {
-          gint mask = 0;
+          GdkModifierType mask = GdkModifierType(0);
           // Health warning - It seems that GDK_MOD1_MASK corresponds
           // to META on Solaris and ALT has no correspondance
           if (menu[i].short_cut.mod & vgui_CTRL)
-            mask|=GDK_CONTROL_MASK;
+            mask = GdkModifierType(mask | GDK_CONTROL_MASK);
           if (menu[i].short_cut.mod & vgui_META)
-            mask|=GDK_MOD1_MASK;
+            mask = GdkModifierType(mask | GDK_MOD1_MASK);
           if (menu[i].short_cut.mod & vgui_SHIFT)
-            mask|=GDK_SHIFT_MASK;
+            mask = GdkModifierType(mask | GDK_SHIFT_MASK);
           if (menu[i].short_cut.mod & vgui_ALT)
-            mask|=GDK_MOD2_MASK;
+            mask = GdkModifierType(mask | GDK_MOD2_MASK);
           gtk_widget_add_accelerator (item,
                                       "activate",
                                       accel_group,
@@ -201,17 +202,17 @@
         if (menu[i].short_cut.mod!=vgui_MODIFIER_NULL ||
            menu[i].short_cut.key!=vgui_KEY_NULL)
           {
-            gint mask = 0;
+            GdkModifierType mask = GdkModifierType(0);
             // Health warning - It seems that GDK_MOD1_MASK corresponds
             // to META on Solaris and ALT has no correspondance
             if (menu[i].short_cut.mod & vgui_CTRL)
-              mask|=GDK_CONTROL_MASK;
+              mask = GdkModifierType(mask | GDK_CONTROL_MASK);
             if (menu[i].short_cut.mod & vgui_META)
-              mask|=GDK_MOD1_MASK;
+              mask = GdkModifierType(mask | GDK_MOD1_MASK);
             if (menu[i].short_cut.mod & vgui_SHIFT)
-              mask|=GDK_SHIFT_MASK;
+              mask = GdkModifierType(mask | GDK_SHIFT_MASK);
             if (menu[i].short_cut.mod & vgui_ALT)
-              mask|=GDK_MOD2_MASK;
+              mask = GdkModifierType(mask | GDK_MOD2_MASK);
             gtk_widget_add_accelerator (item,
                                         "activate",
                                         accel_group,
Index: vgui_gtk_window.cxx
===================================================================
RCS file: /cvsroot/vxl/vxl/core/vgui/impl/gtk/vgui_gtk_window.cxx,v
retrieving revision 1.8
diff -u -r1.8 vgui_gtk_window.cxx
--- vgui_gtk_window.cxx 16 Sep 2002 17:23:42 -0000      1.8
+++ vgui_gtk_window.cxx 18 Apr 2003 03:06:29 -0000
@@ -13,6 +13,7 @@
 #include <vgui/vgui.h>
 #include <vgui/vgui_menu.h>
 
+//#include <gtk/gtkaccelgroup.h>
 #include <gtk/gtk.h>
 #include <gtkgl/gtkglarea.h>
 
@@ -140,8 +141,10 @@
   menubar = gtk_menu_bar_new();
   if (vgui_gtk_utils::accel_group == NULL)
     {
-      vgui_gtk_utils::accel_group = gtk_accel_group_get_default();
-      gtk_accel_group_attach(vgui_gtk_utils::accel_group,GTK_OBJECT(window));
+      vgui_gtk_utils::accel_group = gtk_accel_group_new();
+      gtk_window_add_accel_group(GTK_WINDOW(window), vgui_gtk_utils::accel_group);
     }
   vgui_gtk_utils::set_menu(menubar, *last_menubar, true);
 }
cvs server: Diffing Templates