diff --git a/src/client.cc b/src/client.cc index 6ee3cfae..2c84de6b 100644 --- a/src/client.cc +++ b/src/client.cc @@ -80,6 +80,7 @@ bool Client::is_ui_ok() const bool Client::process_pending_inputs() { const bool debug_keys = (bool)(context().options()["debug"].get() & DebugFlags::Keys); + m_window->run_resize_hook_ifn(); // steal keys as we might receive new keys while handling them. Vector keys = std::move(m_pending_keys); for (auto& key : keys) diff --git a/src/window.cc b/src/window.cc index cbc4deab..8acc7a03 100644 --- a/src/window.cc +++ b/src/window.cc @@ -193,8 +193,17 @@ void Window::set_dimensions(DisplayCoord dimensions) if (m_dimensions != dimensions) { m_dimensions = dimensions; - run_hook_in_own_context(Hook::WinResize, format("{}.{}", dimensions.line, - dimensions.column)); + m_resize_hook_pending = true; + } +} + +void Window::run_resize_hook_ifn() +{ + if (m_resize_hook_pending) + { + m_resize_hook_pending = false; + run_hook_in_own_context(Hook::WinResize, + format("{}.{}", m_dimensions.line, m_dimensions.column)); } } diff --git a/src/window.hh b/src/window.hh index 6d3b7393..ad754568 100644 --- a/src/window.hh +++ b/src/window.hh @@ -48,6 +48,8 @@ public: void set_client(Client* client) { m_client = client; } void clear_display_buffer(); + void run_resize_hook_ifn(); + private: Window(const Window&) = delete; @@ -66,6 +68,7 @@ private: DisplayBuffer m_display_buffer; Highlighters m_builtin_highlighters; + bool m_resize_hook_pending = false; struct Setup {