sokol icon indicating copy to clipboard operation
sokol copied to clipboard

sokol_app.h: support sapp_toggle_fullscreen with HTML5

Open edubart opened this issue 9 months ago • 2 comments

Currently sapp_toggle_fullscreen is not implemented for HTML5 backend, however emscripten has the functions emscripten_request_fullscreen and emscripten_enter_soft_fullscreen which could be used to implement it.

There is an example if it in https://github.com/emscripten-core/emscripten/blob/main/test/test_html5_fullscreen.c

edubart avatar Sep 15 '23 19:09 edubart

Yeah I'm aware of those functions (and IIRC actually used them in early sokol_app.h versions), but had a lot of trouble in the past because fullscreen implementation details differ a lot between browsers (and IIRC iOS Safari didn't support fullscreen at all for a long time). One problem I remember was that the fullscreen security popup clashes with mouse-lock security popup which made UX a mess.

There's also left-over comment which hints at some of the problems I ran into:

https://github.com/floooh/sokol/blob/d4ac122f36d7659a18b312fd4fa2317fb9e06a63/sokol_app.h#L5082-L5101

floooh avatar Sep 17 '23 12:09 floooh

I see, I managed to workaround by adding some JavaScript code in the web frontend, so this problem can be solved in outside the sokol_app.h. Thus consider this low priority.

edubart avatar Sep 18 '23 13:09 edubart