We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 382

Summary: Support horizontal mouse scrolling
Product: SDL Reporter: Jonas Koelker <jonaskoelker>
Component: eventsAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: enhancement    
Priority: P2    
Version: 2.0.0   
Hardware: All   
OS: Linux   

Description Jonas Koelker 2007-01-17 16:39:46 UTC
I posted the below to the mailing list (january 2007) and got silence back:

Hi.  I'm new to the list, so that's why you don't know me.

My agenda is the following:  to have horizontal mouse scrolling (with EmulateWheel) in Battle for Wesnoth (wesnoth.org; a libsdl-using turn-based strategy game).  I wrote a patch which got rejected more or less because horizontal mouse scrolling wasn't a standard feature of sdl (see patch 644 on https://gna.org/patch/?group=wesnoth).

So, I figure that I should convince you to support horizontal mouse scrolling.

Last time you discussed this, the following points were made:
(1) On OS X, when you hold shift and scroll, the vertical scroll events become horizontal.  What should SDL do about this?
(2) We could define SDL_BUTTON_WHEEL(LEFT|RIGHT)
(3) We shouldn't, because it would not work on more than one platform
(4) Yes it would

And that's why you don't support horizontal mouse scrolling, AFAICT.  See for
yourself: http://www.libsdl.org/pipermail/sdl/2005-March/thread.html#67970

To actually quote something:
> Microsoft also sells (and Windows supports) a USB mouse with both vertical
> and horizontal wheels, so it's not necessarily a Mac-specific thing.

And xorg has EmulateWheel:  pick a button.  When you hold that button, pointer movement gets converted into scroll events (in both directions); and you get to decide which button events they get converted into.  Common wisdom is that vert=4,5 and horz=6,7.

So, every major platform can generate horizontal scroll events.  I think libsdl should provide a uniform interface to it, because there's demand for it from application developers:  I want to use horizontal scrolling, the wesnoth devs would like to be able to accept the patch, and horizontal scrolling is already used in many non-sdl applications (konqueror and firefox, to name two).

In summary: support horizontal scrolling in SDL!
Comment 1 Sam Lantinga 2007-07-06 02:22:58 UTC
I agree!  This has been added to SDL 1.2.12, subversion revision 3156
Comment 2 Ryan C. Gordon 2007-07-06 03:02:02 UTC
Buttons 6 and 7 are likely to be real mouse buttons (see the WM_XBUTTON patch in Bug #311)...I know we picked 4 and 5 for the vertical wheel because it matched XFree86's nasty hack, but can we select something that isn't likely to map to a real button, like, 44 and 45?

(and in 1.3, can we have these not map to buttons at all?)

--ryan.

Comment 3 Sam Lantinga 2007-07-06 06:30:45 UTC
We could, although I picked 6 and 7 because it looks like that's what horizontal scrolling usually maps to in xorg.  At this point I don't think there's any way to tell in X11 whether buttons 4/5/6/7 are actual buttons or mouse wheel, which is a shame...

In 1.3 there's a real scrolling event, and the mousewheel button events are only there for backwards compatibility.
Comment 4 Sam Lantinga 2007-07-06 06:36:49 UTC
The only problem with this is that if we use buttons 6 and 7 to represent mousewheel, then that actually changes the buttons that applications will see.  That's probably not acceptable for SDL 1.2 which is supposed to be binary compatible between revisions.
Comment 5 Sam Lantinga 2007-07-06 06:40:01 UTC
Okay, this has been reverted in 1.2 with subversion revision 3159, and horizontal scrolling support is now in SDL 1.3.