emscripten-core / emscripten-core/emscripten
Does EMSCRIPTEN_EVENT_TARGET_SCREEN work?
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
Using `emscripten_set_keypress_callback_on_thread` with `emscripten_main_runtime_thread_id()` as last argument, works with target set to `EMSCRIPTEN_EVENT_TARGET_DOCUMENT` and `EMSCRIPTEN_EVENT_TARGET_WINDOW` but crashes with `EMSCRIPTEN_EVENT_TARGET_SCREEN`.
Error is:
```
Unhandled Promise Rejection: SyntaxError: The string did not match the expected pattern.
```
Looking through the code, however, I find numerous references to indexes 0, 1, 2 but 3 isn't mentioned anywhere. I couldn't find `EMSCRIPTEN_EVENT_TARGET_SCREEN` in tests either. Does it work? Where should it be passed?
**Version of emscripten/emsdk:**
Please include the output `emcc -v` here
```
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.43-git
clang version 17.0.0 (https://github.com/llvm/llvm-project.git 71513a71cdf380efd6a44be6939e2cb979a62407)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /usr/local/Cellar/emscripten/3.1.43/libexec/llvm/bin
```
**Full link command and output with `-v` appended:**
Compiled with pthread & PROXY_TO_PTHREAD:
```
target_compile_options(libAtomVM PUBLIC -O3 -fno-exceptions -fno-rtti -pthread -sINLINING_LIMIT -sUSE_ZLIB=1)
target_link_options(AtomVM PRIVATE -sEXPORTED_RUNTIME_METHODS=ccall -sUSE_ZLIB=1 -O3 -pthread -sFETCH --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/atomvm.pre.js)
target_link_options(AtomVM PRIVATE -lworkerfs.js -sENVIRONMENT=web,worker -sPROXY_TO_PTHREAD)
```
Contributor guide
Assessment
This issue has not been assessed yet.