I am able to echo -e "\e[?1003h"
and watch as my terminal gobbles up mouse movement events like candies but curses doesn't seem to want them at all. I looked at
Mouse movement events in NCurses
but it would appear that this issue was resolved by changing the TERM env, which would not help me because my terminal is indeed responding to mouse move events, however, ncurses is not. Here's something I have tried (This code came almost entirely from the other question):
#include <ncurses.h>
#include <assert.h>
int main(){
int ch, count=0;
mmask_t old;
initscr ();
noecho ();
cbreak ();
mousemask (ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION, &old);
keypad (stdscr, TRUE);
printf("\033[?1003h");
while ((ch = getch ()) != 'q')
{
count++;
if (ch == KEY_MOUSE)
{
MEVENT event;
assert (getmouse (&event) == OK);
mvprintw (0, 0, "Mouse Event!\n");
}
mvprintw (1, 1, "Event number %4d",count);
refresh();
}
endwin();
}
Additional information and warning:
This program actually accomplishes being able to detect mouse movement AFTER execution. This can be reversed with the command echo -e "\e[?1000h"