kranewl

A wlroots-based dynamic Wayland compositor, written in C++, configurable with Lua
git clone git://git.deurzen.net/kranewl
Log | Files | Refs | LICENSE

commit 9ece1650a4ee45b2c0988a6f8205c03dd200bade
parent 15d439e256ded28b510a235b2082a33ee8918d89
Author: deurzen <max@deurzen.net>
Date:   Sun, 29 May 2022 22:53:09 +0200

adds output switching actions

Diffstat:
Msrc/kranewl/model.cc | 25+++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/src/kranewl/model.cc b/src/kranewl/model.cc @@ -771,20 +771,41 @@ Model::toggle_output() { TRACE(); + if (mp_prev_output) + activate_output(mp_prev_output); } void -Model::activate_output(Index) +Model::activate_output(Index index) { TRACE(); + if (index < m_outputs.size()) + activate_output(output(index)); } void -Model::activate_output(Output_ptr) +Model::activate_output(Output_ptr next_output) { TRACE(); + if (next_output == mp_output) + return; + + abort_cursor_interactive(); + + Output_ptr prev_output = mp_output; + mp_prev_output = prev_output; + mp_output = next_output; + m_outputs.activate_element(next_output); + + Context_ptr next_context = next_output->context(); + Context_ptr prev_context = prev_output->context(); + mp_prev_context = prev_context; + mp_context = next_context; + m_contexts.activate_element(next_context); + + activate_workspace(next_context->workspace()); } void