aboutsummaryrefslogtreecommitdiffstats
path: root/src/app.cpp
diff options
context:
space:
mode:
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>2017-10-23 18:26:46 +0900
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2017-11-01 11:02:10 +0000
commitbe02238a0e92c74a13daaf516b5f379f29217eb8 (patch)
tree15e1b814a50a9f4833a318a1ba55b8d029f81b8b /src/app.cpp
parentac5b834e535b95d2b893dbe527b2a7a9b6e2103d (diff)
Modify event notification from broadcast to subscribe model
The event notification was implemented using a broadcast model, change it to a subscription model. Bug-AGL: SPEC-987 Change-Id: I344a3a73320eb81c3f670736b032f07400bb8f64 Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
Diffstat (limited to 'src/app.cpp')
-rw-r--r--src/app.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/app.cpp b/src/app.cpp
index f38668f..f4dbba6 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -105,6 +105,11 @@ int App::init() {
return -1;
}
+ // Make afb event
+ for (int i=Event_Val_Min; i<=Event_Val_Max; i++) {
+ map_afb_event[kListEventName[i]] = afb_daemon_make_event(kListEventName[i]);
+ }
+
this->display->add_global_handler(
"wl_output", [this](wl_registry *r, uint32_t name, uint32_t v) {
this->outputs.emplace_back(std::make_unique<wl::output>(r, name, v));
@@ -118,8 +123,7 @@ int App::init() {
// Init controller hooks
this->controller->chooks = &this->chooks;
- // XXX: This protocol needs the output, so lets just add our mapping
- // here...
+ // This protocol needs the output, so lets just add our mapping here...
this->controller->add_proxy_to_id_mapping(
this->outputs.back()->proxy.get(),
wl_proxy_get_id(reinterpret_cast<struct wl_proxy *>(
@@ -575,23 +579,23 @@ void App::surface_removed(uint32_t surface_id) {
}
void App::emit_activated(char const *label) {
- this->api.send_event("active", label);
+ this->api.send_event(kListEventName[Event_Active], label);
}
void App::emit_deactivated(char const *label) {
- this->api.send_event("inactive", label);
+ this->api.send_event(kListEventName[Event_Inactive], label);
}
void App::emit_syncdraw(char const *label, char const *area) {
- this->api.send_event("syncdraw", label, area);
+ this->api.send_event(kListEventName[Event_SyncDraw], label, area);
}
void App::emit_flushdraw(char const *label) {
- this->api.send_event("flushdraw", label);
+ this->api.send_event(kListEventName[Event_FlushDraw], label);
}
void App::emit_visible(char const *label, bool is_visible) {
- this->api.send_event(is_visible ? "visible" : "invisible", label);
+ this->api.send_event(is_visible ? kListEventName[Event_Visible] : kListEventName[Event_Invisible], label);
}
void App::emit_invisible(char const *label) {
@@ -603,7 +607,7 @@ void App::emit_visible(char const *label) { return emit_visible(label, true); }
result<int> App::api_request_surface(char const *drawing_name) {
auto lid = this->layers.get_layer_id(std::string(drawing_name));
if (!lid) {
- // XXX: to we need to put these applications on the App layer?
+ // TODO: Do we need to put these applications on the App layer?
return Err<int>("Drawing name does not match any role");
}
@@ -613,8 +617,7 @@ result<int> App::api_request_surface(char const *drawing_name) {
auto id = int(this->id_alloc.generate_id(drawing_name));
this->layers.add_surface(id, *lid);
- // XXX: we set the main_surface[_name] here and now,
- // not sure if we want this, but it worked so far.
+ // set the main_surface[_name] here and now
if (!this->layers.main_surface_name.empty() &&
this->layers.main_surface_name == drawing_name) {
this->layers.main_surface = id;