Revert "Add APIs which can get information of display and area"
[apps/agl-service-windowmanager.git] / src / app.cpp
index a5583ae..307217e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Mentor Graphics Development (Deutschland) GmbH
+ * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -44,12 +44,16 @@ namespace {
 using nlohmann::json;
 
 result<json> file_to_json(char const *filename) {
+   json j;
    std::ifstream i(filename);
    if (i.fail()) {
-      return Err<json>("Could not open config file");
+      HMI_DEBUG("wm", "Could not open config file, so use default layer information");
+      j = default_layers_json;
    }
-   json j;
-   i >> j;
+   else {
+      i >> j;
+   }
+
    return Ok(j);
 }
 
@@ -120,7 +124,7 @@ int App::init() {
    this->display->add_global_handler(
       "ivi_controller", [this](wl_registry *r, uint32_t name, uint32_t v) {
          this->controller =
-            std::make_unique<struct genivi::controller>(r, name, v);
+            std::make_unique<struct compositor::controller>(r, name, v);
 
          // Init controller hooks
          this->controller->chooks = &this->chooks;
@@ -204,7 +208,7 @@ int App::init_layers() {
    auto &layers = c->layers;
 
    // Write output dimensions to ivi controller...
-   c->output_size = genivi::size{uint32_t(o->width), uint32_t(o->height)};
+   c->output_size = compositor::size{uint32_t(o->width), uint32_t(o->height)};
 
    // Clear scene
    layers.clear();
@@ -500,8 +504,7 @@ char const *App::api_deactivate_surface(char const *drawing_name) {
       return "No surface active";
    }
 
-   // XXX: check against main_surface, main_surface_name is the configuration
-   // item.
+   // Check against main_surface, main_surface_name is the configuration item.
    if (*surface_id == this->layers.main_surface) {
       HMI_DEBUG("wm", "Refusing to deactivate main_surface %d", *surface_id);
       return nullptr;
@@ -576,7 +579,6 @@ char const *App::api_enddraw(char const *drawing_name) {
       if (n && *n == drawing_name) {
          std::swap(this->pending_end_draw[i], this->pending_end_draw[iend - 1]);
          this->pending_end_draw.resize(iend - 1);
-         // XXX: Please tell the compositor to thaw the surface...
          this->activate(this->pending_end_draw[i]);
          this->layout_commit();
          this->emit_flushdraw(drawing_name);