emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

avoid.el change


From: Richard Stallman
Subject: avoid.el change
Date: Wed, 24 Mar 2004 21:01:13 -0500

Does this change look right to you?

From: "Zoran Milojevic" <address@hidden>
To: <address@hidden>
Date: Tue, 23 Mar 2004 13:05:32 -0500
Organization: Sipquest
Subject: [patch] avoid.el - keep mouse pointer within the same window
Sender: address@hidden

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
address@hidden
http://mail.gnu.org/mailman/listinfo/emacs-pretest-bug





reply via email to

[Prev in Thread] Current Thread [Next in Thread]