11
votes

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.

1

1 Answers

13
votes

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.