Skip to content

Commit 524b94f

Browse files
authored
Use orientationIndex enum from header. NFC (#21550)
1 parent ed2c090 commit 524b94f

File tree

6 files changed

+10
-6
lines changed

6 files changed

+10
-6
lines changed

src/generated_struct_info32.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@
185185
"EMSCRIPTEN_FULLSCREEN_SCALE_CENTER": 3,
186186
"EMSCRIPTEN_FULLSCREEN_SCALE_DEFAULT": 0,
187187
"EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH": 1,
188+
"EMSCRIPTEN_ORIENTATION_UNSUPPORTED": 0,
188189
"EMSCRIPTEN_RESULT_DEFERRED": 1,
189190
"EMSCRIPTEN_RESULT_FAILED": -6,
190191
"EMSCRIPTEN_RESULT_FAILED_NOT_DEFERRED": -2,

src/generated_struct_info64.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@
185185
"EMSCRIPTEN_FULLSCREEN_SCALE_CENTER": 3,
186186
"EMSCRIPTEN_FULLSCREEN_SCALE_DEFAULT": 0,
187187
"EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH": 1,
188+
"EMSCRIPTEN_ORIENTATION_UNSUPPORTED": 0,
188189
"EMSCRIPTEN_RESULT_DEFERRED": 1,
189190
"EMSCRIPTEN_RESULT_FAILED": -6,
190191
"EMSCRIPTEN_RESULT_FAILED_NOT_DEFERRED": -2,

src/library_html5.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ var LibraryHTML5 = {
940940
// alternative selection from OrientationLockType enum
941941
var orientationsType2 = ['portrait', 'portrait', 'landscape', 'landscape'];
942942

943-
var orientationIndex = 0;
943+
var orientationIndex = {{{ cDefs.EMSCRIPTEN_ORIENTATION_UNSUPPORTED }}};
944944
var orientationAngle = 0;
945945
var screenOrientObj = screenOrientation();
946946
if (typeof screenOrientObj === 'object') {

src/modules.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ const C_STRUCTS = new Proxy(structs, {
300300
get(target, prop, receiver) {
301301
if (!(prop in target)) {
302302
throw new Error(
303-
`Missing C struct ${prop}! If you just added it to struct_info.json, you need to run ./tools/gen_struct_info.py`,
303+
`Missing C struct ${prop}! If you just added it to struct_info.json, you need to run ./tools/maint/gen_struct_info.py (then run a second time with --wasm64)`,
304304
);
305305
}
306306
return target[prop];
@@ -311,7 +311,7 @@ const C_DEFINES = new Proxy(defines, {
311311
get(target, prop, receiver) {
312312
if (!(prop in target)) {
313313
throw new Error(
314-
`Missing C define ${prop}! If you just added it to struct_info.json, you need to run ./tools/gen_struct_info.py`,
314+
`Missing C define ${prop}! If you just added it to struct_info.json, you need to run ./tools/maint/gen_struct_info.py (then run a second time with --wasm64)`,
315315
);
316316
}
317317
return target[prop];

src/struct_info.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,9 @@
785785

786786
"EMSCRIPTEN_DEVICE_MOTION_EVENT_SUPPORTS_ACCELERATION",
787787
"EMSCRIPTEN_DEVICE_MOTION_EVENT_SUPPORTS_ACCELERATION_INCLUDING_GRAVITY",
788-
"EMSCRIPTEN_DEVICE_MOTION_EVENT_SUPPORTS_ROTATION_RATE"
788+
"EMSCRIPTEN_DEVICE_MOTION_EVENT_SUPPORTS_ROTATION_RATE",
789+
790+
"EMSCRIPTEN_ORIENTATION_UNSUPPORTED"
789791
],
790792
"structs": {
791793
"EmscriptenKeyboardEvent": [

test/test_other.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14027,13 +14027,13 @@ def test_missing_struct_info(self):
1402714027
{{{ C_STRUCTS.Foo }}}
1402814028
''')
1402914029
err = self.expect_fail([EMCC, test_file('hello_world.c'), '--js-library=lib.js'])
14030-
self.assertContained('Error: Missing C struct Foo! If you just added it to struct_info.json, you need to run ./tools/gen_struct_info.py', err)
14030+
self.assertContained('Error: Missing C struct Foo! If you just added it to struct_info.json, you need to run ./tools/maint/gen_struct_info.py (then run a second time with --wasm64)', err)
1403114031

1403214032
create_file('lib.js', '''
1403314033
{{{ C_DEFINES.Foo }}}
1403414034
''')
1403514035
err = self.expect_fail([EMCC, test_file('hello_world.c'), '--js-library=lib.js'])
14036-
self.assertContained('Error: Missing C define Foo! If you just added it to struct_info.json, you need to run ./tools/gen_struct_info.py', err)
14036+
self.assertContained('Error: Missing C define Foo! If you just added it to struct_info.json, you need to run ./tools/maint/gen_struct_info.py (then run a second time with --wasm64)', err)
1403714037

1403814038
def run_wasi_test_suite_test(self, name):
1403914039
if not os.path.exists(path_from_root('test/third_party/wasi-test-suite')):

0 commit comments

Comments
 (0)