Skip to content

Commit e58e33d

Browse files
committed
Update SDL2 version from 2.24.2 to 2.26.0
This is just a minor update to see if its any better than #20268
1 parent 5ace027 commit e58e33d

File tree

5 files changed

+23
-21
lines changed

5 files changed

+23
-21
lines changed

test/browser/test_sdl2_key.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ int main(int argc, char **argv) {
6262

6363
SDL_StartTextInput();
6464

65-
emscripten_run_script("keydown(38);keyup(38)"); // up
66-
emscripten_run_script("keydown(40);keyup(40);"); // down
67-
emscripten_run_script("keydown(37);keyup(37);"); // left
68-
emscripten_run_script("keydown(39);keyup(39);"); // right
69-
emscripten_run_script("keydown(65);keyup(65);"); // a
70-
emscripten_run_script("keydown(66);keyup(66);"); // b
71-
emscripten_run_script("keydown(100);keyup(100);"); // trigger the end
65+
emscripten_run_script("keydown(38, 'ArrowUp'); keyup(38, 'ArrowUp')"); // up
66+
emscripten_run_script("keydown(40, 'ArrowDown'); keyup(40, 'ArrowWDown')"); // down
67+
emscripten_run_script("keydown(37, 'ArrowLeft'); keyup(37, 'ArrowLeft');"); // left
68+
emscripten_run_script("keydown(39, 'ArrowRight');keyup(39, 'ArrowRight');"); // right
69+
emscripten_run_script("keydown(65, 'KeyA'); keyup(65, 'KeyA');"); // a
70+
emscripten_run_script("keydown(66, 'KeyB'); keyup(66, 'KeyB');"); // b
71+
emscripten_run_script("keydown(100, 'Numpad4'); keyup(100, 'Numpad4');"); // trigger the end
7272

7373
emscripten_set_main_loop(pump_events, 3, 0);
7474
return 99;

test/browser/test_sdl2_mouse.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ void one() {
2525
printf("motion : %d,%d %d,%d\n", m->x, m->y, m->xrel, m->yrel);
2626

2727
if (mouse_motions == 0) {
28+
// Starting with SDL 2.26.0 initual xrel and yrel values are zero
29+
// See: https://github.com/libsdl-org/SDL/commit/0e61c106
2830
#ifdef TEST_SDL_MOUSE_OFFSETS
29-
assert(eq(m->x, 5) && eq(m->y, 15) && eq(m->xrel, 5) && eq(m->yrel, 15));
31+
assert(eq(m->x, 5) && eq(m->y, 15) && eq(m->xrel, 0) && eq(m->yrel, 0));
3032
#else
31-
assert(eq(m->x, 10) && eq(m->y, 20) && eq(m->xrel, 10) && eq(m->yrel, 20));
33+
assert(eq(m->x, 10) && eq(m->y, 20) && eq(m->xrel, 0) && eq(m->yrel, 0));
3234
#endif
3335
} else if (mouse_motions == 1) {
3436
#ifdef TEST_SDL_MOUSE_OFFSETS

test/browser/test_sdl2_pumpevents.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ int main(int argc, char *argv[])
5656
SDL_Window *window;
5757
SDL_CreateWindow("window", 0, 0, 600, 450, 0);
5858

59-
emscripten_run_script("keydown(37);"); // left
59+
emscripten_run_script("keydown(37, 'ArrowLeft');"); // left
6060
loop1();
61-
emscripten_run_script("keydown(39);"); // right
61+
emscripten_run_script("keydown(39, 'ArrowRight');"); // right
6262
loop2();
63-
emscripten_run_script("keydown(65);"); // A
63+
emscripten_run_script("keydown(65, 'KeyA');"); // A
6464
alphakey();
6565
return 0;
6666
}

test/test_browser.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3054,19 +3054,19 @@ def test_sdl2_image_formats(self):
30543054
@no_wasm64('SDL2 + wasm64')
30553055
def test_sdl2_key(self):
30563056
create_file('pre.js', '''
3057-
function keydown(c) {
3058-
var event = new KeyboardEvent("keydown", { 'keyCode': c, 'charCode': c, 'view': window, 'bubbles': true, 'cancelable': true });
3057+
function keydown(keyCode, code) {
3058+
var event = new KeyboardEvent("keydown", { keyCode, code, charCode: keyCode, 'view': window, 'bubbles': true, 'cancelable': true });
30593059
var prevented = !document.dispatchEvent(event);
30603060
30613061
//send keypress if not prevented
30623062
if (!prevented) {
3063-
var event = new KeyboardEvent("keypress", { 'keyCode': c, 'charCode': c, 'view': window, 'bubbles': true, 'cancelable': true });
3063+
var event = new KeyboardEvent("keypress", { keyCode, code, charCode: keyCode, 'view': window, 'bubbles': true, 'cancelable': true });
30643064
document.dispatchEvent(event);
30653065
}
30663066
}
30673067
3068-
function keyup(c) {
3069-
var event = new KeyboardEvent("keyup", { 'keyCode': c, 'charCode': c, 'view': window, 'bubbles': true, 'cancelable': true });
3068+
function keyup(keyCode, code) {
3069+
var event = new KeyboardEvent("keyup", { keyCode, code, charCode: keyCode, 'view': window, 'bubbles': true, 'cancelable': true });
30703070
document.dispatchEvent(event);
30713071
}
30723072
''')
@@ -3281,8 +3281,8 @@ def test_sdl2_canvas_proxy(self):
32813281
def test_sdl2_pumpevents(self):
32823282
# key events should be detected using SDL_PumpEvents
32833283
create_file('pre.js', '''
3284-
function keydown(c) {
3285-
var event = new KeyboardEvent("keydown", { 'keyCode': c, 'charCode': c, 'view': window, 'bubbles': true, 'cancelable': true });
3284+
function keydown(keyCode, code) {
3285+
var event = new KeyboardEvent("keydown", { keyCode, code, charCode: keyCode, 'view': window, 'bubbles': true, 'cancelable': true });
32863286
document.dispatchEvent(event);
32873287
}
32883288
''')

tools/ports/sdl2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
import os
77

8-
TAG = 'release-2.24.2'
9-
HASH = 'b178bdc8f7c40271e09a72f639649d1d61953dda4dc12b77437259667b63b961fd3b2c67b0de6fdc5f9f9c80c49bfafd164e4c13715bc1056e550acc8bad5a3c'
8+
TAG = 'release-2.26.0'
9+
HASH = '2e53af5aa3d3ca7e2b8653f999379bf424b2190aad32a7997350fc058624818cca3a780907af74c8f72305ca18a83a2aa15839e1dbc94107128125a7df9cd7fd'
1010
SUBDIR = 'SDL-' + TAG
1111

1212
variants = {'sdl2-mt': {'PTHREADS': 1}}

0 commit comments

Comments
 (0)