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 534

Summary: Broken scrolling events with MacBook Pro trackpad
Product: SDL Reporter: Ben Anderman <ben>
Component: eventsAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 1.2.10   
Hardware: PowerPC   
OS: Mac OS X 10.4 (Intel)   

Description Ben Anderman 2007-12-30 10:16:16 UTC
I first noticed this bug in Wesnoth, but after testing in my own program, I'm fairly certain it's an SDL bug. When you scroll up with a MacBook Pro trackpad (using two fingers), SDL generates some SDL_BUTTON_WHEELUP events, but a lot of SDL_BUTTON_WHEELDOWN events as well. It seems that if you scroll more quickly up, you get a higher ratio of up events to down ones, but you still get the down ones; if you scroll up slowly, it counts as a net down. To test this, I stuck this code in the main loop of a C++/SDL program of mine:
if (SDL_PollEvent(&event))
{
	if (event.type == SDL_MOUSEBUTTONDOWN)
	{
		std::cerr << "Mouse down ";
		if (event.button.button == SDL_BUTTON_WHEELUP) std::cerr << "WHEELUP\n";
		if (event.button.button == SDL_BUTTON_WHEELDOWN) std::cerr << "WHEELDOWN\n";
	} else if (event.type == SDL_MOUSEBUTTONUP)
	{
		std::cerr << "Mouse up ";
		if (event.button.button == SDL_BUTTON_WHEELUP) std::cerr << "WHEELUP\n";
		if (event.button.button == SDL_BUTTON_WHEELDOWN) std::cerr << "WHEELDOWN\n";
	}
}

PS: I am actually using Mac OS X 10.5 on Intel, but that wasn't in the list. I figured 10.4 would be more useful than "Other".
Comment 1 Sam Lantinga 2007-12-30 11:44:20 UTC
This is fixed in subversion, for SDL 1.2.13 release.  You can get the latest snapshot from:
http://www.libsdl.org/tmp/SDL-1.2.zip