unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ryan Johnson <ryanjohn@ece.cmu.edu>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Subject: Re: Best way to intercept terminal escape sequences?
Date: Sat, 28 Aug 2010 22:34:22 +0200	[thread overview]
Message-ID: <4C7972CE.6070305@ece.cmu.edu> (raw)
In-Reply-To: <jwvd3t2ol0p.fsf-monnier+emacs@gnu.org>

  On 8/28/2010 4:47 PM, Stefan Monnier wrote:
>> That might make sense... the caller could always apply the coding system
>> manually before dumping things back in the unread-command-events queue.
> Or coding-system decoding should be applied to events from
> unread-command-events.
That would basically be the proposed 'read-byte' behavior, then? Where 
read-char can filter out the raw inputs, and anything that it puts back 
goes through the whole input processing chain? Works for me!
>> Who currently uses read-* that might be affected? xt-mouse.el would love it,
>> mouse.el certainly won't care, and other xterm processing will
>> be indifferent.
> As mentioned, read-event did not do obey keyboard-coding-system in
> earlier Emacsen, so any affected package is more likely to be fixed than
> broken by making a change that reverts to this previous behavior.
Assuming this does get fixed, the xterm mouse events will be vastly more 
reliable.

Meanwhile, I've got a patch mostly ready which makes xt-mouse.el behave 
much more like native mouse. Xterm has a mode which sends mouse motion 
events whenever a button is down, and making mouse.el use read-key lets 
me send those events separately. The result is that clicking and 
dragging are highly responsive, where before you didn't see anything 
happen until after button release. The visual feedback is really helpful 
when dragging to highlight text.

I should also be able to add support for multi-click by emulating the 
behavior described in the elisp manual. I kind of hoped the emacs core 
would do that for me, given a stream of mouse-down and mouse-up events, 
but it doesn't. Oh well... some more code to write but nothing terrible. 
The only thing that would be missing is support for track-mouse and 
mouse-face, because they're hardwired in C.

It would be really nice if there were a way to hook into the native 
mouse subsystem rather than reinventing the wheel... it already computes 
what window/buffer a given coordinate is in, grabs timestamps, detects 
multi-click, and implements track-mouse/mouse-face. Assuming proper 
hooks were available, xterm does have a full mouse-tracking mode which 
we could use. That's way over my head to tackle, though.

Should I clean up the current patch, try to add multi-click, or see if 
somebody wants to expose some native mouse hooks?

Ryan




  reply	other threads:[~2010-08-28 20:34 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20100827142724.E1DD712F@hazard.ece.cmu.edu>
2010-08-27 14:44 ` Best way to intercept terminal escape sequences? Ryan Johnson
2010-08-27 15:40   ` Eli Zaretskii
2010-08-27 18:04     ` Ryan Johnson
2010-08-27 20:38       ` Eli Zaretskii
2010-08-27 23:54     ` Stefan Monnier
2010-08-28  7:54       ` Ryan Johnson
2010-08-28 14:47         ` Stefan Monnier
2010-08-28 20:34           ` Ryan Johnson [this message]
2010-08-31 23:12           ` Ryan Johnson
2010-09-02 10:53             ` Stefan Monnier
2010-09-02 12:33               ` Ryan Johnson
2010-09-04 13:01                 ` Improve input handling documentation (was Re: Best way to intercept terminal escape sequences?) Štěpán Němec
     [not found]               ` <jwvy6bfdp23.fsf-monnier+emacs@gnu.org>
2010-09-07  0:32                 ` Best way to intercept terminal escape sequences? Kenichi Handa
2010-09-08  9:05                   ` Stefan Monnier
     [not found] <20100827112348.5023B3D5@osgood.ece.cmu.edu>
2010-08-27 13:56 ` Ryan Johnson
2010-08-27 14:17   ` David Kastrup
2010-08-26 15:58 Ryan Johnson
2010-08-26 23:03 ` Stefan Monnier
2010-08-27  9:28   ` Ryan Johnson
2010-08-27 10:36     ` David Kastrup
2010-08-27 23:50       ` Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2010-08-26 13:22 Ryan Johnson

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=4C7972CE.6070305@ece.cmu.edu \
    --to=ryanjohn@ece.cmu.edu \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).