aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1997-10-23 06:29:35 +0000
committerKarl Heuer1997-10-23 06:29:35 +0000
commitb0ea497faf93edbec30332700822f38006fe82f3 (patch)
tree9a814a41f8c12dd9731c71f1c2348f48d2fae112
parent2bbd9a61a6ea20ecc67e7438a0b0a5ff77405bcd (diff)
downloademacs-b0ea497faf93edbec30332700822f38006fe82f3.tar.gz
emacs-b0ea497faf93edbec30332700822f38006fe82f3.zip
(mouse-drag-vertical-line): Handle left-side scroll bars.
-rw-r--r--lisp/mouse.el64
1 files changed, 38 insertions, 26 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el
index d760c437bf7..6f4a60a86ec 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -306,12 +306,18 @@ This command must be bound to a mouse click."
306 (start-event-window (car (car (cdr start-event)))) 306 (start-event-window (car (car (cdr start-event))))
307 (start-nwindows (count-windows t)) 307 (start-nwindows (count-windows t))
308 (old-selected-window (selected-window)) 308 (old-selected-window (selected-window))
309 event mouse x left right edges wconfig growth) 309 event mouse x left right edges wconfig growth
310 (which-side
311 (or (cdr (assq 'vertical-scroll-bars default-frame-alist))
312 'left)))
310 (if (one-window-p t) 313 (if (one-window-p t)
311 (error "Attempt to resize sole ordinary window")) 314 (error "Attempt to resize sole ordinary window"))
312 (if (= (nth 2 (window-edges start-event-window)) 315 (if (eq which-side 'left)
313 (frame-width start-event-frame)) 316 (if (= (nth 0 (window-edges start-event-window)) 0)
314 (error "Attempt to drag rightmost scrollbar")) 317 (error "Attempt to drag leftmost scrollbar"))
318 (if (= (nth 2 (window-edges start-event-window))
319 (frame-width start-event-frame))
320 (error "Attempt to drag rightmost scrollbar")))
315 (track-mouse 321 (track-mouse
316 (progn 322 (progn
317 ;; enlarge-window only works on the selected window, so 323 ;; enlarge-window only works on the selected window, so
@@ -349,28 +355,34 @@ This command must be bound to a mouse click."
349 ((null (car (cdr mouse))) 355 ((null (car (cdr mouse)))
350 nil) 356 nil)
351 (t 357 (t
352 (setq x (car (cdr mouse)) 358 (save-selected-window
353 edges (window-edges) 359 ;; If the scroll bar is on the window's left,
354 left (nth 0 edges) 360 ;; adjust the window on the left.
355 right (nth 2 edges)) 361 (if (eq which-side 'left)
356 ;; scale back a move that would make the 362 (select-window (previous-window)))
357 ;; window too thin. 363 (setq x (- (car (cdr mouse))
358 (cond ((< (- x left -1) window-min-width) 364 (if (eq which-side 'left) 2 0))
359 (setq x (+ left window-min-width -1)))) 365 edges (window-edges)
360 ;; compute size change needed 366 left (nth 0 edges)
361 (setq growth (- x right -1) 367 right (nth 2 edges))
362 wconfig (current-window-configuration)) 368 ;; scale back a move that would make the
363 (enlarge-window growth t) 369 ;; window too thin.
364 ;; if this window's growth caused another 370 (if (< (- x left -1) window-min-width)
365 ;; window to be deleted because it was too 371 (setq x (+ left window-min-width -1)))
366 ;; thin, rescind the change. 372 ;; compute size change needed
367 ;; 373 (setq growth (- x right -1)
368 ;; if size change caused space to be stolen 374 wconfig (current-window-configuration))
369 ;; from a window to the left of this one, 375 (enlarge-window growth t)
370 ;; rescind the change. 376 ;; if this window's growth caused another
371 (if (or (/= start-nwindows (count-windows t)) 377 ;; window to be deleted because it was too
372 (/= left (nth 0 (window-edges)))) 378 ;; thin, rescind the change.
373 (set-window-configuration wconfig))))))))) 379 ;;
380 ;; if size change caused space to be stolen
381 ;; from a window to the left of this one,
382 ;; rescind the change.
383 (if (or (/= start-nwindows (count-windows t))
384 (/= left (nth 0 (window-edges))))
385 (set-window-configuration wconfig))))))))))
374 386
375(defun mouse-set-point (event) 387(defun mouse-set-point (event)
376 "Move point to the position clicked on with the mouse. 388 "Move point to the position clicked on with the mouse.