Darryl Okahata <darrylo(a)sr.hp.com> wrote:
I also understand the opposing viewpoint (regarding viewports)
...
and I can see the reasoning behind it ... but I don't think that way. ;-)
=20
If modeline dragging via the mouse is ever allowed, I think we'll
need a config variable to control the movement direction, because there
are too many people in either groups. (Me, I don't care what the
default is, as long as there's a way to change it.)
OK. Since I also want it, I propose the following patch. The default
behavior is *not* to scroll the modeline, and you have options to scroll it
either way. I'm also working in adding scrollbar-like arrows at both ends.
2000-01-07 Didier Verna <didier(a)xemacs.org>
* modeline.el (modeline-scrolling-method): new variable.
(mouse-drag-modeline): add reference to it in the docstring.
(mouse-drag-modeline): handle it.
Index: lisp/modeline.el
RCS file: /usr/CVSroot/XEmacs/xemacs/lisp/modeline.el,v
retrieving revision 1.18.2.3
diff -u -r1.18.2.3 modeline.el
--- modeline.el 2000/01/04 08:50:58 1.18.2.3
+++ modeline.el 2000/01/07 12:59:23
@@ -59,11 +59,26 @@
:type 'boolean
:group 'modeline)
+(defcustom modeline-scrolling-method nil
+ "*If non-nil, dragging the modeline with the mouse may also scroll its
+text horizontally (vertical motion controls window resizing and horizontal
+motion controls modeline scrolling).
+
+With a value of t, the modeline text is scrolled in the same direction as
+the mouse motion. With a value of 'scrollbar, the modeline is considered as
+a scrollbar for its own text, which then moves in the opposite direction."
+ :type '(choice (const :tag "none" nil)
+ (const :tag "text" t)
+ (const :tag "scrollbar" 'scrollbar))
+ :group 'modeline)
+
(defun mouse-drag-modeline (event)
"Resize a window by dragging its modeline.
This command should be bound to a button-press event in modeline-map.
Holding down a mouse button and moving the mouse up and down will
-make the clicked-on window taller or shorter."
+make the clicked-on window taller or shorter.
+
+See also the variable `modeline-scrolling-method'."
(interactive "e")
(or (button-press-event-p event)
(error "%s must be invoked by a mouse-press" this-command))
@@ -79,6 +94,9 @@
(start-event-frame (event-frame event))
(start-event-window (event-window event))
(start-nwindows (count-windows t))
+ (hscroll-delta (face-width 'modeline))
+ (start-hscroll (modeline-hscroll (event-window event)))
+ (start-x-pixel (event-x-pixel event))
(last-timestamp 0)
default-line-height
modeline-height
@@ -138,6 +156,9 @@
;; scroll) nore Y pos (modeline drag) have changed.
(and modeline-click-swaps-buffers
(=3D depress-line (event-y event))
+ (or (not modeline-scrolling-method)
+ (=3D start-hscroll
+ (modeline-hscroll start-event-window)))
(modeline-swap-buffers event)))
((button-event-p event)
(setq done t))
@@ -149,6 +170,14 @@
drag-divider-event-lag)
nil)
(t
+ (when modeline-scrolling-method
+ (let ((delta (/ (- (event-x-pixel event) start-x-pixel)
+ hscroll-delta)))
+ (set-modeline-hscroll start-event-window
+ (if (eq modeline-scrolling-method t)
+ (- start-hscroll delta)
+ (+ start-hscroll delta)))
+ ))
(setq last-timestamp (event-timestamp event)
y (event-y-pixel event)
edges (window-pixel-edges start-event-window)
--
/ / _ _ Didier Verna
http://www.inf.enst.fr/~verna/
- / / - / / /_/ / EPITA / LRDE mailto:didier@epita.fr
/_/ / /_/ / /__ / 14-16 rue Voltaire Tel. +33 (1) 44 08 01 77
94276 Kremlin-Bicêtre cedex Fax. +33 (1) 44 08 01 99