set-scroll-with-mouse - Scroll the window with the mouse
The set-scroll-with-mouse command controls the scrolling of a window by the mouse. This is a two stage process, the first stage locks the cursor to the mouse, the second stage scrolls the screen.
The first stage (locking) is performed when the mouse is located on the scroll-box (typically when the left button is depressed i.e. pick-mouse-1). set-scroll-with-mouse is invoked with an argument n, this causes the mouse position to be recorded ready for a scroll. Depending on the scroll method, the blank lines present at the end of the buffer are scrolled off the screen.
Subsequent calls to the set-scroll-with-mouse are made with no argument, the window is scrolled by the relative displacement of the mouse from it's locked position, motion is limited at the end of the scrolling region. Scrolling is proportional to the buffer length. The command is typically bound to move-mouse-1 which results in an update whenever the mouse is moved by the user.
When the button is released drop-mouse-1 then the scrolling is stopped by unbinding move-mouse-1, thereby breaking the binding between the mouse moving and the scroll command.
The scrolling utilizes fractional mouse positional information (i.e. units smaller than a character cell), if available, resulting in a smoother scrolling motion.
The following example shows how the command is used.
0 define-macro mouse-scroll-pick 1 set-scroll-with-mouse ; Lock mouse position to scroller global-bind-key set-scroll-with-mouse "mouse-move-1" !emacro 0 define-macro mouse-scroll-drop global-unbind-key "mouse-move-1" !emacro global-bind-key mouse-scroll-pick "mouse-pick-1" global-bind-key mouse-scroll-drop "mouse-drop-1"
When the left button is 'picked', mouse-scroll-pick lock the cursor to the mouse and binds mouse movement to set-scroll-with-mouse so that whenever the mouse is moved the cursor will be repositioned appropriately. When the button is 'dropped', the mouse movement is unbound so that the cursor will no longer be locked to the mouse.
Copyright (c) 1998-2006 JASSPA
Last Modified: 2002/01/11
Generated On: 2006/10/07