aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-06-10 23:46:49 +0900
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-06-11 09:01:10 +0900
commit99a518fc7038da140fc95b56f7e415a03cc2d4e5 (patch)
treeee6d36e0b5a52cf45fb299af25b87c3c8e4bf4dc
parent17dd59f6fbc3deead5ce85006fb79aa9845bbdb4 (diff)
Change API in applist
* getActions * getRequest This is because these functions doesn't check the elements is in or not. So if there is no element, second parameter bool should be used to check. Change-Id: I0aab79d3317a15d82ca21a40a65f29a2aed07fb3 Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
-rw-r--r--src/applist.cpp9
-rw-r--r--src/applist.hpp7
-rw-r--r--src/request.hpp3
3 files changed, 12 insertions, 7 deletions
diff --git a/src/applist.cpp b/src/applist.cpp
index b5c1681..13e677c 100644
--- a/src/applist.cpp
+++ b/src/applist.cpp
@@ -177,23 +177,28 @@ unsigned AppList::addAllocateRequest(WMRequest req)
return req.req_num; // return 1; if you test time_expire
}
-struct WMTrigger AppList::getRequest(unsigned req_num)
+struct WMTrigger AppList::getRequest(unsigned req_num, bool *found)
{
+ *found = false;
for (const auto &x : this->req_list)
{
if (req_num == x.req_num)
{
+ *found = true;
return x.trigger;
}
}
+ return WMTrigger{"", "", "", Task::TASK_INVALID};
}
-const vector<struct WMAction> &AppList::getActions(unsigned req_num)
+const vector<struct WMAction> &AppList::getActions(unsigned req_num, bool* found)
{
+ *found = false;
for (auto &x : this->req_list)
{
if (req_num == x.req_num)
{
+ *found = true;
return x.sync_draw_req;
}
}
diff --git a/src/applist.hpp b/src/applist.hpp
index 36134a2..69577d0 100644
--- a/src/applist.hpp
+++ b/src/applist.hpp
@@ -61,8 +61,7 @@ class AppList
void removeFloatingSurface(unsigned surface);
// Request Interface
- unsigned
- currentRequestNumber() const;
+ unsigned currentRequestNumber() const;
unsigned getRequestNumber(const std::string &appid) const;
unsigned addAllocateRequest(WMRequest req);
/* TODO: consider, which is better WMClient or std::string appid?
@@ -76,8 +75,8 @@ class AppList
void next();
bool haveRequest() const;
- struct WMTrigger getRequest(unsigned req_num);
- const std::vector<struct WMAction> &getActions(unsigned req_num);
+ struct WMTrigger getRequest(unsigned req_num, bool* found);
+ const std::vector<struct WMAction> &getActions(unsigned req_num, bool* found);
void clientDump();
void reqDump();
diff --git a/src/request.hpp b/src/request.hpp
index ab1ef95..ded2c02 100644
--- a/src/request.hpp
+++ b/src/request.hpp
@@ -26,7 +26,8 @@ namespace wm
enum Task
{
TASK_ALLOCATE,
- TASK_RELEASE
+ TASK_RELEASE,
+ TASK_INVALID
};
struct WMTrigger