]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix splurious button events being generated on Haiku
authorPo Lu <luangruo@yahoo.com>
Sun, 13 Mar 2022 12:32:15 +0000 (12:32 +0000)
committerPo Lu <luangruo@yahoo.com>
Sun, 13 Mar 2022 12:33:09 +0000 (12:33 +0000)
* src/haiku_support.cc (MouseDown, MouseUp): Don't process if
the grab is not appropriate for the buttons that were pressed.

src/haiku_support.cc

index 5fc8d2675ee0bf4fdbaaa12c1238c93cb3b9d847..a14600cb33884141ac0cc087f017b4ab768df463 100644 (file)
@@ -1469,17 +1469,19 @@ public:
     this->GetMouse (&point, &buttons, false);
 
     rq.window = this->Window ();
-    rq.btn_no = 0;
 
-    if (!(previous_buttons & B_PRIMARY_MOUSE_BUTTON) &&
-       (buttons & B_PRIMARY_MOUSE_BUTTON))
+    if (!(previous_buttons & B_PRIMARY_MOUSE_BUTTON)
+       && (buttons & B_PRIMARY_MOUSE_BUTTON))
       rq.btn_no = 0;
-    else if (!(previous_buttons & B_SECONDARY_MOUSE_BUTTON) &&
-            (buttons & B_SECONDARY_MOUSE_BUTTON))
+    else if (!(previous_buttons & B_SECONDARY_MOUSE_BUTTON)
+            && (buttons & B_SECONDARY_MOUSE_BUTTON))
       rq.btn_no = 2;
-    else if (!(previous_buttons & B_TERTIARY_MOUSE_BUTTON) &&
-            (buttons & B_TERTIARY_MOUSE_BUTTON))
+    else if (!(previous_buttons & B_TERTIARY_MOUSE_BUTTON)
+            && (buttons & B_TERTIARY_MOUSE_BUTTON))
       rq.btn_no = 1;
+    else
+      return;
+
     previous_buttons = buttons;
 
     rq.x = point.x;
@@ -1515,7 +1517,6 @@ public:
     this->GetMouse (&point, &buttons, false);
 
     rq.window = this->Window ();
-    rq.btn_no = 0;
 
     if ((previous_buttons & B_PRIMARY_MOUSE_BUTTON)
        && !(buttons & B_PRIMARY_MOUSE_BUTTON))
@@ -1526,6 +1527,9 @@ public:
     else if ((previous_buttons & B_TERTIARY_MOUSE_BUTTON)
             && !(buttons & B_TERTIARY_MOUSE_BUTTON))
       rq.btn_no = 1;
+    else
+      return;
+
     previous_buttons = buttons;
 
     rq.x = point.x;