unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Richard Stallman <rms@gnu.org>
Cc: emacs-devel@gnu.org
Subject: avoid.el change
Date: Wed, 24 Mar 2004 21:01:13 -0500	[thread overview]
Message-ID: <E1B6KBF-0001xz-AP@fencepost.gnu.org> (raw)

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

                 reply	other threads:[~2004-03-25  2:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1B6KBF-0001xz-AP@fencepost.gnu.org \
    --to=rms@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).