+// _ _ _____ _
+// _ __ _ __ _____ _(_) ___ __| | | ____|_ _____ _ __ | |_ ___
+// | '_ \| '__/ _ \ \/ / |/ _ \/ _` | | _| \ \ / / _ \ '_ \| __/ __|
+// | |_) | | | (_) > <| | __/ (_| | | |___ \ V / __/ | | | |_\__ \
+// | .__/|_| \___/_/\_\_|\___|\__,_| |_____| \_/ \___|_| |_|\__|___/
+// |_|
+void App::surface_created(uint32_t surface_id) {
+ DB("surface_id is " << surface_id);
+ int layer_id =
+ this->surface2layer.get_layer_for_surface(surface_id).value_or(-1);
+ if (layer_id == -1) {
+ logerror("Surface %d (0x%x) is not part of any layer!", surface_id,
+ surface_id);
+ } else {
+ auto rect = this->surface2layer.get_rect_for_surface(surface_id).value();
+ this->controller->add_task(
+ "fullscreen surface",
+ [layer_id, surface_id, rect](struct genivi::controller *c) {
+ auto &s = c->surfaces[surface_id];
+
+ int x = rect.x;
+ int y = rect.y;
+ int w = rect.w;
+ int h = rect.h;
+
+ if (w < 0) {
+ w = c->output_size.w + 1 + w;
+ }
+ if (h < 0) {
+ h = c->output_size.h + 1 + h;
+ }
+ logdebug("Computed rect={ %d, %d, %d, %d }", x, y, w, h);
+
+ s->set_configuration(w, h);
+ s->set_source_rectangle(0, 0, w, h);
+ s->set_destination_rectangle(x, y, w, h);
+
+ s->set_visibility(1);
+ c->layers[layer_id]->add_surface(s.get());
+ logdebug("Surface %u now on layer %u", surface_id, layer_id);
+ });
+ }
+}
+
+void App::surface_removed(uint32_t surface_id) {
+ DB("surface_id is " << surface_id);
+}
+
+// _ _ _ _ _ _ _
+// | |__ (_)_ __ __| (_)_ __ __ _ __ _ _ __ (_) (_)_ __ ___ _ __ | |
+// | '_ \| | '_ \ / _` | | '_ \ / _` | / _` | '_ \| | | | '_ ` _ \| '_ \| |
+// | |_) | | | | | (_| | | | | | (_| | | (_| | |_) | | | | | | | | | |_) | |
+// |_.__/|_|_| |_|\__,_|_|_| |_|\__, |___\__,_| .__/|_| |_|_| |_| |_| .__/|_|
+// |___/_____| |_| |_|