diff options
author | runge <runge> | 2008-09-21 23:04:47 +0000 |
---|---|---|
committer | runge <runge> | 2008-09-21 23:04:47 +0000 |
commit | 16c7ea1b357ab518ee5a40f2a663843f064479a9 (patch) | |
tree | 4f8cceaaa9920ae1ca6e4cb0468e5d87f1d63326 /x11vnc/keyboard.c | |
parent | a1e5d55e356f4913169f6dd746b14548cc51695d (diff) | |
download | libtdevnc-16c7ea1b357ab518ee5a40f2a663843f064479a9.tar.gz libtdevnc-16c7ea1b357ab518ee5a40f2a663843f064479a9.zip |
x11vnc: Add symmetric key encryption -enc cipher:keyfile,
works with SSVNC. Make -remap work on MacOSX console.
update to 0.9.5 strings. Add a couple menu items to tkx11vnc.
Diffstat (limited to 'x11vnc/keyboard.c')
-rw-r--r-- | x11vnc/keyboard.c | 94 |
1 files changed, 65 insertions, 29 deletions
diff --git a/x11vnc/keyboard.c b/x11vnc/keyboard.c index 9f1569b..0859552 100644 --- a/x11vnc/keyboard.c +++ b/x11vnc/keyboard.c @@ -2710,15 +2710,20 @@ static void modifier_tweak_keyboard(rfbBool down, rfbKeySym keysym, void initialize_keyboard_and_pointer(void) { +#ifdef MACOSX + if (macosx_console) { + initialize_remap(remap_file); + initialize_pointer_map(pointer_remap); + } +#endif + RAWFB_RET_VOID if (use_modifier_tweak) { initialize_modtweak(); } - if (remap_file != NULL) { - initialize_remap(remap_file); - } + initialize_remap(remap_file); initialize_pointer_map(pointer_remap); clear_modifiers(1); @@ -2783,13 +2788,67 @@ if (0) fprintf(stderr, "GAI: %s - %s\n", str, cd->input); } } +static void apply_remap(rfbKeySym *keysym, int *isbutton) { + if (keyremaps) { + keyremap_t *remap = keyremaps; + while (remap != NULL) { + if (remap->before == *keysym) { + *keysym = remap->after; + *isbutton = remap->isbutton; + if (debug_keyboard) { + char *str1, *str2; + X_LOCK; + str1 = XKeysymToString(remap->before); + str2 = XKeysymToString(remap->after); + rfbLog("keyboard(): remapping keysym: " + "0x%x \"%s\" -> 0x%x \"%s\"\n", + (int) remap->before, + str1 ? str1 : "null", + (int) remap->after, + remap->isbutton ? "button" : + str2 ? str2 : "null"); + X_UNLOCK; + } + break; + } + remap = remap->next; + } + } +} + /* for -pipeinput mode */ static void pipe_keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) { - int can_input = 0, uid = 0; + int can_input = 0, uid = 0, isbutton = 0; allowed_input_t input; char *name; ClientData *cd = (ClientData *) client->clientData; + apply_remap(&keysym, &isbutton); + + if (isbutton) { + int mask, button = (int) keysym; + int x = cursor_x, y = cursor_y; + if (!down) { + return; + } + if (debug_keyboard) { + rfbLog("keyboard(): remapping keystroke to button %d" + " click\n", button); + } + dtime0(&last_key_to_button_remap_time); + + /* + * This in principle can be a little dicey... i.e. even + * 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); + return; + } + if (pipeinput_int == PIPEINPUT_VID) { v4l_key_command(down, keysym, client); } else if (pipeinput_int == PIPEINPUT_CONSOLE) { @@ -3184,31 +3243,8 @@ void keyboard(rfbBool down, rfbKeySym keysym, rfbClientPtr client) { RAWFB_RET_VOID - if (keyremaps) { - keyremap_t *remap = keyremaps; - while (remap != NULL) { - if (remap->before == keysym) { - keysym = remap->after; - isbutton = remap->isbutton; - if (debug_keyboard) { - char *str1, *str2; - X_LOCK; - str1 = XKeysymToString(remap->before); - str2 = XKeysymToString(remap->after); - rfbLog("keyboard(): remapping keysym: " - "0x%x \"%s\" -> 0x%x \"%s\"\n", - (int) remap->before, - str1 ? str1 : "null", - (int) remap->after, - remap->isbutton ? "button" : - str2 ? str2 : "null"); - X_UNLOCK; - } - break; - } - remap = remap->next; - } - } + + apply_remap(&keysym, &isbutton); if (use_xrecord && ! xrecording && down) { |