|
1 | 1 | diff -Naur SDL.orig/src/core/android/SDL_android.c SDL/src/core/android/SDL_android.c
|
2 |
| ---- SDL.orig/src/core/android/SDL_android.c 2022-09-18 15:24:28.000000000 +0200 |
3 |
| -+++ SDL/src/core/android/SDL_android.c 2022-09-18 15:31:20.000000000 +0200 |
4 |
| -@@ -851,32 +851,35 @@ |
| 2 | +--- SDL.orig/src/core/android/SDL_android.c 2022-08-13 05:48:10.000000000 +0200 |
| 3 | ++++ SDL/src/core/android/SDL_android.c 2022-09-25 15:20:13.000000000 +0200 |
| 4 | +@@ -819,11 +819,13 @@ |
| 5 | + |
| 6 | + /* Lock / Unlock Mutex */ |
| 7 | + void Android_ActivityMutex_Lock() { |
| 8 | ++ __android_log_print(2, "SDL", "Android_ActivityMutex_Lock()"); |
| 9 | + SDL_LockMutex(Android_ActivityMutex); |
| 10 | + } |
| 11 | + |
| 12 | + void Android_ActivityMutex_Unlock() { |
| 13 | + SDL_UnlockMutex(Android_ActivityMutex); |
| 14 | ++ __android_log_print(2, "SDL", "Android_ActivityMutex_Unlock()"); |
| 15 | + } |
| 16 | + |
| 17 | + /* Lock the Mutex when the Activity is in its 'Running' state */ |
| 18 | +@@ -832,7 +834,7 @@ |
| 19 | + int resumeSignaled = 0; |
| 20 | + |
| 21 | + retry: |
| 22 | +- |
| 23 | ++ __android_log_print(2, "SDL", "Android_ActivityMutex_Lock_Running()-Lock"); |
| 24 | + SDL_LockMutex(Android_ActivityMutex); |
| 25 | + |
| 26 | + pauseSignaled = SDL_SemValue(Android_PauseSem); |
| 27 | +@@ -840,6 +842,7 @@ |
| 28 | + |
| 29 | + if (pauseSignaled > resumeSignaled) { |
| 30 | + SDL_UnlockMutex(Android_ActivityMutex); |
| 31 | ++ __android_log_print(2, "SDL", "Android_ActivityMutex_Lock_Running()-Unlock"); |
| 32 | + SDL_Delay(50); |
| 33 | + goto retry; |
| 34 | + } |
| 35 | +@@ -851,17 +854,20 @@ |
5 | 36 | jint surfaceWidth, jint surfaceHeight,
|
6 | 37 | jint deviceWidth, jint deviceHeight, jfloat rate)
|
7 | 38 | {
|
8 |
| -- SDL_LockMutex(Android_ActivityMutex); |
9 |
| -+ __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeSetScreenResolution()"); |
10 |
| -+ //SDL_LockMutex(Android_ActivityMutex); |
| 39 | ++ __android_log_print(2, "SDL", "nativeSetScreenResolution()-Lock"); |
| 40 | + SDL_LockMutex(Android_ActivityMutex); |
11 | 41 |
|
12 | 42 | Android_SetScreenResolution(surfaceWidth, surfaceHeight, deviceWidth, deviceHeight, rate);
|
13 | 43 |
|
14 |
| -- SDL_UnlockMutex(Android_ActivityMutex); |
15 |
| -+ //SDL_UnlockMutex(Android_ActivityMutex); |
| 44 | + SDL_UnlockMutex(Android_ActivityMutex); |
| 45 | ++ __android_log_print(2, "SDL", "nativeSetScreenResolution()-Unlock"); |
16 | 46 | }
|
17 | 47 |
|
18 | 48 | /* Resize */
|
19 | 49 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeResize)(
|
20 | 50 | JNIEnv *env, jclass jcls)
|
21 | 51 | {
|
22 |
| -- SDL_LockMutex(Android_ActivityMutex); |
23 |
| -+ __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "onNativeResize()"); |
24 |
| -+ //SDL_LockMutex(Android_ActivityMutex); |
| 52 | ++ __android_log_print(2, "SDL", "onNativeResize()-Lock"); |
| 53 | + SDL_LockMutex(Android_ActivityMutex); |
25 | 54 |
|
26 | 55 | if (Android_Window)
|
27 |
| - { |
28 |
| - Android_SendResize(Android_Window); |
| 56 | +@@ -870,12 +876,14 @@ |
29 | 57 | }
|
30 | 58 |
|
31 |
| -- SDL_UnlockMutex(Android_ActivityMutex); |
32 |
| -+ //SDL_UnlockMutex(Android_ActivityMutex); |
| 59 | + SDL_UnlockMutex(Android_ActivityMutex); |
| 60 | ++ __android_log_print(2, "SDL", "onNativeResize()-Unlock"); |
33 | 61 | }
|
34 | 62 |
|
35 | 63 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeOrientationChanged)(
|
36 | 64 | JNIEnv *env, jclass jcls,
|
37 | 65 | jint orientation)
|
38 | 66 | {
|
39 |
| -- SDL_LockMutex(Android_ActivityMutex); |
40 |
| -+ __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "onNativeOrientationChanged()"); |
41 |
| -+ //SDL_LockMutex(Android_ActivityMutex); |
| 67 | ++ __android_log_print(2, "SDL", "onNativeOrientationChanged()-Lock"); |
| 68 | + SDL_LockMutex(Android_ActivityMutex); |
42 | 69 |
|
43 | 70 | displayOrientation = (SDL_DisplayOrientation)orientation;
|
44 |
| - |
45 |
| -@@ -886,7 +889,7 @@ |
46 |
| - SDL_SendDisplayEvent(display, SDL_DISPLAYEVENT_ORIENTATION, orientation); |
| 71 | +@@ -887,6 +895,7 @@ |
47 | 72 | }
|
48 | 73 |
|
49 |
| -- SDL_UnlockMutex(Android_ActivityMutex); |
50 |
| -+ //SDL_UnlockMutex(Android_ActivityMutex); |
| 74 | + SDL_UnlockMutex(Android_ActivityMutex); |
| 75 | ++ __android_log_print(2, "SDL", "onNativeOrientationChanged()-Unlock"); |
51 | 76 | }
|
52 | 77 |
|
53 | 78 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeAddTouch)(
|
54 |
| -@@ -988,7 +991,8 @@ |
| 79 | +@@ -988,6 +997,7 @@ |
55 | 80 | /* Called from surfaceCreated() */
|
56 | 81 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceCreated)(JNIEnv *env, jclass jcls)
|
57 | 82 | {
|
58 |
| -- SDL_LockMutex(Android_ActivityMutex); |
59 |
| -+ __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "onNativeSurfaceCreated()"); |
60 |
| -+ //SDL_LockMutex(Android_ActivityMutex); |
| 83 | ++ __android_log_print(2, "SDL", "onNativeSurfaceCreated()-Lock"); |
| 84 | + SDL_LockMutex(Android_ActivityMutex); |
61 | 85 |
|
62 | 86 | if (Android_Window)
|
63 |
| - { |
64 |
| -@@ -1000,13 +1004,14 @@ |
65 |
| - } |
| 87 | +@@ -1001,11 +1011,13 @@ |
66 | 88 | }
|
67 | 89 |
|
68 |
| -- SDL_UnlockMutex(Android_ActivityMutex); |
69 |
| -+ //SDL_UnlockMutex(Android_ActivityMutex); |
| 90 | + SDL_UnlockMutex(Android_ActivityMutex); |
| 91 | ++ __android_log_print(2, "SDL", "onNativeSurfaceCreated()-Unlock"); |
70 | 92 | }
|
71 | 93 |
|
72 | 94 | /* Called from surfaceChanged() */
|
73 | 95 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)(JNIEnv *env, jclass jcls)
|
74 | 96 | {
|
75 |
| -- SDL_LockMutex(Android_ActivityMutex); |
76 |
| -+ __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "onNativeSurfaceChanged()"); |
77 |
| -+ //SDL_LockMutex(Android_ActivityMutex); |
| 97 | ++ __android_log_print(2, "SDL", "onNativeSurfaceChanged()-Lock"); |
| 98 | + SDL_LockMutex(Android_ActivityMutex); |
78 | 99 |
|
79 | 100 | #if SDL_VIDEO_OPENGL_EGL
|
80 |
| - if (Android_Window) |
81 |
| -@@ -1023,7 +1028,7 @@ |
82 |
| - } |
| 101 | +@@ -1024,6 +1036,7 @@ |
83 | 102 | #endif
|
84 | 103 |
|
85 |
| -- SDL_UnlockMutex(Android_ActivityMutex); |
86 |
| -+ //SDL_UnlockMutex(Android_ActivityMutex); |
| 104 | + SDL_UnlockMutex(Android_ActivityMutex); |
| 105 | ++ __android_log_print(2, "SDL", "onNativeSurfaceChanged()-Unlock"); |
87 | 106 | }
|
88 | 107 |
|
89 | 108 | /* Called from surfaceDestroyed() */
|
90 |
| -@@ -1032,8 +1037,8 @@ |
| 109 | +@@ -1032,7 +1045,7 @@ |
91 | 110 | int nb_attempt = 50;
|
92 | 111 |
|
93 | 112 | retry:
|
94 | 113 | -
|
95 |
| -- SDL_LockMutex(Android_ActivityMutex); |
96 |
| -+ __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "onNativeSurfaceDestroyed()"); |
97 |
| -+ //SDL_LockMutex(Android_ActivityMutex); |
| 114 | ++ __android_log_print(2, "SDL", "onNativeSurfaceDestroyed()-Lock"); |
| 115 | + SDL_LockMutex(Android_ActivityMutex); |
98 | 116 |
|
99 | 117 | if (Android_Window)
|
100 |
| - { |
101 |
| -@@ -1046,7 +1051,7 @@ |
102 |
| - if (nb_attempt == 0) { |
| 118 | +@@ -1047,6 +1060,7 @@ |
103 | 119 | SDL_SetError("Try to release egl_surface with context probably still active");
|
104 | 120 | } else {
|
105 |
| -- SDL_UnlockMutex(Android_ActivityMutex); |
106 |
| -+ //SDL_UnlockMutex(Android_ActivityMutex); |
| 121 | + SDL_UnlockMutex(Android_ActivityMutex); |
| 122 | ++ __android_log_print(2, "SDL", "onNativeSurfaceDestroyed()-Unlock"); |
107 | 123 | SDL_Delay(10);
|
108 | 124 | goto retry;
|
109 | 125 | }
|
110 |
| -@@ -1067,7 +1072,7 @@ |
111 |
| - /* GL Context handling is done in the event loop because this function is run from the Java thread */ |
| 126 | +@@ -1068,6 +1082,7 @@ |
112 | 127 | }
|
113 | 128 |
|
114 |
| -- SDL_UnlockMutex(Android_ActivityMutex); |
115 |
| -+ //SDL_UnlockMutex(Android_ActivityMutex); |
| 129 | + SDL_UnlockMutex(Android_ActivityMutex); |
| 130 | ++ __android_log_print(2, "SDL", "onNativeSurfaceDestroyed2()-Unlock"); |
116 | 131 | }
|
117 | 132 |
|
118 | 133 | /* Keydown */
|
119 |
| -@@ -1112,11 +1117,12 @@ |
| 134 | +@@ -1112,11 +1127,13 @@ |
120 | 135 | jint touch_device_id_in, jint pointer_finger_id_in,
|
121 | 136 | jint action, jfloat x, jfloat y, jfloat p)
|
122 | 137 | {
|
123 |
| -- SDL_LockMutex(Android_ActivityMutex); |
124 |
| -+ __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "onNativeTouch()"); |
125 |
| -+ SDL_LockMutex(Android_ActivityMutex); |
| 138 | ++ __android_log_print(2, "SDL", "onNativeTouch()-Lock"); |
| 139 | + SDL_LockMutex(Android_ActivityMutex); |
126 | 140 |
|
127 | 141 | Android_OnTouch(Android_Window, touch_device_id_in, pointer_finger_id_in, action, x, y, p);
|
128 | 142 |
|
129 |
| -- SDL_UnlockMutex(Android_ActivityMutex); |
130 |
| -+ SDL_UnlockMutex(Android_ActivityMutex); |
| 143 | + SDL_UnlockMutex(Android_ActivityMutex); |
| 144 | ++ __android_log_print(2, "SDL", "onNativeTouch()-Unlock"); |
131 | 145 | }
|
132 | 146 |
|
133 | 147 | /* Mouse */
|
134 |
| -@@ -1124,11 +1130,12 @@ |
| 148 | +@@ -1124,11 +1141,13 @@ |
135 | 149 | JNIEnv *env, jclass jcls,
|
136 | 150 | jint button, jint action, jfloat x, jfloat y, jboolean relative)
|
137 | 151 | {
|
138 |
| -- SDL_LockMutex(Android_ActivityMutex); |
139 |
| -+ __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "onNativeMouse()"); |
140 |
| -+ //SDL_LockMutex(Android_ActivityMutex); |
| 152 | ++ __android_log_print(2, "SDL", "onNativeMouse()-Lock"); |
| 153 | + SDL_LockMutex(Android_ActivityMutex); |
141 | 154 |
|
142 | 155 | Android_OnMouse(Android_Window, button, action, x, y, relative);
|
143 | 156 |
|
144 |
| -- SDL_UnlockMutex(Android_ActivityMutex); |
145 |
| -+ //SDL_UnlockMutex(Android_ActivityMutex); |
| 157 | + SDL_UnlockMutex(Android_ActivityMutex); |
| 158 | ++ __android_log_print(2, "SDL", "onNativeMouse()-Unlock"); |
146 | 159 | }
|
147 | 160 |
|
148 | 161 | /* Accelerometer */
|
149 |
| -@@ -1243,14 +1250,15 @@ |
| 162 | +@@ -1243,6 +1262,7 @@ |
150 | 163 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeFocusChanged)(
|
151 | 164 | JNIEnv *env, jclass cls, jboolean hasFocus)
|
152 | 165 | {
|
153 |
| -- SDL_LockMutex(Android_ActivityMutex); |
154 |
| -+ __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeFocusChanged()"); |
155 |
| -+ SDL_LockMutex(Android_ActivityMutex); |
| 166 | ++ __android_log_print(2, "SDL", "nativeFocusChanged()-Lock"); |
| 167 | + SDL_LockMutex(Android_ActivityMutex); |
156 | 168 |
|
157 | 169 | if (Android_Window) {
|
158 |
| - __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeFocusChanged()"); |
159 |
| - SDL_SendWindowEvent(Android_Window, (hasFocus ? SDL_WINDOWEVENT_FOCUS_GAINED : SDL_WINDOWEVENT_FOCUS_LOST), 0, 0); |
| 170 | +@@ -1251,6 +1271,7 @@ |
160 | 171 | }
|
161 | 172 |
|
162 |
| -- SDL_UnlockMutex(Android_ActivityMutex); |
163 |
| -+ SDL_UnlockMutex(Android_ActivityMutex); |
| 173 | + SDL_UnlockMutex(Android_ActivityMutex); |
| 174 | ++ __android_log_print(2, "SDL", "nativeFocusChanged()-Unlock"); |
164 | 175 | }
|
165 | 176 |
|
166 | 177 | JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeCommitText)(
|
| 178 | +diff -Naur SDL.orig/src/video/android/SDL_androidevents.c SDL/src/video/android/SDL_androidevents.c |
| 179 | +--- SDL.orig/src/video/android/SDL_androidevents.c 2022-04-09 03:19:19.000000000 +0200 |
| 180 | ++++ SDL/src/video/android/SDL_androidevents.c 2022-09-25 15:20:57.000000000 +0200 |
| 181 | +@@ -117,9 +117,11 @@ |
| 182 | + #if SDL_VIDEO_OPENGL_EGL |
| 183 | + /* Make sure this is the last thing we do before pausing */ |
| 184 | + if (!isContextExternal) { |
| 185 | ++ __android_log_print(2, "SDL", "Android_PumpEvents_Blocking()-Lock"); |
| 186 | + SDL_LockMutex(Android_ActivityMutex); |
| 187 | + android_egl_context_backup(Android_Window); |
| 188 | + SDL_UnlockMutex(Android_ActivityMutex); |
| 189 | ++ __android_log_print(2, "SDL", "Android_PumpEvents_Blocking()-Unlock"); |
| 190 | + } |
| 191 | + #endif |
| 192 | + |
| 193 | +@@ -143,9 +145,11 @@ |
| 194 | + /* Restore the GL Context from here, as this operation is thread dependent */ |
| 195 | + #if SDL_VIDEO_OPENGL_EGL |
| 196 | + if (!isContextExternal && !SDL_HasEvent(SDL_QUIT)) { |
| 197 | ++ __android_log_print(2, "SDL", "Android_PumpEvents_Blocking-2()-Lock"); |
| 198 | + SDL_LockMutex(Android_ActivityMutex); |
| 199 | + android_egl_context_restore(Android_Window); |
| 200 | + SDL_UnlockMutex(Android_ActivityMutex); |
| 201 | ++ __android_log_print(2, "SDL", "Android_PumpEvents_Blocking-2()-Unlock"); |
| 202 | + } |
| 203 | + #endif |
| 204 | + |
| 205 | +@@ -195,9 +199,11 @@ |
| 206 | + |
| 207 | + #if SDL_VIDEO_OPENGL_EGL |
| 208 | + if (!isContextExternal) { |
| 209 | ++ __android_log_print(2, "SDL", "AndroidPumpEvents_NonBlocking()-Lock"); |
| 210 | + SDL_LockMutex(Android_ActivityMutex); |
| 211 | + android_egl_context_backup(Android_Window); |
| 212 | + SDL_UnlockMutex(Android_ActivityMutex); |
| 213 | ++ __android_log_print(2, "SDL", "AndroidPumpEvents_NonBlocking()-Unlock"); |
| 214 | + } |
| 215 | + #endif |
| 216 | + |
| 217 | +@@ -229,9 +235,11 @@ |
| 218 | + #if SDL_VIDEO_OPENGL_EGL |
| 219 | + /* Restore the GL Context from here, as this operation is thread dependent */ |
| 220 | + if (!isContextExternal && !SDL_HasEvent(SDL_QUIT)) { |
| 221 | ++ __android_log_print(2, "SDL", "Android_PumpEvents_NonBlocking-2()-Lock"); |
| 222 | + SDL_LockMutex(Android_ActivityMutex); |
| 223 | + android_egl_context_restore(Android_Window); |
| 224 | + SDL_UnlockMutex(Android_ActivityMutex); |
| 225 | ++ __android_log_print(2, "SDL", "Android_PumpEvents_NonBlocking-2()-Unlock"); |
| 226 | + } |
| 227 | + #endif |
| 228 | + |
| 229 | +diff -Naur SDL.orig/src/video/android/SDL_androidgl.c SDL/src/video/android/SDL_androidgl.c |
| 230 | +--- SDL.orig/src/video/android/SDL_androidgl.c 2022-04-09 03:19:19.000000000 +0200 |
| 231 | ++++ SDL/src/video/android/SDL_androidgl.c 2022-09-25 15:21:55.000000000 +0200 |
| 232 | +@@ -56,6 +56,7 @@ |
| 233 | + ret = SDL_EGL_CreateContext(_this, ((SDL_WindowData *) window->driverdata)->egl_surface); |
| 234 | + |
| 235 | + SDL_UnlockMutex(Android_ActivityMutex); |
| 236 | ++ __android_log_print(2, "SDL", "Android_GLES_CreateContext()-Unlock"); |
| 237 | + |
| 238 | + return ret; |
| 239 | + } |
| 240 | +@@ -64,8 +65,8 @@ |
| 241 | + Android_GLES_SwapWindow(_THIS, SDL_Window * window) |
| 242 | + { |
| 243 | + int retval; |
| 244 | +- |
| 245 | +- SDL_LockMutex(Android_ActivityMutex); |
| 246 | ++ __android_log_print(2, "SDL", "Android_GLES_SwapWindow()-Lock"); |
| 247 | ++ // SDL_LockMutex(Android_ActivityMutex); |
| 248 | + |
| 249 | + /* The following two calls existed in the original Java code |
| 250 | + * If you happen to have a device that's affected by their removal, |
| 251 | +@@ -74,9 +75,10 @@ |
| 252 | + |
| 253 | + /*_this->egl_data->eglWaitNative(EGL_CORE_NATIVE_ENGINE); |
| 254 | + _this->egl_data->eglWaitGL();*/ |
| 255 | +- retval = SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface); |
| 256 | ++ retval = SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface); // |
| 257 | + |
| 258 | +- SDL_UnlockMutex(Android_ActivityMutex); |
| 259 | ++ // SDL_UnlockMutex(Android_ActivityMutex); |
| 260 | ++ __android_log_print(2, "SDL", "Android_GLES_SwapWindow()-Unlock"); |
| 261 | + |
| 262 | + return retval; |
| 263 | + } |
| 264 | +diff -Naur SDL.orig/src/video/android/SDL_androidwindow.c SDL/src/video/android/SDL_androidwindow.c |
| 265 | +--- SDL.orig/src/video/android/SDL_androidwindow.c 2022-06-02 04:01:57.000000000 +0200 |
| 266 | ++++ SDL/src/video/android/SDL_androidwindow.c 2022-09-25 15:23:00.000000000 +0200 |
| 267 | +@@ -100,6 +100,7 @@ |
| 268 | + endfunction: |
| 269 | + |
| 270 | + SDL_UnlockMutex(Android_ActivityMutex); |
| 271 | ++ __android_log_print(2, "SDL", "Android_CreateWindow()-Unlock"); |
| 272 | + |
| 273 | + return retval; |
| 274 | + } |
| 275 | +@@ -112,7 +113,8 @@ |
| 276 | + |
| 277 | + void |
| 278 | + Android_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen) |
| 279 | +-{ |
| 280 | ++{ |
| 281 | ++ __android_log_print(2, "SDL", "Android_SetWindowFullscreen()-Lock"); |
| 282 | + SDL_LockMutex(Android_ActivityMutex); |
| 283 | + |
| 284 | + if (window == Android_Window) { |
| 285 | +@@ -160,6 +162,7 @@ |
| 286 | + endfunction: |
| 287 | + |
| 288 | + SDL_UnlockMutex(Android_ActivityMutex); |
| 289 | ++ __android_log_print(2, "SDL", "Android_SetWindowFullscreen()-Unlock"); |
| 290 | + } |
| 291 | + |
| 292 | + void |
| 293 | +@@ -177,6 +180,7 @@ |
| 294 | + void |
| 295 | + Android_DestroyWindow(_THIS, SDL_Window *window) |
| 296 | + { |
| 297 | ++ __android_log_print(2, "SDL", "Android_DestroyWindow()-Lock"); |
| 298 | + SDL_LockMutex(Android_ActivityMutex); |
| 299 | + |
| 300 | + if (window == Android_Window) { |
| 301 | +@@ -200,6 +204,7 @@ |
| 302 | + } |
| 303 | + |
| 304 | + SDL_UnlockMutex(Android_ActivityMutex); |
| 305 | ++ __android_log_print(2, "SDL", "Android_DestroyWindow()-Unlock"); |
| 306 | + } |
| 307 | + |
| 308 | + SDL_bool |
0 commit comments