mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 19:15:14 -04:00
Web: Fix canvas not auto clearing when client is exited with an error (e.g. invalid port)
This commit is contained in:
parent
d3a9477470
commit
1c786570e4
@ -358,7 +358,12 @@ cc_result Socket_Poll(cc_socket s, int mode, cc_bool* success) {
|
|||||||
*-----------------------------------------------------Process/Module------------------------------------------------------*
|
*-----------------------------------------------------Process/Module------------------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
cc_result Process_StartGame(const cc_string* args) { return ERR_NOT_SUPPORTED; }
|
cc_result Process_StartGame(const cc_string* args) { return ERR_NOT_SUPPORTED; }
|
||||||
void Process_Exit(cc_result code) { exit(code); }
|
void Process_Exit(cc_result code) {
|
||||||
|
/* Window isn't implicitly closed when process is exited */
|
||||||
|
if (code) Window_Close();
|
||||||
|
|
||||||
|
exit(code);
|
||||||
|
}
|
||||||
|
|
||||||
extern int interop_OpenTab(const char* url);
|
extern int interop_OpenTab(const char* url);
|
||||||
cc_result Process_StartOpen(const cc_string* args) {
|
cc_result Process_StartOpen(const cc_string* args) {
|
||||||
|
@ -481,13 +481,16 @@ void Window_Close(void) {
|
|||||||
WindowInfo.Exists = false;
|
WindowInfo.Exists = false;
|
||||||
Event_RaiseVoid(&WindowEvents.Closing);
|
Event_RaiseVoid(&WindowEvents.Closing);
|
||||||
/* If the game is closed while in fullscreen, the last rendered frame stays */
|
/* If the game is closed while in fullscreen, the last rendered frame stays */
|
||||||
/* shown in fullscreen, but the game can't be interacted with anymore */
|
/* shown in fullscreen, but the game can't be interacted with anymore */
|
||||||
Window_ExitFullscreen();
|
Window_ExitFullscreen();
|
||||||
|
|
||||||
/* Don't want cursor stuck on the dead 0,0 canvas */
|
/* Don't want cursor stuck on the dead 0,0 canvas */
|
||||||
Window_DisableRawMouse();
|
Window_DisableRawMouse();
|
||||||
Window_SetSize(0, 0);
|
Window_SetSize(0, 0);
|
||||||
UnhookEvents();
|
UnhookEvents();
|
||||||
|
/* Game_DoFrame doesn't do anything when WindowExists.False is false, */
|
||||||
|
/* but it's still better to cancel main loop to minimise resource usage */
|
||||||
|
emscripten_cancel_main_loop();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void interop_RequestCanvasResize(void);
|
extern void interop_RequestCanvasResize(void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user