[Native File Dialogs] Refocus last focused window on close.

This commit is contained in:
bruvzg 2023-08-24 08:49:18 +03:00
parent 6758a7f8c0
commit 2e1f48ff6e
No known key found for this signature in database
GPG key ID: 7960FCF39844EC38
5 changed files with 22 additions and 4 deletions

View file

@ -239,6 +239,8 @@ Error DisplayServerWindows::file_dialog_show(const String &p_title, const String
filters.push_back({ (LPCWSTR)filter_names[i].ptr(), (LPCWSTR)filter_exts[i].ptr() });
}
WindowID prev_focus = last_focused_window;
HRESULT hr = S_OK;
IFileDialog *pfd = nullptr;
if (p_mode == FILE_DIALOG_MODE_SAVE_FILE) {
@ -339,6 +341,9 @@ Error DisplayServerWindows::file_dialog_show(const String &p_title, const String
}
}
pfd->Release();
if (prev_focus != INVALID_WINDOW_ID) {
callable_mp(DisplayServer::get_singleton(), &DisplayServer::window_move_to_foreground).call_deferred(prev_focus);
}
return OK;
} else {