aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul LeoNerd Evans <leonerd@leonerd.org.uk>2012-04-12 01:08:12 +0100
committerPaul LeoNerd Evans <leonerd@leonerd.org.uk>2012-04-12 01:08:12 +0100
commit84378bcba829e080a143bba85a1c09e9b1a18b5e (patch)
tree1a3d9d8d2de5a6f0dae2ac3c247f32f2dbda108d
parent60b4bfaf72cab1af28c12031b2ffefc0ec7b1fb6 (diff)
downloadtermo-84378bcba829e080a143bba85a1c09e9b1a18b5e.tar.gz
termo-84378bcba829e080a143bba85a1c09e9b1a18b5e.tar.xz
termo-84378bcba829e080a143bba85a1c09e9b1a18b5e.zip
Allow setting mouse encoding protocol from demo
-rw-r--r--demo.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/demo.c b/demo.c
index ed34d31..dcd3970 100644
--- a/demo.c
+++ b/demo.c
@@ -12,13 +12,14 @@ int main(int argc, char *argv[])
TERMKEY_CHECK_VERSION;
int mouse = 0;
+ int mouse_proto = 0;
TermKeyFormat format = TERMKEY_FORMAT_VIM;
char buffer[50];
TermKey *tk;
int opt;
- while((opt = getopt(argc, argv, "m::")) != -1) {
+ while((opt = getopt(argc, argv, "m::p:")) != -1) {
switch(opt) {
case 'm':
if(optarg)
@@ -28,6 +29,11 @@ int main(int argc, char *argv[])
format |= TERMKEY_FORMAT_MOUSE_POS;
break;
+
+ case 'p':
+ mouse_proto = atoi(optarg);
+ break;
+
default:
fprintf(stderr, "Usage: %s [-m]\n", argv[0]);
return 1;
@@ -44,8 +50,11 @@ int main(int argc, char *argv[])
TermKeyResult ret;
TermKeyKey key;
- if(mouse)
+ if(mouse) {
printf("\033[?%dhMouse mode active\n", mouse);
+ if(mouse_proto)
+ printf("\033[?%dh", mouse_proto);
+ }
while((ret = termkey_waitkey(tk, &key)) != TERMKEY_RES_EOF) {
if(ret == TERMKEY_RES_KEY) {