Module Name:    src
Committed By:   martin
Date:           Mon Oct  8 19:06:52 UTC 2018

Modified Files:
        src/lib/libcurses [netbsd-8]: curses_private.h slk.c

Log Message:
Pull up following revision(s) (requested by roy in ticket #1048):

        lib/libcurses/curses_private.h: revision 1.66
        lib/libcurses/slk.c: revision 1.3
        lib/libcurses/slk.c: revision 1.4

curses: declare SLK format as invalid until slk_init(3) called

If we don't, then when __slk_init with a valid format of 0 it sets
up labels to be drawn without a window.

 -

curses: once __slk_init is called, reset slk_fmt

This allows soft label keys to be used on more than one terminal.


To generate a diff of this commit:
cvs rdiff -u -r1.62.4.2 -r1.62.4.3 src/lib/libcurses/curses_private.h
cvs rdiff -u -r1.2 -r1.2.8.1 src/lib/libcurses/slk.c

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

Modified files:

Index: src/lib/libcurses/curses_private.h
diff -u src/lib/libcurses/curses_private.h:1.62.4.2 src/lib/libcurses/curses_private.h:1.62.4.3
--- src/lib/libcurses/curses_private.h:1.62.4.2	Thu Oct  4 10:20:12 2018
+++ src/lib/libcurses/curses_private.h	Mon Oct  8 19:06:52 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: curses_private.h,v 1.62.4.2 2018/10/04 10:20:12 martin Exp $	*/
+/*	$NetBSD: curses_private.h,v 1.62.4.3 2018/10/08 19:06:52 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998-2000 Brett Lymn
@@ -289,6 +289,7 @@ struct __screen {
 	bool		 is_term_slk;
 	WINDOW		*slk_window;
 	int		 slk_format;
+#define	SLK_FMT_INVAL	-1
 #define	SLK_FMT_3_2_3	0
 #define	SLK_FMT_4_4	1
 	int		 slk_nlabels;

Index: src/lib/libcurses/slk.c
diff -u src/lib/libcurses/slk.c:1.2 src/lib/libcurses/slk.c:1.2.8.1
--- src/lib/libcurses/slk.c:1.2	Mon Jan 30 17:15:52 2017
+++ src/lib/libcurses/slk.c	Mon Oct  8 19:06:52 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: slk.c,v 1.2 2017/01/30 17:15:52 roy Exp $	*/
+/*	$NetBSD: slk.c,v 1.2.8.1 2018/10/08 19:06:52 martin Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: slk.c,v 1.2 2017/01/30 17:15:52 roy Exp $");
+__RCSID("$NetBSD: slk.c,v 1.2.8.1 2018/10/08 19:06:52 martin Exp $");
 #endif				/* not lint */
 
 #include <ctype.h>
@@ -57,7 +57,7 @@ __RCSID("$NetBSD: slk.c,v 1.2 2017/01/30
 #define	SLK_SIZE	MAX_SLK_COLS
 #endif
 
-static int	 slk_fmt;	/* fmt of slk_init */
+static int	 slk_fmt = SLK_FMT_INVAL;	/* fmt of slk_init */
 
 /* Safe variants of public functions. */
 static int	 __slk_attron(SCREEN *, const chtype);
@@ -562,6 +562,10 @@ __slk_init(SCREEN *screen)
 	__slk_free(screen);	/* safety */
 
 	screen->slk_format = slk_fmt;
+	if (slk_fmt == SLK_FMT_INVAL)
+		return OK;
+	slk_fmt = SLK_FMT_INVAL;
+
 	switch(screen->slk_format) {
 	case SLK_FMT_3_2_3:
 	case SLK_FMT_4_4:

Reply via email to