Added a relative mouse mode that uses mouse warping instead of raw input.

To enable this, set the environment variable SDL_MOUSE_RELATIVE_MODE_WARP to "1"

When mouse relative mode is disabled, put the cursor back where the application expects it to be, instead of where it was when relative mode was enabled.
This commit is contained in:
Sam Lantinga 2013-12-23 17:37:22 -08:00
parent 0a03232077
commit 134d56c6d9
7 changed files with 116 additions and 67 deletions

View file

@ -698,7 +698,7 @@ X11_DispatchEvent(_THIS)
case MotionNotify:{
SDL_Mouse *mouse = SDL_GetMouse();
if(!mouse->relative_mode) {
if(!mouse->relative_mode || mouse->relative_mode_warp) {
#ifdef DEBUG_MOTION
printf("window %p: X11 motion: %d,%d\n", xevent.xmotion.x, xevent.xmotion.y);
#endif