Bug 304686 - Support for xterm's 1006 mouse extension
Summary: Support for xterm's 1006 mouse extension
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: emulation (show other bugs)
Version: 2.9
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-06 20:30 UTC by Egmont Koblinger
Modified: 2012-09-03 21:49 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 4.10


Attachments
support xterm's 1006 mouse mode (5.54 KB, patch)
2012-08-06 20:32 UTC, Egmont Koblinger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Egmont Koblinger 2012-08-06 20:30:57 UTC
This is a followup of bug 285984. Could you please apply the attached patch?

The extension in the referred bug (invented by urxvt's author) allows the terminal to report coordinates beyond 223. However, for multiple reasons, xterm's author decided to come up with another extension, addressing the same issue and more. His reasons are, quoting from xterm's changelog:

 o  the responses will not be confused with line-deletion and scrolling controls. [This matters when using a control sequence that reports back control sequences, apparently only supported by xterm - this comment was added by me]
 o  the button encoding is a little simpler, since it does not add an unnecessary 32 because the integer parameter does not have to be represented as a printable character.
 o  the control responses for pressing and releasing a mouse button differ, allowing an application to tell which button was released.

My reasons in favor of the new extension are:

 o  It is much easier to patch in support for this new extension into already existing applications. The urxvt extension, due to the lack of a unique prefix, usually requires heavy modifications in application sources which look up escapes in a table or search tree. The new extension has a prefix that you can recognize and jump into the code that's responsible solely for parsing the remaining arguments.
 o  Emacs-25 will support this new extension only, and not the other one, see http://bzr.savannah.gnu.org/lh/emacs/trunk/revision/109093 . The reason is what I mentioned in the previous point. Implementing the urxvt extension would have required ugly hacks extending the interface between the C and the Lisp code (as there's a moment where neither the C engine responsible for generic stuff, nor the Lisp extension responsible for parsing mouse events knows to whom the currently seen partial escape will belong to), while the new extension could easily be implemented solely in Lisp. (And, of course, I have verified that emacs trunk on konsole with my patch indeed works.)
 o  Similarly, I created a while ago the patch for midnight commander using the old extension, and I know that most of the bloatware I needed to add could be removed with the new one. I also created patch for both extensions for the joe text editor, the one for the new extension is way simpler and more straightforward, more likely to be accepted by mainstream. I think I have a good reason to assume that for dozens of other applications out there the situation would be similar.

A note about the patch: I had to slightly modify the meaning of the arguments to the sendMouseEvent method, which looks like an externally scriptable interface. Unfortunately the old semantics only allows to release an unspecified button, which concept does not exist in the new protocol. Even though undocumented, the old values passed to the method (i.e. eventType==0 and cb==3 meaning a button release) still work if the new 1006 mode is off. I hope that such a backwards compatibility glitch is acceptable (the 1006 mode is hardly used by anyone yet, it gives a large time frame for everyone to migrate to the new values), as I have no idea how it could be avoided.


Reproducible: Always
Comment 1 Egmont Koblinger 2012-08-06 20:32:28 UTC
Created attachment 72994 [details]
support xterm's 1006 mouse mode
Comment 2 Kurt Hindenburg 2012-09-03 21:49:50 UTC
Git commit c83e7b638dcc42b617a067e6dc23686eccf23b00 by Kurt Hindenburg.
Committed on 03/09/2012 at 23:07.
Pushed by hindenburg into branch 'master'.

Add support for xterm's 1006 mouse extension

The extension committed in bko 285984 (invented by urxvt's author)
allows the terminal to report coordinates beyond 223. However, for
multiple reasons, xterm's author decided to come up with another
extnsion, addressing the same issue and more.

See more info on this bko 304686

An followup to bko 285984, b876f2a3edcb63f29588fdde6b20dc6c9d13bc24
Patch by Egmont Koblinger egmont@gmail.com
FIXED-IN: 4.10

M  +4    -4    src/TerminalDisplay.cpp
M  +18   -4    src/Vt102Emulation.cpp
M  +6    -5    src/Vt102Emulation.h

http://commits.kde.org/konsole/c83e7b638dcc42b617a067e6dc23686eccf23b00