capturing mouse event in C (linux)

南笙酒味 提交于 2021-02-20 03:42:23

问题


I'm writing a little mouselogger in basic C for linux. I search mouse event in linux/input.h, but I have not found anything about this.

struct input_event {
    struct timeval time;
    __u16 type;
    __u16 code;
    __s32 value;
}

With the struct input_event, I can capturing which button was pressed on mouse and when she move, but not his position. ( I separate the field value in two __s16 variable, but is not a position).

If anyone know a structure where I can access this, or a specific file to listen (actually I'm listen /dev/input/event6)...

Thank, bye !


回答1:


This page gives you step by step guidance on how do to exactly what you want.



来源:https://stackoverflow.com/questions/43272952/capturing-mouse-event-in-c-linux

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!