Repository navigation
Commit c0edf5b
authored
[GLUT/GLFW] Stop resizing canvas to 1x1 on exit/termination (#27833)
In 2012, `Module["canvas"].width = Module["canvas"].height = 1` was
added to the GLUT exit handler in `libglut.js` (#357) to simulate
closing the window when a GLUT program calls `exit()`.
When `libglfw.js` was created in 2013 (#1006), it was copied from
`libglut.js` as a template along with the `atexit` handler in
`glfwInit`, which was later moved into `glfwTerminate` when GLFW 3
support was added in 2014 (#1887).
Remove this 1x1 canvas resize from both libraries:
- Neither SDL1, SDL2, nor EGL resizes the canvas to 1x1 on shutdown or
exit.
- Calling `glfwInit()` followed by `glfwTerminate()` (even without
creating a window) unexpectedly clobbers the canvas dimensions.
- Resizing the canvas clears its bitmap, which destroys rendered output
if an application renders a static frame and then calls
`glfwTerminate()` or exits with `EXIT_RUNTIME=1`.
- In GLFW HiDPI mode, inline CSS dimensions remain set on the canvas, so
setting `width` and `height` to 1 only shrinks the backing buffer while
leaving the element at its previous CSS size.1 parent e81f854 commit c0edf5b
3 files changed
Lines changed: 2 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1501 | 1501 | | |
1502 | 1502 | | |
1503 | 1503 | | |
1504 | | - | |
1505 | 1504 | | |
1506 | 1505 | | |
1507 | 1506 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
370 | 370 | | |
371 | 371 | | |
372 | 372 | | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | 373 | | |
377 | 374 | | |
378 | 375 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
0 commit comments