| 235 | } |
| 236 | |
| 237 | void KeyMappingXcb::default_input(int tab, int input_index) |
| 238 | { |
| 239 | /* Input selected */ |
| 240 | SingleInput si = input_list[tab][input_index]; |
| 241 | |
| 242 | /* Remove previous mapping from this key */ |
| 243 | for (auto iter : input_mapping) { |
| 244 | if (iter.second == si) { |
| 245 | input_mapping.erase(iter.first); |
| 246 | break; |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | /* Check if there's a keycode mapped to this keysym */ |
| 251 | if (si.type == SingleInput::IT_KEYBOARD) { |
| 252 | |
| 253 | /* Gather the list of valid X11 KeyCode values */ |
| 254 | xcb_keycode_t min_keycode = xcb_get_setup(conn)->min_keycode; |
| 255 | xcb_keycode_t max_keycode = xcb_get_setup(conn)->max_keycode; |
| 256 | |
| 257 | for (int k=min_keycode; k<=max_keycode; k++) { |
| 258 | xcb_keysym_t ks = xcb_key_symbols_get_keysym(keysyms, k, 0); |
| 259 | if (ks == si.which) { |
| 260 | input_mapping[si.which] = si; |
| 261 | break; |
| 262 | } |
| 263 | } |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | void KeyMappingXcb::buildAllInputs(AllInputs& ai, uint32_t window, SharedConfig& sc, bool mouse_warp) |
| 268 | { |