]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/test_mouse.c
ncurses 6.3 - patch 20220724
[ncurses.git] / test / test_mouse.c
index 8cb12d9fc6e17b25612ae2c912d5a7f24886e827..602df4cf98c10b535b2af1703cf3ded05f7d13a0 100644 (file)
@@ -22,7 +22,7 @@
  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
  ****************************************************************************/
 /*
- * $Id: test_mouse.c,v 1.18 2022/05/15 00:20:27 tom Exp $
+ * $Id: test_mouse.c,v 1.22 2022/07/24 15:18:53 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;
 
@@ -110,7 +121,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",
@@ -194,9 +205,9 @@ main(int argc, char *argv[])
                unsigned btn;
                mmask_t events;
 #if NCURSES_MOUSE_VERSION > 1
-               const int max_btn = 5;
+               const unsigned max_btn = 5;
 #else
-               const int max_btn = 4;
+               const unsigned max_btn = 4;
 #endif
                const mmask_t btn_mask = (NCURSES_BUTTON_RELEASED |
                                          NCURSES_BUTTON_PRESSED |