lkml.org 
[lkml]   [2020]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH v0 4/5] Add support for SRG report output format
    Add SRG ("1005") style mouse reports. Always use them to create a report to
    userspace if they are available because they may contain more information
    (e.g. scroll wheel events).

    Do not send reports at all if report information is not sufficient.

    Signed-off-by: Tammo Block <tammo.block@gmail.com>
    ---
    drivers/tty/vt/vt.c | 26 +++++++++++++++++++++++---
    1 file changed, 23 insertions(+), 3 deletions(-)

    diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
    index 5c9c449dc150..af0c58a9b108 100644
    --- a/drivers/tty/vt/vt.c
    +++ b/drivers/tty/vt/vt.c
    @@ -1835,10 +1835,30 @@ static inline void respond_ID(struct tty_struct *tty)

    void mouse_report(struct tty_struct *tty, int butt, int mrx, int mry)
    {
    - char buf[8];
    + char buf[20];
    + char rel;

    - sprintf(buf, "\033[M%c%c%c", (char)(' ' + (butt & TIOCL_SELBUTTONMASK)),
    - (char)('!' + mrx), (char)('!' + mry));
    + if (butt & TIOCL_SELSRGREPORT) {
    + rel = (butt & TIOCL_SELSRGRELEASE) ? 1 : 0;
    + butt = butt >> 8;
    +
    + if (vc_cons[fg_console].d->vc_proto_mouse) {
    + sprintf(buf, "\033[<%d;%d;%d%c", butt, mrx + 1, mry + 1, rel ? 'm' : 'M');
    + } else {
    + if (rel)
    + butt = (3 | butt);
    + sprintf(buf, "\033[M%c%c%c", (char)(' ' + butt),
    + (char)('!' + mrx), (char)('!' + mry));
    + }
    + } else {
    + /* Compatibility for older protocol */
    + if (vc_cons[fg_console].d->vc_proto_mouse)
    + return;
    + if (vc_cons[fg_console].d->vc_report_mouse > 2)
    + return;
    + sprintf(buf, "\033[M%c%c%c", (char)(' ' + (butt & TIOCL_SELBUTTONMASK)),
    + (char)('!' + mrx), (char)('!' + mry));
    + }
    respond_string(buf, tty->port);
    }

    --
    2.27.0
    \
     
     \ /
      Last update: 2020-06-26 09:28    [W:4.468 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site