新增plugin_host窗口关闭逻辑

This commit is contained in:
2024-02-28 11:25:47 +08:00
parent 63436a413f
commit 869ec21603
2 changed files with 18 additions and 0 deletions

View File

@@ -24,7 +24,9 @@ void window_manager::tick() {
glfwPollEvents();
if (should_close()) {
destroy_all_plugin_host_window();
return;
}
update_host_window();
}
void window_manager::destroy_all_plugin_host_window() {
@@ -88,3 +90,17 @@ void window_manager::idle_thread_func() {
std::this_thread::yield();
}
}
void window_manager::update_host_window() {
std::vector<plugin_host*> host_editor_to_close;
for (const auto& [host, window]: host_window_map_) {
if (glfwWindowShouldClose(window)) {
host->close_editor();
glfwDestroyWindow(window);
host_editor_to_close.push_back(host);
}
}
for (auto host: host_editor_to_close) {
host_window_map_.erase(host);
}
}