]> code.delx.au - gnu-emacs/blobdiff - lisp/term/ns-win.el
Dired recognize dirs when file size in human units
[gnu-emacs] / lisp / term / ns-win.el
index 9bd59fc19542ffc335d5b58bbf7d96ba150bc34d..5080ed0a8f7769c0fef14c996b8af0006eb9c39a 100644 (file)
@@ -1,6 +1,6 @@
 ;;; ns-win.el --- lisp side of interface with NeXT/Open/GNUstep/MacOS X window system  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1993-1994, 2005-2015 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 2005-2016 Free Software Foundation, Inc.
 
 ;; Authors: Carl Edman
 ;;     Christian Limpach
@@ -717,60 +717,12 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
 
 ;;;; Scrollbar handling.
 
-(global-set-key [vertical-scroll-bar down-mouse-1] 'ns-handle-scroll-bar-event)
+(global-set-key [vertical-scroll-bar down-mouse-1] 'scroll-bar-toolkit-scroll)
+(global-set-key [horizontal-scroll-bar down-mouse-1] 'scroll-bar-toolkit-horizontal-scroll)
 (global-unset-key [vertical-scroll-bar mouse-1])
 (global-unset-key [vertical-scroll-bar drag-mouse-1])
-
-(declare-function scroll-bar-scale "scroll-bar" (num-denom whole))
-
-(defun ns-scroll-bar-move (event)
-  "Scroll the frame according to a Nextstep scroller event."
-  (interactive "e")
-  (let* ((pos (event-end event))
-         (window (nth 0 pos))
-         (scale (nth 2 pos)))
-    (with-current-buffer (window-buffer window)
-      (cond
-       ((eq (car scale) (cdr scale))
-       (goto-char (point-max)))
-       ((= (car scale) 0)
-       (goto-char (point-min)))
-       (t
-       (goto-char (+ (point-min) 1
-                     (scroll-bar-scale scale (- (point-max) (point-min)))))))
-      (beginning-of-line)
-      (set-window-start window (point))
-      (vertical-motion (/ (window-height window) 2) window))))
-
-(defun ns-handle-scroll-bar-event (event)
-  "Handle scroll bar EVENT to emulate Nextstep style scrolling."
-  (interactive "e")
-  (let* ((position (event-start event))
-        (bar-part (nth 4 position))
-        (window (nth 0 position))
-        (old-window (selected-window)))
-    (cond
-     ((eq bar-part 'ratio)
-      (ns-scroll-bar-move event))
-     ((eq bar-part 'handle)
-      (if (eq window (selected-window))
-         (track-mouse (ns-scroll-bar-move event))
-        ;; track-mouse faster for selected window, slower for unselected.
-       (ns-scroll-bar-move event)))
-     (t
-      (select-window window)
-      (cond
-       ((eq bar-part 'up)
-       (goto-char (window-start window))
-       (scroll-down 1))
-       ((eq bar-part 'above-handle)
-       (scroll-down))
-       ((eq bar-part 'below-handle)
-       (scroll-up))
-       ((eq bar-part 'down)
-       (goto-char (window-start window))
-       (scroll-up 1)))
-      (select-window old-window)))))
+(global-unset-key [horizontal-scroll-bar mouse-1])
+(global-unset-key [horizontal-scroll-bar drag-mouse-1])
 
 
 ;;;; Color support.
@@ -936,5 +888,6 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
   (ns-get-selection selection-symbol target-type))
 
 (provide 'ns-win)
+(provide 'term/ns-win)
 
 ;;; ns-win.el ends here