aboutsummaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
Diffstat (limited to 'unix')
-rw-r--r--unix/x0vncserver/XDesktop.cxx8
-rw-r--r--unix/x0vncserver/XDesktop.h4
-rw-r--r--unix/xserver/hw/vnc/XserverDesktop.cc2
-rw-r--r--unix/xserver/hw/vnc/XserverDesktop.h2
-rw-r--r--unix/xserver/hw/vnc/vncInput.c19
5 files changed, 26 insertions, 9 deletions
diff --git a/unix/x0vncserver/XDesktop.cxx b/unix/x0vncserver/XDesktop.cxx
index 29af059f..bf796452 100644
--- a/unix/x0vncserver/XDesktop.cxx
+++ b/unix/x0vncserver/XDesktop.cxx
@@ -242,9 +242,9 @@ void XDesktop::init(VNCServer* vs)
void XDesktop::start()
{
// Determine actual number of buttons of the X pointer device.
- unsigned char btnMap[8];
- int numButtons = XGetPointerMapping(dpy, btnMap, 8);
- maxButtons = (numButtons > 8) ? 8 : numButtons;
+ unsigned char btnMap[9];
+ int numButtons = XGetPointerMapping(dpy, btnMap, 9);
+ maxButtons = (numButtons > 9) ? 9 : numButtons;
vlog.info("Enabling %d button%s of X pointer device",
maxButtons, (maxButtons != 1) ? "s" : "");
@@ -342,7 +342,7 @@ void XDesktop::queryConnection(network::Socket* sock,
queryConnectDialog->map();
}
-void XDesktop::pointerEvent(const Point& pos, uint8_t buttonMask) {
+void XDesktop::pointerEvent(const Point& pos, uint16_t buttonMask) {
#ifdef HAVE_XTEST
if (!haveXtest) return;
XTestFakeMotionEvent(dpy, DefaultScreen(dpy),
diff --git a/unix/x0vncserver/XDesktop.h b/unix/x0vncserver/XDesktop.h
index cf374fb9..711d6893 100644
--- a/unix/x0vncserver/XDesktop.h
+++ b/unix/x0vncserver/XDesktop.h
@@ -60,7 +60,7 @@ public:
bool isRunning();
void queryConnection(network::Socket* sock,
const char* userName) override;
- void pointerEvent(const rfb::Point& pos, uint8_t buttonMask) override;
+ void pointerEvent(const rfb::Point& pos, uint16_t buttonMask) override;
void keyEvent(uint32_t keysym, uint32_t xtcode, bool down) override;
unsigned int setScreenLayout(int fb_width, int fb_height,
const rfb::ScreenSet& layout) override;
@@ -79,7 +79,7 @@ protected:
rfb::VNCServer* server;
QueryConnectDialog* queryConnectDialog;
network::Socket* queryConnectSock;
- uint8_t oldButtonMask;
+ uint16_t oldButtonMask;
bool haveXtest;
bool haveDamage;
int maxButtons;
diff --git a/unix/xserver/hw/vnc/XserverDesktop.cc b/unix/xserver/hw/vnc/XserverDesktop.cc
index e3bc57d8..328b0886 100644
--- a/unix/xserver/hw/vnc/XserverDesktop.cc
+++ b/unix/xserver/hw/vnc/XserverDesktop.cc
@@ -463,7 +463,7 @@ void XserverDesktop::terminate()
kill(getpid(), SIGTERM);
}
-void XserverDesktop::pointerEvent(const Point& pos, uint8_t buttonMask)
+void XserverDesktop::pointerEvent(const Point& pos, uint16_t buttonMask)
{
vncPointerMove(pos.x + vncGetScreenX(screenIndex),
pos.y + vncGetScreenY(screenIndex));
diff --git a/unix/xserver/hw/vnc/XserverDesktop.h b/unix/xserver/hw/vnc/XserverDesktop.h
index d287b72f..8c543db7 100644
--- a/unix/xserver/hw/vnc/XserverDesktop.h
+++ b/unix/xserver/hw/vnc/XserverDesktop.h
@@ -95,7 +95,7 @@ public:
void terminate() override;
void queryConnection(network::Socket* sock,
const char* userName) override;
- void pointerEvent(const rfb::Point& pos, uint8_t buttonMask) override;
+ void pointerEvent(const rfb::Point& pos, uint16_t buttonMask) override;
void keyEvent(uint32_t keysym, uint32_t keycode, bool down) override;
unsigned int setScreenLayout(int fb_width, int fb_height,
const rfb::ScreenSet& layout) override;
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);