int Gpm_GetEvent(Gpm_Event *e){ VimEvent event; int n = read(gpm_fd, (void*)&event, sizeof(VimEvent)); if(event.type == VIM_EVENT_TYPE_GPM) { memcpy(e, (void*)&event.event.gpm, sizeof(Gpm_Event)); return 1; }else if(event.type == VIM_EVENT_TYPE_CMD) { do_cmdline_cmd((char_u *) event.event.cmd); }else if(event.type == VIM_EVENT_TYPE_RELINE) { char* str = event.event.cmd; ml_replace(curwin->w_cursor.lnum,(char_u*)str, TRUE); changed_lines(curwin->w_cursor.lnum, 0, curwin->w_cursor.lnum, 1L); }else if(event.type == VIM_EVENT_TYPE_UPDATE){ vimtouch_lock(); update_screen(0); setcursor(); out_flush(); vimtouch_unlock(); }else if(event.type == VIM_EVENT_TYPE_SETCOL){ curwin->w_cursor.col = event.event.num; }else if(event.type == VIM_EVENT_TYPE_SCROLL){ int do_scroll = event.event.num; scroll_redraw(do_scroll > 0, do_scroll>0?do_scroll:-do_scroll); }else if(event.type == VIM_EVENT_TYPE_RESIZE){ out_flush(); shell_resized_check(); redraw_later(CLEAR); update_screen(CLEAR); out_flush(); } return 0; }
static void vimtouch_Exec_setPtyWindowSize(JNIEnv *env, jobject clazz, jobject fileDescriptor, jint row, jint col, jint xpixel, jint ypixel) { int fd; struct winsize sz; fd = env->GetIntField(fileDescriptor, field_fileDescriptor_descriptor); if (env->ExceptionOccurred() != NULL) { return; } sz.ws_row = row; sz.ws_col = col; sz.ws_xpixel = xpixel; sz.ws_ypixel = ypixel; ioctl(fd, TIOCSWINSZ, &sz); vimtouch_lock(); out_flush(); shell_resized_check(); redraw_later(CLEAR); vimtouch_unlock(); //update_screen(CLEAR); //setcursor(); //out_flush(); }
static void updateScreen() { vimtouch_lock(); //redraw_later(NOT_VALID); update_screen(0); //setcursor(); out_flush(); vimtouch_unlock(); }
static int vimtouch_Exec_scrollBy(JNIEnv *env, jobject clazz, jint line) { int do_scroll = line; vimtouch_lock(); scroll_redraw(do_scroll > 0, do_scroll>0?do_scroll:-do_scroll); update_screen(0); out_flush(); vimtouch_unlock(); return line; }
static void vimtouch_Exec_doCommand(JNIEnv *env, jobject clazz, jstring cmd){ if(!cmd) return; const char* str = env->GetStringUTFChars(cmd, NULL); if(!str) return; vimtouch_lock(); do_cmdline_cmd((char_u *)str); vimtouch_unlock(); env->ReleaseStringUTFChars(cmd, str); }