aboutsummaryrefslogtreecommitdiffstats
path: root/unix/xserver/hw/vnc/vncInput.c
diff options
context:
space:
mode:
authorAdam Halim <adaha@cendio.se>2024-09-24 15:55:21 +0200
committerAdam Halim <adaha@cendio.se>2024-10-22 14:52:31 +0200
commit63327145959e26193682e2b691a6027e26c1ce16 (patch)
tree772dcd8cc872bf7da5482cfaee33639cee924db4 /unix/xserver/hw/vnc/vncInput.c
parent2fe9dca45f7d0a519fef5053ba61e2db7c1ff2b1 (diff)
downloadtigervnc-63327145959e26193682e2b691a6027e26c1ce16.tar.gz
tigervnc-63327145959e26193682e2b691a6027e26c1ce16.zip
Add server support for forward/back mouse buttons
This commit adds support for the pseudo-encoding ExtendedMouseButtons in Xvnc and x0vncserver, which makes it possible to use to use the back/forward mouse buttons. This commit contains work originally done by PixelSmith <manny33@frontbuffer.com>.
Diffstat (limited to 'unix/xserver/hw/vnc/vncInput.c')
-rw-r--r--unix/xserver/hw/vnc/vncInput.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/unix/xserver/hw/vnc/vncInput.c b/unix/xserver/hw/vnc/vncInput.c
index 1de41430..a705a85a 100644
--- a/unix/xserver/hw/vnc/vncInput.c
+++ b/unix/xserver/hw/vnc/vncInput.c
@@ -50,7 +50,7 @@ extern const unsigned int code_map_qnum_to_xorgevdev_len;
extern const unsigned short code_map_qnum_to_xorgkbd[];
extern const unsigned int code_map_qnum_to_xorgkbd_len;
-#define BUTTONS 7
+#define BUTTONS 9
DeviceIntPtr vncKeyboardDev;
DeviceIntPtr vncPointerDev;
@@ -207,6 +207,23 @@ static int vncPointerProc(DeviceIntPtr pDevice, int onoff)
btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);
+ /*
+ * The labels BTN_LABEL_PROP_BTN_SIDE and BTN_LABEL_PROP_BTN_EXTRA
+ * represent the side buttons on mice that are typically used to
+ * navigate back/forward respectively in web browsers.
+ *
+ * In X11, these labels are mapped to the BTN_SIDE and BTN_EXTRA
+ * input codes, which are mapped in the Linux HID driver. These
+ * are not to be confused with the BTN_FORWARD and BTN_BACK input
+ * codes, which some applications also use for back/forward
+ * navigation.
+ *
+ * It seems like most mice have their side buttons mapped to
+ * BTN_SIDE and BTN_EXTRA.
+ */
+ btn_labels[7] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_SIDE);
+ btn_labels[8] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_EXTRA);
+
axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);