Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scrollwheel Event in X11

Tags:

c

x11

I have looked all over, and was shocked to be unable to find anything on the topic.

I just want to be able to capture events from a simple mouse scrollwheel.

like image 893
imallett Avatar asked Mar 19 '13 21:03

imallett


1 Answers

Yep, this is incredibly confusing. That's because X11 decided to assign mouse scroll wheel events as mouse button 4 and 5. Receiving scrollwheel events is the same as receiving mouse button press events (ButtonPress events according to /usr/include/X11/X.h). Note also that the header file defines Button1..Button5. Buttons 4 and 5 correspond to up or down-- maybe not that order, you'll have to determine this empirically. The header file never mentions scrollwheel events.

Thankfully, higher level APIs (like GDK) explicitly provide scrollwheel support by name.

like image 121
Multimedia Mike Avatar answered Oct 04 '22 22:10

Multimedia Mike