From 17dd59f6fbc3deead5ce85006fb79aa9845bbdb4 Mon Sep 17 00:00:00 2001 From: Kazumasa Mitsunari Date: Sun, 10 Jun 2018 23:21:43 +0900 Subject: [PATCH] Remove floating surfaces when activate surface Change-Id: Id8c4d28dfd32968cf0eb0e30cefdf9124ae134ec Signed-off-by: Kazumasa Mitsunari --- src/app.cpp | 5 +++++ src/applist.cpp | 13 +++++++++++++ src/applist.hpp | 7 +++++-- src/wm_client.cpp | 2 -- src/wm_client.hpp | 1 + src/wm_error.hpp | 1 + 6 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/app.cpp b/src/app.cpp index 7dbf397..64a1835 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -872,6 +872,11 @@ void App::api_activate_surface(char const *appid, char const *drawing_name, char auto client = app_list->lookUpClient(id); + unsigned srfc = client->surfaceID(role); + if(srfc != INVALID_SURFACE_ID){ + // remove floating surface + app_list->removeFloatingSurface(client->surfaceID(role)); + } /* * Queueing Phase */ diff --git a/src/applist.cpp b/src/applist.cpp index 5d7dce4..b5c1681 100644 --- a/src/applist.cpp +++ b/src/applist.cpp @@ -124,6 +124,19 @@ void AppList::addFloatingSurface(unsigned surface, unsigned pid) this->floating_surfaces.push_back(fsurface); } +void AppList::removeFloatingSurface(unsigned surface) +{ + for (auto itr = this->floating_surfaces.begin(); itr != this->floating_surfaces.end(); ++itr) + { + if (surface == itr->surface_id) + { + HMI_DEBUG("wm", "Erase surface %d", itr->surface_id); + itr = this->floating_surfaces.erase(itr); + break; + } + } +} + WMError AppList::appendRole(const std::string &id, const std::string &role, unsigned surface) { WMError wm_err = WMError::NO_ENTRY; diff --git a/src/applist.hpp b/src/applist.hpp index 23d6b5a..36134a2 100644 --- a/src/applist.hpp +++ b/src/applist.hpp @@ -51,11 +51,14 @@ class AppList int countClient() const; std::shared_ptr lookUpClient(const std::string &appid); void removeSurface(unsigned surface); - WMError popFloatingSurface(unsigned pid, unsigned *surface); - WMError popFloatingSurface(const std::string &appid, unsigned *surface); WMError appendRole(const std::string &appid, const std::string &role, unsigned surface); + + // Floating surface & client control void addFloatingClient(const std::string &appid, unsigned layer, const std::string &role); void addFloatingSurface(unsigned surface, unsigned pid); + WMError popFloatingSurface(unsigned pid, unsigned *surface); + WMError popFloatingSurface(const std::string &appid, unsigned *surface); + void removeFloatingSurface(unsigned surface); // Request Interface unsigned diff --git a/src/wm_client.cpp b/src/wm_client.cpp index 6f1aa20..2194079 100644 --- a/src/wm_client.cpp +++ b/src/wm_client.cpp @@ -18,8 +18,6 @@ #include "wm_client.hpp" #include "hmi-debug.h" -#define INVALID_SURFACE_ID 0 - using std::string; using std::vector; diff --git a/src/wm_client.hpp b/src/wm_client.hpp index 5fa9444..fce323c 100644 --- a/src/wm_client.hpp +++ b/src/wm_client.hpp @@ -20,6 +20,7 @@ #include #include #include +#include "wm_error.hpp" extern "C" { diff --git a/src/wm_error.hpp b/src/wm_error.hpp index 155d791..c314439 100644 --- a/src/wm_error.hpp +++ b/src/wm_error.hpp @@ -16,6 +16,7 @@ #ifndef WINDOW_MANAGER_ERROR #define WINDOW_MANAGER_ERROR +#define INVALID_SURFACE_ID 0 namespace wm { -- 2.16.6