Mercurial > emacs
annotate lisp/mwheel.el @ 45964:1cfc5b600782
*** empty log message ***
author | Jason Rumney <jasonr@gnu.org> |
---|---|
date | Sat, 22 Jun 2002 19:52:29 +0000 |
parents | d8512fb0b229 |
children | 65253ed28734 |
rev | line source |
---|---|
26398
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
1 ;;; mwheel.el --- Mouse support for MS intelli-mouse type mice |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
2 |
45947
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
3 ;; Copyright (C) 1998, 2000, 2001, Free Software Foundation, Inc. |
26398
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
4 ;; Maintainer: William M. Perry <wmperry@gnu.org> |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
5 ;; Keywords: mouse |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
6 |
26410
55a234a9fe88
Fix copyright notice. Don't require 'cl at run time.
Gerd Moellmann <gerd@gnu.org>
parents:
26398
diff
changeset
|
7 ;; This file is part of GNU Emacs. |
26398
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
8 |
26410
55a234a9fe88
Fix copyright notice. Don't require 'cl at run time.
Gerd Moellmann <gerd@gnu.org>
parents:
26398
diff
changeset
|
9 ;; GNU Emacs is free software; you can redistribute it and/or modify |
55a234a9fe88
Fix copyright notice. Don't require 'cl at run time.
Gerd Moellmann <gerd@gnu.org>
parents:
26398
diff
changeset
|
10 ;; it under the terms of the GNU General Public License as published by |
26398
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
11 ;; the Free Software Foundation; either version 2, or (at your option) |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
12 ;; any later version. |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
13 |
26410
55a234a9fe88
Fix copyright notice. Don't require 'cl at run time.
Gerd Moellmann <gerd@gnu.org>
parents:
26398
diff
changeset
|
14 ;; GNU Emacs is distributed in the hope that it will be useful, |
55a234a9fe88
Fix copyright notice. Don't require 'cl at run time.
Gerd Moellmann <gerd@gnu.org>
parents:
26398
diff
changeset
|
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
55a234a9fe88
Fix copyright notice. Don't require 'cl at run time.
Gerd Moellmann <gerd@gnu.org>
parents:
26398
diff
changeset
|
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
55a234a9fe88
Fix copyright notice. Don't require 'cl at run time.
Gerd Moellmann <gerd@gnu.org>
parents:
26398
diff
changeset
|
17 ;; GNU General Public License for more details. |
26398
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
18 |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
19 ;; You should have received a copy of the GNU General Public License |
26410
55a234a9fe88
Fix copyright notice. Don't require 'cl at run time.
Gerd Moellmann <gerd@gnu.org>
parents:
26398
diff
changeset
|
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
26398
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
22 ;; Boston, MA 02111-1307, USA. |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
23 |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
24 ;;; Commentary: |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
25 |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
26 ;; This code will enable the use of the infamous 'wheel' on the new |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
27 ;; crop of mice. Under XFree86 and the XSuSE X Servers, the wheel |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
28 ;; events are sent as button4/button5 events. |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
29 |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
30 ;; I for one would prefer some way of converting the button4/button5 |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
31 ;; events into different event types, like 'mwheel-up' or |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
32 ;; 'mwheel-down', but I cannot find a way to do this very easily (or |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
33 ;; portably), so for now I just live with it. |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
34 |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
35 ;; To enable this code, simply put this at the top of your .emacs |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
36 ;; file: |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
37 ;; |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
38 ;; (mwheel-install) |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
39 |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
40 ;;; Code: |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
41 |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
42 (require 'custom) |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
43 |
38582
96ca8702243e
(mouse-wheel-down-button, mouse-wheel-up-button):
Gerd Moellmann <gerd@gnu.org>
parents:
33227
diff
changeset
|
44 ;; Setter function for mouse-button user-options. Switch Mouse Wheel |
96ca8702243e
(mouse-wheel-down-button, mouse-wheel-up-button):
Gerd Moellmann <gerd@gnu.org>
parents:
33227
diff
changeset
|
45 ;; mode off and on again so that the old button is unbound and |
96ca8702243e
(mouse-wheel-down-button, mouse-wheel-up-button):
Gerd Moellmann <gerd@gnu.org>
parents:
33227
diff
changeset
|
46 ;; new button is bound to mwheel-scroll. |
96ca8702243e
(mouse-wheel-down-button, mouse-wheel-up-button):
Gerd Moellmann <gerd@gnu.org>
parents:
33227
diff
changeset
|
47 |
96ca8702243e
(mouse-wheel-down-button, mouse-wheel-up-button):
Gerd Moellmann <gerd@gnu.org>
parents:
33227
diff
changeset
|
48 (defun mouse-wheel-change-button (var button) |
96ca8702243e
(mouse-wheel-down-button, mouse-wheel-up-button):
Gerd Moellmann <gerd@gnu.org>
parents:
33227
diff
changeset
|
49 (set-default var button) |
96ca8702243e
(mouse-wheel-down-button, mouse-wheel-up-button):
Gerd Moellmann <gerd@gnu.org>
parents:
33227
diff
changeset
|
50 (when mouse-wheel-mode |
96ca8702243e
(mouse-wheel-down-button, mouse-wheel-up-button):
Gerd Moellmann <gerd@gnu.org>
parents:
33227
diff
changeset
|
51 (mouse-wheel-mode 0) |
96ca8702243e
(mouse-wheel-down-button, mouse-wheel-up-button):
Gerd Moellmann <gerd@gnu.org>
parents:
33227
diff
changeset
|
52 (mouse-wheel-mode 1))) |
96ca8702243e
(mouse-wheel-down-button, mouse-wheel-up-button):
Gerd Moellmann <gerd@gnu.org>
parents:
33227
diff
changeset
|
53 |
96ca8702243e
(mouse-wheel-down-button, mouse-wheel-up-button):
Gerd Moellmann <gerd@gnu.org>
parents:
33227
diff
changeset
|
54 (defcustom mouse-wheel-down-button 4 |
96ca8702243e
(mouse-wheel-down-button, mouse-wheel-up-button):
Gerd Moellmann <gerd@gnu.org>
parents:
33227
diff
changeset
|
55 "Mouse button number for scrolling down." |
96ca8702243e
(mouse-wheel-down-button, mouse-wheel-up-button):
Gerd Moellmann <gerd@gnu.org>
parents:
33227
diff
changeset
|
56 :group 'mouse |
96ca8702243e
(mouse-wheel-down-button, mouse-wheel-up-button):
Gerd Moellmann <gerd@gnu.org>
parents:
33227
diff
changeset
|
57 :type 'integer |
96ca8702243e
(mouse-wheel-down-button, mouse-wheel-up-button):
Gerd Moellmann <gerd@gnu.org>
parents:
33227
diff
changeset
|
58 :set 'mouse-wheel-change-button) |
96ca8702243e
(mouse-wheel-down-button, mouse-wheel-up-button):
Gerd Moellmann <gerd@gnu.org>
parents:
33227
diff
changeset
|
59 |
96ca8702243e
(mouse-wheel-down-button, mouse-wheel-up-button):
Gerd Moellmann <gerd@gnu.org>
parents:
33227
diff
changeset
|
60 (defcustom mouse-wheel-up-button 5 |
96ca8702243e
(mouse-wheel-down-button, mouse-wheel-up-button):
Gerd Moellmann <gerd@gnu.org>
parents:
33227
diff
changeset
|
61 "Mouse button number for scrolling up." |
96ca8702243e
(mouse-wheel-down-button, mouse-wheel-up-button):
Gerd Moellmann <gerd@gnu.org>
parents:
33227
diff
changeset
|
62 :group 'mouse |
96ca8702243e
(mouse-wheel-down-button, mouse-wheel-up-button):
Gerd Moellmann <gerd@gnu.org>
parents:
33227
diff
changeset
|
63 :type 'integer |
96ca8702243e
(mouse-wheel-down-button, mouse-wheel-up-button):
Gerd Moellmann <gerd@gnu.org>
parents:
33227
diff
changeset
|
64 :set 'mouse-wheel-change-button) |
96ca8702243e
(mouse-wheel-down-button, mouse-wheel-up-button):
Gerd Moellmann <gerd@gnu.org>
parents:
33227
diff
changeset
|
65 |
45947
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
66 (defcustom mouse-wheel-scroll-amount '(1 5 nil) |
26398
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
67 "Amount to scroll windows by when spinning the mouse wheel. |
45947
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
68 This is actually a list, where the first element is the amount to |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
69 scroll slowly (normally invoked with the Shift key depressed) the |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
70 second is the amount to scroll on a normal wheel event, and the third |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
71 is the amount to scroll fast (normally with the Control key depressed). |
26398
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
72 |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
73 Each item should be the number of lines to scroll, or `nil' for near |
45947
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
74 full screen. |
26398
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
75 A near full screen is `next-screen-context-lines' less than a full screen." |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
76 :group 'mouse |
45947
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
77 :type '(list |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
78 (choice :tag "Slow (Shift key)" |
26398
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
79 (const :tag "Full screen" :value nil) |
45947
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
80 (integer :tag "Specific # of lines")) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
81 (choice :tag "Normal (no keys)" |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
82 (const :tag "Full screen" :value nil) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
83 (integer :tag "Specific # of lines")) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
84 (choice :tag "Fast (Ctrl key)" |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
85 (const :tag "Full screen" :value nil) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
86 (integer :tag "Specific # of lines")))) |
26398
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
87 |
33227
791ce66d397e
(mouse-wheel-scroll-amount): Renamed from `mwheel-scroll-amount'.
Miles Bader <miles@gnu.org>
parents:
33193
diff
changeset
|
88 (defcustom mouse-wheel-follow-mouse nil |
26398
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
89 "Whether the mouse wheel should scroll the window that the mouse is over. |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
90 This can be slightly disconcerting, but some people may prefer it." |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
91 :group 'mouse |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
92 :type 'boolean) |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
93 |
45947
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
94 (defun mouse-wheel-event-window () |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
95 "Return the window associated with this mouse command." |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
96 ;; If the command was a mouse event, the window is stored in the event. |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
97 (if (listp last-command-event) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
98 (if (fboundp 'event-window) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
99 (event-window last-command-event) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
100 (posn-window (event-start last-command-event))) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
101 ;; If not a mouse event, use the window the mouse is over now. |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
102 (let* ((coordinates (mouse-position)) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
103 (x (car (cdr coordinates))) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
104 (y (cdr (cdr coordinates)))) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
105 (and (numberp x) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
106 (numberp y) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
107 (window-at x y (car coordinates)))))) |
26398
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
108 |
45947
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
109 ;; Interpret mouse-wheel-scroll-amount |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
110 ;; If the scroll-amount is a cons cell instead of a list, |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
111 ;; then the car is the normal speed, the cdr is the slow |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
112 ;; speed, and the fast speed is nil. This is for pre-21.1 |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
113 ;; backward compatibility. |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
114 (defun mouse-wheel-amount (speed) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
115 (cond ((not (consp mouse-wheel-scroll-amount)) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
116 ;; illegal value |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
117 mouse-wheel-scroll-amount) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
118 ((not (consp (cdr mouse-wheel-scroll-amount))) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
119 ;; old-style value: a cons |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
120 (cond ((eq speed 'normal) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
121 (car mouse-wheel-scroll-amount)) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
122 ((eq speed 'slow) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
123 (cdr mouse-wheel-scroll-amount)) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
124 (t |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
125 nil))) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
126 (t |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
127 (cond ((eq speed 'slow) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
128 (nth 0 mouse-wheel-scroll-amount)) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
129 ((eq speed 'normal) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
130 (nth 1 mouse-wheel-scroll-amount)) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
131 (t ;fast |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
132 (nth 2 mouse-wheel-scroll-amount)))))) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
133 |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
134 (defun mouse-wheel-scroll-internal (direction speed) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
135 "Scroll DIRECTION (up or down) SPEED (slow, normal, or fast). |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
136 `mouse-wheel-scroll-amount' defines the speeds." |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
137 (let* ((scrollwin (if mouse-wheel-follow-mouse |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
138 (mouse-wheel-event-window))) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
139 (curwin (if scrollwin |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
140 (selected-window))) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
141 (amt (mouse-wheel-amount speed))) |
26398
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
142 (unwind-protect |
45947
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
143 (progn |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
144 (if scrollwin (select-window scrollwin)) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
145 (if (eq direction 'down) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
146 (scroll-down amt) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
147 (scroll-up amt))) |
26398
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
148 (if curwin (select-window curwin))))) |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
149 |
32867
553975760fe9
(mouse-wheel-mode): New global minor mode.
Miles Bader <miles@gnu.org>
parents:
26410
diff
changeset
|
150 |
45947
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
151 (defun mouse-wheel-scroll-up-fast () |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
152 "Scroll text of current window upward a full screen. |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
153 `mouse-wheel-follow-mouse' controls how the current window is determined. |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
154 `mouse-wheel-scroll-amount' controls the amount of scroll." |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
155 (interactive) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
156 (mouse-wheel-scroll-internal 'up 'fast)) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
157 |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
158 (defun mouse-wheel-scroll-down-fast () |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
159 "Scroll text of current window down a full screen. |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
160 `mouse-wheel-follow-mouse' controls how the current window is determined. |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
161 `mouse-wheel-scroll-amount' controls the amount of scroll." |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
162 (interactive) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
163 (mouse-wheel-scroll-internal 'down 'fast)) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
164 |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
165 (defun mouse-wheel-scroll-up-normal () |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
166 "Scroll text of current window upward a few lines. |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
167 `mouse-wheel-follow-mouse' controls how the current window is determined. |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
168 `mouse-wheel-scroll-amount' controls the amount of scroll." |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
169 (interactive) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
170 (mouse-wheel-scroll-internal 'up 'normal)) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
171 |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
172 (defun mouse-wheel-scroll-down-normal () |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
173 "Scroll text of current window down a few lines. |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
174 `mouse-wheel-follow-mouse' controls how the current window is determined. |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
175 `mouse-wheel-scroll-amount' controls the amount of scroll." |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
176 (interactive) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
177 (mouse-wheel-scroll-internal 'down 'normal)) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
178 |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
179 (defun mouse-wheel-scroll-up-slow () |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
180 "Scroll text of current window upward a line. |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
181 `mouse-wheel-follow-mouse' controls how the current window is determined. |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
182 `mouse-wheel-scroll-amount' controls the amount of scroll." |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
183 (interactive) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
184 (mouse-wheel-scroll-internal 'up 'slow)) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
185 |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
186 (defun mouse-wheel-scroll-down-slow () |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
187 "Scroll text of current window down a line. |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
188 `mouse-wheel-follow-mouse' controls how the current window is determined. |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
189 `mouse-wheel-scroll-amount' controls the amount of scroll." |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
190 (interactive) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
191 (mouse-wheel-scroll-internal 'down 'slow)) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
192 |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
193 |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
194 ;;; helper functions for minor mode mouse-wheel-mode. |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
195 |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
196 (defun mouse-wheel-button-definer (button-pair down-function up-function) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
197 (mouse-wheel-key-definer button-pair 'dn down-function) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
198 (mouse-wheel-key-definer button-pair 'up up-function)) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
199 |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
200 (defun mouse-wheel-key-definer (button-pair up-or-dn function) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
201 (let ((key (if (featurep 'xemacs) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
202 (mouse-wheel-xemacs-key-formatter (car button-pair) up-or-dn) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
203 (mouse-wheel-intern-vector (cdr button-pair) up-or-dn)))) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
204 (cond (mouse-wheel-mode |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
205 (define-key global-map key function)) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
206 ((eq (lookup-key global-map key) 'function) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
207 (define-key global-map key nil))))) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
208 |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
209 (defun mouse-wheel-xemacs-key-formatter (key-format-list up-or-dn) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
210 (cond ((listp key-format-list) ;e.g., (shift "button%d") |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
211 (list (car key-format-list) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
212 (mouse-wheel-xemacs-intern (car (cdr key-format-list)) up-or-dn))) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
213 (t |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
214 (mouse-wheel-xemacs-intern key-format-list up-or-dn)))) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
215 |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
216 (defun mouse-wheel-xemacs-intern (key-format-string up-or-dn) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
217 (intern (format key-format-string |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
218 (if (eq up-or-dn 'up) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
219 mouse-wheel-up-button |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
220 mouse-wheel-down-button)))) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
221 |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
222 (defun mouse-wheel-intern-vector (key-format-string up-or-dn) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
223 "Turns \"mouse-%d\" into [mouse-4]." |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
224 (vector (intern (format key-format-string |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
225 (if (eq up-or-dn 'up) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
226 mouse-wheel-up-button |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
227 mouse-wheel-down-button))))) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
228 |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
229 ;;; Note this definition must be at the end of the file, because |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
230 ;;; `define-minor-mode' actually calls the mode-function if the |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
231 ;;; associated variable is non-nil, which requires that all needed |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
232 ;;; functions be already defined. |
26398
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
233 ;;;###autoload |
32867
553975760fe9
(mouse-wheel-mode): New global minor mode.
Miles Bader <miles@gnu.org>
parents:
26410
diff
changeset
|
234 (define-minor-mode mouse-wheel-mode |
553975760fe9
(mouse-wheel-mode): New global minor mode.
Miles Bader <miles@gnu.org>
parents:
26410
diff
changeset
|
235 "Toggle mouse wheel support. |
553975760fe9
(mouse-wheel-mode): New global minor mode.
Miles Bader <miles@gnu.org>
parents:
26410
diff
changeset
|
236 With prefix argument ARG, turn on if positive, otherwise off. |
553975760fe9
(mouse-wheel-mode): New global minor mode.
Miles Bader <miles@gnu.org>
parents:
26410
diff
changeset
|
237 Returns non-nil if the new state is enabled." |
553975760fe9
(mouse-wheel-mode): New global minor mode.
Miles Bader <miles@gnu.org>
parents:
26410
diff
changeset
|
238 :global t |
553975760fe9
(mouse-wheel-mode): New global minor mode.
Miles Bader <miles@gnu.org>
parents:
26410
diff
changeset
|
239 :group 'mouse |
45947
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
240 ;; This condition-case is here because Emacs 19 will throw an error |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
241 ;; if you try to define a key that it does not know about. I for one |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
242 ;; prefer to just unconditionally do a mwheel-install in my .emacs, so |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
243 ;; that if the wheeled-mouse is there, it just works, and this way it |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
244 ;; doesn't yell at me if I'm on my laptop or another machine, etc. |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
245 (condition-case () |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
246 (progn |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
247 ;; In the latest versions of XEmacs, we could just use |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
248 ;; (S-)*mouse-[45], since those are aliases for the button |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
249 ;; equivalents in XEmacs, but I want this to work in as many |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
250 ;; versions of XEmacs as it can. |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
251 (mouse-wheel-button-definer '("button%d" . "mouse-%d") |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
252 'mouse-wheel-scroll-down-normal 'mouse-wheel-scroll-up-normal) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
253 (mouse-wheel-button-definer '((shift "button%d") . "S-mouse-%d") |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
254 'mouse-wheel-scroll-down-slow 'mouse-wheel-scroll-up-slow) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
255 (mouse-wheel-button-definer '((control "button%d") . "C-mouse-%d") |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
256 'mouse-wheel-scroll-down-fast 'mouse-wheel-scroll-up-fast)) |
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
257 (error nil))) |
32867
553975760fe9
(mouse-wheel-mode): New global minor mode.
Miles Bader <miles@gnu.org>
parents:
26410
diff
changeset
|
258 |
553975760fe9
(mouse-wheel-mode): New global minor mode.
Miles Bader <miles@gnu.org>
parents:
26410
diff
changeset
|
259 ;;; Compatibility entry point |
553975760fe9
(mouse-wheel-mode): New global minor mode.
Miles Bader <miles@gnu.org>
parents:
26410
diff
changeset
|
260 ;;;###autoload |
553975760fe9
(mouse-wheel-mode): New global minor mode.
Miles Bader <miles@gnu.org>
parents:
26410
diff
changeset
|
261 (defun mwheel-install (&optional uninstall) |
553975760fe9
(mouse-wheel-mode): New global minor mode.
Miles Bader <miles@gnu.org>
parents:
26410
diff
changeset
|
262 "Enable mouse wheel support." |
553975760fe9
(mouse-wheel-mode): New global minor mode.
Miles Bader <miles@gnu.org>
parents:
26410
diff
changeset
|
263 (mouse-wheel-mode t)) |
553975760fe9
(mouse-wheel-mode): New global minor mode.
Miles Bader <miles@gnu.org>
parents:
26410
diff
changeset
|
264 |
45947
d8512fb0b229
Allow arbitrary keys for scrolling, add a third
Richard M. Stallman <rms@gnu.org>
parents:
45123
diff
changeset
|
265 |
26398
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
266 (provide 'mwheel) |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
267 |
7eb699cb9ef2
Initial import from perry
William M. Perry <wmperry@aventail.com>
parents:
diff
changeset
|
268 ;;; mwheel.el ends here |