diff -ruN -x Makefile -x configure -x config.cache -x config.h -x *.[178] -x gpm.info -x gpmdoc.ps -x gpmdoc.txt -x gpm-root.c -x stamp-h -x *.elc -x *.d gpm-1.19.6.orig/src/gpm.c gpm-1.19.6/src/gpm.c
--- gpm-1.19.6.orig/src/gpm.c	Mon Oct 22 05:57:05 2001
+++ gpm-1.19.6/src/gpm.c	Mon Oct 22 05:51:57 2001
@@ -410,7 +410,7 @@
 {
   char *data;
   static int fine_dx, fine_dy;
-  static int i, j, m;
+  static int i, j, m, obuttons;
   static Gpm_Event nEvent;
   static struct vt_stat stat;
   static struct timeval tv1={0,0}, tv2; /* tv1==0: first click is single */
@@ -459,7 +459,15 @@
       event->modifiers = nEvent.modifiers; /* propagate modifiers */
 
       /* propagate buttons */
-      nEvent.buttons = opt_sequence[nEvent.buttons]&7; /* change the order */
+      /* Change the button order */
+      obuttons = nEvent.buttons;
+      nEvent.buttons = 0;
+      for (j = 0; j < 8; j++) {
+	if (obuttons & (1 << j)) {
+	  nEvent.buttons |= opt_buts[j];
+	}
+      }
+//    nEvent.buttons = opt_sequence[nEvent.buttons]&7; /* change the order */
       oldB=newB; newB=nEvent.buttons;
       if (!i) event->buttons=nEvent.buttons;
 
