Skip to content

Use orientationIndex enum from header #21550

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/generated_struct_info32.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@
"EMSCRIPTEN_FULLSCREEN_SCALE_CENTER": 3,
"EMSCRIPTEN_FULLSCREEN_SCALE_DEFAULT": 0,
"EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH": 1,
"EMSCRIPTEN_ORIENTATION_UNSUPPORTED": 0,
"EMSCRIPTEN_RESULT_DEFERRED": 1,
"EMSCRIPTEN_RESULT_FAILED": -6,
"EMSCRIPTEN_RESULT_FAILED_NOT_DEFERRED": -2,
Expand Down
1 change: 1 addition & 0 deletions src/generated_struct_info64.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@
"EMSCRIPTEN_FULLSCREEN_SCALE_CENTER": 3,
"EMSCRIPTEN_FULLSCREEN_SCALE_DEFAULT": 0,
"EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH": 1,
"EMSCRIPTEN_ORIENTATION_UNSUPPORTED": 0,
"EMSCRIPTEN_RESULT_DEFERRED": 1,
"EMSCRIPTEN_RESULT_FAILED": -6,
"EMSCRIPTEN_RESULT_FAILED_NOT_DEFERRED": -2,
Expand Down
2 changes: 1 addition & 1 deletion src/library_html5.js
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,7 @@ var LibraryHTML5 = {
// alternative selection from OrientationLockType enum
var orientationsType2 = ['portrait', 'portrait', 'landscape', 'landscape'];

var orientationIndex = 0;
var orientationIndex = {{{ cDefs.EMSCRIPTEN_ORIENTATION_UNSUPPORTED }}};
var orientationAngle = 0;
var screenOrientObj = screenOrientation();
if (typeof screenOrientObj === 'object') {
Expand Down
4 changes: 2 additions & 2 deletions src/modules.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ const C_STRUCTS = new Proxy(structs, {
get(target, prop, receiver) {
if (!(prop in target)) {
throw new Error(
`Missing C struct ${prop}! If you just added it to struct_info.json, you need to run ./tools/gen_struct_info.py`,
`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)`,
);
}
return target[prop];
Expand All @@ -311,7 +311,7 @@ const C_DEFINES = new Proxy(defines, {
get(target, prop, receiver) {
if (!(prop in target)) {
throw new Error(
`Missing C define ${prop}! If you just added it to struct_info.json, you need to run ./tools/gen_struct_info.py`,
`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)`,
);
}
return target[prop];
Expand Down
4 changes: 3 additions & 1 deletion src/struct_info.json
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,9 @@

"EMSCRIPTEN_DEVICE_MOTION_EVENT_SUPPORTS_ACCELERATION",
"EMSCRIPTEN_DEVICE_MOTION_EVENT_SUPPORTS_ACCELERATION_INCLUDING_GRAVITY",
"EMSCRIPTEN_DEVICE_MOTION_EVENT_SUPPORTS_ROTATION_RATE"
"EMSCRIPTEN_DEVICE_MOTION_EVENT_SUPPORTS_ROTATION_RATE",

"EMSCRIPTEN_ORIENTATION_UNSUPPORTED"
],
"structs": {
"EmscriptenKeyboardEvent": [
Expand Down
4 changes: 2 additions & 2 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -14027,13 +14027,13 @@ def test_missing_struct_info(self):
{{{ C_STRUCTS.Foo }}}
''')
err = self.expect_fail([EMCC, test_file('hello_world.c'), '--js-library=lib.js'])
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)
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)

create_file('lib.js', '''
{{{ C_DEFINES.Foo }}}
''')
err = self.expect_fail([EMCC, test_file('hello_world.c'), '--js-library=lib.js'])
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)
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)

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