Add a check for the new SRG protocol bit and move masking of report to
report_mouse function (Otherwise all SRG information is lost ...)

Signed-off-by: Tammo Block <tammo.bl...@gmail.com>
---
 drivers/tty/vt/selection.c | 6 +++---
 drivers/tty/vt/vt.c        | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c
index 31bb3647a99c..75e7995ddc70 100644
--- a/drivers/tty/vt/selection.c
+++ b/drivers/tty/vt/selection.c
@@ -331,9 +331,9 @@ static int vc_selection(struct vc_data *vc, struct 
tiocl_selection *v,
        v->xe = min_t(u16, v->xe - 1, vc->vc_cols - 1);
        v->ye = min_t(u16, v->ye - 1, vc->vc_rows - 1);
 
-       if (mouse_reporting() && (v->sel_mode & TIOCL_SELMOUSEREPORT)) {
-               mouse_report(tty, v->sel_mode & TIOCL_SELBUTTONMASK, v->xs,
-                            v->ys);
+       if (mouse_reporting() && (v->sel_mode &
+               (TIOCL_SELMOUSEREPORT | TIOCL_SELSRGREPORT))) {
+               mouse_report(tty, v->sel_mode, v->xs, v->ys);
                return 0;
        }
 
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index d52ac57034e0..5c9c449dc150 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -1837,8 +1837,8 @@ void mouse_report(struct tty_struct *tty, int butt, int 
mrx, int mry)
 {
        char buf[8];
 
-       sprintf(buf, "\033[M%c%c%c", (char)(' ' + butt), (char)('!' + mrx),
-               (char)('!' + mry));
+       sprintf(buf, "\033[M%c%c%c", (char)(' ' + (butt & TIOCL_SELBUTTONMASK)),
+               (char)('!' + mrx), (char)('!' + mry));
        respond_string(buf, tty->port);
 }
 
-- 
2.27.0

Reply via email to