Unix VM change for swapping mouse buttons

Ned Konz ned at bike-nomad.com
Fri Jul 7 19:18:15 UTC 2000


OK, I fixed my problem. Now I can specify either:

* an environment variable SQUEAK_SWAPMOUSE
* a commandline argument -swapmouse

to get the meanings of buttons 2 and 3 swapped.

I also fixed a typo in the name of an environment variable.

I don't know whom I need to send this to, so I'm sending it
to the list.

Ned Konz

--- sqXWindow.c	Fri May 19 15:31:08 2000
+++ sqXWindow.c.new	Fri Jul  7 11:50:21 2000
@@ -178,6 +178,7 @@
 int		 noTitle= 0;
 int		 fullScreen= 0;
 struct timeval	 startUpTime;
+int		 swapMouseButtons = false; /* true if buttons 2 and 3 swapped */
 
 /* maximum input polling frequency */
 #define	MAXPOLLSPERSEC	33
@@ -1318,9 +1319,9 @@
 
   switch (theEvent->button)
     {
-    case 1: stButtons= 4; break;
-    case 2: stButtons= 2; break;
-    case 3: stButtons= 1; break;
+    case 1: stButtons= 4; break;	/* Red */
+    case 2: stButtons= (swapMouseButtons ? 1 : 2); break; /* Yellow or
(swapped) Blue */
+    case 3: stButtons= (swapMouseButtons ? 2 : 1); break; /* Blue or
(swapped) Yellow */
     case 4: /* Mouse wheel support */
     case 5: keyBufAppend( (theEvent->button + 26)        /* Up/Down */
 		       | (2 << 8)                          /* Ctrl  */
@@ -3076,6 +3077,7 @@
 #ifdef USE_XSHM
   printf("  -xshm                use X shared memory extension\n");
 #endif
+  printf("  -swapmouse           swap mouse buttons 2 and 3\n");
   printf("\nNotes:\n");
   printf("  <imageName> defaults to 'Squeak"SQVERSION".image'.\n");
   printf("  Using 'unix:0' for <dpy> may improve local display
performance.\n");
@@ -3137,7 +3139,7 @@
 
   /* defaults */
 
-  if ((ev= getenv("SQEEAK_ALIGN")))
+  if ((ev= getenv("SQUEAK_ALIGN")))
     asmAlign= atoi(ev);
   else
     asmAlign= 1;
@@ -3182,6 +3184,8 @@
   if (getenv("SQUEAK_SECURE"))
     secure= 1;
 
+  swapMouseButtons = getenv("SQUEAK_SWAPMOUSE") ? true : false;
+
 #if defined(USE_XSHM) && !defined(HEADLESS)
   if (getenv("SQUEAK_XSHM"))
     useXshm= 1;
@@ -3366,6 +3370,15 @@
 	    exit(1);
 	  }
 	  secure= true;
+	  continue;
+	}
+
+      if (!strcmp(*argv, "-swapmouse"))
+	{
+	  vmArgVec[vmArgCnt++]= *argv;	/* Save as a VM arg */
+	  argc--;       /* skip -swapmouse */
+	  argv++;
+	  swapMouseButtons = true;
 	  continue;
 	}





More information about the Squeak-dev mailing list