Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save aaronjensen/228875b17bbb55a4c45cd89530440fe0 to your computer and use it in GitHub Desktop.
Save aaronjensen/228875b17bbb55a4c45cd89530440fe0 to your computer and use it in GitHub Desktop.
From 02acfa6aa8132d767bf71390b101cd29fd5c1b44 Mon Sep 17 00:00:00 2001
From: Aaron Jensen <[email protected]>
Date: Thu, 24 May 2018 03:45:03 -0700
Subject: [PATCH] Prevent errant scroll on mouse click (Bug#31546)
* src/nsterm.m (ns_mouse_position): Use correct frame when determining
mouse position.
* lisp/mouse.el (mouse-drag-track): Only account for mode-line height
if `mode-line-format' is non-nil.
---
lisp/mouse.el | 3 ++-
src/nsterm.m | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 95aada9b15..6a45118de0 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -1219,7 +1219,8 @@ mouse-drag-track
(bounds (window-edges start-window))
(make-cursor-line-fully-visible nil)
(top (nth 1 bounds))
- (bottom (if (window-minibuffer-p start-window)
+ (bottom (if (or (window-minibuffer-p start-window)
+ (not mode-line-format))
(nth 3 bounds)
;; Don't count the mode line.
(1- (nth 3 bounds))))
diff --git a/src/nsterm.m b/src/nsterm.m
index 3c95fedadc..fcbac1733b 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -2581,7 +2581,7 @@ so some key presses (TAB) are swallowed by the system. */
if (f && FRAME_NS_P (f))
{
- view = FRAME_NS_VIEW (*fp);
+ view = FRAME_NS_VIEW (f);
position = [[view window] mouseLocationOutsideOfEventStream];
position = [view convertPoint: position fromView: nil];
--
2.17.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment