* avoid.el change
@ 2004-03-25 2:01 Richard Stallman
0 siblings, 0 replies; only message in thread
From: Richard Stallman @ 2004-03-25 2:01 UTC (permalink / raw)
Cc: emacs-devel
Does this change look right to you?
From: "Zoran Milojevic" <zoran@sipquest.com>
To: <emacs-pretest-bug@gnu.org>
Date: Tue, 23 Mar 2004 13:05:32 -0500
Organization: Sipquest
Subject: [patch] avoid.el - keep mouse pointer within the same window
Sender: emacs-pretest-bug-bounces+rms=gnu.org@gnu.org
Hi.
The following patch (excuse my lisp) keeps the mouse pointer within the
same window when mouse avoidance mode decides to move it away. Helps
with mouse-autoselect-window turned on.
Cheers,
Zoran Milojevic
Index: lisp/avoid.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/avoid.el,v
retrieving revision 1.35
diff -u -r1.35 avoid.el
--- lisp/avoid.el 1 Sep 2003 15:45:08 -0000 1.35
+++ lisp/avoid.el 23 Mar 2004 17:34:09 -0000
@@ -196,8 +196,9 @@
(defun mouse-avoidance-banish-destination ()
"The position to which mouse-avoidance-mode `banish' moves the mouse.
You can redefine this if you want the mouse banished to a different
corner."
- (cons (1- (frame-width))
- 0))
+ (let* ((pos (window-edges)))
+ (cons (- (nth 2 pos) 2)
+ (nth 1 pos))))
(defun mouse-avoidance-banish-mouse ()
;; Put the mouse pointer in the upper-right corner of the current
frame.
@@ -231,16 +232,21 @@
(let* ((cur (mouse-position))
(cur-frame (car cur))
(cur-pos (cdr cur))
+ (pos (window-edges))
+ (mleft (pop pos))
+ (mtop (pop pos))
+ (mright (pop pos))
+ (mbot (pop pos))
(deltax (mouse-avoidance-delta
(car cur-pos) (- (random mouse-avoidance-nudge-var)
(car mouse-avoidance-state))
mouse-avoidance-nudge-dist mouse-avoidance-nudge-var
- 0 (frame-width)))
+ mleft (1- mright)))
(deltay (mouse-avoidance-delta
(cdr cur-pos) (- (random mouse-avoidance-nudge-var)
(cdr mouse-avoidance-state))
mouse-avoidance-nudge-dist mouse-avoidance-nudge-var
- 0 (frame-height))))
+ mtop (1- mbot))))
(setq mouse-avoidance-state
(cons (+ (car mouse-avoidance-state) deltax)
(+ (cdr mouse-avoidance-state) deltay)))
_______________________________________________
Emacs-pretest-bug mailing list
Emacs-pretest-bug@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-pretest-bug
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-03-25 2:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-25 2:01 avoid.el change Richard Stallman
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).