aboutsummaryrefslogtreecommitdiff
path: root/contrib/ncurses/ncurses/base
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ncurses/ncurses/base')
-rwxr-xr-xcontrib/ncurses/ncurses/base/MKlib_gen.sh9
-rw-r--r--contrib/ncurses/ncurses/base/lib_addstr.c4
-rw-r--r--contrib/ncurses/ncurses/base/lib_color.c12
-rw-r--r--contrib/ncurses/ncurses/base/lib_colorset.c26
-rw-r--r--contrib/ncurses/ncurses/base/lib_dft_fgbg.c4
-rw-r--r--contrib/ncurses/ncurses/base/lib_getch.c65
-rw-r--r--contrib/ncurses/ncurses/base/lib_hline.c4
-rw-r--r--contrib/ncurses/ncurses/base/lib_mouse.c144
-rw-r--r--contrib/ncurses/ncurses/base/lib_newterm.c18
-rw-r--r--contrib/ncurses/ncurses/base/lib_restart.c65
-rw-r--r--contrib/ncurses/ncurses/base/lib_set_term.c38
-rw-r--r--contrib/ncurses/ncurses/base/lib_winch.c19
12 files changed, 219 insertions, 189 deletions
diff --git a/contrib/ncurses/ncurses/base/MKlib_gen.sh b/contrib/ncurses/ncurses/base/MKlib_gen.sh
index 0a29c6085f62..337794007035 100755
--- a/contrib/ncurses/ncurses/base/MKlib_gen.sh
+++ b/contrib/ncurses/ncurses/base/MKlib_gen.sh
@@ -2,7 +2,7 @@
#
# MKlib_gen.sh -- generate sources from curses.h macro definitions
#
-# ($Id: MKlib_gen.sh,v 1.11 1998/01/17 14:16:52 Juan.Jose.Garcia.Ripoll Exp $)
+# ($Id: MKlib_gen.sh,v 1.12 2000/07/29 16:30:11 tom Exp $)
#
# The XSI Curses standard requires all curses entry points to exist as
# functions, even though many definitions would normally be shadowed
@@ -113,6 +113,11 @@ BEGIN {
print "\n"
skip=1;
+ if ( $1 == "chtype" ) {
+ returnType = "Char";
+ } else {
+ returnType = "Code";
+ }
print "M_" $2
print $0;
print "{";
@@ -200,7 +205,7 @@ BEGIN {
if (match($0, "^void"))
call = ""
else if (dotrace)
- call = "returnCode( ";
+ call = sprintf("return%s( ", returnType);
else
call = "%%return ";
diff --git a/contrib/ncurses/ncurses/base/lib_addstr.c b/contrib/ncurses/ncurses/base/lib_addstr.c
index 0a72165910f3..59a3bae81c8c 100644
--- a/contrib/ncurses/ncurses/base/lib_addstr.c
+++ b/contrib/ncurses/ncurses/base/lib_addstr.c
@@ -40,7 +40,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_addstr.c,v 1.17 2000/04/29 21:15:55 tom Exp $")
+MODULE_ID("$Id: lib_addstr.c,v 1.18 2000/07/29 16:42:41 tom Exp $")
int
waddnstr(WINDOW *win, const char *const astr, int n)
@@ -51,7 +51,7 @@ waddnstr(WINDOW *win, const char *const astr, int n)
T((T_CALLED("waddnstr(%p,%s,%d)"), win, _nc_visbuf(astr), n));
if (win && (str != 0)) {
- T(("... current %s", _traceattr(win->_attrs)));
+ TR(TRACE_VIRTPUT | TRACE_ATTRS, ("... current %s", _traceattr(win->_attrs)));
TR(TRACE_VIRTPUT, ("str is not null"));
code = OK;
if (n < 0)
diff --git a/contrib/ncurses/ncurses/base/lib_color.c b/contrib/ncurses/ncurses/base/lib_color.c
index 71bee42487cd..492194babbfb 100644
--- a/contrib/ncurses/ncurses/base/lib_color.c
+++ b/contrib/ncurses/ncurses/base/lib_color.c
@@ -41,7 +41,7 @@
#include <term.h>
#include <tic.h>
-MODULE_ID("$Id: lib_color.c,v 1.51 2000/05/20 20:09:22 tom Exp $")
+MODULE_ID("$Id: lib_color.c,v 1.53 2000/09/02 18:02:15 tom Exp $")
/*
* These should be screen structure members. They need to be globals for
@@ -85,7 +85,7 @@ static const color_t hls_palette[] =
};
/* *INDENT-ON* */
-#ifdef NCURSES_EXT_FUNCS
+#if NCURSES_EXT_FUNCS
/*
* These are called from _nc_do_color(), which in turn is called from
* vidattr - so we have to assume that SP may be null.
@@ -265,7 +265,7 @@ init_pair(short pair, short f, short b)
if ((pair < 0) || (pair >= COLOR_PAIRS))
returnCode(ERR);
-#ifdef NCURSES_EXT_FUNCS
+#if NCURSES_EXT_FUNCS
if (SP->_default_color) {
if (f < 0)
f = C_MASK;
@@ -438,7 +438,7 @@ _nc_do_color(int old_pair, int pair, bool reverse, int (*outc) (int))
pair_content(old_pair, &old_fg, &old_bg);
if ((fg == C_MASK && old_fg != C_MASK)
|| (bg == C_MASK && old_bg != C_MASK)) {
-#ifdef NCURSES_EXT_FUNCS
+#if NCURSES_EXT_FUNCS
/*
* A minor optimization - but extension. If "AX" is specified in
* the terminal description, treat it as screen's indicator of ECMA
@@ -458,7 +458,7 @@ _nc_do_color(int old_pair, int pair, bool reverse, int (*outc) (int))
return;
}
-#ifdef NCURSES_EXT_FUNCS
+#if NCURSES_EXT_FUNCS
if (fg == C_MASK)
fg = default_fg();
if (bg == C_MASK)
@@ -471,7 +471,7 @@ _nc_do_color(int old_pair, int pair, bool reverse, int (*outc) (int))
bg = xx;
}
- T(("setting colors: pair = %d, fg = %d, bg = %d", pair, fg, bg));
+ TR(TRACE_ATTRS, ("setting colors: pair = %d, fg = %d, bg = %d", pair, fg, bg));
if (fg != C_MASK) {
set_foreground_color(fg, outc);
diff --git a/contrib/ncurses/ncurses/base/lib_colorset.c b/contrib/ncurses/ncurses/base/lib_colorset.c
index d9fc5c28dc01..3870e875f322 100644
--- a/contrib/ncurses/ncurses/base/lib_colorset.c
+++ b/contrib/ncurses/ncurses/base/lib_colorset.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
+ * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -40,17 +40,19 @@
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("$Id: lib_colorset.c,v 1.5 1999/05/16 17:13:43 juergen Exp $")
+MODULE_ID("$Id: lib_colorset.c,v 1.6 2000/07/29 16:37:19 tom Exp $")
-int wcolor_set(WINDOW *win, short color_pair_number, void *opts)
+int
+wcolor_set(WINDOW *win, short color_pair_number, void *opts)
{
- T((T_CALLED("wcolor_set(%p,%d)"), win, color_pair_number));
- if (win && !opts && (color_pair_number >= 0) && (color_pair_number < COLOR_PAIRS)) {
- T(("... current %ld", (long) PAIR_NUMBER(win->_attrs)));
- toggle_attr_on(win->_attrs,COLOR_PAIR(color_pair_number));
- returnCode(OK);
- } else
- returnCode(ERR);
+ T((T_CALLED("wcolor_set(%p,%d)"), win, color_pair_number));
+ if (win
+ && !opts
+ && (color_pair_number >= 0)
+ && (color_pair_number < COLOR_PAIRS)) {
+ TR(TRACE_ATTRS, ("... current %ld", (long) PAIR_NUMBER(win->_attrs)));
+ toggle_attr_on(win->_attrs, COLOR_PAIR(color_pair_number));
+ returnCode(OK);
+ } else
+ returnCode(ERR);
}
-
-
diff --git a/contrib/ncurses/ncurses/base/lib_dft_fgbg.c b/contrib/ncurses/ncurses/base/lib_dft_fgbg.c
index 19d75477b140..7c090244f291 100644
--- a/contrib/ncurses/ncurses/base/lib_dft_fgbg.c
+++ b/contrib/ncurses/ncurses/base/lib_dft_fgbg.c
@@ -33,7 +33,7 @@
#include <curses.priv.h>
#include <term.h>
-MODULE_ID("$Id: lib_dft_fgbg.c,v 1.11 2000/05/07 01:26:06 tom Exp $")
+MODULE_ID("$Id: lib_dft_fgbg.c,v 1.13 2000/07/07 16:50:27 tom Exp $")
/*
* Modify the behavior of color-pair 0 so that the library doesn't assume that
@@ -61,7 +61,7 @@ assume_default_colors(int fg, int bg)
if (initialize_pair) /* don't know how to handle this */
returnCode(ERR);
- SP->_default_color = (fg != COLOR_WHITE) || (bg != COLOR_BLACK);
+ SP->_default_color = (fg < 0 || fg == C_MASK) || (bg < 0 || bg == C_MASK);
SP->_has_sgr_39_49 = (tigetflag("AX") == TRUE);
SP->_default_fg = (fg >= 0) ? (fg & C_MASK) : C_MASK;
SP->_default_bg = (bg >= 0) ? (bg & C_MASK) : C_MASK;
diff --git a/contrib/ncurses/ncurses/base/lib_getch.c b/contrib/ncurses/ncurses/base/lib_getch.c
index 7ab4b5085c75..f67bf9a35f77 100644
--- a/contrib/ncurses/ncurses/base/lib_getch.c
+++ b/contrib/ncurses/ncurses/base/lib_getch.c
@@ -40,56 +40,17 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_getch.c,v 1.47 2000/05/28 01:12:51 tom Exp $")
+MODULE_ID("$Id: lib_getch.c,v 1.50 2000/10/09 23:53:57 Ilya.Zakharevich Exp $")
#include <fifo_defs.h>
int ESCDELAY = 1000; /* max interval betw. chars in funkeys, in millisecs */
-#ifdef USE_EMX_MOUSE
-# include <sys/select.h>
-static int
-kbd_mouse_read(unsigned char *p)
-{
- fd_set fdset;
- int nums = SP->_ifd + 1;
-
- for (;;) {
- FD_ZERO(&fdset);
- FD_SET(SP->_ifd, &fdset);
- if (SP->_checkfd >= 0) {
- FD_SET(SP->_checkfd, &fdset);
- if (SP->_checkfd >= nums)
- nums = SP->_checkfd + 1;
- }
- if (SP->_mouse_fd >= 0) {
- FD_SET(SP->_mouse_fd, &fdset);
- if (SP->_mouse_fd >= nums)
- nums = SP->_mouse_fd + 1;
- }
- if (select(nums, &fdset, NULL, NULL, NULL) >= 0) {
- int n;
-
- if (SP->_mouse_fd >= 0
- && FD_ISSET(SP->_mouse_fd, &fdset)) { /* Prefer mouse */
- n = read(SP->_mouse_fd, p, 1);
- } else {
- n = read(SP->_ifd, p, 1);
- }
- return n;
- }
- if (errno != EINTR) {
- return -1;
- }
- }
-}
-#endif /* USE_EMX_MOUSE */
-
static inline int
fifo_peek(void)
{
int ch = SP->_fifo[peek];
- T(("peeking at %d", peek));
+ TR(TRACE_IEVENT, ("peeking at %d", peek));
p_inc();
return ch;
@@ -100,7 +61,7 @@ fifo_pull(void)
{
int ch;
ch = SP->_fifo[head];
- T(("pulling %d from %d", ch, head));
+ TR(TRACE_IEVENT, ("pulling %d from %d", ch, head));
if (peek == head) {
h_inc();
@@ -129,7 +90,7 @@ fifo_push(void)
errno = 0;
#endif
-#if USE_GPM_SUPPORT
+#if USE_GPM_SUPPORT || defined(USE_EMX_MOUSE)
if ((SP->_mouse_fd >= 0)
&& (_nc_timed_wait(3, -1, (int *) 0) & 2)) {
SP->_mouse_event(SP);
@@ -139,11 +100,7 @@ fifo_push(void)
#endif
{
unsigned char c2 = 0;
-#ifdef USE_EMX_MOUSE
- n = kbd_mouse_read(&c2);
-#else
n = read(SP->_ifd, &c2, 1);
-#endif
ch = c2 & 0xff;
}
@@ -162,17 +119,17 @@ fifo_push(void)
#endif
if ((n == -1) || (n == 0)) {
- T(("read(%d,&ch,1)=%d, errno=%d", SP->_ifd, n, errno));
- return ERR;
+ TR(TRACE_IEVENT, ("read(%d,&ch,1)=%d, errno=%d", SP->_ifd, n, errno));
+ ch = ERR;
}
- T(("read %d characters", n));
+ TR(TRACE_IEVENT, ("read %d characters", n));
SP->_fifo[tail] = ch;
SP->_fifohold = 0;
if (head == -1)
head = peek = tail;
t_inc();
- T(("pushed %#x at %d", ch, tail));
+ TR(TRACE_IEVENT, ("pushed %#x at %d", ch, tail));
#ifdef TRACE
if (_nc_tracing & TRACE_IEVENT)
_nc_fifo_dump();
@@ -223,7 +180,7 @@ wgetch(WINDOW *win)
if (head == -1 && !SP->_raw && !SP->_cbreak) {
char buf[MAXCOLUMNS], *sp;
- T(("filling queue in cooked mode"));
+ TR(TRACE_IEVENT, ("filling queue in cooked mode"));
wgetnstr(win, buf, MAXCOLUMNS);
@@ -241,13 +198,13 @@ wgetch(WINDOW *win)
if (!win->_notimeout && (win->_delay >= 0 || SP->_cbreak > 1)) {
int delay;
- T(("timed delay in wgetch()"));
+ TR(TRACE_IEVENT, ("timed delay in wgetch()"));
if (SP->_cbreak > 1)
delay = (SP->_cbreak - 1) * 100;
else
delay = win->_delay;
- T(("delay is %d milliseconds", delay));
+ TR(TRACE_IEVENT, ("delay is %d milliseconds", delay));
if (head == -1) /* fifo is empty */
if (!_nc_timed_wait(3, delay, (int *) 0))
diff --git a/contrib/ncurses/ncurses/base/lib_hline.c b/contrib/ncurses/ncurses/base/lib_hline.c
index 71d6b140424c..fd32d35a38e7 100644
--- a/contrib/ncurses/ncurses/base/lib_hline.c
+++ b/contrib/ncurses/ncurses/base/lib_hline.c
@@ -40,7 +40,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_hline.c,v 1.5 2000/04/29 21:14:30 tom Exp $")
+MODULE_ID("$Id: lib_hline.c,v 1.6 2000/07/04 14:08:09 Philippe.Blain Exp $")
int
whline(WINDOW *win, chtype ch, int n)
@@ -69,6 +69,8 @@ whline(WINDOW *win, chtype ch, int n)
line->text[end] = ch;
end--;
}
+
+ _nc_synchook(win);
code = OK;
}
returnCode(code);
diff --git a/contrib/ncurses/ncurses/base/lib_mouse.c b/contrib/ncurses/ncurses/base/lib_mouse.c
index 59db16d1aea6..3b8563503979 100644
--- a/contrib/ncurses/ncurses/base/lib_mouse.c
+++ b/contrib/ncurses/ncurses/base/lib_mouse.c
@@ -84,7 +84,7 @@
#endif
#endif
-MODULE_ID("$Id: lib_mouse.c,v 1.52 2000/06/29 23:02:26 tom Exp $")
+MODULE_ID("$Id: lib_mouse.c,v 1.55 2000/10/10 00:07:28 Ilya.Zakharevich Exp $")
#define MY_TRACE TRACE_ICALLS|TRACE_IEVENT
@@ -130,8 +130,8 @@ _trace_slot(const char *tag)
for (ep = events; ep < events + EV_MAX; ep++)
_tracef("mouse event queue slot %ld = %s",
- (long) (ep - events),
- _tracemouse(ep));
+ (long) (ep - events),
+ _tracemouse(ep));
}
#endif
@@ -154,7 +154,7 @@ write_event(int down, int button, int x, int y)
char buf[6];
unsigned long ignore;
- strcpy(buf, key_mouse);
+ strncpy(buf, key_mouse, 3); /* should be "\033[M" */
buf[3] = ' ' + (button - 1) + (down ? 0 : 0x40);
buf[4] = ' ' + x - LEFT_COL + 1;
buf[5] = ' ' + y - TOP_ROW + 1;
@@ -169,20 +169,27 @@ mouse_server(unsigned long ignored GCC_UNUSED)
MOUEVENTINFO mouev;
HMOU hmou;
unsigned short mask = MOUSE_BN1_DOWN | MOUSE_BN2_DOWN | MOUSE_BN3_DOWN;
+ int nbuttons = 3;
int oldstate = 0;
- char errmess[] = "Unexpected termination of mouse thread\r\n";
- unsigned long ignore;
+ char err[80];
+ unsigned long rc;
/* open the handle for the mouse */
if (MouOpen(NULL, &hmou) == 0) {
-
- if (MouSetEventMask(&mask, hmou) == 0
- && MouDrawPtr(hmou) == 0) {
-
+ rc = MouSetEventMask(&mask, hmou);
+ if (rc) { /* retry with 2 buttons */
+ mask = MOUSE_BN1_DOWN | MOUSE_BN2_DOWN;
+ rc = MouSetEventMask(&mask, hmou);
+ nbuttons = 2;
+ }
+ if (rc == 0 && MouDrawPtr(hmou) == 0) {
for (;;) {
/* sit and wait on the event queue */
- if (MouReadEventQue(&mouev, &fWait, hmou))
+ rc = MouReadEventQue(&mouev, &fWait, hmou);
+ if (rc) {
+ sprintf(err, "Error reading mouse queue, rc=%lu.\r\n", rc);
break;
+ }
if (!mouse_activated)
goto finish;
@@ -195,24 +202,27 @@ mouse_server(unsigned long ignored GCC_UNUSED)
*/
if ((mouev.fs ^ oldstate) & MOUSE_BN1_DOWN)
write_event(mouev.fs & MOUSE_BN1_DOWN,
- mouse_buttons[1], mouev.col, mouev.row);
+ mouse_buttons[1], mouev.col, mouev.row);
if ((mouev.fs ^ oldstate) & MOUSE_BN2_DOWN)
write_event(mouev.fs & MOUSE_BN2_DOWN,
- mouse_buttons[3], mouev.col, mouev.row);
+ mouse_buttons[3], mouev.col, mouev.row);
if ((mouev.fs ^ oldstate) & MOUSE_BN3_DOWN)
write_event(mouev.fs & MOUSE_BN3_DOWN,
- mouse_buttons[2], mouev.col, mouev.row);
+ mouse_buttons[2], mouev.col, mouev.row);
finish:
oldstate = mouev.fs;
}
- }
+ } else
+ sprintf(err, "Error setting event mask, buttons=%d, rc=%lu.\r\n",
+ nbuttons, rc);
- DosWrite(2, errmess, strlen(errmess), &ignore);
+ DosWrite(2, err, strlen(err), &rc);
MouClose(hmou);
}
DosExit(EXIT_THREAD, 0L);
}
+
static void
server_state(const int state)
{ /* It would be nice to implement pointer-off and stop looping... */
@@ -248,8 +258,10 @@ initialize_mousetype(void)
&& strstr(cur_term->type.term_names, "xterm") == 0
&& key_mouse) {
int handles[2];
+
if (pipe(handles) < 0) {
perror("mouse pipe error");
+ return;
} else {
int rc;
@@ -270,9 +282,10 @@ initialize_mousetype(void)
setmode(handles[1], O_BINARY);
/* Do not use CRT functions, we may single-threaded. */
rc = DosCreateThread((unsigned long *) &mouse_thread,
- mouse_server, 0, 0, 8192);
+ mouse_server, 0, 0, 8192);
if (rc) {
printf("mouse thread error %d=%#x", rc, rc);
+ return;
} else {
mousetype = M_XTERM;
return;
@@ -359,6 +372,23 @@ _nc_mouse_event(SCREEN * sp GCC_UNUSED)
}
#endif
+#ifdef USE_EMX_MOUSE
+ if (SP->_mouse_fd >= 0
+ && (_nc_timed_wait(3, 0, (int *) 0) & 2) != 0) {
+ char kbuf[3];
+
+ int i, res = read(M_FD(sp), &kbuf, 3); /* Eat the prefix */
+ if (res != 3)
+ printf("Got %d chars instead of 3 for prefix.\n", res);
+ for (i = 0; i < res; i++) {
+ if (kbuf[i] != key_mouse[i])
+ printf("Got char %d instead of %d for prefix.\n",
+ (int) kbuf[i], (int) key_mouse[i]);
+ }
+ return TRUE;
+ }
+#endif /* USE_EMX_MOUSE */
+
/* xterm: never have to query, mouse events are in the keyboard stream */
return (FALSE); /* no event waiting */
}
@@ -419,7 +449,7 @@ _nc_mouse_inline(SCREEN * sp)
kbuf[3] = '\0';
TR(TRACE_IEVENT,
- ("_nc_mouse_inline sees the following xterm data: '%s'", kbuf));
+ ("_nc_mouse_inline sees the following xterm data: '%s'", kbuf));
eventp->id = 0; /* there's only one mouse... */
@@ -457,8 +487,8 @@ _nc_mouse_inline(SCREEN * sp)
*/
eventp->bstate =
(BUTTON1_RELEASED |
- BUTTON2_RELEASED |
- BUTTON3_RELEASED);
+ BUTTON2_RELEASED |
+ BUTTON3_RELEASED);
/*
* ...however, because there are no kinds of mouse events under
* xterm that can intervene between press and release, we can
@@ -488,9 +518,9 @@ _nc_mouse_inline(SCREEN * sp)
eventp->x = (kbuf[1] - ' ') - 1;
eventp->y = (kbuf[2] - ' ') - 1;
TR(MY_TRACE,
- ("_nc_mouse_inline: primitive mouse-event %s has slot %ld",
- _tracemouse(eventp),
- (long) (eventp - events)));
+ ("_nc_mouse_inline: primitive mouse-event %s has slot %ld",
+ _tracemouse(eventp),
+ (long) (eventp - events)));
/* bump the next-free pointer into the circular list */
eventp = NEXT(eventp);
@@ -514,7 +544,7 @@ mouse_activate(bool on)
switch (mousetype) {
case M_XTERM:
-#ifdef NCURSES_EXT_FUNCS
+#if NCURSES_EXT_FUNCS
keyok(KEY_MOUSE, on);
#endif
TPUTS_TRACE("xterm mouse initialization");
@@ -598,9 +628,9 @@ _nc_mouse_parse(int runcount)
*/
if (runcount == 1) {
TR(MY_TRACE,
- ("_nc_mouse_parse: returning simple mouse event %s at slot %ld",
- _tracemouse(prev),
- (long) (prev - events)));
+ ("_nc_mouse_parse: returning simple mouse event %s at slot %ld",
+ _tracemouse(prev),
+ (long) (prev - events)));
return (prev->id >= 0)
? ((prev->bstate & eventmask) ? TRUE : FALSE)
: FALSE;
@@ -616,9 +646,9 @@ _nc_mouse_parse(int runcount)
if (_nc_tracing & TRACE_IEVENT) {
_trace_slot("before mouse press/release merge:");
_tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d",
- (long) (runp - events),
- (long) ((eventp - events) + (EV_MAX - 1)) % EV_MAX,
- runcount);
+ (long) (runp - events),
+ (long) ((eventp - events) + (EV_MAX - 1)) % EV_MAX,
+ runcount);
}
#endif /* TRACE */
@@ -664,9 +694,9 @@ _nc_mouse_parse(int runcount)
if (_nc_tracing & TRACE_IEVENT) {
_trace_slot("before mouse click merge:");
_tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d",
- (long) (runp - events),
- (long) ((eventp - events) + (EV_MAX - 1)) % EV_MAX,
- runcount);
+ (long) (runp - events),
+ (long) ((eventp - events) + (EV_MAX - 1)) % EV_MAX,
+ runcount);
}
#endif /* TRACE */
@@ -700,7 +730,7 @@ _nc_mouse_parse(int runcount)
/* merge click events forward */
if ((ep->bstate &
- (BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED))
+ (BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED))
&& (follower->bstate &
(BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED))) {
if ((eventmask & BUTTON1_DOUBLE_CLICKED)
@@ -727,9 +757,9 @@ _nc_mouse_parse(int runcount)
/* merge double-click events forward */
if ((ep->bstate &
- (BUTTON1_DOUBLE_CLICKED
- | BUTTON2_DOUBLE_CLICKED
- | BUTTON3_DOUBLE_CLICKED))
+ (BUTTON1_DOUBLE_CLICKED
+ | BUTTON2_DOUBLE_CLICKED
+ | BUTTON3_DOUBLE_CLICKED))
&& (follower->bstate &
(BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED))) {
if ((eventmask & BUTTON1_TRIPLE_CLICKED)
@@ -761,9 +791,9 @@ _nc_mouse_parse(int runcount)
if (_nc_tracing & TRACE_IEVENT) {
_trace_slot("before mouse event queue compaction:");
_tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d",
- (long) (runp - events),
- (long) ((eventp - events) + (EV_MAX - 1)) % EV_MAX,
- runcount);
+ (long) (runp - events),
+ (long) ((eventp - events) + (EV_MAX - 1)) % EV_MAX,
+ runcount);
}
#endif /* TRACE */
@@ -779,16 +809,16 @@ _nc_mouse_parse(int runcount)
if (_nc_tracing & TRACE_IEVENT) {
_trace_slot("after mouse event queue compaction:");
_tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d",
- (long) (runp - events),
- (long) ((eventp - events) + (EV_MAX - 1)) % EV_MAX,
- runcount);
+ (long) (runp - events),
+ (long) ((eventp - events) + (EV_MAX - 1)) % EV_MAX,
+ runcount);
}
for (ep = runp; ep != eventp; ep = NEXT(ep))
if (ep->id != INVALID_EVENT)
TR(MY_TRACE,
- ("_nc_mouse_parse: returning composite mouse event %s at slot %ld",
- _tracemouse(ep),
- (long) (ep - events)));
+ ("_nc_mouse_parse: returning composite mouse event %s at slot %ld",
+ _tracemouse(ep),
+ (long) (ep - events)));
#endif /* TRACE */
/* after all this, do we have a valid event? */
@@ -847,8 +877,8 @@ getmouse(MEVENT * aevent)
*aevent = *prev;
TR(TRACE_IEVENT, ("getmouse: returning event %s from slot %ld",
- _tracemouse(prev),
- (long) (prev - events)));
+ _tracemouse(prev),
+ (long) (prev - events)));
prev->id = INVALID_EVENT; /* so the queue slot becomes free */
returnCode(OK);
@@ -888,12 +918,12 @@ mousemask(mmask_t newmask, mmask_t * oldmask)
if (mousetype != M_NONE) {
eventmask = newmask &
(BUTTON_ALT | BUTTON_CTRL | BUTTON_SHIFT
- | BUTTON1_PRESSED | BUTTON1_RELEASED | BUTTON1_CLICKED
- | BUTTON1_DOUBLE_CLICKED | BUTTON1_TRIPLE_CLICKED
- | BUTTON2_PRESSED | BUTTON2_RELEASED | BUTTON2_CLICKED
- | BUTTON2_DOUBLE_CLICKED | BUTTON2_TRIPLE_CLICKED
- | BUTTON3_PRESSED | BUTTON3_RELEASED | BUTTON3_CLICKED
- | BUTTON3_DOUBLE_CLICKED | BUTTON3_TRIPLE_CLICKED);
+ | BUTTON1_PRESSED | BUTTON1_RELEASED | BUTTON1_CLICKED
+ | BUTTON1_DOUBLE_CLICKED | BUTTON1_TRIPLE_CLICKED
+ | BUTTON2_PRESSED | BUTTON2_RELEASED | BUTTON2_CLICKED
+ | BUTTON2_DOUBLE_CLICKED | BUTTON2_TRIPLE_CLICKED
+ | BUTTON3_PRESSED | BUTTON3_RELEASED | BUTTON3_CLICKED
+ | BUTTON3_DOUBLE_CLICKED | BUTTON3_TRIPLE_CLICKED);
mouse_activate(eventmask != 0);
@@ -910,9 +940,9 @@ wenclose(const WINDOW *win, int y, int x)
if (win) {
y -= win->_yoffset;
return ((win->_begy <= y &&
- win->_begx <= x &&
- (win->_begx + win->_maxx) >= x &&
- (win->_begy + win->_maxy) >= y) ? TRUE : FALSE);
+ win->_begx <= x &&
+ (win->_begx + win->_maxx) >= x &&
+ (win->_begy + win->_maxy) >= y) ? TRUE : FALSE);
}
return FALSE;
}
diff --git a/contrib/ncurses/ncurses/base/lib_newterm.c b/contrib/ncurses/ncurses/base/lib_newterm.c
index 08e35cf50182..7da4069b5b85 100644
--- a/contrib/ncurses/ncurses/base/lib_newterm.c
+++ b/contrib/ncurses/ncurses/base/lib_newterm.c
@@ -40,14 +40,14 @@
#include <curses.priv.h>
-#if defined(SVR4_TERMIO) && !defined(_POSIX_SOURCE)
+#if SVR4_TERMIO && !defined(_POSIX_SOURCE)
#define _POSIX_SOURCE
#endif
#include <term.h> /* clear_screen, cup & friends, cur_term */
#include <tic.h>
-MODULE_ID("$Id: lib_newterm.c,v 1.46 2000/07/01 22:26:22 tom Exp $")
+MODULE_ID("$Id: lib_newterm.c,v 1.48 2000/09/02 18:11:42 tom Exp $")
#ifndef ONLCR /* Allows compilation under the QNX 4.2 OS */
#define ONLCR 0
@@ -191,17 +191,21 @@ newterm(NCURSES_CONST char *name, FILE * ofp, FILE * ifp)
SP->_use_rmso = SGR0_TEST(exit_standout_mode);
SP->_use_rmul = SGR0_TEST(exit_underline_mode);
-#ifdef USE_WIDEC_SUPPORT
+#if USE_WIDEC_SUPPORT
/*
* XFree86 xterm can be configured to support UTF-8 based on environment
* variable settings.
*/
{
char *s;
- if (((s = getenv("LC_ALL")) != 0
- || (s = getenv("LC_CTYPE")) != 0
- || (s = getenv("LANG")) != 0)
- && strstr(s, "UTF-8") != 0) {
+ s = getenv("LC_ALL");
+ if (s == NULL || *s == '\0') {
+ s = getenv("LC_CTYPE");
+ if (s == NULL || *s == '\0') {
+ s = getenv("LANG");
+ }
+ }
+ if (s != NULL && *s != '\0' && strstr(s, "UTF-8") != NULL) {
SP->_outch = _nc_utf8_outch;
}
}
diff --git a/contrib/ncurses/ncurses/base/lib_restart.c b/contrib/ncurses/ncurses/base/lib_restart.c
index de0182f42691..831e3255d842 100644
--- a/contrib/ncurses/ncurses/base/lib_restart.c
+++ b/contrib/ncurses/ncurses/base/lib_restart.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
+ * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -41,50 +41,51 @@
#include <curses.priv.h>
-#if defined(SVR4_TERMIO) && !defined(_POSIX_SOURCE)
+#if SVR4_TERMIO && !defined(_POSIX_SOURCE)
#define _POSIX_SOURCE
#endif
-#include <term.h> /* lines, columns, cur_term */
+#include <term.h> /* lines, columns, cur_term */
-MODULE_ID("$Id: lib_restart.c,v 1.2 1999/07/24 20:10:04 tom Exp $")
+MODULE_ID("$Id: lib_restart.c,v 1.3 2000/09/02 18:09:44 tom Exp $")
-int restartterm(NCURSES_CONST char *termp, int filenum, int *errret)
+int
+restartterm(NCURSES_CONST char *termp, int filenum, int *errret)
{
-int saveecho = SP->_echo;
-int savecbreak = SP->_cbreak;
-int saveraw = SP->_raw;
-int savenl = SP->_nl;
+ int saveecho = SP->_echo;
+ int savecbreak = SP->_cbreak;
+ int saveraw = SP->_raw;
+ int savenl = SP->_nl;
- T((T_CALLED("restartterm(%s,%d,%p)"), termp, filenum, errret));
+ T((T_CALLED("restartterm(%s,%d,%p)"), termp, filenum, errret));
- setupterm(termp, filenum, errret);
+ setupterm(termp, filenum, errret);
- if (saveecho)
- echo();
- else
- noecho();
+ if (saveecho)
+ echo();
+ else
+ noecho();
- if (savecbreak) {
- cbreak();
- noraw();
- } else if (saveraw) {
- nocbreak();
- raw();
- } else {
- nocbreak();
- noraw();
- }
- if (savenl)
- nl();
- else
- nonl();
+ if (savecbreak) {
+ cbreak();
+ noraw();
+ } else if (saveraw) {
+ nocbreak();
+ raw();
+ } else {
+ nocbreak();
+ noraw();
+ }
+ if (savenl)
+ nl();
+ else
+ nonl();
- reset_prog_mode();
+ reset_prog_mode();
#if USE_SIZECHANGE
- _nc_update_screensize();
+ _nc_update_screensize();
#endif
- returnCode(OK);
+ returnCode(OK);
}
diff --git a/contrib/ncurses/ncurses/base/lib_set_term.c b/contrib/ncurses/ncurses/base/lib_set_term.c
index b4d547fcf514..15dd6d3f505d 100644
--- a/contrib/ncurses/ncurses/base/lib_set_term.c
+++ b/contrib/ncurses/ncurses/base/lib_set_term.c
@@ -43,7 +43,7 @@
#include <term.h> /* cur_term */
#include <tic.h>
-MODULE_ID("$Id: lib_set_term.c,v 1.55 2000/07/02 00:22:18 tom Exp $")
+MODULE_ID("$Id: lib_set_term.c,v 1.58 2000/10/04 22:05:48 tom Exp $")
SCREEN *
set_term(SCREEN * screenp)
@@ -171,7 +171,7 @@ no_mouse_wrap(SCREEN * sp GCC_UNUSED)
{
}
-#if defined(NCURSES_EXT_FUNCS) && defined(USE_COLORFGBG)
+#if NCURSES_EXT_FUNCS && USE_COLORFGBG
static char *
extract_fgbg(char *src, int *result)
{
@@ -220,17 +220,45 @@ _nc_setupscreen(short slines, short const scolumns, FILE * output)
SP->_endwin = TRUE;
SP->_ofp = output;
SP->_cursor = -1; /* cannot know real cursor shape */
-#ifdef NCURSES_NO_PADDING
+
+#if NCURSES_NO_PADDING
SP->_no_padding = getenv("NCURSES_NO_PADDING") != 0;
TR(TRACE_CHARPUT | TRACE_MOVE, ("padding will%s be used",
SP->_no_padding ? " not" : ""));
#endif
-#ifdef NCURSES_EXT_FUNCS
+
+#if NCURSES_EXT_FUNCS
SP->_default_color = FALSE;
SP->_has_sgr_39_49 = FALSE;
+
+ /*
+ * Set our assumption of the terminal's default foreground and background
+ * colors. The curs_color man-page states that we can assume that the
+ * background is black. The origin of this assumption appears to be
+ * terminals that displayed colored text, but no colored backgrounds, e.g.,
+ * the first colored terminals around 1980. More recent ones with better
+ * technology can display not only colored backgrounds, but all
+ * combinations. So a terminal might be something other than "white" on
+ * black (green/black looks monochrome too), but black on white or even
+ * on ivory.
+ *
+ * White-on-black is the simplest thing to use for monochrome. Almost
+ * all applications that use color paint both text and background, so
+ * the distinction is moot. But a few do not - which is why we leave this
+ * configurable (a better solution is to use assume_default_colors() for
+ * the rare applications that do require that sort of appearance, since
+ * is appears that more users expect to be able to make a white-on-black
+ * or black-on-white display under control of the application than not).
+ */
+#ifdef USE_ASSUMED_COLOR
SP->_default_fg = COLOR_WHITE;
SP->_default_bg = COLOR_BLACK;
-#ifdef USE_COLORFGBG
+#else
+ SP->_default_fg = C_MASK;
+ SP->_default_bg = C_MASK;
+#endif
+
+#if USE_COLORFGBG
/*
* If rxvt's $COLORFGBG variable is set, use it to specify the assumed
* default colors. Note that rxvt (mis)uses bold colors, equating a bold
diff --git a/contrib/ncurses/ncurses/base/lib_winch.c b/contrib/ncurses/ncurses/base/lib_winch.c
index 119c731ebe3b..765220799a50 100644
--- a/contrib/ncurses/ncurses/base/lib_winch.c
+++ b/contrib/ncurses/ncurses/base/lib_winch.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
+ * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -39,14 +39,15 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_winch.c,v 1.1 1998/11/14 22:06:09 tom Exp $")
+MODULE_ID("$Id: lib_winch.c,v 1.2 2000/07/29 16:41:44 tom Exp $")
-chtype winch(WINDOW *win)
+chtype
+winch(WINDOW *win)
{
- T((T_CALLED("winch(%p)"), win));
- if (win != 0) {
- returnCode(win->_line[win->_cury].text[win->_curx]);
- } else {
- returnCode(0);
- }
+ T((T_CALLED("winch(%p)"), win));
+ if (win != 0) {
+ returnChar(win->_line[win->_cury].text[win->_curx]);
+ } else {
+ returnChar(0);
+ }
}