# HG changeset patch # User Richard M. Stallman # Date 769640115 0 # Node ID 83dba60657ef09694e6d94bceff5e7b584082f27 # Parent b5acd78a49e32dd104f3e4a86d6b1927b84163b2 (posn-col-row): Do something useful for scroll bar event. diff -r b5acd78a49e3 -r 83dba60657ef lisp/subr.el --- a/lisp/subr.el Sun May 22 20:38:11 1994 +0000 +++ b/lisp/subr.el Sun May 22 20:55:15 1994 +0000 @@ -420,17 +420,27 @@ as returned by the `event-start' and `event-end' functions." (nth 2 position)) -(defsubst posn-col-row (position) - "Return the column and row in POSITION, measured in characters. +(defun posn-col-row (position) + "Return the row and column in POSITION, measured in characters. POSITION should be a list of the form (WINDOW BUFFER-POSITION (X . Y) TIMESTAMP) -as returned by the `event-start' and `event-end' functions." - (let* ((pair (nth 2 position)) - (window (posn-window position)) - (frame (if (framep window) window (window-frame window))) - (x (/ (car pair) (frame-char-width frame))) - (y (/ (cdr pair) (frame-char-height frame)))) - (cons x y))) +as returned by the `event-start' and `event-end' functions. +For a scroll-bar event, the result column is 0, and the row +corresponds to the vertical position of the click in the scroll bar." + (let ((pair (nth 2 position)) + (window (posn-window position))) + (if (eq (if (symbolp (nth 1 position)) (nth 1 position) + (car (nth 1 position))) + 'vertical-scroll-bar) + (cons 0 (scroll-bar-scale pair (1- (window-height window)))) + (if (eq (if (symbolp (nth 1 position)) (nth 1 position) + (car (nth 1 position))) + 'horizontal-scroll-bar) + (cons (scroll-bar-scale pair (window-width window)) 0) + (let ((frame (if (framep window) window (window-frame window))) + (x (/ (car pair) (frame-char-width frame))) + (y (/ (cdr pair) (frame-char-height frame)))) + (cons x y)))))) (defsubst posn-timestamp (position) "Return the timestamp of POSITION.