Lines Matching refs:kbd
97 struct keyboard *kbd; in keyboard_new() local
132 kbd = calloc(1, sizeof(*kbd)); in keyboard_new()
133 if (!kbd) { in keyboard_new()
138 kbd->path = path; in keyboard_new()
139 kbd->fd = fd; in keyboard_new()
140 kbd->state = state; in keyboard_new()
141 kbd->compose_state = compose_state; in keyboard_new()
142 *out = kbd; in keyboard_new()
157 keyboard_free(struct keyboard *kbd) in keyboard_free() argument
159 if (!kbd) in keyboard_free()
161 if (kbd->fd >= 0) in keyboard_free()
162 close(kbd->fd); in keyboard_free()
163 free(kbd->path); in keyboard_free()
164 xkb_state_unref(kbd->state); in keyboard_free()
165 xkb_compose_state_unref(kbd->compose_state); in keyboard_free()
166 free(kbd); in keyboard_free()
181 struct keyboard *kbds = NULL, *kbd = NULL; in get_keyboards() local
190 ret = keyboard_new(ents[i], keymap, compose_table, &kbd); in get_keyboards()
205 kbd->next = kbds; in get_keyboards()
206 kbds = kbd; in get_keyboards()
241 process_event(struct keyboard *kbd, uint16_t type, uint16_t code, int32_t value) in process_event() argument
252 keymap = xkb_state_get_keymap(kbd->state); in process_event()
258 xkb_keysym_t keysym = xkb_state_key_get_one_sym(kbd->state, keycode); in process_event()
259 xkb_compose_state_feed(kbd->compose_state, keysym); in process_event()
263 test_print_keycode_state(kbd->state, kbd->compose_state, keycode); in process_event()
266 status = xkb_compose_state_get_status(kbd->compose_state); in process_event()
268 xkb_compose_state_reset(kbd->compose_state); in process_event()
272 changed = xkb_state_update_key(kbd->state, keycode, XKB_KEY_UP); in process_event()
274 changed = xkb_state_update_key(kbd->state, keycode, XKB_KEY_DOWN); in process_event()
281 read_keyboard(struct keyboard *kbd) in read_keyboard() argument
287 while ((len = read(kbd->fd, &evs, sizeof(evs))) > 0) { in read_keyboard()
290 process_event(kbd, evs[i].type, evs[i].code, evs[i].value); in read_keyboard()
294 fprintf(stderr, "Couldn't read %s: %s\n", kbd->path, strerror(errno)); in read_keyboard()
306 struct keyboard *kbd; in loop() local
317 for (kbd = kbds; kbd; kbd = kbd->next) { in loop()
320 ev.data.ptr = kbd; in loop()
321 ret = epoll_ctl(epfd, EPOLL_CTL_ADD, kbd->fd, &ev); in loop()
325 kbd->path, strerror(errno)); in loop()
342 kbd = evs[i].data.ptr; in loop()
343 ret = read_keyboard(kbd); in loop()