X-Git-Url: http://ncurses.scripts.mit.edu/?a=blobdiff_plain;f=test%2Ftest_mouse.c;h=1348877f667a5c81180f3156e399f11e31439cc2;hb=aaa5142e4bdde469fbc59d1c91455cbd0c45281a;hp=b24903d541454cbd0c9a895af5fcdbaea548d0e6;hpb=1ddfa997c0965852dbdc738aa6d92c0cd0975f3b;p=ncurses.git diff --git a/test/test_mouse.c b/test/test_mouse.c index b24903d5..1348877f 100644 --- a/test/test_mouse.c +++ b/test/test_mouse.c @@ -22,7 +22,7 @@ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************/ /* - * $Id: test_mouse.c,v 1.19 2022/05/15 16:41:20 tom Exp $ + * $Id: test_mouse.c,v 1.23 2022/08/20 18:12:16 tom Exp $ * * Author: Leonid S Usov * @@ -43,7 +43,18 @@ raw_loop(void) char *xtermcap; tcgetattr(0, &old); +#if HAVE_CFMAKERAW cfmakeraw(&tty); +#else + tty = old; + tty.c_iflag &= (unsigned) (~(IGNBRK | BRKINT | PARMRK | ISTRIP + | INLCR | IGNCR | ICRNL | IXON)); + tty.c_oflag &= (unsigned) (~OPOST); + tty.c_lflag &= (unsigned) (~(ECHO | ECHONL | ICANON | ISIG | IEXTEN)); + tty.c_cflag &= (unsigned) (~(CSIZE | PARENB)); + tty.c_cflag |= CS8; + tcsetattr(0, TCSANOW, &tty); +#endif setupterm(NULL, 0, 0); xtermcap = tigetstr("XM"); @@ -57,7 +68,7 @@ raw_loop(void) tcsetattr(0, TCSANOW, &tty); - while (true) { + while (1) { int c = getc(stdin); const char *pretty; @@ -86,11 +97,13 @@ static void logw(const char *fmt, ...) { int row = getcury(stdscr); - va_list args; + va_start(args, fmt); wmove(stdscr, row++, 0); vw_printw(stdscr, fmt, args); + va_end(args); + clrtoeol(); row %= (getmaxy(stdscr) - logoffset); @@ -110,7 +123,7 @@ usage(void) { "Usage: test_mouse [options]", "", - "Test mouse events. These examples for $TERM demonstrate xterm" + "Test mouse events. These examples for $TERM demonstrate xterm", "features:", " xterm", " xterm-1002",