static void candwin_read_cb(int fd, int /* ev */) { char buf[1024]; int n; n = static_cast<int>(read(fd, buf, 1024 - 1)); if (n == 0) { terminate_canddisp_connection(); return; } if (n == -1) return; buf[n] = '\0'; if (!strcmp(buf, "err")) { terminate_canddisp_connection(); return; } InputContext *focusedContext = InputContext::focusedContext(); if (focusedContext) { char *line = buf; char *eol = strchr(line, '\n'); if (eol != NULL) *eol = '\0'; if (strcmp("index", line) == 0) { line = eol + 1; eol = strchr(line, '\n'); if (eol != NULL) *eol = '\0'; int index; sscanf(line, "%d", &index); focusedContext->candidate_select(index); uim_set_candidate_index(focusedContext->getUC(), index); // send packet queue for drawing on-the-spot preedit strings focusedContext->get_ic()->force_send_packet(); } } return; }
void InputContext::candidate_select_cb(void *ptr, int index) { InputContext *ic = (InputContext *)ptr; ic->set_need_hilite_selected_cand(true); ic->candidate_select(index); }