diff options
| author | blymn <blymn@NetBSD.org> | 2001-12-31 14:23:11 +0000 |
|---|---|---|
| committer | blymn <blymn@NetBSD.org> | 2001-12-31 14:23:11 +0000 |
| commit | 64df79afe7deeff8af81fea5064bd1cd4a98a18b (patch) | |
| tree | 07eb6dcf37d4d1eaefe53e78055ffa14b820361a /lib/libcurses | |
| parent | 4118c45610d6e50f0acd3d76d36b82790172474c (diff) | |
fix __startwin() so it outputs the init strings to the correct device.
Diffstat (limited to 'lib/libcurses')
| -rw-r--r-- | lib/libcurses/curses_private.h | 4 | ||||
| -rw-r--r-- | lib/libcurses/putchar.c | 20 | ||||
| -rw-r--r-- | lib/libcurses/refresh.c | 45 | ||||
| -rw-r--r-- | lib/libcurses/tty.c | 15 |
4 files changed, 58 insertions, 26 deletions
diff --git a/lib/libcurses/curses_private.h b/lib/libcurses/curses_private.h index 2b7fd63c86f..3b373ab81da 100644 --- a/lib/libcurses/curses_private.h +++ b/lib/libcurses/curses_private.h @@ -1,4 +1,4 @@ -/* $NetBSD: curses_private.h,v 1.18 2001/12/11 11:18:17 blymn Exp $ */ +/* $NetBSD: curses_private.h,v 1.19 2001/12/31 14:23:11 blymn Exp $ */ /*- * Copyright (c) 1998-2000 Brett Lymn @@ -247,11 +247,13 @@ extern SCREEN *_cursesi_screen; /* The current screen in use */ #ifdef DEBUG void __CTRACE(const char *fmt, ...); #endif +void __cputchar_args(char ch, void *args); void _cursesi_free_keymap(keymap_t *map); int _cursesi_gettmode(SCREEN *screen); void _cursesi_reset_acs(SCREEN *screen); void _cursesi_resetterm(SCREEN *screen); int _cursesi_setterm(char *type, SCREEN *screen); +int _cursesi_wnoutrefresh(SCREEN *screen, WINDOW *win); int __delay(void); unsigned int __hash(char *s, int len); void __id_subwins(WINDOW *orig); diff --git a/lib/libcurses/putchar.c b/lib/libcurses/putchar.c index 65e0ca265f8..b9c193ef63b 100644 --- a/lib/libcurses/putchar.c +++ b/lib/libcurses/putchar.c @@ -1,4 +1,4 @@ -/* $NetBSD: putchar.c,v 1.14 2001/12/02 09:14:22 blymn Exp $ */ +/* $NetBSD: putchar.c,v 1.15 2001/12/31 14:23:11 blymn Exp $ */ /* * Copyright (c) 1981, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)putchar.c 8.2 (Berkeley) 5/4/94"; #else -__RCSID("$NetBSD: putchar.c,v 1.14 2001/12/02 09:14:22 blymn Exp $"); +__RCSID("$NetBSD: putchar.c,v 1.15 2001/12/31 14:23:11 blymn Exp $"); #endif #endif /* not lint */ @@ -54,3 +54,19 @@ __cputchar(int ch) #endif return (putc(ch, _cursesi_screen->outfd)); } + +/* + * This is the same as __cputchar but the extra argument holds the file + * descriptor to write the output to. This function can only be used with + * the "new" libterm interface. + */ +void +__cputchar_args(char ch, void *args) +{ + FILE *outfd = (FILE *) args; + +#ifdef DEBUG + __CTRACE("__cputchar_args: %s on fd %d\n", unctrl(ch), outfd); +#endif + putc(ch, outfd); +} diff --git a/lib/libcurses/refresh.c b/lib/libcurses/refresh.c index cad4c33283b..2b4bf92246f 100644 --- a/lib/libcurses/refresh.c +++ b/lib/libcurses/refresh.c @@ -1,4 +1,4 @@ -/* $NetBSD: refresh.c,v 1.43 2001/12/02 09:14:22 blymn Exp $ */ +/* $NetBSD: refresh.c,v 1.44 2001/12/31 14:23:11 blymn Exp $ */ /* * Copyright (c) 1981, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)refresh.c 8.7 (Berkeley) 8/13/94"; #else -__RCSID("$NetBSD: refresh.c,v 1.43 2001/12/02 09:14:22 blymn Exp $"); +__RCSID("$NetBSD: refresh.c,v 1.44 2001/12/31 14:23:11 blymn Exp $"); #endif #endif /* not lint */ @@ -75,6 +75,19 @@ refresh(void) int wnoutrefresh(WINDOW *win) { + return _cursesi_wnoutrefresh(_cursesi_screen, win); +} + + +/* + * _cursesi_wnoutrefresh -- + * Does the grunt work for wnoutrefresh to the given screen. + * + */ +int +_cursesi_wnoutrefresh(SCREEN *screen, WINDOW *win) +{ + short wy, wx, x_off; __LINE *wlp, *vlp; @@ -82,21 +95,21 @@ wnoutrefresh(WINDOW *win) __CTRACE("wnoutrefresh: win %0.2o, flags 0x%08x\n", win, win->flags); #endif - if (_cursesi_screen->curwin) + if (screen->curwin) return(OK); - __virtscr->cury = win->cury + win->begy; - __virtscr->curx = win->curx + win->begx; + screen->__virtscr->cury = win->cury + win->begy; + screen->__virtscr->curx = win->curx + win->begx; /* Copy the window flags from "win" to "__virtscr" */ if (win->flags & __CLEAROK) { if (win->flags & __FULLWIN) - __virtscr->flags |= __CLEAROK; + screen->__virtscr->flags |= __CLEAROK; win->flags &= ~__CLEAROK; } - __virtscr->flags &= ~__LEAVEOK; - __virtscr->flags |= win->flags; + screen->__virtscr->flags &= ~__LEAVEOK; + screen->__virtscr->flags |= win->flags; - for (wy = 0; wy < win->maxy && wy < __virtscr->maxy - win->begy; wy++) { + for (wy = 0; wy < win->maxy && wy < screen->__virtscr->maxy - win->begy; wy++) { wlp = win->lines[wy]; #ifdef DEBUG __CTRACE("wnoutrefresh: wy %d\tf: %d\tl:%d\tflags %x\n", wy, @@ -104,13 +117,13 @@ wnoutrefresh(WINDOW *win) #endif if ((wlp->flags & __ISDIRTY) == 0) continue; - vlp = __virtscr->lines[wy + win->begy]; + vlp = screen->__virtscr->lines[wy + win->begy]; if (*wlp->firstchp < win->maxx + win->ch_off && *wlp->lastchp >= win->ch_off) { /* Copy line from "win" to "__virtscr". */ for (wx = 0, x_off = win->begx; wx < win->maxx && - x_off < __virtscr->maxx; wx++, x_off++) { + x_off < screen->__virtscr->maxx; wx++, x_off++) { vlp->line[x_off].attr = wlp->line[wx].attr; if (wlp->line[wx].attr & __COLOR) vlp->line[x_off].attr |= @@ -179,11 +192,11 @@ wnoutrefresh(WINDOW *win) int wrefresh(WINDOW *win) { - int retval; - - _cursesi_screen->curwin = (win == curscr); + int retval; + + _cursesi_screen->curwin = (win == _cursesi_screen->curscr); if (!_cursesi_screen->curwin) - retval = wnoutrefresh(win); + retval = _cursesi_wnoutrefresh(_cursesi_screen, win); else retval = OK; if (retval == OK) { @@ -216,7 +229,7 @@ doupdate(void) if (_cursesi_screen->curwin) win = curscr; else - win = __virtscr; + win = _cursesi_screen->__virtscr; /* Initialize loop parameters. */ _cursesi_screen->ly = curscr->cury; diff --git a/lib/libcurses/tty.c b/lib/libcurses/tty.c index b7f9245d38e..677d1c8eb16 100644 --- a/lib/libcurses/tty.c +++ b/lib/libcurses/tty.c @@ -1,4 +1,4 @@ -/* $NetBSD: tty.c,v 1.26 2001/12/02 22:43:44 christos Exp $ */ +/* $NetBSD: tty.c,v 1.27 2001/12/31 14:23:12 blymn Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)tty.c 8.6 (Berkeley) 1/10/95"; #else -__RCSID("$NetBSD: tty.c,v 1.26 2001/12/02 22:43:44 christos Exp $"); +__RCSID("$NetBSD: tty.c,v 1.27 2001/12/31 14:23:12 blymn Exp $"); #endif #endif /* not lint */ @@ -403,8 +403,6 @@ intrflush(WINDOW *win, bool bf) /*ARGSUSED*/ void __startwin(SCREEN *screen) { -/* static char *stdbuf;*/ -/* static size_t len;*/ (void) fflush(screen->infd); @@ -424,10 +422,13 @@ __startwin(SCREEN *screen) } (void) setvbuf(screen->outfd, screen->stdbuf, _IOFBF, screen->len); - tputs(__tc_ti, 0, __cputchar); - tputs(__tc_vs, 0, __cputchar); + t_puts(screen->cursesi_genbuf, __tc_ti, 0, __cputchar_args, + (void *) screen->outfd); + t_puts(screen->cursesi_genbuf, __tc_vs, 0, __cputchar_args, + (void *) screen->outfd); if (screen->curscr->flags & __KEYPAD) - tputs(__tc_ks, 0, __cputchar); + t_puts(screen->cursesi_genbuf, __tc_ks, 0, __cputchar_args, + (void *) screen->outfd); screen->endwin = 0; } |
