在Linux中生成鼠标滚动事件

时间:2022-11-04 17:19:08

I having small doubt in generating mouse event from C program. I am writing a program to generate mouse events from a C program in linux. I have implemented mouse click,drag. .. etc using xlib. But dont have any idea about generating mouse scroll event.

我对从C程序生成鼠标事件有点怀疑。我正在编写一个程序来从linux中的C程序生成鼠标事件。我已经实现了鼠标点击,拖动。使用xlib等等。但是不知道如何生成鼠标滚动事件。

Operating System : Fedora 15

操作系统:Fedora 15

1 个解决方案

#1


1  

X11 has two mechanism to report scroll events. The old-fashioned way is to treat the scroll wheel as two extra mouse buttons: scroll up is reported as button 4 and scroll down as button 5 (or vice versa, I don't remember). The modern way is to report them via the XInput2 extension, which allows things like horizontal scrolling and smooth scroll and suchlike.

X11有两种机制来报告滚动事件。传统的方法是将滚动轮视为两个额外的鼠标按钮:向上滚动被报告为按钮4,向下滚动为按钮5(或者相反,我不记得了)。现代的方法是通过XInput2扩展来报告它们,它允许水平滚动、平滑滚动等等。

#1


1  

X11 has two mechanism to report scroll events. The old-fashioned way is to treat the scroll wheel as two extra mouse buttons: scroll up is reported as button 4 and scroll down as button 5 (or vice versa, I don't remember). The modern way is to report them via the XInput2 extension, which allows things like horizontal scrolling and smooth scroll and suchlike.

X11有两种机制来报告滚动事件。传统的方法是将滚动轮视为两个额外的鼠标按钮:向上滚动被报告为按钮4,向下滚动为按钮5(或者相反,我不记得了)。现代的方法是通过XInput2扩展来报告它们,它允许水平滚动、平滑滚动等等。