Monday 7 September 2009

Fixing NAM bug

I am using ns-2.31 on Ubuntu and had this error message when i tried to run NAM
[code omitted because of length]
: no event type or button # or keysym
while executing
"bind Listbox {
%W yview scroll [expr {- (%D / 120) * 4}] units
}"
invoked from within
"if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
bind Listbox {
%W yview scroll [expr {- (%D)}] units
}
bind Li..."



I found two patches to solve this problem from http://bugs.gentoo.org/show_bug.cgi?id=225999

i made correction to both files as

--- generic/tk.h.orig 2008-02-06 16:31:40.000000000 +0100
+++ generic/tk.h 2008-07-24 08:21:46.000000000 +0200
@@ -635,17 +635,15 @@
  *
  *---------------------------------------------------------------------------
  */
-#define VirtualEvent     (LASTEvent)
-#define ActivateNotify     (LASTEvent + 1)
-#define DeactivateNotify    (LASTEvent + 2)
-#define MouseWheelEvent     (LASTEvent + 3)
-#define TK_LASTEVENT     (LASTEvent + 4)
+#define VirtualEvent     (MappingNotify + 1)
+#define ActivateNotify     (MappingNotify + 2)
+#define DeactivateNotify    (MappingNotify + 3)
+#define MouseWheelEvent     (MappingNotify + 4)
+#define TK_LASTEVENT     (MappingNotify + 5)
 
 #define MouseWheelMask     (1L << 28)
-
 #define ActivateMask     (1L << 29)
 #define VirtualEventMask    (1L << 30)
-#define TK_LASTEVENT     (LASTEvent + 4)
 
 
 /*
And for other one as
 
--- tk8.4.18-orig/generic/tkBind.c 2006-07-21 08:26:54.000000000 +0200
+++ tk8.4.18/generic/tkBind.c 2008-07-05 12:17:10.000000000 +0200
@@ -586,6 +586,9 @@
    /* ColormapNotify */  COLORMAP,
    /* ClientMessage */  0,
    /* MappingNotify */  0,
+#ifdef GenericEvent
+   /* GenericEvent */          0,
+#endif 
    /* VirtualEvent */  VIRTUAL,
    /* Activate */  ACTIVATE,     
    /* Deactivate */  ACTIVATE,
 
finally it worked. Thank god. i can sleep now.  

1 comment: