代码格式化,添加log

This commit is contained in:
Nanako 2024-07-30 20:56:27 +08:00
parent 9b5c6f1666
commit 9f291e21da
3 changed files with 13 additions and 6 deletions

View File

@ -67,6 +67,7 @@ void plugin_host::create_and_open_editor() {
return; return;
} }
on_open_editor(handle); on_open_editor(handle);
spdlog::info("{} window created", name.c_str());
} }
void plugin_host::destroy_editor() { void plugin_host::destroy_editor() {

View File

@ -89,13 +89,19 @@ void window_manager::on_host_window_close(GLFWwindow* window) {
return info.second.window.get() == window; return info.second.window.get() == window;
}); });
if (f != host_infos_.end()) { if (f != host_infos_.end()) {
f->first->editor_opened = false; auto& info = f->second;
f->first->on_close_editor(); auto host = f->first;
host->editor_opened = false;
host->on_close_editor();
int x, y; int x, y;
glfwGetWindowPos(window, &x, &y); glfwGetWindowPos(window, &x, &y);
f->second.x = x; info.x = x;
f->second.y = y; info.y = y;
f->second.window.reset(); info.window.reset();
spdlog::info("{} window close", host->name.c_str());
} }
} }

View File

@ -13,7 +13,7 @@ public:
void release(singleton_release_guard& release_guard) override; void release(singleton_release_guard& release_guard) override;
std::shared_ptr<GLFWwindow> create_window(int width, int height, const char* title); std::shared_ptr<GLFWwindow> create_window(int width, int height, const char* title);
void* create_plugin_window(plugin_host* host); auto create_plugin_window(plugin_host* host) -> void*;
void destroy_plugin_window(plugin_host* host); void destroy_plugin_window(plugin_host* host);
void resize_plugin_window(plugin_host* host, int width, int height); void resize_plugin_window(plugin_host* host, int width, int height);
const char* get_name() override { return "window_manager"; } const char* get_name() override { return "window_manager"; }