i was trying to write a programme in c language which can detect mouse movement, but the prograame which i have written can only detect the mouse click or scroll... the programme which i have written given below..
#include<stdio.h>
#include<string.h>
#include <ncurses.h>
int main() {
int ch, count=0;
mmask_t old;
MEVENT event;
initscr ();
start_color();
noecho ();
cbreak ();
keypad (stdscr, TRUE);
init_pair(1, COLOR_GREEN, COLOR_WHITE );
mousemask (ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION, &old);
while ((ch = wgetch(stdscr)) != 'q') {
count++;
switch(ch) {
case KEY_MOUSE:
if(getmouse (&event) == OK) {
mvprintw (count, 0, "Mouse Event %d\n",count);
}
attron( COLOR_PAIR(1) | A_BLINK );
bkgd(COLOR_PAIR(1) | A_BLINK );
mvprintw (event.y,event.x, "hey.");
refresh();
break;
}
}
endwin();
return 0;
}
run the programme with linked -lncurses.
pls help me to improve my programme which also detect when the mouse moves.