emacs-diffs
[Top][All Lists]
Advanced

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

master 02ab6aaf7b: Fix minor problem with scroll bar grabs on Haiku


From: Po Lu
Subject: master 02ab6aaf7b: Fix minor problem with scroll bar grabs on Haiku
Date: Thu, 28 Jul 2022 03:28:49 -0400 (EDT)

branch: master
commit 02ab6aaf7bc4d9c31d8e034ba3fe778bf2f35def
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Fix minor problem with scroll bar grabs on Haiku
    
    * haiku_support.cc (class EmacsScrollBar, EmacsScrollBar)
    (MouseDown, MouseUp): Keep a counter of the mouse down events
    received.
---
 src/haiku_support.cc | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/haiku_support.cc b/src/haiku_support.cc
index 204fdb81c2..cb378d2d81 100644
--- a/src/haiku_support.cc
+++ b/src/haiku_support.cc
@@ -1996,8 +1996,9 @@ public:
   float old_value;
   scroll_bar_info info;
 
-  /* True if button events should be passed to the parent.  */
-  bool handle_button;
+  /* How many button events were passed to the parent without
+     release.  */
+  int handle_button_count;
   bool in_overscroll;
   bool can_overscroll;
   bool maybe_overscroll;
@@ -2013,7 +2014,7 @@ public:
     : BScrollBar (BRect (x, y, x1, y1), NULL, NULL, 0, 0, horizontal_p ?
                  B_HORIZONTAL : B_VERTICAL),
       dragging (0),
-      handle_button (false),
+      handle_button_count (0),
       in_overscroll (false),
       can_overscroll (false),
       maybe_overscroll (false),
@@ -2234,10 +2235,10 @@ public:
 
     if (message && (message->FindInt32 ("modifiers", &mods)
                    == B_OK)
-       && mods & B_CONTROL_KEY && !handle_button)
+       && mods & B_CONTROL_KEY)
       {
        /* Allow C-mouse-3 to split the window on a scroll bar.   */
-       handle_button = true;
+       handle_button_count += 1;
        SetMouseEventMask (B_POINTER_EVENTS, (B_SUSPEND_VIEW_FOCUS
                                              | B_LOCK_WINDOW_FOCUS));
        parent->BasicMouseDown (ConvertToParent (pt), this, message);
@@ -2309,9 +2310,9 @@ public:
     in_overscroll = false;
     maybe_overscroll = false;
 
-    if (handle_button)
+    if (handle_button_count)
       {
-       handle_button = false;
+       handle_button_count--;
        looper = Looper ();
        msg = (looper
               ? looper->CurrentMessage ()



reply via email to

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