Mouse Scrolling bug with SDL

Mouse scroll wheel scrolling is not working while the shift key is
held down. This must be some sort of bug because the exact same code
produces different results on windows than it does on a mac. Command,
Control, and Alt all work fine, but the shift key disables scrolling.
I believe it worked in older versions of SDL (prior to 1.2.13). I
thought I might have been doing something wrong with my program, so I
tried using one of the sample SDL programs linked to from the SDL
tutorials page, SDL and SDL and OpenGL(http://www.meandmark.com/sdlopenglpart1.html
).
I just modified the EventLoop function.

void GameApp::EventLoop(void)
{
SDL_Event event;
while((!done) && (SDL_WaitEvent(&event)))
{
switch(event.type)
{
case SDL_USEREVENT:
HandleUserEvents(&event);
break;
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP:
// Scroll doesn’t register while shift key is held down.
if(event.button.button == SDL_BUTTON_WHEELDOWN)
printf(“SDL_BUTTON_WHEELDOWN\n”);
else if(event.button.button == SDL_BUTTON_WHEELUP)
printf(“SDL_BUTTON_WHEELUP\n”);
break;
case SDL_KEYDOWN:
if(event.key.keysym.sym==SDLK_v)
{
const SDL_version * v = SDL_Linked_Version();// I am using 1.2.13
printf(“Version: %u.%u.%u\n”, v->major, v->minor, v->patch);
}
else if(event.key.keysym.sym==SDLK_LSHIFT)
printf(“You are holding the SDLK_LSHIFT key down. Scrolling is
ignored!\n”);
break;
case SDL_KEYUP:
if(event.key.keysym.sym==SDLK_LSHIFT)
printf(“You released the SDLK_LSHIFT key. Scrolling will work
again.\n”);
break;
case SDL_QUIT:
done = true;
break;
default:
break;
} // End switch
} // End while
}

Does anyone know why this might be occurring?

-Trevor Agnitti
www.lackeyccg.com

I’ve noticed issues with mouse scrolling as well. In my case, having
the cursor tied to the window with grabmouse (as it is in fullscreen
mode, but it also happens in windowed mode) and then using the
scrollwheel introduces a lot of lag in subsequent mouse movement.

This is on Kubuntu 8.04/64-bit build. I’ve noticed it in several SDL
based apps, such as Stella, EUAE, Tuxracer, etc. Quite annoying,
really, as I sometimes forget about it and use the wheel, and the only
way to get rid of the lag is quit the application.

SA

There is indeed a bug in the mac SDL.framework version 1.2.13 where if
you hold the shift key down, the mouse scroll wheel messages are not
sent. I have confirmed that it DOES work with mac SDL.framework
version 1.2.12. Does anyone have any ideas how something got broken
from 1.2.12 to 1.2.13?

-Trevor Agnitti
www.lackeyccg.com

When you hold shift, the scroll gets interpreted as horizontal instead of vertical. You can use event.wheel.x instead of event.wheel.y to get the data.