Subject: NS: scroll-bar not draggable

From: Stefan Monnier <[email-masked]>
Date: Tue, 19 Mar 2013 08:41:13 -0400

>>>>> Jan said:
> On OSX the event produced when clicking below the handle looks like:
> (down-mouse-1 (#<window 0x103229e50 on *info*> vertical-scroll-bar (0 . 428) 83281193 below-handle))
> On Gtk3 it looks like:
> (mouse-1 (#<window 0x11a0228 on *info*> vertical-scroll-bar (0 . 0) 0 below-handle))

So it seems that we need the patch below instead.  Can you try it (after
removing your earlier patch) and confirm that it also fixes the problem?

        Stefan

=== modified file 'lisp/subr.el'
--- lisp/subr.el	2013-03-08 08:11:59 +0000
+++ lisp/subr.el	2013-03-19 12:40:38 +0000
@@ -1044,14 +1044,16 @@
 		(nth 1 position))))
     (and (symbolp area) area)))
 
-(defsubst posn-point (position)
+(defun posn-point (position)
   "Return the buffer location in POSITION.
 POSITION should be a list of the form returned by the `event-start'
-and `event-end' functions."
+and `event-end' functions.
+Returns nil if POSITION does not correspond to any buffer location (e.g.
+a click on a scroll bar)."
   (or (nth 5 position)
-      (if (consp (nth 1 position))
-	  (car (nth 1 position))
-	(nth 1 position))))
+      (let ((pt (nth 1 position)))
+        (or (car-safe pt)
+            (if (integerp pt) pt)))))
 
 (defun posn-set-point (position)
   "Move point to POSITION.
@@ -1124,12 +1126,14 @@
 and `event-end' functions."
   (nth 3 position))
 
-(defsubst posn-string (position)
+(defun posn-string (position)
   "Return the string object of POSITION.
 Value is a cons (STRING . STRING-POS), or nil if not a string.
 POSITION should be a list of the form returned by the `event-start'
 and `event-end' functions."
-  (nth 4 position))
+  (let ((x (nth 4 position)))
+    ;; Apparently this can also be `handle' or `below-handle' (bug#13979).
+    (when (consp x) x)))
 
 (defsubst posn-image (position)
   "Return the image object of POSITION.