From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.bugs Subject: RE: mouse wheel support in Emacs 21.3.50 Date: Mon, 25 Oct 2004 09:31:34 -0700 Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1098721944 22157 80.91.229.6 (25 Oct 2004 16:32:24 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 25 Oct 2004 16:32:24 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Oct 25 18:32:05 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CM7lM-0005So-00 for ; Mon, 25 Oct 2004 18:32:04 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CM7t1-0005El-2l for geb-bug-gnu-emacs@m.gmane.org; Mon, 25 Oct 2004 12:39:59 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CM7sk-00057U-Hr for bug-gnu-emacs@gnu.org; Mon, 25 Oct 2004 12:39:42 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CM7sj-00056c-GW for bug-gnu-emacs@gnu.org; Mon, 25 Oct 2004 12:39:41 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CM7sj-00056P-1j for bug-gnu-emacs@gnu.org; Mon, 25 Oct 2004 12:39:41 -0400 Original-Received: from [141.146.126.229] (helo=agminet02.oracle.com) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1CM7kv-0005yg-PV; Mon, 25 Oct 2004 12:31:38 -0400 Original-Received: from rgmgw2.us.oracle.com (rgmgw2.us.oracle.com [138.1.191.11]) by agminet02.oracle.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id i9PGVYoP018725; Mon, 25 Oct 2004 09:31:35 -0700 Original-Received: from rgmgw2.us.oracle.com (localhost [127.0.0.1]) by rgmgw2.us.oracle.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id i9PGVYRc017740; Mon, 25 Oct 2004 10:31:34 -0600 Original-Received: from dradamslap (dradams-lap.us.oracle.com [130.35.177.126]) by rgmgw2.us.oracle.com (Switch-3.1.4/Switch-3.1.0) with SMTP id i9PGVYbX017732; Mon, 25 Oct 2004 10:31:34 -0600 Original-To: "Jason Rumney" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-reply-to: X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Importance: Normal X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list 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 Xref: main.gmane.org gmane.emacs.bugs:9442 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:9442 Hi Jason, Thanks for a detailed explanation. Very clear. FYI, I wrote an application that lets you use the mouse wheel (or the arrow keys) to incrementally modify Emacs things (anything, really). This is how I treat the mouse wheel in both Emacs 20 and 21: (cond ;; Emacs 20 mouse wheel. ((and (consp evnt) (equal 'mouse-wheel (event-basic-type (car evnt)))) ...) ;; Emacs 21 mouse wheel: `mwheel.el' ((and (consp evnt) (member (event-basic-type (car evnt)) '(wheel-up wheel-down))) (let ((button (mwheel-event-button evnt))) (cond ((eq button mouse-wheel-down-event) ...) ((eq button mouse-wheel-up-event) ...) (t (error "Bad binding in mwheel-scroll")))) Here is the application, in case you're interested: http://www.emacswiki.org/cgi-bin/wiki/DoReMi. Thanks, Drew -----Original Message-----From: Jason Rumney "Drew Adams" writes: > 1. Bug?: Searching Elisp Info for "wheel" shows nothing that is current. It > shows the same stuff as for Emacs 20 ("mouse-wheel"...). Yet, looking at > real mouse wheel events, I see stuff like wheel-up that is not in Info, and > I don't see "mouse-wheel" in real events. I have updated the elisp manual to reflect the current implementation. The rationale behind it was to separate out the wheel-up and wheel-down events to make it easier for end users to rebind them (the single mouse-wheel event was unusual in that you had to look at the DELTA parameter to see if it was positive or negative, most mouse and keyboard events are simpler). It also allowed us to reuse the mwheel implementation, which had some extra features that the previous Windows-only support did not have. > 3. I'd like to know how to interpret the components of the various mouse > events. In Emacs 20 this was simple; there was just the POSITION and the > DELTA. Now I see lots of components (with no Elisp Info) There is only POSITION (which like in the old mouse-wheel event is a list). > In particular, if I call read-event and get mouse wheel events, where > can I get the DELTA info that used to be there? That is where the double- and triple- modifiers come in, for compatibility with the mouse-4 and mouse-5 way of handling the mouse wheel. > Actually, I can pretty much see what's going on in mwheel-scroll, in terms > of getting the DELTA info (amount), but before I base new code on what > happens in (this 2002) mwheel-scroll code, I wonder if this is a good model; > that is, if this deals with the latest event structure and is the > recommended (i.e. current) way to go about things. I can't see this changing unless X gets proper mouse wheel support instead of emulating mouse-4 and -5. Unfortunately I think too many X applications now have mouse-4 and -5 hardcoded for that to change. One thing that could change is that mouse-4 and mouse-5 could be translated to wheel-up and wheel-down internally by Emacs, but because they come to Emacs as mouse button events, wheel-up and wheel-down will not be able to change I think (eg reintroducing DELTA). > And the whole treatment of the wheel as buttons 4 & 5 is not clear > to me. That is specific to X. On Windows and Mac, wheel-up and wheel-down are used. If you want to write portable code, use mouse-wheel-up-event and mouse-wheel-down-event to determine what events you should be dealing with. > And what if (as I do) I have 5 mouse buttons and a wheel? If you are on Windows or Mac, no problem, since the wheel has its own events. If you're on X, you'll have to map them to mouse-6 and mouse-7 or other applications will become confused (Emacs can be made to handle them as -4 and -5, with the wheel as -6 and -7, but other applications are not so flexible). > 5. Finally, although I have little real hope for this, are there any > guidelines for trying to make code that deals with making the mouse wheel > work in both Emacs 20 and 21? Since Emacs 20 had different mouse wheel handling for different platforms, such guidelines would be quite complex, as would your code for handling the differences. I've never heard of anyone using the mouse wheel in Emacs for anything other than its default scrolling behaviour, so I'm not sure there is any demand for such a guide.