From 546a95eb9b061d78deac570afb20ae8afae793a7 Mon Sep 17 00:00:00 2001 From: wang_zhiqiang Date: Sat, 13 Apr 2019 10:42:23 +0800 Subject: add registerShortCut Change-Id: I1a1f433e4d788765f5214a948ea44f3c779ff965 --- src/libhomescreen.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/libhomescreen.cpp') diff --git a/src/libhomescreen.cpp b/src/libhomescreen.cpp index 121def7..f302c3b 100644 --- a/src/libhomescreen.cpp +++ b/src/libhomescreen.cpp @@ -47,7 +47,8 @@ const std::vector LibHomeScreen::api_list { std::string("hideWindow"), std::string("replyShowWindow"), std::string("showNotification"), - std::string("showInformation") + std::string("showInformation"), + std::string("registerShortcut") }; const std::vector LibHomeScreen::event_list { @@ -59,6 +60,7 @@ const std::vector LibHomeScreen::event_list { std::string("replyShowWindow"), std::string("showNotification"), std::string("showInformation"), + std::string("registerShortcut"), std::string("none") }; @@ -326,6 +328,9 @@ void LibHomeScreen::set_event_handler(enum EventType et, handler_func f) case Event_ShowInformation: this->subscribe(LibHomeScreen::event_list[6]); break; + case Event_RegisterShortCut: + this->subscribe(LibHomeScreen::event_list[7]); + break; } this->handlers[et] = std::move(f); @@ -692,6 +697,12 @@ void LibHomeScreen::on_event(void *closure, const char *event, struct afb_wsj1_m i->second(json_data); } } + else if (strcasecmp(event_type, LibHomeScreen::event_list[7].c_str()) == 0) { + auto i = this->handlers.find(Event_RegisterShortCut); + if ( i != this->handlers.end() ) { + i->second(json_data); + } + } } /** -- cgit 1.2.3-korg