aboutsummaryrefslogtreecommitdiffstats
path: root/vncviewer/Viewport.cxx
diff options
context:
space:
mode:
authorAdam Halim <adaha@cendio.se>2024-10-04 10:09:36 +0200
committerAdam Halim <adaha@cendio.se>2024-10-22 14:52:36 +0200
commitc40d8a4debbfbf98045ef25fcac91672f0cc1049 (patch)
treea83dcaf1dad87039047a8a45ec2a49a47646325e /vncviewer/Viewport.cxx
parent66287bd933e1d5426b7b6108afcc42ac9b3440a5 (diff)
downloadtigervnc-c40d8a4debbfbf98045ef25fcac91672f0cc1049.tar.gz
tigervnc-c40d8a4debbfbf98045ef25fcac91672f0cc1049.zip
vncviewer: support for back/forward mouse buttons
This commit implements the pseudo-encoding ExtendedMouseButtons which makes it possible to use the back/forward mouse buttons. This commit contains work originally done by PixelSmith <manny33@frontbuffer.com>.
Diffstat (limited to 'vncviewer/Viewport.cxx')
-rw-r--r--vncviewer/Viewport.cxx20
1 files changed, 18 insertions, 2 deletions
diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx
index 9d71a859..6cda65e9 100644
--- a/vncviewer/Viewport.cxx
+++ b/vncviewer/Viewport.cxx
@@ -606,6 +606,20 @@ int Viewport::handle(int event)
if (Fl::event_button3())
buttonMask |= 1 << 2;
+ // The back/forward buttons are not supported by FTLK 1.3 and require
+ // a patch which adds these buttons to the FLTK API. These buttons
+ // will be part of the upcoming 1.4 API:
+ // * https://github.com/fltk/fltk/pull/1081
+ //
+ // A backport for branch-1.3 is available here:
+ // * https://github.com/fltk/fltk/pull/1083
+#if defined(FL_BUTTON4) && defined(FL_BUTTON5)
+ if (Fl::event_button4())
+ buttonMask |= 1 << 7;
+ if (Fl::event_button5())
+ buttonMask |= 1 << 8;
+#endif
+
if (event == FL_MOUSEWHEEL) {
wheelMask = 0;
if (Fl::event_dy() < 0)
@@ -660,7 +674,7 @@ int Viewport::handle(int event)
return Fl_Widget::handle(event);
}
-void Viewport::sendPointerEvent(const rfb::Point& pos, uint8_t buttonMask)
+void Viewport::sendPointerEvent(const rfb::Point& pos, uint16_t buttonMask)
{
if (viewOnly)
return;
@@ -790,7 +804,7 @@ void Viewport::flushPendingClipboard()
}
-void Viewport::handlePointerEvent(const rfb::Point& pos, uint8_t buttonMask)
+void Viewport::handlePointerEvent(const rfb::Point& pos, uint16_t buttonMask)
{
filterPointerEvent(pos, buttonMask);
}
@@ -937,6 +951,8 @@ int Viewport::handleSystemEvent(void *event, void *data)
(msg->message == WM_RBUTTONUP) ||
(msg->message == WM_MBUTTONDOWN) ||
(msg->message == WM_MBUTTONUP) ||
+ (msg->message == WM_XBUTTONDOWN) ||
+ (msg->message == WM_XBUTTONUP) ||
(msg->message == WM_MOUSEWHEEL) ||
(msg->message == WM_MOUSEHWHEEL)) {
// We can't get a mouse event in the middle of an AltGr sequence, so