Assume everyone has curs_set() -- there's no good test for this, and the

existing tests are bogus.
This commit is contained in:
William McBrine
2007-06-29 21:40:07 +00:00
parent 5f58235cbd
commit db961bf839
2 changed files with 15 additions and 40 deletions

View File

@@ -2,7 +2,7 @@
/*
* 'textual user interface'
*
* $Id: tui.c,v 1.30 2007/06/29 21:04:52 wmcbrine Exp $
* $Id: tui.c,v 1.31 2007/06/29 21:40:07 wmcbrine Exp $
*
* Author : P.J. Kunst (kunst@prl.philips.nl)
* Date : 25-02-93
@@ -240,7 +240,8 @@ static void repaintmainmenu(int width, menu *mp)
mvwaddstr(wmain, 0, i * width,
prepad(padstr(p->name, width - 1), 1));
touchwin (wmain); wrefresh (wmain);
touchwin(wmain);
wrefresh(wmain);
}
static void mainhelp(void)
@@ -252,27 +253,6 @@ static void mainhelp(void)
#endif
}
static void hidecursor(void)
{
#if defined(PDCURSES) || defined(SYSV)
curs_set(0);
#endif
}
static void normalcursor(void)
{
#if defined(PDCURSES) || defined(SYSV)
curs_set(1);
#endif
}
static void insertcursor(void)
{
#if defined(PDCURSES) || defined(SYSV)
curs_set(2);
#endif
}
static void mainmenu(menu *mp)
{
int nitems, barlen, old = -1, cur = 0, c, cur0;
@@ -313,9 +293,9 @@ static void mainmenu(menu *mp)
wrefresh(wbody);
rmerror();
setmenupos(th + mh, cur * barlen);
normalcursor();
curs_set(1);
(mp[cur].func)(); /* perform function */
hidecursor();
curs_set(0);
switch (key)
{
@@ -378,7 +358,7 @@ static void cleanup(void) /* cleanup curses settings */
delwin(wmain);
delwin(wbody);
delwin(wstat);
normalcursor();
curs_set(1);
endwin();
incurses = FALSE;
}
@@ -480,7 +460,7 @@ void domenu(menu *mp)
bool stop = FALSE;
WINDOW *wmenu;
hidecursor();
curs_set(0);
getmenupos(&y, &x);
menudim(mp, &nitems, &barlen);
mheight = nitems + 2;
@@ -520,9 +500,9 @@ void domenu(menu *mp)
rmerror();
key = ERR;
normalcursor();
curs_set(1);
(mp[cur].func)(); /* perform function */
hidecursor();
curs_set(0);
repaintmenu(wmenu, mp);
@@ -591,7 +571,7 @@ void startmenu(menu *mp, char *mtitle)
cbreak(); /* direct input (no newline required)... */
noecho(); /* ... without echoing */
hidecursor(); /* hide cursor (if possible) */
curs_set(0); /* hide cursor (if possible) */
nodelay(wbody, TRUE); /* don't wait for input... */
halfdelay(10); /* ...well, no more than a second, anyway */
keypad(wbody, TRUE); /* enable cursor keys */
@@ -671,7 +651,7 @@ int weditstr(WINDOW *win, char *buf, int field)
colorbox(wedit, EDITBOXCOLOR, 0);
keypad(wedit, TRUE);
normalcursor();
curs_set(1);
while (!stop)
{
@@ -712,10 +692,7 @@ int weditstr(WINDOW *win, char *buf, int field)
defdisp = FALSE;
insert = !insert;
if (insert)
insertcursor();
else
normalcursor();
curs_set(insert ? 2 : 1);
break;
default:
@@ -779,7 +756,7 @@ int weditstr(WINDOW *win, char *buf, int field)
}
}
hidecursor();
curs_set(0);
wattrset(wedit, oldattr);
repainteditbox(wedit, bp - buf, buf);

View File

@@ -44,7 +44,7 @@
/* */
/******************************************************************************/
/* $Id: xmas.c,v 1.27 2006/09/24 23:49:15 wmcbrine Exp $ */
/* $Id: xmas.c,v 1.28 2007/06/29 21:40:07 wmcbrine Exp $ */
#include <curses.h>
#include <signal.h>
@@ -103,10 +103,8 @@ int main(int argc, char **argv)
if (has_colors())
start_color();
#endif
#ifdef PDCURSES
curs_set(0);
#endif
treescrn = newwin(16, 27, 3, 53);
treescrn2 = newwin(16, 27, 3, 53);
treescrn3 = newwin(16, 27, 3, 53);