[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
under ncurses, mouse events come as escape codes
From: |
Adam H. Peterson |
Subject: |
under ncurses, mouse events come as escape codes |
Date: |
Thu, 29 Sep 2005 12:14:53 -0600 |
User-agent: |
Mozilla Thunderbird 1.0.6 (X11/20050823) |
I apologize if this is off-topic for this group. I'm having difficulty
finding a forum to ask help in using ncurses, so here goes....
I'm having difficulty reading mouse events under NCurses. Instead of
receiving KEY_MOUSE from getch(), I'm getting escape codes. For
example, this program:
#include <ncurses.h>
#include <stdio.h>
#include <stdlib.h>
int main() {
initscr();
clear();
noecho();
cbreak();
mousemask(ALL_MOUSE_EVENTS, NULL);
for (;;) {
int ch=getch();
switch (ch) {
case KEY_MOUSE:
{
MEVENT event;
getmouse(&event);
printw("A mouse event occurred\n");
refresh();
}
break;
case 'q':
endwin();
exit(0);
default:
printw("Key %d occurred\n", ch);
refresh();
}
}
}
When I click on the terminal window, I don't get "A mouse event
occurred" but instead I get:
Key 27 occurred
Key 91 occurred
Key 77 occurred
Key 32 occurred
Key 62 occurred
Key 43 occurred
Key 27 occurred
Key 91 occurred
Key 77 occurred
Key 35 occurred
Key 62 occurred
Key 43 occurred
(I assume the key 27 begins the escape sequence for mouse down and the
second one begins the sequence for mouse up.)
Is there anything I'm doing wrong?
I'm using a gnome terminal, by the way, but I tried it under an XTerm
and got the same results.
- under ncurses, mouse events come as escape codes,
Adam H. Peterson <=