- ((display-graphic-p frame)
- (/ (window-mode-line-height window) 2))
- (t (window-mode-line-height window))))))
- ((eq line 'vertical)
- ;; Get the window to adjust for the vertical case. If the scroll
- ;; bar is on the window's right or we drag a vertical divider,
- ;; adjust the window where the start-event occurred. If the
- ;; scroll bar is on the start-event window's left or there are no
- ;; scrollbars, adjust the window on the left of it.
- (unless (or (eq side 'right)
- (not (zerop (window-right-divider-width window))))
- (setq window (window-in-direction 'left window t)))))
-
- ;; Start tracking.
- (track-mouse
+ ((not (consp event))
+ nil)
+ ((eq line 'vertical)
+ ;; Drag right edge of `window'.
+ (setq start (event-start event))
+ (setq position (car (posn-x-y start)))
+ ;; Set `posn-window' to the window where `event' was recorded.
+ ;; This can be `window' or the window on the left or right of
+ ;; `window'.
+ (when (window-live-p (setq posn-window (posn-window start)))
+ ;; Add left edge of `posn-window' to `position'.
+ (setq position (+ (window-pixel-left posn-window) position))
+ (unless (nth 1 start)
+ ;; Add width of objects on the left of the text area to
+ ;; `position'.
+ (when (eq (window-current-scroll-bars posn-window) 'left)
+ (setq position (+ (window-scroll-bar-width posn-window)
+ position)))
+ (setq position (+ (car (window-fringes posn-window))
+ (or (car (window-margins posn-window)) 0)
+ position))))
+ ;; When the cursor overshoots after shrinking a window to its
+ ;; minimum size and the dragging direction changes, have the
+ ;; cursor first catch up with the window edge.
+ (unless (or (zerop (setq growth (- position last-position)))
+ (and (> growth 0)
+ (< position (+ (window-pixel-left window)
+ (window-pixel-width window))))
+ (and (< growth 0)
+ (> position (+ (window-pixel-left window)
+ (window-pixel-width window)))))
+ (setq dragged t)
+ (adjust-window-trailing-edge window growth t t))
+ (setq last-position position))
+ (draggable
+ ;; Drag bottom edge of `window'.
+ (setq start (event-start event))
+ ;; Set `posn-window' to the window where `event' was recorded.
+ ;; This can be either `window' or the window above or below of
+ ;; `window'.
+ (setq posn-window (posn-window start))
+ (setq position (cdr (posn-x-y start)))
+ (when (window-live-p posn-window)
+ ;; Add top edge of `posn-window' to `position'.
+ (setq position (+ (window-pixel-top posn-window) position))
+ ;; If necessary, add height of header line to `position'
+ (when (memq (posn-area start)
+ '(nil left-fringe right-fringe left-margin right-margin))
+ (setq position (+ (window-header-line-height posn-window) position))))
+ ;; When the cursor overshoots after shrinking a window to its
+ ;; minimum size and the dragging direction changes, have the
+ ;; cursor first catch up with the window edge.
+ (unless (or (zerop (setq growth (- position last-position)))
+ (and (> growth 0)
+ (< position (+ (window-pixel-top window)
+ (window-pixel-height window))))
+ (and (< growth 0)
+ (> position (+ (window-pixel-top window)
+ (window-pixel-height window)))))
+ (setq dragged t)
+ (adjust-window-trailing-edge window growth nil t))
+ (setq last-position position))))))
+ ;; Start tracking.
+ (setq track-mouse t)