diff options
author | Adam Halim <adaha@cendio.se> | 2024-09-24 15:55:21 +0200 |
---|---|---|
committer | Adam Halim <adaha@cendio.se> | 2024-10-22 14:52:31 +0200 |
commit | 63327145959e26193682e2b691a6027e26c1ce16 (patch) | |
tree | 772dcd8cc872bf7da5482cfaee33639cee924db4 /common/rfb/SMsgReader.cxx | |
parent | 2fe9dca45f7d0a519fef5053ba61e2db7c1ff2b1 (diff) | |
download | tigervnc-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 'common/rfb/SMsgReader.cxx')
-rw-r--r-- | common/rfb/SMsgReader.cxx | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/common/rfb/SMsgReader.cxx b/common/rfb/SMsgReader.cxx index 9ddea53d..0aa83e3a 100644 --- a/common/rfb/SMsgReader.cxx +++ b/common/rfb/SMsgReader.cxx @@ -272,11 +272,32 @@ bool SMsgReader::readKeyEvent() bool SMsgReader::readPointerEvent() { + int mask; + int x; + int y; + if (!is->hasData(1 + 2 + 2)) return false; - int mask = is->readU8(); - int x = is->readU16(); - int y = is->readU16(); + + is->setRestorePoint(); + + mask = is->readU8(); + x = is->readU16(); + y = is->readU16(); + + if (handler->client.supportsExtendedMouseButtons() && mask & 0x80 ) { + int highBits; + int lowBits; + + if (!is->hasDataOrRestore(1)) + return false; + + highBits = is->readU8(); + lowBits = mask & 0x7f; /* Clear marker bit */ + mask = (highBits << 7) | lowBits; + } + + is->clearRestorePoint(); handler->pointerEvent(Point(x, y), mask); return true; } |