- int wheel_number = button / 2 - 2 ; /* Map 4 and 5 to wheel zero */
- int direction = 9 - button * 2 ; /* Map 4 to +1 and 5 to -1 */
-
- fgStructure.Window->Callbacks.MouseWheel(
- wheel_number,
- direction,
- event.xbutton.x,
- event.xbutton.y
- );
+ /*
+ * Map 4 and 5 to wheel zero; EVEN to +1, ODD to -1
+ * " 6 and 7 " " one; ...
+ *
+ * XXX This *should* be behind some variables/macros,
+ * XXX since the order and numbering isn't certain
+ * XXX See XFree86 configuration docs (even back in the
+ * XXX 3.x days, and especially with 4.x).
+ */
+ int wheel_number = (button - 4) / 2;
+ int direction = (button & 1)*2 - 1;
+
+ if( ButtonPress )
+ fgStructure.Window->Callbacks.MouseWheel(
+ wheel_number,
+ direction,
+ event.xbutton.x,
+ event.xbutton.y
+ );