unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* avoid.el patch
@ 2004-04-24 14:28 Richard Stallman
  2004-08-20 22:01 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Stallman @ 2004-04-24 14:28 UTC (permalink / raw)


Boris Goldowsky didn't respond about this; could someone see if it
looks right, and if so install it?  It is small enough to be a (tiny
change).

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] 2+ messages in thread

* Re: avoid.el patch
  2004-04-24 14:28 avoid.el patch Richard Stallman
@ 2004-08-20 22:01 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2004-08-20 22:01 UTC (permalink / raw)
  Cc: emacs-devel

> Boris Goldowsky didn't respond about this; could someone see if it
> looks right, and if so install it?  It is small enough to be a (tiny
> change).

It looks right and seems to behave right as well.
I've installed it (along with a few other changes to make life a bit less
miserable when the mode is on).


        Stefan


> 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



> _______________________________________________
> Emacs-devel mailing list
> Emacs-devel@gnu.org
> http://mail.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-08-20 22:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-24 14:28 avoid.el patch Richard Stallman
2004-08-20 22:01 ` Stefan Monnier

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).