bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#10165: [PATCH] Allow setting corner in mouse avoidance mode.


From: Thierry Volpiatto
Subject: bug#10165: [PATCH] Allow setting corner in mouse avoidance mode.
Date: Sat, 03 Dec 2011 10:26:09 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

Use this, as there is an error in precedent patch (still using value of
old variable), sorry.

--8<---------------cut here---------------start------------->8---
(defun mouse-avoidance-banish-destination ()
  "The position to which Mouse Avoidance mode `banish' moves the mouse.

If you want the mouse banished to a different corner set
`mouse-avoidance-banish-position' as you need."
  (let* ((fra-or-win         (assoc-default
                              'frame-or-window
                              mouse-avoidance-banish-position 'eq))
         (list-values        (case fra-or-win
                               (frame (list 0 0 (frame-width) (frame-height)))
                               (window (window-edges))))
         (alist              (loop for v in list-values
                                   for k in '(left top right bottom)
                                   collect (cons k v)))
         (side               (assoc-default
                              'side
                              mouse-avoidance-banish-position 'eq))
         (side-dist          (assoc-default
                              'side-pos
                              mouse-avoidance-banish-position 'eq))
         (top-or-bottom      (assoc-default
                              'top-or-bottom
                              mouse-avoidance-banish-position 'eq))
         (top-or-bottom-dist (assoc-default
                              'top-or-bottom-pos
                              mouse-avoidance-banish-position 'eq))
         (side-fn            (case side
                               (left '+)
                               (right '-)))
         (top-or-bottom-fn   (case top-or-bottom
                               (top '+)
                               (bottom '-))))
    (cons (funcall side-fn                        ; -/+
                   (assoc-default side alist 'eq) ; right or left
                   side-dist)                     ; distance from side
          (funcall top-or-bottom-fn                        ; -/+
                   (assoc-default top-or-bottom alist 'eq) ; top/bottom
                   top-or-bottom-dist)))) ; distance from top/bottom
--8<---------------cut here---------------end--------------->8---



-- 
  Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 






reply via email to

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