--- rxvt-unicode/src/keyboard.C 2006/01/02 21:17:01 1.18 +++ rxvt-unicode/src/keyboard.C 2006/02/20 22:40:35 1.25 @@ -1,3 +1,26 @@ +/*----------------------------------------------------------------------* + * File: keyboard.C + *----------------------------------------------------------------------* + * + * All portions of code are copyright by their respective author/s. + * Copyright (c) 2005 WU Fengguang + * Copyright (c) 2005-2006 Marc Lehmann + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + *----------------------------------------------------------------------*/ + #include "../config.h" #include "rxvt.h" @@ -48,22 +71,22 @@ keysym_t keyboard_manager::stock_keymap[] = { /* examples */ /* keysym, state, range, handler, str */ -//{XK_ISO_Left_Tab, 0, 1, keysym_t::NORMAL, "\033[Z"}, +//{XK_ISO_Left_Tab, 0, 1, keysym_t::STRING, "\033[Z"}, //{ 'a', 0, 26, keysym_t::RANGE_META8, "a" "%c"}, //{ 'a', ControlMask, 26, keysym_t::RANGE_META8, "" "%c"}, //{ XK_Left, 0, 4, keysym_t::LIST, ".\033[.DACB."}, //{ XK_Left, ShiftMask, 4, keysym_t::LIST, ".\033[.dacb."}, //{ XK_Left, ControlMask, 4, keysym_t::LIST, ".\033O.dacb."}, -//{ XK_Tab, ControlMask, 1, keysym_t::NORMAL, "\033"}, -//{ XK_apostrophe, ControlMask, 1, keysym_t::NORMAL, "\033"}, -//{ XK_slash, ControlMask, 1, keysym_t::NORMAL, "\033"}, -//{ XK_semicolon, ControlMask, 1, keysym_t::NORMAL, "\033"}, -//{ XK_grave, ControlMask, 1, keysym_t::NORMAL, "\033"}, -//{ XK_comma, ControlMask, 1, keysym_t::NORMAL, "\033"}, -//{ XK_Return, ControlMask, 1, keysym_t::NORMAL, "\033"}, -//{ XK_Return, ShiftMask, 1, keysym_t::NORMAL, "\033"}, -//{ ' ', ShiftMask, 1, keysym_t::NORMAL, "\033"}, -//{ '.', ControlMask, 1, keysym_t::NORMAL, "\033"}, +//{ XK_Tab, ControlMask, 1, keysym_t::STRING, "\033"}, +//{ XK_apostrophe, ControlMask, 1, keysym_t::STRING, "\033"}, +//{ XK_slash, ControlMask, 1, keysym_t::STRING, "\033"}, +//{ XK_semicolon, ControlMask, 1, keysym_t::STRING, "\033"}, +//{ XK_grave, ControlMask, 1, keysym_t::STRING, "\033"}, +//{ XK_comma, ControlMask, 1, keysym_t::STRING, "\033"}, +//{ XK_Return, ControlMask, 1, keysym_t::STRING, "\033"}, +//{ XK_Return, ShiftMask, 1, keysym_t::STRING, "\033"}, +//{ ' ', ShiftMask, 1, keysym_t::STRING, "\033"}, +//{ '.', ControlMask, 1, keysym_t::STRING, "\033"}, //{ '0', ControlMask, 10, keysym_t::RANGE, "0" "\033"}, //{ '0', MetaMask|ControlMask, 10, keysym_t::RANGE, "0" "\033"}, //{ 'a', MetaMask|ControlMask, 26, keysym_t::RANGE, "a" "\033"}, @@ -74,11 +97,11 @@ output_string (rxvt_term *rt, const char *str) { if (strncmp (str, "command:", 8) == 0) - rt->cmd_write ((unsigned char *)str + 8, strlen (str) - 8); + rt->cmd_write (str + 8, strlen (str) - 8); else if (strncmp (str, "perl:", 5) == 0) - PERL_INVOKE((rt, HOOK_KEYBOARD_COMMAND, DT_STRING, str + 5, DT_END)); + HOOK_INVOKE((rt, HOOK_USER_COMMAND, DT_STR, str + 5, DT_END)); else - rt->tt_write ((unsigned char *)str, strlen (str)); + rt->tt_write (str, strlen (str)); } static void @@ -95,12 +118,12 @@ else if (rt->meta_char == C0_ESC) /* escape prefix */ #endif { - const unsigned char ch = C0_ESC; + const char ch = C0_ESC; rt->tt_write (&ch, 1); } } - rt->tt_write ((unsigned char *) buf, buflen); + rt->tt_write (buf, buflen); } static int @@ -194,7 +217,7 @@ { keysym_t *key = new keysym_t; wchar_t *wc = rxvt_mbstowcs (trans); - const char *translation = rxvt_wcstoutf8 (wc); + char *translation = rxvt_wcstoutf8 (wc); free (wc); if (key && translation) @@ -203,7 +226,7 @@ key->state = state; key->range = 1; key->str = translation; - key->type = keysym_t::NORMAL; + key->type = keysym_t::STRING; if (strncmp (translation, "list", 4) == 0 && translation [4]) { @@ -293,7 +316,7 @@ switch (key.type) { - case keysym_t::NORMAL: + case keysym_t::STRING: output_string (term, str); break; @@ -422,7 +445,7 @@ keymap.swap (sorted_keymap); -#if defined (DEBUG_STRICT) || defined (DEBUG_KEYBOARD) +#ifdef DEBUG_STRICT // check for invariants for (i = 0; i < KEYSYM_HASH_BUDGETS; ++i) {