# HG changeset patch # User Karl Heuer # Date 877588175 0 # Node ID ecae234a33bbd79e2fa5cf347fce751a12e8c32f # Parent 721fb698182212b794e16169c23b34a71cb096f0 (mouse-drag-vertical-line): Handle left-side scroll bars. diff -r 721fb6981822 -r ecae234a33bb lisp/mouse.el --- a/lisp/mouse.el Thu Oct 23 04:29:36 1997 +0000 +++ b/lisp/mouse.el Thu Oct 23 06:29:35 1997 +0000 @@ -306,12 +306,18 @@ (start-event-window (car (car (cdr start-event)))) (start-nwindows (count-windows t)) (old-selected-window (selected-window)) - event mouse x left right edges wconfig growth) + event mouse x left right edges wconfig growth + (which-side + (or (cdr (assq 'vertical-scroll-bars default-frame-alist)) + 'left))) (if (one-window-p t) (error "Attempt to resize sole ordinary window")) - (if (= (nth 2 (window-edges start-event-window)) - (frame-width start-event-frame)) - (error "Attempt to drag rightmost scrollbar")) + (if (eq which-side 'left) + (if (= (nth 0 (window-edges start-event-window)) 0) + (error "Attempt to drag leftmost scrollbar")) + (if (= (nth 2 (window-edges start-event-window)) + (frame-width start-event-frame)) + (error "Attempt to drag rightmost scrollbar"))) (track-mouse (progn ;; enlarge-window only works on the selected window, so @@ -349,28 +355,34 @@ ((null (car (cdr mouse))) nil) (t - (setq x (car (cdr mouse)) - edges (window-edges) - left (nth 0 edges) - right (nth 2 edges)) - ;; scale back a move that would make the - ;; window too thin. - (cond ((< (- x left -1) window-min-width) - (setq x (+ left window-min-width -1)))) - ;; compute size change needed - (setq growth (- x right -1) - wconfig (current-window-configuration)) - (enlarge-window growth t) - ;; if this window's growth caused another - ;; window to be deleted because it was too - ;; thin, rescind the change. - ;; - ;; if size change caused space to be stolen - ;; from a window to the left of this one, - ;; rescind the change. - (if (or (/= start-nwindows (count-windows t)) - (/= left (nth 0 (window-edges)))) - (set-window-configuration wconfig))))))))) + (save-selected-window + ;; If the scroll bar is on the window's left, + ;; adjust the window on the left. + (if (eq which-side 'left) + (select-window (previous-window))) + (setq x (- (car (cdr mouse)) + (if (eq which-side 'left) 2 0)) + edges (window-edges) + left (nth 0 edges) + right (nth 2 edges)) + ;; scale back a move that would make the + ;; window too thin. + (if (< (- x left -1) window-min-width) + (setq x (+ left window-min-width -1))) + ;; compute size change needed + (setq growth (- x right -1) + wconfig (current-window-configuration)) + (enlarge-window growth t) + ;; if this window's growth caused another + ;; window to be deleted because it was too + ;; thin, rescind the change. + ;; + ;; if size change caused space to be stolen + ;; from a window to the left of this one, + ;; rescind the change. + (if (or (/= start-nwindows (count-windows t)) + (/= left (nth 0 (window-edges)))) + (set-window-configuration wconfig)))))))))) (defun mouse-set-point (event) "Move point to the position clicked on with the mouse.