[Xorg] Xt 0.1.5 support for buttons 6 & 7

sand at blarg.net sand at blarg.net
Thu Jul 8 07:23:20 PDT 2004


Daniel Stone writes:
> On Wed, Jul 07, 2004 at 09:10:21PM -0700, sand at blarg.net wrote:
> > Two levels up, Xt 0.1.5 is also missing support for buttons 6 and 7.
> > I'd like to use them for CLIPBOARD copy and paste in xterm, so I've
> > written a patch against libXt-0.1.5 and xproto-6.6.2 to support them.
> > When I compile xterm-191 against the resulting libraries (on XFree86
> > 4.3.0) it works as expected: I can create working translation bindings
> > for them in my X resources.
> 
> Step one is to post the patch to the list ...
> 

Some groups are okay with patches against a specific distributed
version; others prefer patches against CVS.  I've stuck patches
against the current TAR bundles to the bottom of this message.

One thing that we might want to change is the first patch block for
"X.h".  I added the Button6MotionMask and Button7MotionMask entries to
the bottom of the *Mask list, in case shuffling the bit values of
the existing entries would break something.  If that's not a risk,
then all the Button?MotionMask values would be better off together.

Derek

-- 
Derek Upham
sand at blarg.net

"Ha!  Your Leaping Tiger Kung Fu is no match for my Frightened Piglet style!"

------------------------------ cut here ------------------------------

diff -u -r xproto-6.6.2.orig/X.h xproto-6.6.2/X.h
--- xproto-6.6.2.orig/X.h	2003-07-18 08:53:24.000000000 -0700
+++ xproto-6.6.2/X.h	2004-07-06 21:18:37.000000000 -0700
@@ -178,6 +178,8 @@
 #define PropertyChangeMask		(1L<<22) 
 #define ColormapChangeMask		(1L<<23) 
 #define OwnerGrabButtonMask		(1L<<24) 
+#define Button6MotionMask		(1L<<25) 
+#define Button7MotionMask		(1L<<26) 
 
 /* Event names.  Used in "type" field in XEvent structures.  Not to be
 confused with event masks above.  They start from 2 because 0 and 1
@@ -252,6 +254,8 @@
 #define Button3Mask		(1<<10)
 #define Button4Mask		(1<<11)
 #define Button5Mask		(1<<12)
+#define Button6Mask		(1<<13)
+#define Button7Mask		(1<<14)
 
 #define AnyModifier		(1<<15)  /* used in GrabButton, GrabKey */
 
@@ -265,6 +269,8 @@
 #define Button3			3
 #define Button4			4
 #define Button5			5
+#define Button6			6
+#define Button7			7
 
 /* Notify modes */
 
diff -u -r libXt-0.1.5.orig/Event.c libXt-0.1.5/Event.c
--- libXt-0.1.5.orig/Event.c	2003-04-21 09:34:27.000000000 -0700
+++ libXt-0.1.5/Event.c	2004-07-06 20:17:41.000000000 -0700
@@ -766,7 +766,8 @@
 static void CompressExposures();
 
 #define KnownButtons (Button1MotionMask|Button2MotionMask|Button3MotionMask|\
-		      Button4MotionMask|Button5MotionMask)
+		      Button4MotionMask|Button5MotionMask|Button6MotionMask|\
+                      Button7MotionMask)
 
 /* keep this SMALL to avoid blowing stack cache! */
 /* because some compilers allocate all local locals on procedure entry */
diff -u -r libXt-0.1.5.orig/Pointer.c libXt-0.1.5/Pointer.c
--- libXt-0.1.5.orig/Pointer.c	2001-12-14 11:56:27.000000000 -0800
+++ libXt-0.1.5/Pointer.c	2004-07-06 20:19:09.000000000 -0700
@@ -54,7 +54,9 @@
 #include "PassivGraI.h"
 
 
-#define AllButtonsMask (Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask)
+#define AllButtonsMask (Button1Mask | Button2Mask | Button3Mask | \
+                        Button4Mask | Button5Mask | \
+                        Button6Mask | Button7Mask)
 
 Widget _XtProcessPointerEvent(event, widget, pdi)
     XButtonEvent  	*event;
diff -u -r libXt-0.1.5.orig/TMparse.c libXt-0.1.5/TMparse.c
--- libXt-0.1.5.orig/TMparse.c	2003-05-27 15:26:43.000000000 -0700
+++ libXt-0.1.5/TMparse.c	2004-07-06 20:21:45.000000000 -0700
@@ -149,6 +149,8 @@
     {"Button3",	0,	ParseModImmed,Button3Mask},
     {"Button4",	0,	ParseModImmed,Button4Mask},
     {"Button5",	0,	ParseModImmed,Button5Mask},
+    {"Button6",	0,	ParseModImmed,Button6Mask},
+    {"Button7",	0,	ParseModImmed,Button7Mask},
     {"c",	0,	ParseModImmed,ControlMask},
     {"s",	0,	ParseModImmed,ShiftMask},
     {"l",	0,	ParseModImmed,LockMask},
@@ -160,6 +162,8 @@
     {"Button3", 0,	Button3},
     {"Button4", 0,	Button4},
     {"Button5", 0,	Button5},
+    {"Button6", 0,	Button6},
+    {"Button7", 0,	Button7},
     {NULL, NULLQUARK, 0},
 };
 
@@ -245,6 +249,8 @@
 {"Btn3Down", 	    NULLQUARK, ButtonPress,	ParseImmed,(Opaque)Button3},
 {"Btn4Down", 	    NULLQUARK, ButtonPress,	ParseImmed,(Opaque)Button4},
 {"Btn5Down", 	    NULLQUARK, ButtonPress,	ParseImmed,(Opaque)Button5},
+{"Btn6Down", 	    NULLQUARK, ButtonPress,	ParseImmed,(Opaque)Button6},
+{"Btn7Down", 	    NULLQUARK, ButtonPress,	ParseImmed,(Opaque)Button7},
 
 /* Event Name,	  Quark, Event Type,	Detail Parser, Closure */
 
@@ -255,6 +261,8 @@
 {"Btn3Up", 	    NULLQUARK, ButtonRelease,    ParseImmed,(Opaque)Button3},
 {"Btn4Up", 	    NULLQUARK, ButtonRelease,    ParseImmed,(Opaque)Button4},
 {"Btn5Up", 	    NULLQUARK, ButtonRelease,    ParseImmed,(Opaque)Button5},
+{"Btn6Up", 	    NULLQUARK, ButtonRelease,    ParseImmed,(Opaque)Button6},
+{"Btn7Up", 	    NULLQUARK, ButtonRelease,    ParseImmed,(Opaque)Button7},
 
 {"MotionNotify",    NULLQUARK, MotionNotify, ParseTable, (Opaque)motionDetails},
 {"PtrMoved", 	    NULLQUARK, MotionNotify, ParseTable, (Opaque)motionDetails},
@@ -266,6 +274,8 @@
 {"Btn3Motion", NULLQUARK, MotionNotify, ParseAddModifier, (Opaque)Button3Mask},
 {"Btn4Motion", NULLQUARK, MotionNotify, ParseAddModifier, (Opaque)Button4Mask},
 {"Btn5Motion", NULLQUARK, MotionNotify, ParseAddModifier, (Opaque)Button5Mask},
+{"Btn6Motion", NULLQUARK, MotionNotify, ParseAddModifier, (Opaque)Button6Mask},
+{"Btn7Motion", NULLQUARK, MotionNotify, ParseAddModifier, (Opaque)Button7Mask},
 
 {"EnterNotify",     NULLQUARK, EnterNotify,    ParseTable,(Opaque)notifyModes},
 {"Enter",	    NULLQUARK, EnterNotify,    ParseTable,(Opaque)notifyModes},
@@ -1097,7 +1107,8 @@
 }
 
 static ModifierMask buttonModifierMasks[] = {
-    0, Button1Mask, Button2Mask, Button3Mask, Button4Mask, Button5Mask
+    0, Button1Mask, Button2Mask, Button3Mask, Button4Mask, Button5Mask,
+    Button6Mask, Button7Mask
 };
 static String ParseRepeat();
 
diff -u -r libXt-0.1.5.orig/TMprint.c libXt-0.1.5/TMprint.c
--- libXt-0.1.5.orig/TMprint.c	2003-04-21 09:34:29.000000000 -0700
+++ libXt-0.1.5/TMprint.c	2004-07-06 20:22:47.000000000 -0700
@@ -136,6 +136,9 @@
     CHECK_STR_OVERFLOW(sb);
     PRINTMOD(Button4Mask, "Button4");
     PRINTMOD(Button5Mask, "Button5");
+    CHECK_STR_OVERFLOW(sb);
+    PRINTMOD(Button6Mask, "Button6");
+    PRINTMOD(Button7Mask, "Button7");
 
 #undef PRINTMOD
 }
diff -u -r libXt-0.1.5.orig/TMstate.c libXt-0.1.5/TMstate.c
--- libXt-0.1.5.orig/TMstate.c	2003-04-21 09:34:29.000000000 -0700
+++ libXt-0.1.5/TMstate.c	2004-07-06 20:23:39.000000000 -0700
@@ -1183,7 +1183,8 @@
 	}
         tempMask = modifierMask &
 	    (Button1Mask | Button2Mask | Button3Mask
-	     | Button4Mask | Button5Mask);
+	     | Button4Mask | Button5Mask | Button6Mask
+             | Button7Mask);
         if (tempMask == 0)
 	    return PointerMotionMask;
         if (tempMask & Button1Mask)
@@ -1196,6 +1197,10 @@
             returnMask |= Button4MotionMask;
         if (tempMask & Button5Mask)
             returnMask |= Button5MotionMask;
+        if (tempMask & Button6Mask)
+            returnMask |= Button6MotionMask;
+        if (tempMask & Button7Mask)
+            returnMask |= Button7MotionMask;
         return returnMask;
     }
     returnMask = _XtConvertTypeToMask(eventType);




More information about the xorg mailing list