Re: Workaround for GtkClist problem. [Was: Small patch.] (fwd)



Does this patch look correct?

	Jeff




---------- Forwarded message ----------
Date: Tue, 29 Dec 1998 14:12:45 -0500 (EST)
From: Eric Nielson <enielson@netcom.ca>
To: Erik Andersen <andersen@inconnect.com>
Cc: other-gnomehack@lists.debian.org
Subject: Re: Workaround for GtkClist problem. [Was: Small patch.]
Resent-Date: 29 Dec 1998 19:12:35 -0000
Resent-From: gnomehack@other.debian.org
Resent-cc: recipient list not shown: ;

> > Cool. I'll put this in tonight. BTW, have you taken a look at the latest
> > and greatest today? I don't know what the deal is with the canvas
> > widget, but it is choking in the gtk idle handler. Do you know of
> > anything else that uses the gnome canvas widget that we can compare with
> > to find the problem? I took a quick look over it today, but I didn't see
> > anything obvious.
> > 
> >  -Erik
> > 
> 
> I put in your patch, and I also #ifdef'd out a bit of the MapWindow
> code so now it runs, and the player sel dialog seems to work. Could
> you try running the latest and greatest, and see what happens when you
> select various roles? I print out the selected role. For some reason I
> don't understand yet, when I select Archeologist (role 0) the result
> is corrupt. I suspect that gtk_clist_get_text() in the Gtk is broken.
> I have Gtk 1.1.9 installed. Could you see if this is the case there as
> well? Thanks.
> 
>  -Erik


  I have the CVS GTK+ from a few days ago (numbered 1.1.10) and it does
the same for role 0 all the time, and it happens to other roles 
occasionally.
Looks to me like there's a problem in the gtk clist code somewhere. Here's
a
small patch that gets around it by using the selected row number for the
actual role number, since they're the same.
  The canvas code seems to work for me, it doesn't crash in any idle
handlers.   

Eric.
--- GnomeHackPlayerSelDialog.c	Tue Dec 29 13:53:43 1998
+++ GnomeHackPlayerSelDialog.c.old	Tue Dec 29 13:53:30 1998
@@ -23,12 +23,19 @@
 #include <gnome.h>
 
 static char *the_role;
-
+gint         role_number;
 
 static void
 player_sel_row_selected (GtkCList *clist, int row, int col, GdkEvent *event)
 {
+    
+    role_number = row;
+    
+#if 0 /* the_role is getting corrupted somewhere after this
+          function returns */
     gtk_clist_get_text (clist, row, col, &the_role);
+    g_print("Selected role %s, %d %d\n", the_role, row, col);
+#endif
 }
 
 int
@@ -91,6 +98,7 @@
     if (i == 1 ) {
 	return( -2);
     }
+#if 0 /* See comment in player_sel_row_selected */
     /* They didn't quit or select random -- they must have selected a role */
     i=0;
     while (1) {
@@ -101,7 +109,8 @@
 	if ( ! roles[i] )
 	    g_error("No role matches your selection!");
     }
-    g_message("Selected role=%s (%d)", the_role, i );
-    
-    return ( i);
+#endif
+    g_message("Selected role=%s (%d)", roles[role_number], role_number );
+
+    return ( role_number);
 }


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