新增plugin_host窗口关闭逻辑
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user