LOGD ("client id:%d", id);
int filedes[2];
- if (pipe2(filedes,O_CLOEXEC|O_NONBLOCK) ==-1 ) {
+ if (pipe2(filedes,O_CLOEXEC | O_NONBLOCK) == -1) {
LOGW ("create pipe failed");
return;
}
WSCContextISF* ic = find_ic (context_id);
if (!ic) return;
- wl_input_method_context_get_surrounding_text(ic->im_ctx, maxlen_before, maxlen_after, filedes[1]);
+ if (ic->im_ctx)
+ wl_input_method_context_get_surrounding_text(ic->im_ctx, maxlen_before, maxlen_after, filedes[1]);
+
ecore_wl_flush();
close (filedes[1]);
+
if (ic->surrounding_text_fd_read_handler) {
int fd = ecore_main_fd_handler_fd_get(ic->surrounding_text_fd_read_handler);
close(fd);
ecore_main_fd_handler_del(ic->surrounding_text_fd_read_handler);
ic->surrounding_text_fd_read_handler = NULL;
}
+
if (ic->surrounding_text) {
free (ic->surrounding_text);
ic->surrounding_text = NULL;
}
+
ic->surrounding_text_fd_read_handler = ecore_main_fd_handler_add(filedes[0], ECORE_FD_READ, surrounding_text_fd_read_func, ic, NULL, NULL);
}
socket_helper_delete_surrounding_text (int id, uint32 context_id, uint32 offset, uint32 len) {
LOGD ("client id:%d", id);
//panel_slot_delete_surrounding_text (context_id, offset, len);
- wsc_context_delete_surrounding (_focused_ic, offset, len);
+ if (_focused_ic)
+ wsc_context_delete_surrounding (_focused_ic, offset, len);
}
void
socket_helper_set_selection (int id, uint32 context_id, uint32 start, uint32 end) {
LOGD ("client id:%d", id);
- wsc_context_set_selection (_focused_ic, start, end);
+ if (_focused_ic)
+ wsc_context_set_selection (_focused_ic, start, end);
}
void
send_private_command (int id, uint32 context_id, const String& command) {
LOGD ("client id:%d", id);
//panel_slot_send_private_command (context_id, command);
- wl_input_method_context_private_command (_focused_ic->im_ctx, _focused_ic->serial, command.c_str ());
+ if (_focused_ic && _focused_ic->im_ctx)
+ wl_input_method_context_private_command (_focused_ic->im_ctx, _focused_ic->serial, command.c_str ());
}
void