[英]Simple NCURSES mouse handling in C
我有以下代码:
#include <ncurses.h>
#include <string.h>
int
main()
{
int ch;
initscr();
noecho();
cbreak();
refresh();
while(1)
{
ch = getch();
addch(ch);
};
return 0;
}
当按下鼠标按钮时,它应该在屏幕上输出某些内容,但是没有。
我尝试了一些技巧,这些技巧修复了NCurses中的鼠标移动事件,但没有成功。
另外,当我在同一终端上运行htop时,单击鼠标即可。 而且htop似乎没有什么不同,对吗? https://github.com/hishamhm/htop/search?q=MOUSE&ref=cmdform
我添加了mousemask,现在可以使用了。
#include <ncurses.h>
#include <string.h>
int
main()
{
int ch;
initscr();
noecho();
cbreak();
refresh();
mousemask(ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION, NULL);
while(1)
{
ch = getch();
addch(ch);
};
return 0;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.