From dec7875a6e23212021e4d9080330a42832dfe02a Mon Sep 17 00:00:00 2001
From: Edward Rudd <urkle@outoforder.cc>
Date: Tue, 15 Jun 2021 01:40:19 +0000
Subject: [PATCH] update SDL soruce to 2.0.14

---
 source/src/video/emscripten/SDL_emscriptenmouse.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/source/src/video/emscripten/SDL_emscriptenmouse.c b/source/src/video/emscripten/SDL_emscriptenmouse.c
index ac118e2..8d96896 100644
--- a/source/src/video/emscripten/SDL_emscriptenmouse.c
+++ b/source/src/video/emscripten/SDL_emscriptenmouse.c
@@ -18,8 +18,6 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-
-
 #include "../../SDL_internal.h"
 
 #if SDL_VIDEO_DRIVER_EMSCRIPTEN
@@ -28,9 +26,9 @@
 #include <emscripten/html5.h>
 
 #include "SDL_emscriptenmouse.h"
+#include "SDL_emscriptenvideo.h"
 
 #include "../../events/SDL_mouse_c.h"
-#include "SDL_assert.h"
 
 static SDL_Cursor*
 Emscripten_CreateCursorFromString(const char* cursor_str, SDL_bool is_custom)
@@ -236,9 +234,19 @@
 static int
 Emscripten_SetRelativeMouseMode(SDL_bool enabled)
 {
+    SDL_Window *window;
+    SDL_WindowData *window_data;
+
     /* TODO: pointer lock isn't actually enabled yet */
     if(enabled) {
-        if(emscripten_request_pointerlock(NULL, 1) >= EMSCRIPTEN_RESULT_SUCCESS) {
+        window = SDL_GetMouseFocus();
+        if (window == NULL) {
+            return -1;
+        }
+
+        window_data = (SDL_WindowData *) window->driverdata;
+
+        if(emscripten_request_pointerlock(window_data->canvas_id, 1) >= EMSCRIPTEN_RESULT_SUCCESS) {
             return 0;
         }
     } else {

--
Gitblit v1.9.3