diff options
| author | Alan Third | 2017-11-02 21:41:11 +0000 |
|---|---|---|
| committer | Alan Third | 2017-11-02 22:41:42 +0000 |
| commit | 36400c7dc9c8d46f956f42d4bdbb6fe7b3f8c30a (patch) | |
| tree | f0a93da8930e3d9784fba5ef014b4e2532dbc095 /src | |
| parent | 04bc1410c26884bfed9fd7ba7376491023df03fc (diff) | |
| download | emacs-36400c7dc9c8d46f956f42d4bdbb6fe7b3f8c30a.tar.gz emacs-36400c7dc9c8d46f956f42d4bdbb6fe7b3f8c30a.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/nsterm.m | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/nsterm.m b/src/nsterm.m index a382e5f7130..5c29f039e51 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -8912,10 +8912,20 @@ not_in_argv (NSString *arg) | |||
| 8912 | } | 8912 | } |
| 8913 | last_mouse_offset = kloc; | 8913 | last_mouse_offset = kloc; |
| 8914 | 8914 | ||
| 8915 | if (part != NSScrollerKnob) | 8915 | /* if knob, tell emacs a location offset by knob pos |
| 8916 | /* this is a slot click on GNUstep: go straight there */ | 8916 | (to indicate top of handle) */ |
| 8917 | if (part == NSScrollerKnob) | ||
| 8918 | pos = (loc - last_mouse_offset); | ||
| 8919 | else | ||
| 8920 | /* else this is a slot click on GNUstep: go straight there */ | ||
| 8917 | pos = loc; | 8921 | pos = loc; |
| 8918 | 8922 | ||
| 8923 | /* If there are buttons in the scroller area, we need to | ||
| 8924 | recalculate pos as emacs expects the scroller slot to take up | ||
| 8925 | the entire available length. */ | ||
| 8926 | if (length != pixel_length) | ||
| 8927 | pos = pos * pixel_length / length; | ||
| 8928 | |||
| 8919 | /* send a fake mouse-up to super to preempt modal -trackKnob: mode */ | 8929 | /* send a fake mouse-up to super to preempt modal -trackKnob: mode */ |
| 8920 | fake_event = [NSEvent mouseEventWithType: NSEventTypeLeftMouseUp | 8930 | fake_event = [NSEvent mouseEventWithType: NSEventTypeLeftMouseUp |
| 8921 | location: [e locationInWindow] | 8931 | location: [e locationInWindow] |
| @@ -8980,6 +8990,13 @@ not_in_argv (NSString *arg) | |||
| 8980 | } | 8990 | } |
| 8981 | 8991 | ||
| 8982 | pos = (loc - last_mouse_offset); | 8992 | pos = (loc - last_mouse_offset); |
| 8993 | |||
| 8994 | /* If there are buttons in the scroller area, we need to | ||
| 8995 | recalculate pos as emacs expects the scroller slot to take up | ||
| 8996 | the entire available length. */ | ||
| 8997 | if (length != pixel_length) | ||
| 8998 | pos = pos * pixel_length / length; | ||
| 8999 | |||
| 8983 | [self sendScrollEventAtLoc: pos fromEvent: e]; | 9000 | [self sendScrollEventAtLoc: pos fromEvent: e]; |
| 8984 | } | 9001 | } |
| 8985 | 9002 | ||