Scrollwheel registers as MouseButton.LEFT #232

Closed
opened 2026-01-29 02:44:55 +00:00 by john · 1 comment
Owner

MouseButton.SCROLL_UP, .SCROLL_DOWN?

SFML exposes a numerical count of scroll ticks, but if I recall correctly they're in odd units, like one scroll click = "+/-4". The single event per notch of my scrollwheel is precision enough.

MouseButton.SCROLL_UP, .SCROLL_DOWN? SFML exposes a numerical count of scroll ticks, but if I recall correctly they're in odd units, like one scroll click = "+/-4". The single event per notch of my scrollwheel is precision enough.
Author
Owner

Fixed in the current session. Changes made:

  1. PyMouseButton.cpp: Added SCROLL_UP (value=10) and SCROLL_DOWN (value=11) to the MouseButton enum:

    {"SCROLL_UP", SCROLL_UP_VALUE, "wheel_up"},
    {"SCROLL_DOWN", SCROLL_DOWN_VALUE, "wheel_down"},
    
  2. PyCallable.cpp and PyScene.cpp: Updated button string-to-enum conversion to handle scroll events:

    else if (button == "wheel_up") button_val = 10;   // SCROLL_UP
    else if (button == "wheel_down") button_val = 11; // SCROLL_DOWN
    

Scroll wheel events now produce MouseButton.SCROLL_UP or MouseButton.SCROLL_DOWN in the on_click callback instead of incorrectly showing MouseButton.LEFT.

Legacy string comparison works: MouseButton.SCROLL_UP == "wheel_up" returns True.

Fixed in the current session. Changes made: 1. **PyMouseButton.cpp**: Added `SCROLL_UP` (value=10) and `SCROLL_DOWN` (value=11) to the MouseButton enum: ```cpp {"SCROLL_UP", SCROLL_UP_VALUE, "wheel_up"}, {"SCROLL_DOWN", SCROLL_DOWN_VALUE, "wheel_down"}, ``` 2. **PyCallable.cpp** and **PyScene.cpp**: Updated button string-to-enum conversion to handle scroll events: ```cpp else if (button == "wheel_up") button_val = 10; // SCROLL_UP else if (button == "wheel_down") button_val = 11; // SCROLL_DOWN ``` Scroll wheel events now produce `MouseButton.SCROLL_UP` or `MouseButton.SCROLL_DOWN` in the on_click callback instead of incorrectly showing `MouseButton.LEFT`. Legacy string comparison works: `MouseButton.SCROLL_UP == "wheel_up"` returns True.
john closed this issue 2026-01-29 04:22:25 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
john/McRogueFace#232
No description provided.