Fix the previous commit to work on Linux32. Add more comments.

This commit is contained in:
ilag11111 2014-04-08 19:19:23 -07:00
parent 0306c1834a
commit 025523f3e3
1 changed files with 13 additions and 2 deletions

View File

@ -831,9 +831,17 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt)
SDLdoUngrabMouse(); SDLdoUngrabMouse();
return; return;
} }
// If LINUX64 is defined, LINUX isn't defined. This code or another
// fix needs to be put in a more proper spot.
#ifdef LINUX64
#ifndef LINUX
#define LINUX 1
#endif
#endif
#ifndef LINUX #ifndef LINUX
#ifndef LINUX64 // On most systems, grab the mouse and use relative input.
event.data2 = +evt.xrel; event.data2 = +evt.xrel;
event.data3 = -evt.yrel; event.data3 = -evt.yrel;
event.type = ev_mouse; event.type = ev_mouse;
@ -841,6 +849,10 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt)
SDL_SetWindowGrab(window, mousegrabok); SDL_SetWindowGrab(window, mousegrabok);
SDL_SetRelativeMouseMode(SDL_TRUE); SDL_SetRelativeMouseMode(SDL_TRUE);
#else #else
// On Linux, SDL_SetWindowGrab is bugged and will also grab keyboard
// input, which breaks alt-tabbing. Instead, we're warping the
// mouse as a workaround.
// If the event is from warping the pointer back to middle // If the event is from warping the pointer back to middle
// of the screen then ignore it. // of the screen then ignore it.
if (((evt.x == wwidth/2) && (evt.y == wheight/2))) if (((evt.x == wwidth/2) && (evt.y == wheight/2)))
@ -864,7 +876,6 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt)
HalfWarpMouse(wwidth, wheight); HalfWarpMouse(wwidth, wheight);
} }
#endif #endif
#endif
} }