]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/knight.c
ncurses 6.0 - patch 20170513
[ncurses.git] / test / knight.c
index b1215fcc9d954bda9df593e87d437dcbc970147e..878c113dc53b1caab2feb42e9d497d7afdce9b2a 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2013,2017 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            *
@@ -33,7 +33,7 @@
  * Eric S. Raymond <esr@snark.thyrsus.com> July 22 1995.  Mouse support
  * added September 20th 1995.
  *
- * $Id: knight.c,v 1.35 2013/02/03 00:16:59 tom Exp $
+ * $Id: knight.c,v 1.37 2017/04/15 17:43:11 tom Exp $
  */
 
 #include <test.priv.h>
@@ -130,6 +130,9 @@ init_program(void)
 #ifdef NCURSES_MOUSE_VERSION
     (void) mousemask(BUTTON1_CLICKED, (mmask_t *) NULL);
 #endif /* NCURSES_MOUSE_VERSION */
+#if defined(PDCURSES)
+    mouse_set(BUTTON1_RELEASED);
+#endif
 
     oldch = minus;
 }
@@ -577,8 +580,9 @@ play(void)
                nx = col + 1;
                break;
 
-#ifdef NCURSES_MOUSE_VERSION
+#ifdef KEY_MOUSE
            case KEY_MOUSE:
+#ifdef NCURSES_MOUSE_VERSION
                {
                    MEVENT myevent;
 
@@ -595,6 +599,24 @@ play(void)
                    }
                }
 #endif /* NCURSES_MOUSE_VERSION */
+#ifdef PDCURSES
+               {
+                   int test_y, test_x;
+                   request_mouse_pos();
+                   test_y = MOUSE_Y_POS + 0;
+                   test_x = MOUSE_X_POS + 1;
+                   if (test_y >= CY(0) && test_y <= CY(BDEPTH)
+                       && test_x >= CX(0) && test_x <= CX(BWIDTH)) {
+                       ny = CYINV(test_y);
+                       nx = CXINV(test_x);
+                       wmove(helpwin, 0, 0);
+                       wrefresh(helpwin);
+                       ungetch('\n');
+                   }
+                   break;
+               }
+#endif /* PDCURSES */
+#endif /* KEY_MOUSE */
 
            case KEY_B2:
            case '\n':
@@ -712,7 +734,7 @@ play(void)
            case 'x':
                goto dropout;
 
-           case '?':
+           case HELP_KEY_1:
                show_help(&keyhelp);
                break;