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 8432c3c2d7d08a029ef90a324e6a8d1fbb086658
parent 8795db798ae412e4d8294d7265b50313da219542
Author: deurzen <max@deurzen.net>
Date:   Tue, 31 May 2022 12:45:51 +0200

adds view relayering on layout change

Diffstat:
Minclude/kranewl/model.hh | 6+++++-
Minclude/kranewl/tree/view.hh | 1+
Msrc/kranewl/model.cc | 34++++++++++++++++++++++++++++++++++
3 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/include/kranewl/model.hh b/include/kranewl/model.hh @@ -85,10 +85,14 @@ public: void cursor_interactive(Cursor::Mode, View_ptr); void abort_cursor_interactive(); - void sync_focus(); void cycle_focus(Direction); void drag_focus(Direction); + void sync_focus(); + void relayer_views(Workspace_ptr); + void relayer_views(Context_ptr); + void relayer_views(Output_ptr); + void reverse_views(); void rotate_views(Direction); void shuffle_main(Direction); diff --git a/include/kranewl/tree/view.hh b/include/kranewl/tree/view.hh @@ -148,6 +148,7 @@ typedef struct View : public Node { || view->m_disowned; } + SceneLayer scene_layer() const { return m_scene_layer; } OutsideState outside_state() const; Server_ptr mp_server; diff --git a/src/kranewl/model.cc b/src/kranewl/model.cc @@ -392,6 +392,37 @@ Model::sync_focus() } void +Model::relayer_views(Workspace_ptr workspace) +{ + for (View_ptr view : *workspace) { + if (is_free(view)) { + if (view->scene_layer() != SceneLayer::SCENE_LAYER_FREE) + view->relayer(SceneLayer::SCENE_LAYER_FREE); + view->lower(); + } else { + if (view->scene_layer() != SceneLayer::SCENE_LAYER_TILE) { + view->relayer(SceneLayer::SCENE_LAYER_TILE); + } + } + } + + if (mp_focus) + mp_focus->raise(); +} + +void +Model::relayer_views(Context_ptr context) +{ + relayer_views(context->workspace()); +} + +void +Model::relayer_views(Output_ptr output) +{ + relayer_views(output->context()); +} + +void Model::cycle_focus(Direction direction) { TRACE(); @@ -933,6 +964,7 @@ Model::toggle_layout() TRACE(); mp_workspace->toggle_layout(); + relayer_views(mp_workspace); apply_layout(mp_workspace); } @@ -942,6 +974,7 @@ Model::set_layout(LayoutHandler::LayoutKind layout) TRACE(); mp_workspace->set_layout(layout); + relayer_views(mp_workspace); apply_layout(mp_workspace); } @@ -977,6 +1010,7 @@ Model::set_layout_retain_region(LayoutHandler::LayoutKind layout) for (std::size_t i = 0; i < views.size(); ++i) views[i]->set_free_region(regions[i]); + relayer_views(mp_workspace); apply_layout(mp_workspace); }