summaryrefslogtreecommitdiff
path: root/src/client.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2016-05-09 13:48:48 +0100
committerMaxime Coste <frrrwww@gmail.com>2016-05-09 13:48:48 +0100
commitd3aff03062a344f8ec0387d7c514747ee97fc69b (patch)
treeae23d25579c463378ffe4624ac0233e5ccbae767 /src/client.cc
parent3338ba5c6c19590794f678dd9c47c49b8391f34f (diff)
Keep a pointer to current client in windows so that window hooks can access it
Diffstat (limited to 'src/client.cc')
-rw-r--r--src/client.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/client.cc b/src/client.cc
index 3dc3ea07..6d875c39 100644
--- a/src/client.cc
+++ b/src/client.cc
@@ -28,6 +28,8 @@ Client::Client(std::unique_ptr<UserInterface>&& ui,
std::move(name)},
m_env_vars(env_vars)
{
+ m_window->set_client(this);
+
context().set_client(*this);
context().set_window(*m_window);
@@ -42,6 +44,7 @@ Client::Client(std::unique_ptr<UserInterface>&& ui,
Client::~Client()
{
m_window->options().unregister_watcher(*this);
+ m_window->set_client(nullptr);
}
Optional<Key> Client::get_next_key(EventMode mode)
@@ -149,11 +152,13 @@ void Client::change_buffer(Buffer& buffer)
auto& client_manager = ClientManager::instance();
m_window->options().unregister_watcher(*this);
+ m_window->set_client(nullptr);
client_manager.add_free_window(std::move(m_window),
std::move(context().selections()));
WindowAndSelections ws = client_manager.get_free_window(buffer);
m_window = std::move(ws.window);
+ m_window->set_client(this);
m_window->options().register_watcher(*this);
m_ui->set_ui_options(m_window->options()["ui_options"].get<UserInterface::Options>());