]> source.dussan.org Git - tigervnc.git/commitdiff
Use bit shifts for mouse buttonMask
authorAdam Halim <adaha@cendio.se>
Tue, 24 Sep 2024 14:38:35 +0000 (16:38 +0200)
committerAdam Halim <adaha@cendio.se>
Tue, 22 Oct 2024 12:52:36 +0000 (14:52 +0200)
It makes more sense to use bit shifts instead of decimals for each
button.

vncviewer/Viewport.cxx

index ad7a6e8de8a478265079ffafc8d79910b253b139..9d71a859c3356e4209da053b84d2b203f27c572b 100644 (file)
@@ -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