From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: olaf.rogalsky@gmail.com Newsgroups: gmane.emacs.bugs Subject: bug#19416: 25.0.50; enhancement of xterm mouse tracking: draging the mouse now generates mouse-movement events Date: Sat, 20 Dec 2014 01:00:19 +0100 Message-ID: <87d27fqjfw.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1419034884 30236 80.91.229.3 (20 Dec 2014 00:21:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 20 Dec 2014 00:21:24 +0000 (UTC) To: 19416@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Dec 20 01:21:18 2014 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 1Y27nJ-0000OQ-I6 for geb-bug-gnu-emacs@m.gmane.org; Sat, 20 Dec 2014 01:21:17 +0100 Original-Received: from localhost ([::1]:32770 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y27nI-0007mC-SX for geb-bug-gnu-emacs@m.gmane.org; Fri, 19 Dec 2014 19:21:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39792) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y27nA-0007kt-7u for bug-gnu-emacs@gnu.org; Fri, 19 Dec 2014 19:21:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y27n4-0006fI-NJ for bug-gnu-emacs@gnu.org; Fri, 19 Dec 2014 19:21:08 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:42628) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y27n4-0006fD-Ig for bug-gnu-emacs@gnu.org; Fri, 19 Dec 2014 19:21:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Y27n4-0000OA-1a for bug-gnu-emacs@gnu.org; Fri, 19 Dec 2014 19:21:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: olaf.rogalsky@gmail.com Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 20 Dec 2014 00:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 19416 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.14190348051415 (code B ref -1); Sat, 20 Dec 2014 00:21:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 20 Dec 2014 00:20:05 +0000 Original-Received: from localhost ([127.0.0.1]:51994 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Y27m5-0000MN-OS for submit@debbugs.gnu.org; Fri, 19 Dec 2014 19:20:04 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:34439) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Y27TR-0008Lz-Hu for submit@debbugs.gnu.org; Fri, 19 Dec 2014 19:00:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y27TL-0007vo-Pv for submit@debbugs.gnu.org; Fri, 19 Dec 2014 19:00:45 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:40982) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y27TL-0007vj-Gh for submit@debbugs.gnu.org; Fri, 19 Dec 2014 19:00:39 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36103) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y27TD-0004aj-II for bug-gnu-emacs@gnu.org; Fri, 19 Dec 2014 19:00:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y27T8-0007qx-06 for bug-gnu-emacs@gnu.org; Fri, 19 Dec 2014 19:00:31 -0500 Original-Received: from mail-wg0-x22f.google.com ([2a00:1450:400c:c00::22f]:42832) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y27T7-0007qP-Iv for bug-gnu-emacs@gnu.org; Fri, 19 Dec 2014 19:00:25 -0500 Original-Received: by mail-wg0-f47.google.com with SMTP id n12so2586201wgh.20 for ; Fri, 19 Dec 2014 16:00:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type; bh=kkIP8Zm11N/nyPBnjOzwdT5hx5yxzkgnZN9MVttnvyU=; b=cpzTA5hbGAsaUrKbEEj1Vl7qnv7iTzy+nTV8r4LZck9zjQ62bsA3eBeGoErdDMRm6z H1mlw6kqwX5+cEBr7LYx38GnF32tKKvtLKxEmtKklmRCazWC+G3DBaPl/ng3B5z45xhc EDLMWDCdP1er8za3szvlqDWokw6W8fMHi+3PYKz4ccvTOEQUOaX/SuUUJvEkDcFxoYB4 NJW6pUiec/scQLJeZ7sHuxh/Vbs51aUk9tGvWRgfXLpG1QNXGOC2/vOM2C4/ySkDOst3 wqkb6V1xJt6peccmsEr14U9zR1e7Q3bqy8abyLUa7TM/2FScZdYeFRZ1x0ya9jkNaFGa LrbA== X-Received: by 10.194.2.34 with SMTP id 2mr19822101wjr.58.1419033624138; Fri, 19 Dec 2014 16:00:24 -0800 (PST) Original-Received: from blaubaer (p5B21D11B.dip0.t-ipconnect.de. [91.33.209.27]) by mx.google.com with ESMTPSA id wz5sm14447122wjc.29.2014.12.19.16.00.21 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 19 Dec 2014 16:00:22 -0800 (PST) X-Google-Original-From: olaf.rogalsky@aol.com X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Mailman-Approved-At: Fri, 19 Dec 2014 19:20:00 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x 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:97587 Archived-At: --=-=-= Content-Type: text/plain Hi, xterm-mouse-mode (of cause, when used in a xterm window) currently does not create mouse-motion events while dragging the mouse. Therefore, selecting a region with mouse (press button-1 and start dragging, not yet releasing the button) gives no visible feedback about the so far selected region. Similar, dragging the mode-line of a window in a splitted frame gives no feedback of the amount of window size change. The effect of dragging the mouse becomes appearent only after release of the button. I prepared a patch, which greates motion-events while dragging, so that visible feedback now is given immediately. Further, the patch unifies the code for the default mouse protocol encoding (enabled by "\e[?1000h" or "\e[?1002h") and the extended encoding ("\e[?1005h"). It would be nice, if the patch could find its way into emacs. Thanks, Olaf --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=xterm-mouse-motion.patch Content-Description: mouse-motion events for xterm while dragging the mouse --- /home/olaf/src/emacs/emacs/lisp/xt-mouse.el 2014-12-13 18:29:19.515492821 +0100 +++ xt-mouse.el 2014-12-19 17:58:20.240967393 +0100 @@ -60,8 +60,8 @@ (ev-data (nth 1 event)) (ev-where (nth 1 ev-data)) (vec (vector event)) - (is-down (string-match "down-" (symbol-name ev-command)))) - + (is-down (string-match "down-" (symbol-name ev-command))) + (is-move (eq 'mouse-movement ev-command))) ;; Mouse events symbols must have an 'event-kind property with ;; the value 'mouse-click. (when ev-command (put ev-command 'event-kind 'mouse-click)) @@ -71,11 +71,12 @@ (is-down (setf (terminal-parameter nil 'xterm-mouse-last-down) event) vec) + (is-move vec) (t (let* ((down (terminal-parameter nil 'xterm-mouse-last-down)) (down-data (nth 1 down)) (down-where (nth 1 down-data))) - (setf (terminal-parameter nil 'xterm-mouse-last-down) nil) + (setf (terminal-parameter nil 'xterm-mouse-last-down) nil) (cond ((null down) ;; This is an "up-only" event. Pretend there was an up-event @@ -132,65 +133,106 @@ (fdiff (- f (* 1.0 maxwrap dbig)))) (+ (truncate fdiff) (* maxwrap dbig)))))) -;; Normal terminal mouse click reporting: expect three bytes, of the -;; form . Return a list (EVENT-TYPE X Y). -(defun xterm-mouse--read-event-sequence-1000 () - (let* ((code (- (read-event) 32)) - (type - ;; For buttons > 3, the release-event looks differently - ;; (see xc/programs/xterm/button.c, function EditorButton), - ;; and come in a release-event only, no down-event. - (cond ((>= code 64) - (format "mouse-%d" (- code 60))) - ((memq code '(8 9 10)) - (format "M-down-mouse-%d" (- code 7))) - ((memq code '(3 11)) - (let ((down (car (terminal-parameter - nil 'xterm-mouse-last-down)))) - (when (and down (string-match "[0-9]" (symbol-name down))) - (format (if (eq code 3) "mouse-%s" "M-mouse-%s") - (match-string 0 (symbol-name down)))))) - ((memq code '(0 1 2)) - (format "down-mouse-%d" (+ 1 code))))) - (x (- (read-event) 33)) - (y (- (read-event) 33))) - (and type (wholenump x) (wholenump y) - (list (intern type) x y)))) - -;; XTerm's 1006-mode terminal mouse click reporting has the form -;;