… | |
… | |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * |
4 | * |
5 | * All portions of code are copyright by their respective author/s. |
5 | * All portions of code are copyright by their respective author/s. |
6 | * Copyright (c) 2005 WU Fengguang |
6 | * Copyright (c) 2005 WU Fengguang |
7 | * Copyright (c) 2005-2006 Marc Lehmann <schmorp@schmorp.de> |
7 | * Copyright (c) 2005-2006 Marc Lehmann <schmorp@schmorp.de> |
|
|
8 | * Copyright (c) 2015 Emanuele Giaquinta <e.giaquinta@glauco.it> |
8 | * |
9 | * |
9 | * This program is free software; you can redistribute it and/or modify |
10 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by |
11 | * it under the terms of the GNU General Public License as published by |
11 | * the Free Software Foundation; either version 3 of the License, or |
12 | * the Free Software Foundation; either version 3 of the License, or |
12 | * (at your option) any later version. |
13 | * (at your option) any later version. |
… | |
… | |
132 | |
133 | |
133 | keymap.push_back (key); |
134 | keymap.push_back (key); |
134 | hash[0] = 3; |
135 | hash[0] = 3; |
135 | } |
136 | } |
136 | |
137 | |
137 | bool |
138 | keysym_t * |
138 | keyboard_manager::dispatch (rxvt_term *term, KeySym keysym, unsigned int state, const char *kbuf, int len) |
139 | keyboard_manager::lookup_keysym (rxvt_term *term, KeySym keysym, unsigned int state) |
139 | { |
140 | { |
140 | assert (("register_done() need to be called", hash[0] == 0)); |
141 | assert (("register_done() need to be called", hash[0] == 0)); |
141 | |
142 | |
142 | state &= OtherModMask; // mask out uninteresting modifiers |
143 | state &= OtherModMask; // mask out uninteresting modifiers |
143 | |
144 | |
… | |
… | |
148 | if (!!(term->priv_modes & PrivMode_aplKP) != !!(state & ShiftMask)) |
149 | if (!!(term->priv_modes & PrivMode_aplKP) != !!(state & ShiftMask)) |
149 | state |= AppKeypadMask; |
150 | state |= AppKeypadMask; |
150 | |
151 | |
151 | int index = find_keysym (keysym, state); |
152 | int index = find_keysym (keysym, state); |
152 | |
153 | |
153 | if (index >= 0) |
154 | return index >= 0 ? keymap [index] : 0; |
154 | { |
155 | } |
155 | keysym_t *key = keymap [index]; |
|
|
156 | |
156 | |
|
|
157 | bool |
|
|
158 | keyboard_manager::dispatch (rxvt_term *term, KeySym keysym, unsigned int state, const char *kbuf, int len) |
|
|
159 | { |
|
|
160 | keysym_t *key = lookup_keysym (term, keysym, state); |
|
|
161 | |
|
|
162 | if (key) |
|
|
163 | { |
157 | if (key->type == keysym_t::BUILTIN_STRING) |
164 | if (key->type == keysym_t::BUILTIN_STRING) |
158 | { |
165 | { |
159 | term->tt_write_user_input (kbuf, len); |
166 | term->tt_write_user_input (kbuf, len); |
160 | return true; |
167 | return true; |
161 | } |
168 | } |