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 8dc4f5a7d403264d115863c4d695ac6f90d6507a
parent 81b4be77799991f14b2f42a61f3e972918dda24e
Author: deurzen <m.deurzen@tum.de>
Date:   Mon, 23 May 2022 02:05:31 +0200

adds global scene layers

Diffstat:
Ainclude/kranewl/layers.hh | 11+++++++++++
Minclude/kranewl/server.hh | 2++
Minclude/version.hh | 4++--
Msrc/kranewl/server.cc | 9+++++++++
Msrc/kranewl/tree/view.cc | 29+++++++++++++++++++++++++++--
5 files changed, 51 insertions(+), 4 deletions(-)

diff --git a/include/kranewl/layers.hh b/include/kranewl/layers.hh @@ -0,0 +1,11 @@ +#pragma once + +struct Layer { + static constexpr short Background = 0; + static constexpr short Bottom = 1; + static constexpr short Tile = 2; + static constexpr short Free = 3; + static constexpr short Top = 4; + static constexpr short Overlay = 5; + static constexpr short NoFocus = 6; +}; diff --git a/include/kranewl/server.hh b/include/kranewl/server.hh @@ -69,6 +69,7 @@ public: struct wlr_data_device_manager* mp_data_device_manager; struct wlr_output_layout* mp_output_layout; struct wlr_scene* mp_scene; + struct wlr_scene_node* m_layers[7]; #ifdef XWAYLAND struct wlr_xwayland* mp_xwayland; #endif @@ -76,6 +77,7 @@ public: /* Root m_root; */ Seat m_seat; + private: struct wlr_xdg_shell* mp_xdg_shell; struct wlr_layer_shell_v1* mp_layer_shell; diff --git a/include/version.hh b/include/version.hh @@ -1 +1 @@ -#define VERSION "master/a619f30+" -\ No newline at end of file +#define VERSION "master/81b4be7+" +\ No newline at end of file diff --git a/src/kranewl/server.cc b/src/kranewl/server.cc @@ -102,6 +102,15 @@ Server::Server(Model_ptr model) wlr_scene_attach_output_layout(scene, mp_output_layout); return scene; }()), + m_layers{ + &wlr_scene_tree_create(&mp_scene->node)->node, + &wlr_scene_tree_create(&mp_scene->node)->node, + &wlr_scene_tree_create(&mp_scene->node)->node, + &wlr_scene_tree_create(&mp_scene->node)->node, + &wlr_scene_tree_create(&mp_scene->node)->node, + &wlr_scene_tree_create(&mp_scene->node)->node, + &wlr_scene_tree_create(&mp_scene->node)->node + }, m_seat([this]() { struct wlr_cursor* cursor = wlr_cursor_create(); wlr_cursor_attach_output_layout(cursor, mp_output_layout); diff --git a/src/kranewl/tree/view.cc b/src/kranewl/tree/view.cc @@ -1,11 +1,23 @@ #include <trace.hh> +#include <kranewl/layers.hh> +#include <kranewl/server.hh> #include <kranewl/tree/view.hh> +#include <kranewl/tree/xdg_view.hh> +// https://github.com/swaywm/wlroots/issues/682 +#include <pthread.h> +#define class class_ +#define namespace namespace_ +#define static extern "C" { #include <sys/types.h> #include <wlr/types/wlr_xdg_shell.h> +#include <wlr/types/wlr_scene.h> } +#undef static +#undef class +#undef namespace View::View( XDGView_ptr, @@ -104,7 +116,7 @@ View::~View() {} static inline void -retrieve_view_pid(View_ptr view) +set_view_pid(View_ptr view) { switch (view->m_type) { case View::Type::XDGShell: @@ -142,7 +154,20 @@ View::map_view( TRACE(); view->mp_wlr_surface = wlr_surface; - retrieve_view_pid(view); + set_view_pid(view); + + view->mp_scene = &wlr_scene_tree_create(view->mp_server->m_layers[Layer::Tile])->node; + view->mp_wlr_surface->data = view->mp_scene_surface = view->m_type == View::Type::XDGShell + ? wlr_scene_xdg_surface_create( + view->mp_scene, + reinterpret_cast<XDGView_ptr>(view)->mp_wlr_xdg_surface + ) + : wlr_scene_subsurface_tree_create(view->mp_scene, view->mp_wlr_surface); + view->mp_scene_surface->data = view; + + if (fullscreen_output && fullscreen_output->data) { + Output_ptr output = reinterpret_cast<Output_ptr>(fullscreen_output->data); + } } ViewChild::ViewChild(SubsurfaceViewChild_ptr)