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 8d73824100226112b1c3b1af35814e208bf10c50
parent bb5b8935904d22ba2912e910cd88b770868b155b
Author: deurzen <max@deurzen.net>
Date:   Thu,  2 Jun 2022 08:58:31 +0200

corrects user {env,autostart} evaluation order

Diffstat:
Minclude/kranewl/model.hh | 4+++-
Msrc/kranewl/main.cc | 11++++++-----
Msrc/kranewl/model.cc | 33+++++++++++++++++++--------------
3 files changed, 28 insertions(+), 20 deletions(-)

diff --git a/include/kranewl/model.hh b/include/kranewl/model.hh @@ -34,9 +34,11 @@ class Config; class Model final { public: - Model(Config const&, std::string const&, std::optional<std::string>); + Model(Config const&); ~Model(); + void initialize(std::string const&, std::optional<std::string>); + void register_server(Server_ptr); void exit(); diff --git a/src/kranewl/main.cc b/src/kranewl/main.cc @@ -35,13 +35,14 @@ main(int argc, char** argv) const ConfigParser config_parser{options.config_path}; const Config config = config_parser.generate_config(); - Model model{ - config, + Model model{config}; + Server server{&model}; + + model.initialize( options.env_path, options.autostart_path - }; - - Server{&model}.run(); + ); + server.run(); return EXIT_SUCCESS; } diff --git a/src/kranewl/model.cc b/src/kranewl/model.cc @@ -36,11 +36,7 @@ extern "C" { #undef namespace #undef class -Model::Model( - Config const& config, - std::string const& env_path, - [[maybe_unused]] std::optional<std::string> autostart_path -) +Model::Model(Config const& config) : m_config{config}, m_running{true}, m_outputs{{}, true}, @@ -63,15 +59,6 @@ Model::Model( { TRACE(); - parse_and_set_env_vars(env_path); - -#ifdef NDEBUG - if (autostart_path) { - spdlog::info("Executing autostart file at {}", *autostart_path); - exec_external(*autostart_path); - } -#endif - static const std::vector<std::string> context_names{ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j" }; @@ -109,6 +96,24 @@ Model::~Model() {} void +Model::initialize( + std::string const& env_path, + [[maybe_unused]] std::optional<std::string> autostart_path +) +{ + TRACE(); + + parse_and_set_env_vars(env_path); + +#ifdef NDEBUG + if (autostart_path) { + spdlog::info("Executing autostart file at {}", *autostart_path); + exec_external(*autostart_path); + } +#endif +} + +void Model::register_server(Server_ptr server) { TRACE();