X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fwm_client.cpp;h=a9ed54712fb2fa53948886c6b52ed9ccbfb90b90;hb=c4d50e105fd1204bdf6cac88300d667c1af3d682;hp=6f1aa206288186ef79929fea635ff5c206dc0923;hpb=14be8c3bcc558d319f3324f06a5700b9155d2aa6;p=apps%2Fagl-service-windowmanager.git diff --git a/src/wm_client.cpp b/src/wm_client.cpp index 6f1aa20..a9ed547 100644 --- a/src/wm_client.cpp +++ b/src/wm_client.cpp @@ -26,10 +26,10 @@ using std::vector; namespace wm { -const vector kWMEvents = { +static const vector kWMEvents = { // Private event for applications "syncDraw", "flushDraw", "visible", "invisible", "active", "inactive", "error"}; -const vector kErrorDescription = { +static const vector kErrorDescription = { "unknown-error"}; static const char kKeyDrawingName[] = "drawing_name"; @@ -84,22 +84,57 @@ unsigned WMClient::surfaceID(const string &role) const { if (0 == this->role2surface.count(role)) { - HMI_WARNING("wm", "invalid role"); return INVALID_SURFACE_ID; } return this->role2surface.at(role); } +std::string WMClient::role(unsigned surface) const +{ + for(const auto& x : this->role2surface) + { + if(x.second == surface) + { + return x.first; + } + } + return std::string(""); +} + unsigned WMClient::layerID() const { return this->layer; } +/** + * Set layerID the client belongs to + * + * This function set layerID the client belongs to. + * But this function may not used because the layer should be fixed at constructor. + * So this function will be used to change layer by some reasons. + * + * @param unsigned[in] layerID + * @return None + * @attention WMClient can't have multiple layer + */ void WMClient::registerLayer(unsigned layer) { this->layer = layer; } +/** + * Add the pair of role and surface to the client + * + * This function set the pair of role and surface to the client. + * This function is used for the client which has multi surfaces. + * If the model and relationship for role and surface(layer) + * is changed, this function will be changed + * Current Window Manager doesn't use this function. + * + * @param string[in] role + * @param unsigned[in] surface + * @return true + */ bool WMClient::addSurface(const string &role, unsigned surface) { HMI_DEBUG("wm", "Add role %s with surface %d", role.c_str(), surface); @@ -118,6 +153,8 @@ bool WMClient::removeSurfaceIfExist(unsigned surface) { if (surface == x.second) { + HMI_INFO("wm", "Remove surface from client %s: role %s, surface: %d", + this->id.c_str(), x.first.c_str(), x.second); this->role2surface.erase(x.first); ret = true; break; @@ -137,6 +174,7 @@ bool WMClient::removeRole(const string &role) return ret; } +#ifndef GTEST_ENABLED bool WMClient::subscribe(afb_req req, const string &evname) { if(evname != kKeyError){ @@ -169,6 +207,7 @@ void WMClient::emitError(WM_CLIENT_ERROR_EVENT ev) HMI_DEBUG("wm", "afb_event_push failed: %m"); } } +#endif void WMClient::dumpInfo() {