Commit 66555f611548d2b8a2210508a62e9b03ee0af9f6

Drew Bliss 2017-04-06T13:27:48

SDL - attempt to fix https://github.com/ValveSoftware/Dota-2/issues/1199 of mouse not locking in Dota. This fix is proposed by Ryan Gordon (increase timeout in X11_SetWindowGrab from 250ms to 5000ms). I'm going to integrate to source2 and ship it to dota customers. If it works, SamL will upsteam it to SDL.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c
index 6362f16..e0b45b4 100644
--- a/src/video/x11/SDL_x11window.c
+++ b/src/video/x11/SDL_x11window.c
@@ -1488,8 +1488,8 @@ X11_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed)
             int attempts;
             int result;
 
-            /* Try for up to ~250ms to grab. If it still fails, stop trying. */
-            for (attempts = 0; attempts < 5; attempts++) {
+            /* Try for up to 5000ms (5s) to grab. If it still fails, stop trying. */
+            for (attempts = 0; attempts < 100; attempts++) {
                 result = X11_XGrabPointer(display, data->xwindow, True, 0, GrabModeAsync,
                                  GrabModeAsync, data->xwindow, None, CurrentTime);
                 if (result == GrabSuccess) {