Skip to content

Commit

Permalink
Update SDL2 version from 2.24.2 to 2.26.0
Browse files Browse the repository at this point in the history
This is just a minor update to see if its any better than #20268
  • Loading branch information
sbc100 committed Feb 14, 2024
1 parent ff35d3f commit baf0883
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
14 changes: 7 additions & 7 deletions test/browser/test_sdl2_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ int main(int argc, char **argv) {

SDL_StartTextInput();

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

emscripten_set_main_loop(pump_events, 3, 0);
return 99;
Expand Down
6 changes: 4 additions & 2 deletions test/browser/test_sdl2_mouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ void one() {
printf("motion : %d,%d %d,%d\n", m->x, m->y, m->xrel, m->yrel);

if (mouse_motions == 0) {
// Starting with SDL 2.26.0 initual xrel and yrel values are zero
// See: https://github.com/libsdl-org/SDL/commit/0e61c106
#ifdef TEST_SDL_MOUSE_OFFSETS
assert(eq(m->x, 5) && eq(m->y, 15) && eq(m->xrel, 5) && eq(m->yrel, 15));
assert(eq(m->x, 5) && eq(m->y, 15) && eq(m->xrel, 0) && eq(m->yrel, 0));
#else
assert(eq(m->x, 10) && eq(m->y, 20) && eq(m->xrel, 10) && eq(m->yrel, 20));
assert(eq(m->x, 10) && eq(m->y, 20) && eq(m->xrel, 0) && eq(m->yrel, 0));
#endif
} else if (mouse_motions == 1) {
#ifdef TEST_SDL_MOUSE_OFFSETS
Expand Down
10 changes: 5 additions & 5 deletions test/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3039,19 +3039,19 @@ def test_sdl2_image_formats(self):
@no_wasm64('SDL2 + wasm64')
def test_sdl2_key(self):
create_file('pre.js', '''
function keydown(c) {
var event = new KeyboardEvent("keydown", { 'keyCode': c, 'charCode': c, 'view': window, 'bubbles': true, 'cancelable': true });
function keydown(keyCode, code) {
var event = new KeyboardEvent("keydown", { keyCode, code, charCode: keyCode, 'view': window, 'bubbles': true, 'cancelable': true });
var prevented = !document.dispatchEvent(event);
//send keypress if not prevented
if (!prevented) {
var event = new KeyboardEvent("keypress", { 'keyCode': c, 'charCode': c, 'view': window, 'bubbles': true, 'cancelable': true });
var event = new KeyboardEvent("keypress", { keyCode, code, charCode: keyCode, 'view': window, 'bubbles': true, 'cancelable': true });
document.dispatchEvent(event);
}
}
function keyup(c) {
var event = new KeyboardEvent("keyup", { 'keyCode': c, 'charCode': c, 'view': window, 'bubbles': true, 'cancelable': true });
function keyup(keyCode, code) {
var event = new KeyboardEvent("keyup", { keyCode, code, charCode: keyCode, 'view': window, 'bubbles': true, 'cancelable': true });
document.dispatchEvent(event);
}
''')
Expand Down
4 changes: 2 additions & 2 deletions tools/ports/sdl2.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import os

TAG = 'release-2.24.2'
HASH = 'b178bdc8f7c40271e09a72f639649d1d61953dda4dc12b77437259667b63b961fd3b2c67b0de6fdc5f9f9c80c49bfafd164e4c13715bc1056e550acc8bad5a3c'
TAG = 'release-2.26.0'
HASH = '2e53af5aa3d3ca7e2b8653f999379bf424b2190aad32a7997350fc058624818cca3a780907af74c8f72305ca18a83a2aa15839e1dbc94107128125a7df9cd7fd'
SUBDIR = 'SDL-' + TAG

variants = {'sdl2-mt': {'PTHREADS': 1}}
Expand Down

0 comments on commit baf0883

Please sign in to comment.