mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
Make SetMouse timeout after 2 seconds
This makes sure that some unchecked event doesn't cause a lockup. However, blocking input is really not the way to go: need to implement a state machine and use non-blocking event reads.
This commit is contained in:
parent
203d981675
commit
4eb6cf6f9e
1 changed files with 8 additions and 1 deletions
|
@ -354,7 +354,14 @@ X11_SetMouse (void)
|
||||||
XWarpPointer (x_disp, None, x_win, 0, 0, 0, 0, 0, 0);
|
XWarpPointer (x_disp, None, x_win, 0, 0, 0, 0, 0, 0);
|
||||||
XWarpPointer (x_disp, None, x_win, 0, 0, 0, 0,
|
XWarpPointer (x_disp, None, x_win, 0, 0, 0, 0,
|
||||||
viddef.width / 2, viddef.height / 2);
|
viddef.width / 2, viddef.height / 2);
|
||||||
XPeekIfEvent (x_disp, &ev, check_mouse_event, 0);
|
//FIXME this should be done in a state machine that handles events without
|
||||||
|
//blocking
|
||||||
|
double start = Sys_DoubleTime ();
|
||||||
|
while (!XCheckIfEvent (x_disp, &ev, check_mouse_event, 0)) {
|
||||||
|
if (Sys_DoubleTime () - start > 2) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
x_mouse_time = ev.xmotion.time;
|
x_mouse_time = ev.xmotion.time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue