在C中捕获鼠标事件(Linux) [英] capturing mouse event in C (linux)

查看:61
本文介绍了在C中捕获鼠标事件(Linux)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用基本的Linux C语言编写一个小小的鼠标记录程序.我在linux/input.h中搜索鼠标事件,但是我没有找到任何有关此的信息.

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;
}

使用 struct input_event ,我可以捕获鼠标按下的按钮以及其移动的时间,但是不能捕获其位置.(我将字段值分成两个__s16变量,但不是位置).

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).

如果有人知道我可以访问的结构或要监听的特定文件(实际上,我正在监听/dev/input/event6 )...

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

谢谢,再见!

推荐答案

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

这篇关于在C中捕获鼠标事件(Linux)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆