summaryrefslogtreecommitdiffstats
path: root/sys/teken
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-09-27 18:19:41 +0000
committered <ed@FreeBSD.org>2009-09-27 18:19:41 +0000
commit9ed9beeb2c80690441194fd4c3bf678db65c8870 (patch)
tree69bf6ef33b2ac397085096edc293d509c65f85c6 /sys/teken
parenta0b7c793b48225f55ff16faf7571e9cb2c6ba513 (diff)
downloadFreeBSD-src-9ed9beeb2c80690441194fd4c3bf678db65c8870.zip
FreeBSD-src-9ed9beeb2c80690441194fd4c3bf678db65c8870.tar.gz
Add support for VT200-style mouse input.
Right now if applications want to use the mouse on the command line, they use sysmouse(4) and install a signal handler in the kernel to deliver signals when mouse events arrive. This conflicts with my plan to change to TERM=xterm, so implement proper VT200-style mouse input. Because mouse input is now streamed through the TTY, it means you can now SSH to another system on the console and use the mouse there as well. The disadvantage of the VT200 mouse protocol, is that it doesn't seem to generate events when moving the cursor. Only when pressing and releasing mouse buttons. There are different protocols as well, but this one seems to be most commonly supported. Reported by: Paul B. Mahol <onemda gmail com> Tested with: vim(1)
Diffstat (limited to 'sys/teken')
-rw-r--r--sys/teken/teken.h1
-rw-r--r--sys/teken/teken_subr.h6
2 files changed, 7 insertions, 0 deletions
diff --git a/sys/teken/teken.h b/sys/teken/teken.h
index aab037f..22b5745 100644
--- a/sys/teken/teken.h
+++ b/sys/teken/teken.h
@@ -97,6 +97,7 @@ typedef void tf_param_t(void *, int, unsigned int);
#define TP_SETBELLPD 6
#define TP_SETBELLPD_PITCH(pd) ((pd) >> 16)
#define TP_SETBELLPD_DURATION(pd) ((pd) & 0xffff)
+#define TP_MOUSE 7
typedef void tf_respond_t(void *, const void *, size_t);
typedef struct {
diff --git a/sys/teken/teken_subr.h b/sys/teken/teken_subr.h
index 32cae4d..b8ebcdc 100644
--- a/sys/teken/teken_subr.h
+++ b/sys/teken/teken_subr.h
@@ -932,6 +932,9 @@ teken_subr_reset_dec_mode(teken_t *t, unsigned int cmd)
case 47: /* Switch to alternate buffer. */
teken_printf("Switch to alternate buffer\n");
break;
+ case 1000: /* Mouse input. */
+ teken_funcs_param(t, TP_MOUSE, 0);
+ break;
default:
teken_printf("Unknown DECRST: %u\n", cmd);
}
@@ -1078,6 +1081,9 @@ teken_subr_set_dec_mode(teken_t *t, unsigned int cmd)
case 47: /* Switch to alternate buffer. */
teken_printf("Switch away from alternate buffer\n");
break;
+ case 1000: /* Mouse input. */
+ teken_funcs_param(t, TP_MOUSE, 1);
+ break;
default:
teken_printf("Unknown DECSET: %u\n", cmd);
}
OpenPOWER on IntegriCloud