diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/applist.cpp | 42 | ||||
-rw-r--r-- | src/applist.hpp | 13 | ||||
-rw-r--r-- | src/request.hpp | 1 |
3 files changed, 37 insertions, 19 deletions
diff --git a/src/applist.cpp b/src/applist.cpp index 06921c0..37a7717 100644 --- a/src/applist.cpp +++ b/src/applist.cpp @@ -97,34 +97,50 @@ bool AppList::requestFinished(){ return req_list.empty(); } -struct WMTrigger AppList::getRequest(unsigned request_seq){ +struct WMTrigger AppList::getRequest(unsigned req_num){ for(auto& x : req_list){ - if (request_seq == x.seq_num) + if (req_num == x.seq_num) { return x.trigger; } } } -const vector<struct WMAction>& AppList::getActions(unsigned request_seq){ +const vector<struct WMAction>& AppList::getActions(unsigned req_num){ for (auto &x : req_list) { - if (request_seq == x.seq_num) + if (req_num == x.seq_num) { return x.sync_draw_req; } } } -bool AppList::setAction(unsigned request_seq, const string &appid, const string &role, const string &area){ +bool AppList::setAction(unsigned req_num, const struct WMAction &action){ + bool result = false; + for (auto &x : req_list) + { + if (req_num != x.seq_num) + { + continue; + } + x.sync_draw_req.push_back(action); + result = true; + break; + } + + return result; +} + +bool AppList::setAction(unsigned req_num, const string &appid, const string &role, const string &area, bool visible){ bool result = false; for (auto& x : req_list) { - if (request_seq != x.seq_num) + if (req_num != x.seq_num) { continue; } - WMAction action{appid, role, area, false}; + WMAction action{appid, role, area, visible, false}; x.sync_draw_req.push_back(action); result = true; @@ -133,15 +149,15 @@ bool AppList::setAction(unsigned request_seq, const string &appid, const string return result; } -bool AppList::setEndDrawFinished(unsigned request_seq, const string &appid, const string &role){ +bool AppList::setEndDrawFinished(unsigned req_num, const string &appid, const string &role){ bool result = false; for (auto& x : req_list) { - if (request_seq < x.seq_num) + if (req_num < x.seq_num) { break; } - if (request_seq == x.seq_num) + if (req_num == x.seq_num) { for(auto& y : x.sync_draw_req){ if (y.appid == appid && y.role == role) @@ -161,14 +177,14 @@ bool AppList::setEndDrawFinished(unsigned request_seq, const string &appid, cons * @param unsigned sequence_num * @return true if all action is set. */ -bool AppList::endDrawFullfilled(unsigned request_seq){ +bool AppList::endDrawFullfilled(unsigned req_num){ bool result = false; for (const auto& x : req_list) { - if(request_seq < x.seq_num){ + if(req_num < x.seq_num){ break; } - if(request_seq == x.seq_num){ + if(req_num == x.seq_num){ result = true; for(const auto& y : x.sync_draw_req){ result &= y.end_draw_finished; diff --git a/src/applist.hpp b/src/applist.hpp index e0d67fc..52dcfeb 100644 --- a/src/applist.hpp +++ b/src/applist.hpp @@ -50,15 +50,16 @@ public: if appid is key to manage resources, it is better to select std::string otherwise WMClient is better, IMO */ bool requestFinished(); - bool setAction(unsigned request_seq, const std::string &appid, const std::string &role, const std::string &area); - bool setEndDrawFinished(unsigned request_seq, const std::string &appid, const std::string &role); - bool endDrawFullfilled(unsigned request_seq); - void removeRequest(unsigned request_seq); + bool setAction(unsigned req_num, const struct WMAction &action); + bool setAction(unsigned req_num, const std::string &appid, const std::string &role, const std::string &area, bool visible = true); + bool setEndDrawFinished(unsigned req_num, const std::string &appid, const std::string &role); + bool endDrawFullfilled(unsigned req_num); + void removeRequest(unsigned req_num); void next(); bool haveRequest(); - struct WMTrigger getRequest(unsigned request_seq); - const std::vector<struct WMAction>& getActions(unsigned request_seq); + struct WMTrigger getRequest(unsigned req_num); + const std::vector<struct WMAction>& getActions(unsigned req_num); void client_dump(); void req_dump(); diff --git a/src/request.hpp b/src/request.hpp index cad340e..08c8fb0 100644 --- a/src/request.hpp +++ b/src/request.hpp @@ -41,6 +41,7 @@ struct WMAction std::string appid; std::string role; std::string area; + bool visible; bool end_draw_finished; }; |