summaryrefslogtreecommitdiff
path: root/lib/libcurses/base
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1999-03-11 21:03:59 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1999-03-11 21:03:59 +0000
commit73a856115702157d58128365662b9519d7daeadc (patch)
tree6ff9a5f980b684e623391e394e48c512c960ced4 /lib/libcurses/base
parent62849813a43735aeaa89e531a24138e11c68b595 (diff)
ncurses-4.2-990307
Diffstat (limited to 'lib/libcurses/base')
-rw-r--r--lib/libcurses/base/lib_getch.c12
-rw-r--r--lib/libcurses/base/lib_newterm.c14
-rw-r--r--lib/libcurses/base/lib_set_term.c8
-rw-r--r--lib/libcurses/base/lib_slk.c28
-rw-r--r--lib/libcurses/base/lib_slkclear.c14
-rw-r--r--lib/libcurses/base/lib_slkrefr.c15
6 files changed, 55 insertions, 36 deletions
diff --git a/lib/libcurses/base/lib_getch.c b/lib/libcurses/base/lib_getch.c
index e4b65e62ff8..65d314e1907 100644
--- a/lib/libcurses/base/lib_getch.c
+++ b/lib/libcurses/base/lib_getch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_getch.c,v 1.1 1999/01/18 19:09:46 millert Exp $ */
+/* $OpenBSD: lib_getch.c,v 1.2 1999/03/11 21:03:55 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -42,7 +42,7 @@
#include <curses.priv.h>
-MODULE_ID("$From: lib_getch.c,v 1.41 1998/09/26 23:34:53 tom Exp $")
+MODULE_ID("$From: lib_getch.c,v 1.43 1999/03/08 02:35:10 tom Exp $")
#include <fifo_defs.h>
@@ -231,8 +231,9 @@ int ch;
if (wgetch_should_refresh(win))
wrefresh(win);
- if (!win->_notimeout && (win->_delay >= 0 || SP->_cbreak > 1)) {
- int delay;
+ if (!win->_notimeout && (win->_delay >= 0 || SP->_cbreak > 1))
+ {
+ int delay;
T(("timed delay in wgetch()"));
if (SP->_cbreak > 1)
@@ -248,7 +249,8 @@ int ch;
/* else go on to read data available */
}
- if (win->_use_keypad) {
+ if (win->_use_keypad)
+ {
/*
* This is tricky. We only want to get special-key
* events one at a time. But we want to accumulate
diff --git a/lib/libcurses/base/lib_newterm.c b/lib/libcurses/base/lib_newterm.c
index 6218dfa32a2..ad9819fe8dc 100644
--- a/lib/libcurses/base/lib_newterm.c
+++ b/lib/libcurses/base/lib_newterm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_newterm.c,v 1.2 1999/01/31 20:17:09 millert Exp $ */
+/* $OpenBSD: lib_newterm.c,v 1.3 1999/03/11 21:03:55 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -50,7 +50,7 @@
#include <term.h> /* clear_screen, cup & friends, cur_term */
-MODULE_ID("$From: lib_newterm.c,v 1.38 1999/01/31 01:23:25 tom Exp $")
+MODULE_ID("$From: lib_newterm.c,v 1.39 1999/03/03 23:44:22 juergen Exp $")
#ifndef ONLCR /* Allows compilation under the QNX 4.2 OS */
#define ONLCR 0
@@ -96,6 +96,7 @@ void filter(void)
SCREEN * newterm(NCURSES_CONST char *term, FILE *ofp, FILE *ifp)
{
int errret;
+int slk_format = _nc_slk_format;
SCREEN* current;
#ifdef TRACE
int t = _nc_getenv_num("NCURSES_TRACE");
@@ -150,10 +151,11 @@ int t = _nc_getenv_num("NCURSES_TRACE");
We assume that we must simulate, if it is none of the standard
formats (4-4 or 3-2-3) for which there may be some hardware
support. */
- if (num_labels <= 0 || !SLK_STDFMT)
- if (_nc_slk_format)
+ if (num_labels <= 0 || !SLK_STDFMT(slk_format))
+ if (slk_format)
{
- if (ERR==_nc_ripoffline(-SLK_LINES, _nc_slk_initialize))
+ if (ERR==_nc_ripoffline(-SLK_LINES(slk_format),
+ _nc_slk_initialize))
return 0;
}
/* this actually allocates the screen structure, and saves the
@@ -167,7 +169,7 @@ int t = _nc_getenv_num("NCURSES_TRACE");
}
/* if the terminal type has real soft labels, set those up */
- if (_nc_slk_format && num_labels > 0 && SLK_STDFMT)
+ if (slk_format && num_labels > 0 && SLK_STDFMT(slk_format))
_nc_slk_initialize(stdscr, COLS);
SP->_ifd = fileno(ifp);
diff --git a/lib/libcurses/base/lib_set_term.c b/lib/libcurses/base/lib_set_term.c
index 3dcf382d002..63a3dd87bed 100644
--- a/lib/libcurses/base/lib_set_term.c
+++ b/lib/libcurses/base/lib_set_term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_set_term.c,v 1.2 1999/02/24 06:31:08 millert Exp $ */
+/* $OpenBSD: lib_set_term.c,v 1.3 1999/03/11 21:03:55 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -33,8 +33,6 @@
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
****************************************************************************/
-
-
/*
** lib_set_term.c
**
@@ -46,7 +44,7 @@
#include <term.h> /* cur_term */
-MODULE_ID("$From: lib_set_term.c,v 1.44 1999/02/18 11:31:47 tom Exp $")
+MODULE_ID("$From: lib_set_term.c,v 1.45 1999/03/06 22:29:13 tom Exp $")
SCREEN * set_term(SCREEN *screen)
{
@@ -161,7 +159,7 @@ size_t i;
SP->_curscol = -1;
SP->_nl = TRUE;
SP->_raw = FALSE;
- SP->_cbreak = FALSE;
+ SP->_cbreak = 0;
SP->_echo = TRUE;
SP->_fifohead = -1;
SP->_endwin = TRUE;
diff --git a/lib/libcurses/base/lib_slk.c b/lib/libcurses/base/lib_slk.c
index 9605d61d9ed..76ba38d65dd 100644
--- a/lib/libcurses/base/lib_slk.c
+++ b/lib/libcurses/base/lib_slk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_slk.c,v 1.1 1999/01/18 19:09:59 millert Exp $ */
+/* $OpenBSD: lib_slk.c,v 1.2 1999/03/11 21:03:55 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -43,7 +43,7 @@
#include <ctype.h>
#include <term.h> /* num_labels, label_*, plab_norm */
-MODULE_ID("$From: lib_slk.c,v 1.15 1999/01/02 22:56:30 tom Exp $")
+MODULE_ID("$From: lib_slk.c,v 1.16 1999/03/03 23:44:22 juergen Exp $")
/*
* We'd like to move these into the screen context structure, but cannot,
@@ -58,7 +58,7 @@ int _nc_slk_format; /* one more than format specified in slk_init() */
static void
slk_paint_info(WINDOW *win)
{
- if (win && _nc_slk_format==4)
+ if (win && SP->slk_format==4)
{
int i;
@@ -66,7 +66,7 @@ slk_paint_info(WINDOW *win)
wmove (win,0,0);
for (i = 0; i < SP->_slk->maxlab; i++) {
- if (win && _nc_slk_format==4)
+ if (win && SP->slk_format==4)
{
mvwaddch(win,0,SP->_slk->ent[i].x,'F');
if (i<9)
@@ -89,6 +89,7 @@ int
_nc_slk_initialize(WINDOW *stwin, int cols)
{
int i, x;
+int res = OK;
char *p;
T(("slk_initialize()"));
@@ -105,9 +106,12 @@ char *p;
SP->_slk->buffer = NULL;
SP->_slk->attr = A_STANDOUT;
- SP->_slk->maxlab = (num_labels > 0) ? num_labels : MAX_SKEY;
- SP->_slk->maxlen = (num_labels > 0) ? label_width * label_height : MAX_SKEY_LEN;
- SP->_slk->labcnt = (SP->_slk->maxlab < MAX_SKEY) ? MAX_SKEY : SP->_slk->maxlab;
+ SP->_slk->maxlab = (num_labels > 0) ?
+ num_labels : MAX_SKEY(_nc_slk_format);
+ SP->_slk->maxlen = (num_labels > 0) ?
+ label_width * label_height : MAX_SKEY_LEN(_nc_slk_format);
+ SP->_slk->labcnt = (SP->_slk->maxlab < MAX_SKEY(_nc_slk_format)) ?
+ MAX_SKEY(_nc_slk_format) : SP->_slk->maxlab;
SP->_slk->ent = typeCalloc(slk_ent, SP->_slk->labcnt);
if (SP->_slk->ent == NULL)
@@ -179,11 +183,17 @@ char *p;
FreeIfNeeded(SP->_slk->ent);
free(SP->_slk);
SP->_slk = (SLK*)0;
- return(ERR);
+ res = (ERR);
}
}
- return(OK);
+ /* We now reset the format so that the next newterm has again
+ * per default no SLK keys and may call slk_init again to
+ * define a new layout. (juergen 03-Mar-1999)
+ */
+ SP->slk_format = _nc_slk_format;
+ _nc_slk_format = 0;
+ return(res);
}
diff --git a/lib/libcurses/base/lib_slkclear.c b/lib/libcurses/base/lib_slkclear.c
index aa28feda10b..eef57c72fd4 100644
--- a/lib/libcurses/base/lib_slkclear.c
+++ b/lib/libcurses/base/lib_slkclear.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_slkclear.c,v 1.1 1999/01/18 19:10:01 millert Exp $ */
+/* $OpenBSD: lib_slkclear.c,v 1.2 1999/03/11 21:03:56 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -40,7 +40,7 @@
*/
#include <curses.priv.h>
-MODULE_ID("$From: lib_slkclear.c,v 1.3 1998/02/11 12:13:56 tom Exp $")
+MODULE_ID("$From: lib_slkclear.c,v 1.4 1999/03/03 23:44:22 juergen Exp $")
int
slk_clear(void)
@@ -54,7 +54,11 @@ slk_clear(void)
inherit those attributes from the standard screen */
SP->_slk->win->_bkgd = stdscr->_bkgd;
SP->_slk->win->_attrs = stdscr->_attrs;
- werase(SP->_slk->win);
-
- returnCode(wrefresh(SP->_slk->win));
+ if (SP->_slk->win == stdscr) {
+ returnCode(OK);
+ }
+ else {
+ werase(SP->_slk->win);
+ returnCode(wrefresh(SP->_slk->win));
+ }
}
diff --git a/lib/libcurses/base/lib_slkrefr.c b/lib/libcurses/base/lib_slkrefr.c
index ab3df3b391e..5c3e7d944d9 100644
--- a/lib/libcurses/base/lib_slkrefr.c
+++ b/lib/libcurses/base/lib_slkrefr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_slkrefr.c,v 1.1 1999/01/18 19:10:03 millert Exp $ */
+/* $OpenBSD: lib_slkrefr.c,v 1.2 1999/03/11 21:03:56 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -40,7 +40,7 @@
#include <curses.priv.h>
#include <term.h> /* num_labels, label_*, plab_norm */
-MODULE_ID("$From: lib_slkrefr.c,v 1.6 1999/01/02 22:56:59 tom Exp $")
+MODULE_ID("$From: lib_slkrefr.c,v 1.7 1999/03/03 23:44:22 juergen Exp $")
/*
* Write the soft labels to the soft-key window.
@@ -49,22 +49,25 @@ static void
slk_intern_refresh(SLK *slk)
{
int i;
+int fmt = SP->slk_format;
+
for (i = 0; i < slk->labcnt; i++) {
if (slk->dirty || slk->ent[i].dirty) {
if (slk->ent[i].visible) {
- if (num_labels > 0 && SLK_STDFMT)
+ if (num_labels > 0 && SLK_STDFMT(fmt))
{
if (i < num_labels) {
TPUTS_TRACE("plab_norm");
- putp(tparm(plab_norm, i, slk->win,slk->ent[i].form_text));
+ putp(tparm(plab_norm, i+1, slk->win,slk->ent[i].form_text));
}
}
else
{
- wmove(slk->win,SLK_LINES-1,slk->ent[i].x);
+ wmove(slk->win,SLK_LINES(fmt)-1,slk->ent[i].x);
if (SP && SP->_slk)
wattrset(slk->win,SP->_slk->attr);
- waddnstr(slk->win,slk->ent[i].form_text, MAX_SKEY_LEN);
+ waddnstr(slk->win,slk->ent[i].form_text,
+ MAX_SKEY_LEN(fmt));
/* if we simulate SLK's, it's looking much more
natural to use the current ATTRIBUTE also
for the label window */