emscripten-core / emscripten-core/emscripten
SDL: calling SDL_SetWindowSize inside fullscreen callback doesn't work
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
**Version of emscripten/emsdk:**
```
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.51 (c0c2ca1314672a25699846b4663701bcb6f69cca)
clang version 18.0.0git (https://github.com/llvm/llvm-project f2464ca317bfeeedddb7cbdea3c2c8ec487890bb)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /home/eliasdaler/work/emsdk/upstream/bin
```
When I register a full screen callback via `emscripten_set_fullscreenchange_callback`, calling `SDL_SetWindowSize` inside of the callback doesn't work and makes the image disappear.
However, if I poll the full screen state in the main loop and change `SDL_SetWindowSize` on full screen change, everything works as expected.
Repro can be found here: https://github.com/eliasdaler/em_test/tree/em_bug
Build instructions:
```sh
git clone https://github.com/eliasdaler/em_test/
cd em_test/
git checkout em_bug
mkdir build && cd build
emcmake cmake ..
cmake --build .
emrun src/site/index.html
```
To get it working properly
1. Uncomment [this](https://github.com/eliasdaler/em_test/blob/48f43a0f5c99bedaec630d52b338cdfcc607e878/src/Game.cpp#L111C9-L111C82)
2. Comment out [this](https://github.com/eliasdaler/em_test/blob/48f43a0f5c99bedaec630d52b338cdfcc607e878/src/Game.cpp#L20)
Contributor guide
Assessment
This issue has not been assessed yet.