Problem with SDL Mouse Motion

Hi,

I have my application set up to receive keyboard and mouse motion events.

The mouse motion rotates my camera in my game. The keyboard moves the camera
forward, backward, and so forth (Controls much like a first person shooter).
In order to activate camera rotation with the mouse, the user must hold down
the right click button. When the user presses the right click button, I do
two things:

SDL_ShowCursor( 0 );
SDL_WM_GrabInput( SDL_GRAB_ON );

When I release the right mouse button, I do the following:

SDL_ShowCursor( 1 );
SDL_WM_GrabInput( SDL_GRAB_OFF );

As I hold the right click button and rotate the camera, I am also able to
press and hold keys on the keyboard to move the camera. As I hold down a key
and rotate the camera, the problem is that the rotation isn’t very smooth.
If I don’t call SDL_WM_GrabInput() with SDL_GRAB_ON, the mouse rotation
looks fine even when holding down keys on the keyboard.

I’m using the relative X,Y values received from the SDL_MOUSEMOTION event to
rotate the mouse. It appears as if these values aren’t being calculated
properly when both of the following conditions are met:

  1. A key on the keyboard is being continuously held down
  2. SDL_WM_GrabInput() is called with SDL_GRAB_ON

Has anyone else experienced this issue? I would have posted some code
examples but this issue spans a wide range of code. If you want samples
please request a specific area of code. For example, you could ask for the
function I use to pump messages, or you could be interested in the code I
use to process each mouse and keyboard event.

Thanks.