emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 1b8711f426: Fix splurious button events being generated on Haiku


From: Po Lu
Subject: master 1b8711f426: Fix splurious button events being generated on Haiku
Date: Sun, 13 Mar 2022 08:34:38 -0400 (EDT)

branch: master
commit 1b8711f42640983167b0b63c4b0cb39b66e373c4
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Fix splurious button events being generated on Haiku
    
    * 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 | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/haiku_support.cc b/src/haiku_support.cc
index 5fc8d2675e..a14600cb33 100644
--- a/src/haiku_support.cc
+++ b/src/haiku_support.cc
@@ -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;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]