aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Halim <adaha@cendio.se>2024-09-24 16:38:35 +0200
committerAdam Halim <adaha@cendio.se>2024-10-22 14:52:36 +0200
commit66287bd933e1d5426b7b6108afcc42ac9b3440a5 (patch)
treef8b0bce031c33165044ca654869352447836aa39
parent63327145959e26193682e2b691a6027e26c1ce16 (diff)
downloadtigervnc-66287bd933e1d5426b7b6108afcc42ac9b3440a5.tar.gz
tigervnc-66287bd933e1d5426b7b6108afcc42ac9b3440a5.zip
Use bit shifts for mouse buttonMask
It makes more sense to use bit shifts instead of decimals for each button.
-rw-r--r--vncviewer/Viewport.cxx14
1 files changed, 7 insertions, 7 deletions
diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx
index ad7a6e8d..9d71a859 100644
--- a/vncviewer/Viewport.cxx
+++ b/vncviewer/Viewport.cxx
@@ -600,22 +600,22 @@ int Viewport::handle(int event)
case FL_MOUSEWHEEL:
buttonMask = 0;
if (Fl::event_button1())
- buttonMask |= 1;
+ buttonMask |= 1 << 0;
if (Fl::event_button2())
- buttonMask |= 2;
+ buttonMask |= 1 << 1;
if (Fl::event_button3())
- buttonMask |= 4;
+ buttonMask |= 1 << 2;
if (event == FL_MOUSEWHEEL) {
wheelMask = 0;
if (Fl::event_dy() < 0)
- wheelMask |= 8;
+ wheelMask |= 1 << 3;
if (Fl::event_dy() > 0)
- wheelMask |= 16;
+ wheelMask |= 1 << 4;
if (Fl::event_dx() < 0)
- wheelMask |= 32;
+ wheelMask |= 1 << 5;
if (Fl::event_dx() > 0)
- wheelMask |= 64;
+ wheelMask |= 1 << 6;
// A quick press of the wheel "button", followed by a immediate
// release below