diff options
author | runge <runge@karlrunge.com> | 2009-03-16 11:09:53 -0400 |
---|---|---|
committer | runge <runge@karlrunge.com> | 2009-03-16 11:09:53 -0400 |
commit | 128ee3ec4ebe6dce7d002c33c932c76183c0fa76 (patch) | |
tree | 790e9262aa1376aaf18a1895dc1a1a602cd5465f /x11vnc/keyboard.c | |
parent | 9ae2e8391de9f2e37193c321cc67d526c3ff919f (diff) | |
download | libtdevnc-128ee3ec4ebe6dce7d002c33c932c76183c0fa76.tar.gz libtdevnc-128ee3ec4ebe6dce7d002c33c932c76183c0fa76.zip |
Add some -remap tricks. Limit rfbCFD message count.
Diffstat (limited to 'x11vnc/keyboard.c')
-rw-r--r-- | x11vnc/keyboard.c | 46 |
1 files changed, 38 insertions, 8 deletions
diff --git a/x11vnc/keyboard.c b/x11vnc/keyboard.c index 1edc40b..040b2d0 100644 --- a/x11vnc/keyboard.c +++ b/x11vnc/keyboard.c @@ -2860,6 +2860,8 @@ static void pipe_keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) { if (isbutton) { int mask, button = (int) keysym; int x = cursor_x, y = cursor_y; + char *b, bstr[32]; + if (!down) { return; } @@ -2874,10 +2876,23 @@ static void pipe_keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) { * remap the button click to keystroke sequences! * Usually just will simulate the button click. */ - mask = 1<<(button-1); - pointer(mask, x, y, client); - mask = 0; - pointer(mask, x, y, client); + + /* loop over possible multiclicks: Button123 */ + sprintf(bstr, "%d", button); + b = bstr; + while (*b != '\0') { + char t[2]; + int butt; + t[0] = *b; + t[1] = '\0'; + if (sscanf(t, "%d", &butt) == 1) { + mask = 1<<(butt-1); + pointer(mask, x, y, client); + mask = 0; + pointer(mask, x, y, client); + } + b++; + } return; } @@ -3302,6 +3317,8 @@ void keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) { if (isbutton) { int mask, button = (int) keysym; + char *b, bstr[32]; + if (! down) { return; /* nothing to send */ } @@ -3317,10 +3334,23 @@ void keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) { * remap the button click to keystroke sequences! * Usually just will simulate the button click. */ - mask = 1<<(button-1); - do_button_mask_change(mask, button); /* down */ - mask = 0; - do_button_mask_change(mask, button); /* up */ + + /* loop over possible multiclicks: Button123 */ + sprintf(bstr, "%d", button); + b = bstr; + while (*b != '\0') { + char t[2]; + int butt; + t[0] = *b; + t[1] = '\0'; + if (sscanf(t, "%d", &butt) == 1) { + mask = 1<<(butt-1); + do_button_mask_change(mask, butt); /* down */ + mask = 0; + do_button_mask_change(mask, butt); /* up */ + } + b++; + } XFlush_wr(dpy); X_UNLOCK; return; |