mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 01:01:33 +00:00
Disables input grabbing in Linux; allows alt-tabbing and other actions.
This commit is contained in:
parent
ec559c84c1
commit
0306c1834a
1 changed files with 21 additions and 12 deletions
|
@ -831,32 +831,41 @@ static void Impl_HandleMouseMotionEvent(SDL_MouseMotionEvent evt)
|
||||||
SDLdoUngrabMouse();
|
SDLdoUngrabMouse();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef LINUX
|
||||||
|
#ifndef LINUX64
|
||||||
|
event.data2 = +evt.xrel;
|
||||||
|
event.data3 = -evt.yrel;
|
||||||
|
event.type = ev_mouse;
|
||||||
|
D_PostEvent(&event);
|
||||||
|
SDL_SetWindowGrab(window, mousegrabok);
|
||||||
|
SDL_SetRelativeMouseMode(SDL_TRUE);
|
||||||
|
#else
|
||||||
// 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 (ignorenext || ((evt.x == wwidth/2) && (evt.y == wheight/2)))
|
if (((evt.x == wwidth/2) && (evt.y == wheight/2)))
|
||||||
{
|
{
|
||||||
ignorenext = SDL_FALSE;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{*/
|
{
|
||||||
event.data2 = +evt.xrel;
|
event.data2 = +evt.xrel;
|
||||||
event.data3 = -evt.yrel;
|
event.data3 = -evt.yrel;
|
||||||
//}
|
}
|
||||||
event.type = ev_mouse;
|
event.type = ev_mouse;
|
||||||
D_PostEvent(&event);
|
D_PostEvent(&event);
|
||||||
// Warp the pointer back to the middle of the window
|
// Warp the pointer back to the middle of the window
|
||||||
// or we cannot move any further if it's at a border.
|
// or we cannot move any further if it's at a border.
|
||||||
/*if ((evt.x < (wwidth/2 )-(wwidth/4 )) ||
|
if ((evt.x < (wwidth/2 )-(wwidth/4 )) ||
|
||||||
(evt.y < (wheight/2)-(wheight/4)) ||
|
(evt.y < (wheight/2)-(wheight/4)) ||
|
||||||
(evt.x > (wwidth/2 )+(wwidth/4 )) ||
|
(evt.x > (wwidth/2 )+(wwidth/4 )) ||
|
||||||
(evt.y > (wheight/2)+(wheight/4) ) )*/
|
(evt.y > (wheight/2)+(wheight/4) ) )
|
||||||
{
|
{
|
||||||
//if (SDL_GRAB_ON == SDL_WM_GrabInput(SDL_GRAB_QUERY) || !mousegrabok)
|
HalfWarpMouse(wwidth, wheight);
|
||||||
SDL_SetWindowGrab(window, mousegrabok);
|
|
||||||
//HalfWarpMouse(wwidth, wheight);
|
|
||||||
SDL_SetRelativeMouseMode(SDL_TRUE);
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Impl_HandleMouseButtonEvent(SDL_MouseButtonEvent evt, Uint32 type)
|
static void Impl_HandleMouseButtonEvent(SDL_MouseButtonEvent evt, Uint32 type)
|
||||||
|
|
Loading…
Reference in a new issue