void ttclsn(void) { int oleave; if (ttymode) ttymode = 0; else return; oleave = leave; leave = 1; ttflsh(); #ifdef HAVE_POSIX_TERMIOS tcsetattr(fileno(termin), TCSADRAIN, &oldterm); #else #ifdef HAVE_SYSV_TERMIO joe_ioctl(fileno(termin), TCSETAW, &oldterm); #else joe_ioctl(fileno(termin), TIOCSETN, &oarg); joe_ioctl(fileno(termin), TIOCSETC, &otarg); joe_ioctl(fileno(termin), TIOCSLTC, &oltarg); #endif #endif leave = oleave; }
int ttgetc() { ttflsh(); if(have) have=0; else if(read(fileno(term),&havec,1)<1) ttsig(0); return havec; }
void edupd(int flg) { W *w; int wid, hei; if (dostaupd) { staupd = 1; dostaupd = 0; } ttgtsz(&wid, &hei); if (nresize(maint->t, wid, hei)) { sresize(maint); #ifdef MOUSE_GPM gpm_mx = wid; gpm_my = hei; #endif } dofollows(); ttflsh(); nscroll(maint->t, BG_COLOR(bg_text)); help_display(maint); w = maint->curwin; do { if (w->y != -1) { if (w->object && w->watom->disp) w->watom->disp(w->object, flg); msgout(w); } w = (W *) (w->link.next); } while (w != maint->curwin); cpos(maint->t, maint->curwin->x + maint->curwin->curx, maint->curwin->y + maint->curwin->cury); staupd = 0; }
void ttputs(unsigned char *s) { while (*s) { obuf[obufp++] = *s++; if (obufp == obufsiz) ttflsh(); } }
int ttgetc() { char c; ttflsh(); if(read(fileno(term),&c,1)<1) ttsig(0); have=0; return c; }
void ttclsn() { int oleave=leave; if(ttymode) ttymode=0; else return; leave=1; ttflsh(); ioctl(fileno(term),TCSETAW,&oldterm); leave=oleave; }
void ttclsn(void) { int oleave; if (ttymode) ttymode = 0; else return; oleave = leave; leave = 1; ttflsh(); tcsetattr(fileno(termin), TCSADRAIN, &oldterm); leave = oleave; }
int ttgetc(void) { int stat; long new_time; int flg; tickon(); loop: flg = 0; /* Status line clock */ new_time = time(NULL); if (new_time != last_time) { last_time = new_time; dostaupd = 1; ticked = 1; } /* Autoscroller */ if (auto_scroll && mnow() >= auto_trig_time) { do_auto_scroll(); ticked = 1; flg = 1; } ttflsh(); while (winched) { winched = 0; edupd(1); ttflsh(); } if (ticked) { edupd(flg); ttflsh(); tickon(); } if (ackkbd != -1) { if (!have) { /* Wait for input */ stat = read(mpxfd, &pack, sizeof(struct packet) - 1024); if (pack.size && stat > 0) { joe_read(mpxfd, pack.data, pack.size); } else if (stat < 1) { if (winched || ticked) goto loop; else ttsig(0); } acceptch = pack.ch; } have = 0; if (pack.who) { /* Got bknd input */ if (acceptch != NO_MORE_DATA) { if (pack.who->func) { pack.who->func(pack.who->object, pack.data, pack.size); edupd(1); } } else mpxdied(pack.who); goto loop; } else { if (acceptch != NO_MORE_DATA) { tickoff(); return acceptch; } else { tickoff(); ttsig(0); return 0; } } } if (have) { have = 0; } else { if (read(fileno(termin), &havec, 1) < 1) { if (winched || ticked) goto loop; else ttsig(0); } } tickoff(); return havec; }