[Xorg] Xt 0.1.5 support for buttons 6 & 7
sand at blarg.net
sand at blarg.net
Sun Jul 11 16:08:22 PDT 2004
Keith Packard writes:
> You don't get to change X.h at all; you can't add new event masks to the
> protocol (the X server would have to be changed to support them), and you
> needn't add new Button? names. I'd add Xt specific button names instead
>
> #define XtButton6 6
> #define XtButton7 7
>
> I don't know how hard it will be to get Xt to accept buttons for which no
> event selection or state bits exist, but that's the only way to make this
> work.
Here's a revised patch that only touches libXt-0.1.5. Because the X11
protocol doesn't have event masks for those buttons, we can't use the
buttons in drag events. What we *can* do is bind actions to up and
down events on them. For example:
xterm.vt100.translations: #override\n\
<Btn6Up>:insert-selection(CLIPBOARD) \n\
<Btn7Up>:select-set(CLIPBOARD) \n\
<Btn6Down>:ignore() \n\
<Btn7Down>:ignore() \n\
<BtnUp>:ignore() \n
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 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-11 14:57:32.000000000 -0700
@@ -88,6 +88,15 @@
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#endif
+/* The core X11R6 protocol predates 7-button mice.
+ * This prevents us from referring to those buttons in event masks.
+ * We *can* recognize basic up/down events for those buttons, since
+ * those use the plain button number. Compare with the "Button5"
+ * pre-processor definition in "X.h".
+ */
+#define XtButton6 6
+#define XtButton7 7
+
static String XtNtranslationParseError = "translationParseError";
typedef int EventType;
@@ -160,6 +169,8 @@
{"Button3", 0, Button3},
{"Button4", 0, Button4},
{"Button5", 0, Button5},
+ {"Button6", 0, XtButton6},
+ {"Button7", 0, XtButton7},
{NULL, NULLQUARK, 0},
};
@@ -245,6 +256,8 @@
{"Btn3Down", NULLQUARK, ButtonPress, ParseImmed,(Opaque)Button3},
{"Btn4Down", NULLQUARK, ButtonPress, ParseImmed,(Opaque)Button4},
{"Btn5Down", NULLQUARK, ButtonPress, ParseImmed,(Opaque)Button5},
+{"Btn6Down", NULLQUARK, ButtonPress, ParseImmed,(Opaque)XtButton6},
+{"Btn7Down", NULLQUARK, ButtonPress, ParseImmed,(Opaque)XtButton7},
/* Event Name, Quark, Event Type, Detail Parser, Closure */
@@ -255,6 +268,8 @@
{"Btn3Up", NULLQUARK, ButtonRelease, ParseImmed,(Opaque)Button3},
{"Btn4Up", NULLQUARK, ButtonRelease, ParseImmed,(Opaque)Button4},
{"Btn5Up", NULLQUARK, ButtonRelease, ParseImmed,(Opaque)Button5},
+{"Btn6Up", NULLQUARK, ButtonRelease, ParseImmed,(Opaque)XtButton6},
+{"Btn7Up", NULLQUARK, ButtonRelease, ParseImmed,(Opaque)XtButton7},
{"MotionNotify", NULLQUARK, MotionNotify, ParseTable, (Opaque)motionDetails},
{"PtrMoved", NULLQUARK, MotionNotify, ParseTable, (Opaque)motionDetails},
More information about the xorg
mailing list