summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/app.cpp58
1 files changed, 1 insertions, 57 deletions
diff --git a/src/app.cpp b/src/app.cpp
index 7f0bcbb..98db0b4 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -40,35 +40,7 @@ namespace wm {
namespace {
App *g_app;
-using json = nlohmann::json;
-
-struct wm::area area_from_json(json const &j) {
- return wm::area{
- j["name"],
- {
- j["width"], j["height"], j["x"], j["y"],
- },
- j["zorder"],
- };
-}
-
-result<struct layout> layout_from_json(json const &j) {
- auto &ja = j["areas"];
-
- auto l = layout{j["name"], uint32_t(ja.size()), {}};
-
- if (ja.size() > layout::MAX_N_AREAS) {
- return Err<struct layout>("Invalid number of areas in layout");
- }
-
- logdebug("Loading layout '%s' with %u areas", l.name.c_str(),
- unsigned(ja.size()));
-
- std::transform(std::cbegin(ja), std::cend(ja), std::begin(l.areas),
- area_from_json);
-
- return Ok(l);
-}
+using nlohmann::json;
result<json> file_to_json(char const *filename) {
std::ifstream i(filename);
@@ -80,24 +52,6 @@ result<json> file_to_json(char const *filename) {
return Ok(j);
}
-// Will throw if parsing fails
-struct result<layouts_type> load_layout(char const *filename) {
- logdebug("loading layout from %s", filename);
-
- auto j = file_to_json(filename);
- if (j.is_err()) {
- return Err<layouts_type>(j.unwrap_err());
- }
- json jlayouts = j.unwrap();
-
- auto layouts = layouts_type();
- layouts.reserve(jlayouts.size());
- std::transform(std::cbegin(jlayouts), std::cend(jlayouts),
- std::back_inserter(layouts), layout_from_json);
-
- return Ok(layouts);
-}
-
struct result<layer_map>
load_layer_map(char const *filename) {
logdebug("loading IDs from %s", filename);
@@ -142,16 +96,6 @@ App::App(wl::display *d)
logerror("%s", l.err().value());
}
}
-
- {
- auto l =
- load_layout(this->config.get_string("layout.json").value().c_str());
- if (l.is_ok()) {
- this->layouts = l.unwrap();
- } else {
- logerror("%s", l.err().value());
- }
- }
} catch (std::exception &e) {
logerror("Loading of configuration failed: %s", e.what());
}