1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-13 13:31:48 +00:00

Fix Floating Window request close when a dialog is opened

This commit is contained in:
Hilderin
2025-02-05 19:51:30 -05:00
parent a63a8b430b
commit a3d03717c0
9 changed files with 50 additions and 6 deletions

View File

@@ -798,16 +798,17 @@ void GameView::_window_close_request() {
// Before the parent window closed, we close the embedded game. That prevents
// the embedded game to be seen without a parent window for a fraction of second.
if (EditorRunBar::get_singleton()->is_playing() && (embedded_process->is_embedding_completed() || embedded_process->is_embedding_in_progress())) {
// Try to gracefully close the window. That way, the NOTIFICATION_WM_CLOSE_REQUEST
// notification should be propagated in the game process.
embedded_process->reset();
// When the embedding is not complete, we need to kill the process.
// If the game is paused, the close request will not be processed by the game, so it's better to kill the process.
if (paused || embedded_process->is_embedding_in_progress()) {
embedded_process->reset();
// Call deferred to prevent the _stop_pressed callback to be executed before the wrapper window
// actually closes.
callable_mp(EditorRunBar::get_singleton(), &EditorRunBar::stop_playing).call_deferred();
} else {
// Try to gracefully close the window. That way, the NOTIFICATION_WM_CLOSE_REQUEST
// notification should be propagated in the game process.
embedded_process->request_close();
}
}
}