1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
include <curses.h>
#ifdef NCURSES_MOUSE_VERSION
#define Mouse "Mouse supported"
#else
#define Mouse "Mouse not supported"
#endif
#include <signal.h>
int main() {
int c,line=0; /* ,result = 0; => inutilisee */
int mx,my;
mmask_t Mask;
(void) initscr(); /* initialize the curses library */
keypad(stdscr, TRUE); /* enable keyboard mapping */
(void)immedok(stdscr,TRUE);
(void)scrollok(stdscr,TRUE);
mvaddstr(line++,0,Mouse);
getmaxyx(stdscr,my,mx);
if (!mousemask(ALL_MOUSE_EVENTS, &Mask)) {
mvaddstr(line++,0,"Mouse mask failed");
/* if (Mask != NULL) */
if (Mask != 0) /* Mask n est pas un pointeur... */
mvaddstr(line++,0,"Mouse mask returned");
else
mvaddstr(line++,0,"No mouse mask returned");
}
do {
mvaddstr(line++,5,"Waiting mouse events");
c = wgetch(stdscr);
if ( c == KEY_MOUSE)
mvaddstr(mx-1,my-1,"Mouse event detected");
else
mvaddstr(line++,5,"No event");
} while (c != 'q');
return 0;
} |
Partager