【发布时间】:2018-07-08 13:15:50
【问题描述】:
这是我的程序。它没有检测到 KEY_MOUSE,但'q' 退出就好了。 '5' 也退出,无论是在键盘上还是在小键盘上。
#include <ncurses.h>
int main()
{
initscr();
// noecho();
cbreak();
// raw();
keypad(stdscr, TRUE);
mousemask( ALL_MOUSE_EVENTS, NULL);
move(10,30);
printw("Hello ncurses!\n");
refresh();
while(true) {
int c = getch();
// int c = wgetch(stdscr);
if (c == 'q') break;
if (c == '5') break;
if (c == KEY_MOUSE) break;
}
endwin();
return 0;
}
我不确定问题出在程序中,还是在我的环境中。我使用msys2 在 Windows 上编译它。我还安装了clink,只是为了减少使用cmd.exe 的痛苦。
【问题讨论】: