mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-14 05:41:02 +00:00
Fix the previous commit to work on Linux32. Add more comments.
This commit is contained in:
parent
0306c1834a
commit
025523f3e3
1 changed files with 13 additions and 2 deletions
|
@ -832,8 +832,16 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt)
|
||||||
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
|
#ifndef LINUX
|
||||||
#ifndef LINUX64
|
#define LINUX 1
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef LINUX
|
||||||
|
// 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
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue