[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-26 36400c7: Fix mouse-scrollbar offset on GNUstep an
From: |
Alan Third |
Subject: |
[Emacs-diffs] emacs-26 36400c7: Fix mouse-scrollbar offset on GNUstep and old macOS (bug#29053) |
Date: |
Thu, 2 Nov 2017 18:48:44 -0400 (EDT) |
branch: emacs-26
commit 36400c7dc9c8d46f956f42d4bdbb6fe7b3f8c30a
Author: Alan Third <address@hidden>
Commit: Alan Third <address@hidden>
Fix mouse-scrollbar offset on GNUstep and old macOS (bug#29053)
* src/nsterm.m (EmacsScroller::mouseDown,
EmacsScroller::mouseDragged): Take scroller buttons into account when
calculating scroller knob position.
---
src/nsterm.m | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/src/nsterm.m b/src/nsterm.m
index a382e5f..5c29f03 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -8912,10 +8912,20 @@ not_in_argv (NSString *arg)
}
last_mouse_offset = kloc;
- if (part != NSScrollerKnob)
- /* this is a slot click on GNUstep: go straight there */
+ /* if knob, tell emacs a location offset by knob pos
+ (to indicate top of handle) */
+ if (part == NSScrollerKnob)
+ pos = (loc - last_mouse_offset);
+ else
+ /* else this is a slot click on GNUstep: go straight there */
pos = loc;
+ /* If there are buttons in the scroller area, we need to
+ recalculate pos as emacs expects the scroller slot to take up
+ the entire available length. */
+ if (length != pixel_length)
+ pos = pos * pixel_length / length;
+
/* send a fake mouse-up to super to preempt modal -trackKnob: mode */
fake_event = [NSEvent mouseEventWithType: NSEventTypeLeftMouseUp
location: [e locationInWindow]
@@ -8980,6 +8990,13 @@ not_in_argv (NSString *arg)
}
pos = (loc - last_mouse_offset);
+
+ /* If there are buttons in the scroller area, we need to
+ recalculate pos as emacs expects the scroller slot to take up
+ the entire available length. */
+ if (length != pixel_length)
+ pos = pos * pixel_length / length;
+
[self sendScrollEventAtLoc: pos fromEvent: e];
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-26 36400c7: Fix mouse-scrollbar offset on GNUstep and old macOS (bug#29053),
Alan Third <=