Module Name:    src
Committed By:   roy
Date:           Mon Jan  2 10:28:35 UTC 2017

Modified Files:
        src/distrib/sets/lists/comp: mi
        src/lib/libcurses: Makefile addbytes.c clrtobot.c clrtoeol.c curses.h
            curses_private.h curses_refresh.3 curses_touch.3 delch.c ins_wch.c
            ins_wstr.c insdelln.c insstr.c line.c touchwin.c
Added Files:
        src/lib/libcurses: immedok.c syncok.c

Log Message:
Implement POSIX Curses functions immedok(3) and syncok(3).


To generate a diff of this commit:
cvs rdiff -u -r1.2088 -r1.2089 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.76 -r1.77 src/lib/libcurses/Makefile
cvs rdiff -u -r1.44 -r1.45 src/lib/libcurses/addbytes.c
cvs rdiff -u -r1.22 -r1.23 src/lib/libcurses/clrtobot.c \
    src/lib/libcurses/delch.c
cvs rdiff -u -r1.26 -r1.27 src/lib/libcurses/clrtoeol.c
cvs rdiff -u -r1.112 -r1.113 src/lib/libcurses/curses.h
cvs rdiff -u -r1.53 -r1.54 src/lib/libcurses/curses_private.h
cvs rdiff -u -r1.11 -r1.12 src/lib/libcurses/curses_refresh.3
cvs rdiff -u -r1.8 -r1.9 src/lib/libcurses/curses_touch.3 \
    src/lib/libcurses/ins_wstr.c
cvs rdiff -u -r0 -r1.1 src/lib/libcurses/immedok.c src/lib/libcurses/syncok.c
cvs rdiff -u -r1.7 -r1.8 src/lib/libcurses/ins_wch.c src/lib/libcurses/line.c
cvs rdiff -u -r1.16 -r1.17 src/lib/libcurses/insdelln.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libcurses/insstr.c
cvs rdiff -u -r1.28 -r1.29 src/lib/libcurses/touchwin.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2088 src/distrib/sets/lists/comp/mi:1.2089
--- src/distrib/sets/lists/comp/mi:1.2088	Sun Jan  1 03:06:06 2017
+++ src/distrib/sets/lists/comp/mi	Mon Jan  2 10:28:35 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2088 2017/01/01 03:06:06 roy Exp $
+#	$NetBSD: mi,v 1.2089 2017/01/02 10:28:35 roy Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.comp				comp-sys-root
@@ -6807,6 +6807,7 @@
 ./usr/share/man/cat3/ilogbl.0			comp-c-catman		.cat
 ./usr/share/man/cat3/imaxabs.0			comp-c-catman		.cat
 ./usr/share/man/cat3/imaxdiv.0			comp-c-catman		.cat
+./usr/share/man/cat3/immedok.0			comp-c-catman		.cat
 ./usr/share/man/cat3/inch.0			comp-c-catman		.cat
 ./usr/share/man/cat3/inchnstr.0			comp-c-catman		.cat
 ./usr/share/man/cat3/inchstr.0			comp-c-catman		.cat
@@ -9322,6 +9323,7 @@
 ./usr/share/man/cat3/swapon.0			comp-c-catman		.cat
 ./usr/share/man/cat3/swprintf.0			comp-c-catman		.cat
 ./usr/share/man/cat3/swscanf.0			comp-c-catman		.cat
+./usr/share/man/cat3/synckok.0			comp-c-catman		.cat
 ./usr/share/man/cat3/sys_errlist.0		comp-c-catman		.cat
 ./usr/share/man/cat3/sys_nerr.0			comp-c-catman		.cat
 ./usr/share/man/cat3/sys_siglist.0		comp-c-catman		.cat
@@ -14153,6 +14155,7 @@
 ./usr/share/man/html3/ilogbl.html		comp-c-htmlman		html
 ./usr/share/man/html3/imaxabs.html		comp-c-htmlman		html
 ./usr/share/man/html3/imaxdiv.html		comp-c-htmlman		html
+./usr/share/man/html3/immedok.html		comp-c-htmlman		html
 ./usr/share/man/html3/inch.html			comp-c-htmlman		html
 ./usr/share/man/html3/inchnstr.html		comp-c-htmlman		html
 ./usr/share/man/html3/inchstr.html		comp-c-htmlman		html
@@ -16607,6 +16610,7 @@
 ./usr/share/man/html3/swapon.html		comp-c-htmlman		html
 ./usr/share/man/html3/swprintf.html		comp-c-htmlman		html
 ./usr/share/man/html3/swscanf.html		comp-c-htmlman		html
+./usr/share/man/html3/syncok.html		comp-c-htmlman		html
 ./usr/share/man/html3/sys_errlist.html		comp-c-htmlman		html
 ./usr/share/man/html3/sys_nerr.html		comp-c-htmlman		html
 ./usr/share/man/html3/sys_siglist.html		comp-c-htmlman		html
@@ -21416,6 +21420,7 @@
 ./usr/share/man/man3/ilogbl.3			comp-c-man		.man
 ./usr/share/man/man3/imaxabs.3			comp-c-man		.man
 ./usr/share/man/man3/imaxdiv.3			comp-c-man		.man
+./usr/share/man/man3/immedok.3			comp-c-man		.man
 ./usr/share/man/man3/inch.3			comp-c-man		.man
 ./usr/share/man/man3/inchnstr.3			comp-c-man		.man
 ./usr/share/man/man3/inchstr.3			comp-c-man		.man
@@ -23927,6 +23932,7 @@
 ./usr/share/man/man3/swapon.3			comp-c-man		.man
 ./usr/share/man/man3/swprintf.3			comp-c-man		.man
 ./usr/share/man/man3/swscanf.3			comp-c-man		.man
+./usr/share/man/man3/syncok.3			comp-c-man		.man
 ./usr/share/man/man3/sys_errlist.3		comp-c-man		.man
 ./usr/share/man/man3/sys_nerr.3			comp-c-man		.man
 ./usr/share/man/man3/sys_siglist.3		comp-c-man		.man

Index: src/lib/libcurses/Makefile
diff -u src/lib/libcurses/Makefile:1.76 src/lib/libcurses/Makefile:1.77
--- src/lib/libcurses/Makefile:1.76	Sun Jan  1 03:06:06 2017
+++ src/lib/libcurses/Makefile	Mon Jan  2 10:28:34 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.76 2017/01/01 03:06:06 roy Exp $
+#	$NetBSD: Makefile,v 1.77 2017/01/02 10:28:34 roy Exp $
 #	@(#)Makefile	8.2 (Berkeley) 1/2/94
 
 .include <bsd.own.mk>
@@ -19,12 +19,12 @@ SRCS=	acs.c addbytes.c addch.c addchnstr
 	ctrace.c cur_hash.c curs_set.c \
 	curses.c delch.c deleteln.c delwin.c echochar.c erase.c fileio.c \
 	flushok.c fullname.c getch.c getstr.c getyx.c id_subwins.c idlok.c \
-	idcok.c inch.c inchstr.c initscr.c insch.c insdelln.c insertln.c \
-	instr.c keypad.c keyname.c leaveok.c line.c meta.c move.c \
+	idcok.c immedok.c inch.c inchstr.c initscr.c insch.c insdelln.c \
+	insertln.c instr.c keypad.c keyname.c leaveok.c line.c meta.c move.c \
 	mvwin.c newwin.c nodelay.c notimeout.c overlay.c overwrite.c pause.c \
 	printw.c putchar.c refresh.c resize.c scanw.c screen.c scroll.c \
-	scrollok.c setterm.c standout.c timeout.c toucholap.c touchwin.c \
-	tstp.c tty.c unctrl.c underscore.c
+	scrollok.c setterm.c standout.c syncok.c timeout.c toucholap.c \
+	touchwin.c tstp.c tty.c unctrl.c underscore.c
 
 MAN=	curses.3 curses_addch.3 curses_addchstr.3 curses_addstr.3 \
 	curses_attributes.3 curses_background.3 curses_border.3 \
@@ -94,7 +94,7 @@ MLINKS+= curses_addch.3 addch.3 curses_a
 	 curses_tty.3 halfdelay.3 curses_input.3 has_key.3 \
 	 curses_tty.3 has_il.3 \
 	 curses_line.3 hline.3 curses_tty.3 idcok.3 \
-	 curses_tty.3 idlok.3 curses_inch.3 inch.3 \
+	 curses_tty.3 idlok.3 curses_refresh.3 immedok.3 curses_inch.3 inch.3 \
 	 curses_inch.3 inchnstr.3 curses_inch.3 inchstr.3 \
 	 curses_inch.3 innstr.3 curses_color.3 init_color.3 \
 	 curses_color.3 init_pair.3 curses_screen.3 initscr.3 \
@@ -148,7 +148,8 @@ MLINKS+= curses_addch.3 addch.3 curses_a
 	 curses_screen.3 set_term.3 curses_screen.3 setterm.3 \
 	 curses_standout.3 standend.3 curses_standout.3 standout.3 \
 	 curses_color.3 start_color.3 curses_pad.3 subpad.3 \
-	 curses_window.3 subwin.3 curses_input.3 timeout.3 \
+	 curses_window.3 subwin.3 curses_touch.3 syncok.3 \
+	 curses_input.3 timeout.3 \
 	 curses_touch.3 touchline.3 curses_touch.3 touchoverlap.3 \
 	 curses_touch.3 touchwin.3 curses_tty.3 typeahead.3 \
 	 curses_print.3 unctrl.3 \

Index: src/lib/libcurses/addbytes.c
diff -u src/lib/libcurses/addbytes.c:1.44 src/lib/libcurses/addbytes.c:1.45
--- src/lib/libcurses/addbytes.c:1.44	Mon Nov 28 18:25:26 2016
+++ src/lib/libcurses/addbytes.c	Mon Jan  2 10:28:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: addbytes.c,v 1.44 2016/11/28 18:25:26 christos Exp $	*/
+/*	$NetBSD: addbytes.c,v 1.45 2017/01/02 10:28:34 roy Exp $	*/
 
 /*
  * Copyright (c) 1987, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)addbytes.c	8.4 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: addbytes.c,v 1.44 2016/11/28 18:25:26 christos Exp $");
+__RCSID("$NetBSD: addbytes.c,v 1.45 2017/01/02 10:28:34 roy Exp $");
 #endif
 #endif				/* not lint */
 
@@ -328,6 +328,7 @@ _cursesi_addbyte(WINDOW *win, __LINE **l
 		 *y, *x, *win->alines[*y]->firstchp,
 		 *win->alines[*y]->lastchp);
 #endif
+	__sync(win);
 	return (OK);
 }
 
@@ -608,6 +609,7 @@ _cursesi_addwchar(WINDOW *win, __LINE **
 #ifdef DEBUG
 	__CTRACE(__CTRACE_INPUT, "add_wch: %d : 0x%x\n", lp->ch, lp->attr);
 #endif /* DEBUG */
+	__sync(win);
 	return OK;
 #endif
 }

Index: src/lib/libcurses/clrtobot.c
diff -u src/lib/libcurses/clrtobot.c:1.22 src/lib/libcurses/clrtobot.c:1.23
--- src/lib/libcurses/clrtobot.c:1.22	Sun Feb 19 19:38:13 2012
+++ src/lib/libcurses/clrtobot.c	Mon Jan  2 10:28:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: clrtobot.c,v 1.22 2012/02/19 19:38:13 christos Exp $	*/
+/*	$NetBSD: clrtobot.c,v 1.23 2017/01/02 10:28:34 roy Exp $	*/
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)clrtobot.c	8.2 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: clrtobot.c,v 1.22 2012/02/19 19:38:13 christos Exp $");
+__RCSID("$NetBSD: clrtobot.c,v 1.23 2017/01/02 10:28:34 roy Exp $");
 #endif
 #endif				/* not lint */
 
@@ -114,5 +114,6 @@ wclrtobot(WINDOW *win)
 				    (int) (maxx - win->alines[y]->line));
 		startx = 0;
 	}
+	__sync(win);
 	return (OK);
 }
Index: src/lib/libcurses/delch.c
diff -u src/lib/libcurses/delch.c:1.22 src/lib/libcurses/delch.c:1.23
--- src/lib/libcurses/delch.c:1.22	Wed Jul 22 16:57:14 2009
+++ src/lib/libcurses/delch.c	Mon Jan  2 10:28:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: delch.c,v 1.22 2009/07/22 16:57:14 roy Exp $	*/
+/*	$NetBSD: delch.c,v 1.23 2017/01/02 10:28:34 roy Exp $	*/
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)delch.c	8.2 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: delch.c,v 1.22 2009/07/22 16:57:14 roy Exp $");
+__RCSID("$NetBSD: delch.c,v 1.23 2017/01/02 10:28:34 roy Exp $");
 #endif
 #endif				/* not lint */
 
@@ -142,6 +142,7 @@ wdelch(WINDOW *win)
 		temp1++;
 	}
 	__touchline(win, (int) win->cury, sx, (int) win->maxx - 1);
+	__sync(win);
 	return (OK);
 #endif /* HAVE_WCHAR */
 }

Index: src/lib/libcurses/clrtoeol.c
diff -u src/lib/libcurses/clrtoeol.c:1.26 src/lib/libcurses/clrtoeol.c:1.27
--- src/lib/libcurses/clrtoeol.c:1.26	Sun Feb 19 19:38:13 2012
+++ src/lib/libcurses/clrtoeol.c	Mon Jan  2 10:28:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: clrtoeol.c,v 1.26 2012/02/19 19:38:13 christos Exp $	*/
+/*	$NetBSD: clrtoeol.c,v 1.27 2017/01/02 10:28:34 roy Exp $	*/
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)clrtoeol.c	8.2 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: clrtoeol.c,v 1.26 2012/02/19 19:38:13 christos Exp $");
+__RCSID("$NetBSD: clrtoeol.c,v 1.27 2017/01/02 10:28:34 roy Exp $");
 #endif
 #endif				/* not lint */
 
@@ -114,5 +114,7 @@ wclrtoeol(WINDOW *win)
 	    *win->alines[y]->firstchp, *win->alines[y]->lastchp);
 #endif
 	/* Update firstch and lastch for the line. */
-	return (__touchline(win, y, x, (int) win->maxx - 1));
+	__touchline(win, y, x, (int) win->maxx - 1);
+	__sync(win);
+	return OK;
 }

Index: src/lib/libcurses/curses.h
diff -u src/lib/libcurses/curses.h:1.112 src/lib/libcurses/curses.h:1.113
--- src/lib/libcurses/curses.h:1.112	Sun Jan  1 03:06:06 2017
+++ src/lib/libcurses/curses.h	Mon Jan  2 10:28:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: curses.h,v 1.112 2017/01/01 03:06:06 roy Exp $	*/
+/*	$NetBSD: curses.h,v 1.113 2017/01/02 10:28:34 roy Exp $	*/
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -681,6 +681,7 @@ int	 has_key(int);
 int	 hline(chtype, int);
 int	 idcok(WINDOW *, bool);
 int	 idlok(WINDOW *, bool);
+int	 immedok(WINDOW *, bool);
 int	 init_color(short, short, short, short);
 int	 init_pair(short, short, short);
 WINDOW	*initscr(void);
@@ -746,6 +747,7 @@ SCREEN  *set_term(SCREEN *);
 int	 start_color(void);
 WINDOW	*subpad(WINDOW *, int, int, int, int);
 WINDOW	*subwin(WINDOW *, int, int, int, int);
+int	 syncok(WINDOW *, bool);
 chtype	 termattrs(void);
 attr_t	 term_attrs(void);
 int	 touchline(WINDOW *, int, int);

Index: src/lib/libcurses/curses_private.h
diff -u src/lib/libcurses/curses_private.h:1.53 src/lib/libcurses/curses_private.h:1.54
--- src/lib/libcurses/curses_private.h:1.53	Sat Dec 31 22:47:01 2016
+++ src/lib/libcurses/curses_private.h	Mon Jan  2 10:28:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: curses_private.h,v 1.53 2016/12/31 22:47:01 roy Exp $	*/
+/*	$NetBSD: curses_private.h,v 1.54 2017/01/02 10:28:34 roy Exp $	*/
 
 /*-
  * Copyright (c) 1998-2000 Brett Lymn
@@ -131,6 +131,8 @@ struct __window {		/* Window structure. 
 #define __IDCHAR	0x00040000	/* insert/delete char sequences */
 #define __ISPAD		0x00080000	/* "window" is a pad */
 #define __ISDERWIN	0x00100000	/* "window" is derived from parent */
+#define __IMMEDOK	0x00200000	/* refreshed when changed */
+#define __SYNCOK	0x00400000	/* sync when changed */
 	unsigned int flags;
 	int	delay;			/* delay for getch() */
 	attr_t	wattr;			/* Character attributes */
@@ -344,6 +346,7 @@ void	 __startwin(SCREEN *);
 void	 __stop_signal_handler(int);
 int	 __stopwin(void);
 void	 __swflags(WINDOW *);
+void	 __sync(WINDOW *);
 int	 __timeout(int);
 int	 __touchline(WINDOW *, int, int, int);
 int	 __touchwin(WINDOW *);

Index: src/lib/libcurses/curses_refresh.3
diff -u src/lib/libcurses/curses_refresh.3:1.11 src/lib/libcurses/curses_refresh.3:1.12
--- src/lib/libcurses/curses_refresh.3:1.11	Sat Dec 31 13:50:16 2016
+++ src/lib/libcurses/curses_refresh.3	Mon Jan  2 10:28:34 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: curses_refresh.3,v 1.11 2016/12/31 13:50:16 roy Exp $
+.\"	$NetBSD: curses_refresh.3,v 1.12 2017/01/02 10:28:34 roy Exp $
 .\"
 .\" Copyright (c) 2002
 .\"	Brett Lymn (bl...@netbsd.org, brett_l...@yahoo.com.au)
@@ -30,7 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"
-.Dd December 31, 2016
+.Dd January 2, 2017
 .Dt CURSES_REFRESH 3
 .Os
 .Sh NAME
@@ -39,9 +39,10 @@
 .Nm wrefresh ,
 .Nm wnoutrefresh ,
 .Nm doupdate ,
+.Nm immedok ,
+.Nm flushok ,
 .Nm leaveok ,
-.Nm is_leaveok ,
-.Nm flushok
+.Nm is_leaveok
 .Nd curses terminal update routines
 .Sh LIBRARY
 .Lb libcurses
@@ -56,11 +57,13 @@
 .Ft int
 .Fn doupdate "void"
 .Ft int
+.Fn immedok "WINDOW *win" "boolf flag"
+.Ft int
+.Fn flushok "WINDOW *win" "boolf flag"
+.Ft int
 .Fn leaveok "WINDOW *win" "boolf flag"
 .Ft bool
 .Fn is_leaveok "const WINDOW *win"
-.Ft int
-.Fn flushok "WINDOW *win" "boolf flag"
 .Sh DESCRIPTION
 These functions update the terminal with the contents of
 .Dv stdscr
@@ -110,6 +113,23 @@ followed by
 .Fn doupdate .
 .Pp
 The
+.Fn immedok
+function determines whether the screen is refreshed whenever the window is
+changed.
+The initial state is
+.Dv FALSE .
+.Pp
+The
+.Fn flushok
+function is used to determine whether or not the screen's output file
+descriptor will be flushed on refresh.
+Setting
+.Fa flag
+to
+.Dv TRUE
+will cause the output to be flushed.
+.Pp
+The
 .Fn leaveok
 function determines whether refresh operations may leave the screen cursor
 in an arbitrary position on the screen.
@@ -122,16 +142,6 @@ position after a refresh operation has t
 The
 .Fn is_leaveok
 function returns the setting.
-.Pp
-The
-.Fn flushok
-function is used to determine whether or not the screen's output file
-descriptor will be flushed on refresh.
-Setting
-.Fa flag
-to
-.Dv TRUE
-will cause the output to be flushed.
 .Sh RETURN VALUES
 Functions returning pointers will return
 .Dv NULL

Index: src/lib/libcurses/curses_touch.3
diff -u src/lib/libcurses/curses_touch.3:1.8 src/lib/libcurses/curses_touch.3:1.9
--- src/lib/libcurses/curses_touch.3:1.8	Wed Feb 24 13:02:13 2010
+++ src/lib/libcurses/curses_touch.3	Mon Jan  2 10:28:34 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: curses_touch.3,v 1.8 2010/02/24 13:02:13 drochner Exp $
+.\"	$NetBSD: curses_touch.3,v 1.9 2017/01/02 10:28:34 roy Exp $
 .\"
 .\" Copyright (c) 2002
 .\"	Brett Lymn (bl...@netbsd.org, brett_l...@yahoo.com.au)
@@ -30,7 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"
-.Dd February 23, 2010
+.Dd January 2, 2017
 .Dt CURSES_TOUCH 3
 .Os
 .Sh NAME
@@ -44,6 +44,7 @@
 .Nm is_wintouched ,
 .Nm redrawwin ,
 .Nm wredrawln ,
+.Nm syncok ,
 .Nm wsyncup ,
 .Nm wsyncdown
 .Nd curses window modification routines
@@ -69,6 +70,8 @@
 .Fn redrawwin "WINDOW *win"
 .Ft int
 .Fn wredrawln "WINDOW *win" "int line" "int n"
+.Ft int
+.Fn syncok "WINDOW *win"
 .Ft void
 .Fn wsyncup "WINDOW *win"
 .Ft void
@@ -165,6 +168,13 @@ It is equivalent to
 .Fn wtouchln win line n 1 .
 .Pp
 The
+.Fn syncok
+function determines whether all the ancestors of the specified window are
+implicitly touched whenever there is a change in the window.
+The intial state is
+.Dv FALSE .
+.Pp
+The
 .Fn wsyncup
 function touches all ancestors of
 .Fa win .
Index: src/lib/libcurses/ins_wstr.c
diff -u src/lib/libcurses/ins_wstr.c:1.8 src/lib/libcurses/ins_wstr.c:1.9
--- src/lib/libcurses/ins_wstr.c:1.8	Sat Oct 22 21:55:06 2016
+++ src/lib/libcurses/ins_wstr.c	Mon Jan  2 10:28:34 2017
@@ -1,4 +1,4 @@
-/*   $NetBSD: ins_wstr.c,v 1.8 2016/10/22 21:55:06 christos Exp $ */
+/*   $NetBSD: ins_wstr.c,v 1.9 2017/01/02 10:28:34 roy Exp $ */
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation Inc.
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: ins_wstr.c,v 1.8 2016/10/22 21:55:06 christos Exp $");
+__RCSID("$NetBSD: ins_wstr.c,v 1.9 2017/01/02 10:28:34 roy Exp $");
 #endif						  /* not lint */
 
 #include <string.h>
@@ -329,6 +329,7 @@ wins_nwstr(WINDOW *win, const wchar_t *w
 	if (newx > *lnp->lastchp)
 		*lnp->lastchp = newx;
 	__touchline(win, (int) win->cury, sx, (int) win->maxx - 1);
+	__sync(win);
 	return OK;
 #endif /* HAVE_WCHAR */
 }

Index: src/lib/libcurses/ins_wch.c
diff -u src/lib/libcurses/ins_wch.c:1.7 src/lib/libcurses/ins_wch.c:1.8
--- src/lib/libcurses/ins_wch.c:1.7	Sat Oct 22 21:55:06 2016
+++ src/lib/libcurses/ins_wch.c	Mon Jan  2 10:28:34 2017
@@ -1,4 +1,4 @@
-/*   $NetBSD: ins_wch.c,v 1.7 2016/10/22 21:55:06 christos Exp $ */
+/*   $NetBSD: ins_wch.c,v 1.8 2017/01/02 10:28:34 roy Exp $ */
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation Inc.
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: ins_wch.c,v 1.7 2016/10/22 21:55:06 christos Exp $");
+__RCSID("$NetBSD: ins_wch.c,v 1.8 2017/01/02 10:28:34 roy Exp $");
 #endif						  /* not lint */
 
 #include <string.h>
@@ -248,7 +248,7 @@ wins_wch(WINDOW *win, const cchar_t *wch
 	if ( newx > *lnp->lastchp )
 		*lnp->lastchp = newx;
 	__touchline(win, y, sx, (int) win->maxx - 1);
-
+	__sync(win);
 	return OK;
 #endif /* HAVE_WCHAR */
 }
Index: src/lib/libcurses/line.c
diff -u src/lib/libcurses/line.c:1.7 src/lib/libcurses/line.c:1.8
--- src/lib/libcurses/line.c:1.7	Mon Jan  2 08:44:12 2017
+++ src/lib/libcurses/line.c	Mon Jan  2 10:28:35 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: line.c,v 1.7 2017/01/02 08:44:12 roy Exp $	*/
+/*	$NetBSD: line.c,v 1.8 2017/01/02 10:28:35 roy Exp $	*/
 
 /*-
  * Copyright (c) 1998-1999 Brett Lymn
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: line.c,v 1.7 2017/01/02 08:44:12 roy Exp $");
+__RCSID("$NetBSD: line.c,v 1.8 2017/01/02 10:28:35 roy Exp $");
 #endif				/* not lint */
 
 #include <string.h>
@@ -240,6 +240,7 @@ int whline_set(WINDOW *win, const cchar_
 	}
 
 	wmove(win, win->cury, ocurx);
+	__sync(win);
 	return OK;
 #endif /* HAVE_WCHAR */
 }
@@ -299,7 +300,9 @@ int wvline_set(WINDOW *win, const cchar_
 		    ocury + i, ocurx);
 #endif /* DEBUG */
 	}
+
 	wmove(win, ocury, ocurx);
+	__sync(win);
 	return OK;
 #endif /* HAVE_WCHAR */
 }

Index: src/lib/libcurses/insdelln.c
diff -u src/lib/libcurses/insdelln.c:1.16 src/lib/libcurses/insdelln.c:1.17
--- src/lib/libcurses/insdelln.c:1.16	Wed Jul 22 16:57:15 2009
+++ src/lib/libcurses/insdelln.c	Mon Jan  2 10:28:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: insdelln.c,v 1.16 2009/07/22 16:57:15 roy Exp $	*/
+/*	$NetBSD: insdelln.c,v 1.17 2017/01/02 10:28:34 roy Exp $	*/
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: insdelln.c,v 1.16 2009/07/22 16:57:15 roy Exp $");
+__RCSID("$NetBSD: insdelln.c,v 1.17 2017/01/02 10:28:34 roy Exp $");
 #endif				/* not lint */
 
 /*
@@ -177,5 +177,6 @@ winsdelln(WINDOW *win, int nlines)
 	}
 	if (win->orig != NULL)
 		__id_subwins(win->orig);
+	__sync(win);
 	return (OK);
 }

Index: src/lib/libcurses/insstr.c
diff -u src/lib/libcurses/insstr.c:1.3 src/lib/libcurses/insstr.c:1.4
--- src/lib/libcurses/insstr.c:1.3	Wed Jul 22 16:57:15 2009
+++ src/lib/libcurses/insstr.c	Mon Jan  2 10:28:34 2017
@@ -1,4 +1,4 @@
-/*   $NetBSD: insstr.c,v 1.3 2009/07/22 16:57:15 roy Exp $ */
+/*   $NetBSD: insstr.c,v 1.4 2017/01/02 10:28:34 roy Exp $ */
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation Inc.
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: insstr.c,v 1.3 2009/07/22 16:57:15 roy Exp $");
+__RCSID("$NetBSD: insstr.c,v 1.4 2017/01/02 10:28:34 roy Exp $");
 #endif						  /* not lint */
 
 #include <string.h>
@@ -205,5 +205,6 @@ winsnstr(WINDOW *win, const char *str, i
 	if ( win->ch_off + win->maxx - 1 > *lnp->lastchp )
 		*lnp->lastchp = win->ch_off + win->maxx - 1;
 	__touchline(win, (int)win->cury, (int)win->curx, (int)win->maxx - 1);
+	__sync(win);
 	return OK;
 }

Index: src/lib/libcurses/touchwin.c
diff -u src/lib/libcurses/touchwin.c:1.28 src/lib/libcurses/touchwin.c:1.29
--- src/lib/libcurses/touchwin.c:1.28	Thu Jan  7 07:37:08 2016
+++ src/lib/libcurses/touchwin.c	Mon Jan  2 10:28:35 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: touchwin.c,v 1.28 2016/01/07 07:37:08 jdc Exp $	*/
+/*	$NetBSD: touchwin.c,v 1.29 2017/01/02 10:28:35 roy Exp $	*/
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)touchwin.c	8.2 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: touchwin.c,v 1.28 2016/01/07 07:37:08 jdc Exp $");
+__RCSID("$NetBSD: touchwin.c,v 1.29 2017/01/02 10:28:35 roy Exp $");
 #endif
 #endif				/* not lint */
 
@@ -44,6 +44,20 @@ __RCSID("$NetBSD: touchwin.c,v 1.28 2016
 static int _cursesi_touchline_force(WINDOW *, int, int, int, int);
 
 /*
+ * __sync --
+ *	To be called after each window change.
+ */
+void
+__sync(WINDOW *win)
+{
+
+	if (win->flags & __IMMEDOK)
+		wrefresh(win);
+	if (win->flags & __SYNCOK)
+		wsyncup(win);
+}
+
+/*
  * is_linetouched --
  *	Indicate if line has been touched or not.
  */

Added files:

Index: src/lib/libcurses/immedok.c
diff -u /dev/null src/lib/libcurses/immedok.c:1.1
--- /dev/null	Mon Jan  2 10:28:35 2017
+++ src/lib/libcurses/immedok.c	Mon Jan  2 10:28:34 2017
@@ -0,0 +1,52 @@
+/*	$NetBSD: immedok.c,v 1.1 2017/01/02 10:28:34 roy Exp $	*/
+
+/*-
+ * Copyright (c) 2017 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Roy Marples.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: immedok.c,v 1.1 2017/01/02 10:28:34 roy Exp $");
+#endif				/* not lint */
+
+#include "curses.h"
+#include "curses_private.h"
+
+/*
+ * immedok --
+ *	Refresh the window when changed.
+ */
+int
+immedok(WINDOW *win, bool bf)
+{
+	if (bf)
+		win->flags |= __IMMEDOK;
+	else
+		win->flags &= ~__IMMEDOK;
+	return (OK);
+}
Index: src/lib/libcurses/syncok.c
diff -u /dev/null src/lib/libcurses/syncok.c:1.1
--- /dev/null	Mon Jan  2 10:28:35 2017
+++ src/lib/libcurses/syncok.c	Mon Jan  2 10:28:35 2017
@@ -0,0 +1,52 @@
+/*	$NetBSD: syncok.c,v 1.1 2017/01/02 10:28:35 roy Exp $	*/
+
+/*-
+ * Copyright (c) 2017 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Roy Marples.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: syncok.c,v 1.1 2017/01/02 10:28:35 roy Exp $");
+#endif				/* not lint */
+
+#include "curses.h"
+#include "curses_private.h"
+
+/*
+ * immedok --
+ *	Refresh the window when changed.
+ */
+int
+syncok(WINDOW *win, bool bf)
+{
+	if (bf)
+		win->flags |= __SYNCOK;
+	else
+		win->flags &= ~__SYNCOK;
+	return (OK);
+}

Reply via email to