From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.bugs Subject: bug#10165: [PATCH] Allow setting corner in mouse avoidance mode. Date: Thu, 12 Apr 2012 23:12:04 +0200 Message-ID: <87wr5k1wpn.fsf@gmail.com> References: <877h2itald.fsf@gmail.com> <87pqgaj757.fsf@mail.jurta.org> <87liqxj401.fsf@gmail.com> <871uspy0e3.fsf@gmail.com> <87ipm0spfp.fsf@mail.jurta.org> <874nxj4ei8.fsf@gmail.com> <87zkfb2znw.fsf@gmail.com> <87y5uvb5x8.fsf@mail.jurta.org> <87wrafusgd.fsf@gmail.com> <87wraezyvf.fsf@mail.jurta.org> <874nxi7u70.fsf@gmail.com> <877h2eav6t.fsf@gmail.com> <87zkfaxaz2.fsf@gmail.com> <87d3c370j8.fsf@mail.jurta.org> <871usilwpp.fsf@gmail.com> <878vmo8f0e.fsf@mail.jurta.org> <87ty5cs1fo.fsf@gmail.com> <87ehwg6utr.fsf@mail.jurta.org> <87pqfzshcs.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1334265180 20772 80.91.229.3 (12 Apr 2012 21:13:00 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 12 Apr 2012 21:13:00 +0000 (UTC) Cc: 10165@debbugs.gnu.org To: Lars Magne Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Apr 12 23:12:59 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SIRK7-0002nG-5P for geb-bug-gnu-emacs@m.gmane.org; Thu, 12 Apr 2012 23:12:59 +0200 Original-Received: from localhost ([::1]:33652 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SIRK6-0000US-GL for geb-bug-gnu-emacs@m.gmane.org; Thu, 12 Apr 2012 17:12:58 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35586) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SIRK2-0000TZ-Ok for bug-gnu-emacs@gnu.org; Thu, 12 Apr 2012 17:12:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SIRJw-0002s9-Lc for bug-gnu-emacs@gnu.org; Thu, 12 Apr 2012 17:12:54 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58404) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SIRJw-0002rS-FB for bug-gnu-emacs@gnu.org; Thu, 12 Apr 2012 17:12:48 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SIRL8-0005ij-1v for bug-gnu-emacs@gnu.org; Thu, 12 Apr 2012 17:14:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Thierry Volpiatto Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 12 Apr 2012 21:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10165 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 10165-submit@debbugs.gnu.org id=B10165.133426521521939 (code B ref 10165); Thu, 12 Apr 2012 21:14:02 +0000 Original-Received: (at 10165) by debbugs.gnu.org; 12 Apr 2012 21:13:35 +0000 Original-Received: from localhost ([127.0.0.1]:54942 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SIRKd-0005hl-7N for submit@debbugs.gnu.org; Thu, 12 Apr 2012 17:13:35 -0400 Original-Received: from mail-wi0-f174.google.com ([209.85.212.174]:38119) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SIRKW-0005ha-Gk for 10165@debbugs.gnu.org; Thu, 12 Apr 2012 17:13:29 -0400 Original-Received: by wibhr17 with SMTP id hr17so5068305wib.15 for <10165@debbugs.gnu.org>; Thu, 12 Apr 2012 14:12:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=WookQBZ2vMI9iXHlXtoMFdGhUmH8mctOYKYvy+23QzA=; b=CZozwZqvAZx1mZiCYa5dv9/zyfeV1SaJzaKP0wH0B4D3W5zMblgi7b5hVWfjkP9tQm /MnGyXK45ig/HJIkA0Ro0m13A0HX131ATn4mHrGqzJ8h3Eew53hbbJFmD3V9Xu6tA0bI dk5gPqypy/5iSWTqzrnQaGFfUOpNrtUsaMDScIoZhsl0AWEa+Y9pRhoNve2USDm95bLe 7BDO80NSoxfhS4z2G+OMlqAa3PXasxKy/xTkZywmBYPEX1cvbSixUjFYUID/gqxuOnxu mD0L7QddTfkf2e6Qtmyp5hiWe7bhln/TmcTOR39P0WKX89OOIpA42ev+F1ofdvKAfIlm o8qg== Original-Received: by 10.180.85.70 with SMTP id f6mr19271708wiz.5.1334265129081; Thu, 12 Apr 2012 14:12:09 -0700 (PDT) Original-Received: from thierry-MM061 (lbe83-2-78-243-104-167.fbx.proxad.net. [78.243.104.167]) by mx.google.com with ESMTPS id n8sm29759wix.10.2012.04.12.14.12.06 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 12 Apr 2012 14:12:08 -0700 (PDT) In-Reply-To: (Lars Magne Ingebrigtsen's message of "Thu, 12 Apr 2012 22:04:04 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.95 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:58947 Archived-At: --=-=-= Content-Type: text/plain Lars Magne Ingebrigtsen writes: > Thierry Volpiatto writes: > >> Yes you are right, sorry, need to use negative values for such setting. > > There were lots of different versions of the patch, but we're now in > Emacs 24.2 land, so installing this now would be OK. Ok I will install it tomorrow. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=patch-r118474.patch Content-Description: banish mouse # HG changeset patch # User Thierry Volpiatto # Date 1334264470 -7200 # Node ID 3348d7d9ee32577461067f83f3df8f5c9f2106c7 # Parent 6535056f09a7e69005c3ea1402fec39eaa754e5f * lisp/avoid.el Allow customizing position of mouse when banishing. (mouse-avoidance-banish-position): New user variable. (mouse-avoidance-banish-destination): Place mouse pointer according to `mouse-avoidance-banish-position'. diff --git a/lisp/avoid.el b/lisp/avoid.el --- a/lisp/avoid.el +++ b/lisp/avoid.el @@ -115,6 +115,23 @@ :type 'integer :group 'avoid) +(defcustom mouse-avoidance-banish-position '((frame-or-window . frame) + (side . right) + (side-pos . 3) + (top-or-bottom . top) + (top-or-bottom-pos . 0)) + "Position to which Mouse Avoidance mode `banish' moves the mouse. +An alist where keywords mean: +FRAME-OR-WINDOW: banish the mouse to corner of frame or window. +SIDE: banish the mouse on right or left corner of frame or window. +SIDE-POS: Distance from right or left edge of frame or window. +TOP-OR-BOTTOM: banish the mouse to top or bottom of frame or window. +TOP-OR-BOTTOM-POS: Distance from top or bottom edge of frame or window." + :group 'avoid + :type '(alist :key-type symbol :value-type symbol) + :options '(frame-or-window side (side-pos integer) + top-or-bottom (top-or-bottom-pos integer))) + ;; Internal variables (defvar mouse-avoidance-state nil) (defvar mouse-avoidance-pointer-shapes nil) @@ -183,13 +200,45 @@ (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." - (let* ((pos (window-edges))) - (cons (- (nth 2 pos) 2) - (nth 1 pos)))) + +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 (defun mouse-avoidance-banish-mouse () - ;; Put the mouse pointer in the upper-right corner of the current frame. + "Put the mouse pointer to `mouse-avoidance-banish-position'." (mouse-avoidance-set-mouse-position (mouse-avoidance-banish-destination))) (defsubst mouse-avoidance-delta (cur delta dist var min max) --=-=-= Content-Type: text/plain -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 --=-=-=--