From 662cbb792bfefd2abe9626c0d033ef7dca666249 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Mon, 27 Nov 2017 18:45:11 +0100 Subject: [PATCH] Fix: update activate_surface usage missing an arg Change-Id: I9835b07c3567f01038f3e20a3d5ff012e1ffcbc6 Signed-off-by: Romain Forlot --- src/app.cpp | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/src/app.cpp b/src/app.cpp index ddb2182..b562b9d 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -596,37 +596,33 @@ void App::api_ping() { this->dispatch_pending_events(); } void App::surface_created(uint32_t surface_id) { auto layer_id = this->layers.get_layer_id(surface_id); if (!layer_id) { - HMI_DEBUG("wm", "Newly created surface %d is not associated with any layer! Must be a XDG apps", - surface_id); + HMI_DEBUG("wm", "Newly created surface %d from a XDG apps. Main surface: %s", + surface_id, this->layers.main_surface_name.c_str()); layer_id = this->layers.get_layer_id(XDG_DRAWING_NAME); if(!layer_id) { HMI_DEBUG("wm", "No role found for that XDG App"); return; } - + this->id_alloc.id2name[surface_id] = XDG_DRAWING_NAME; + this->id_alloc.name2id[XDG_DRAWING_NAME] = 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); - } } - HMI_DEBUG("wm", "surface_id is %u, layer_id is %u", surface_id, *layer_id); + HMI_DEBUG("wm", "surface_id is %u, layer_id is %u, drawing name is: %s", + surface_id, + *layer_id, + this->lookup_name(surface_id).value_or("unknown-name").c_str()); this->controller->layers[*layer_id]->add_surface( this->controller->surfaces[surface_id].get()); - if(this->layers.main_surface_name == XDG_DRAWING_NAME) { - // activate the main_surface right away - if (surface_id == static_cast(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()); - } + if(this->lookup_name(surface_id).value_or("unknown-name") == XDG_DRAWING_NAME) { + HMI_DEBUG("wm", "Activating surface id: %d, name: %s", surface_id, this->lookup_name(surface_id).value_or("unknown-name").c_str()); + this->activate(surface_id); + this->api_activate_surface( + this->lookup_name(surface_id).value_or("unknown-name").c_str(), + kNameLayoutNormal); } } -- 2.16.6