Activate by default xdg apps
authorRomain Forlot <romain.forlot@iot.bzh>
Mon, 27 Nov 2017 17:34:05 +0000 (18:34 +0100)
committerRomain Forlot <romain.forlot@iot.bzh>
Mon, 27 Nov 2017 17:34:05 +0000 (18:34 +0100)
Change-Id: I9acd2205d0cd171a82732e511493eb486dc34bb2
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
src/app.cpp

index fcdda1f..ddb2182 100644 (file)
@@ -607,10 +607,10 @@ void App::surface_created(uint32_t surface_id) {
 
       this->layers.add_surface(surface_id, *layer_id);
       // set the main_surface[_name] here and now
-      if (!this->layers.main_surface_name.empty() &&
-          this->layers.main_surface_name == XDG_DRAWING_NAME) {
-         this->layers.main_surface = surface_id;
-         HMI_DEBUG("wm", "Set main_surface id to %u", surface_id);
+      if (this->layers.main_surface_name.empty()) {
+        this->layers.main_surface_name == XDG_DRAWING_NAME;
+        this->layers.main_surface = surface_id;
+        HMI_DEBUG("wm", "Set main_surface id to %u", surface_id);
       }
    }
 
@@ -619,13 +619,15 @@ void App::surface_created(uint32_t surface_id) {
    this->controller->layers[*layer_id]->add_surface(
       this->controller->surfaces[surface_id].get());
 
-   // activate the main_surface right away
-   /*if (surface_id == static_cast<unsigned>(this->layers.main_surface)) {
-      HMI_DEBUG("wm", "Activating main_surface (%d)", surface_id);
+    if(this->layers.main_surface_name == XDG_DRAWING_NAME) {
+    // activate the main_surface right away
+        if (surface_id == static_cast<unsigned>(this->layers.main_surface)) {
+            HMI_DEBUG("wm", "Activating main_surface (%d)", surface_id);
 
-      this->api_activate_surface(
-         this->lookup_name(surface_id).value_or("unknown-name").c_str());
-   }*/
+            this->api_activate_surface(
+                this->lookup_name(surface_id).value_or("unknown-name").c_str());
+        }
+    }
 }
 
 void App::surface_removed(uint32_t surface_id) {