#include <json-c/json.h>
#include <algorithm>
-#include <bits/signum.h>
#include <csignal>
#include <fstream>
#include <json.hpp>
* App Impl
*/
App::App(wl::display *d)
- : api{this},
- chooks{this},
+ : chooks{this},
display{d},
controller{},
outputs(),
void App::api_ping() { this->dispatch_pending_events(); }
+void App::send_event(char const *evname, char const *label){
+ HMI_DEBUG("wm", "%s: %s(%s)", __func__, evname, label);
+
+ json_object *j = json_object_new_object();
+ json_object_object_add(j, kKeyDrawingName, json_object_new_string(label));
+
+ int ret = afb_event_push(this->map_afb_event[evname], j);
+ if (ret != 0) {
+ HMI_DEBUG("wm", "afb_event_push failed: %m");
+ }
+}
+
+void App::send_event(char const *evname, char const *label, char const *area){
+ HMI_DEBUG("wm", "%s: %s(%s, %s)", __func__, evname, label, area);
+
+ json_object *j = json_object_new_object();
+ json_object_object_add(j, kKeyDrawingName, json_object_new_string(label));
+ json_object_object_add(j, kKeyDrawingArea, json_object_new_string(area));
+
+ int ret = afb_event_push(this->map_afb_event[evname], j);
+ if (ret != 0) {
+ HMI_DEBUG("wm", "afb_event_push failed: %m");
+ }
+}
+
/**
* proxied events
*/
this->controller->layers[*layer_id]->add_surface(
this->controller->surfaces[surface_id].get());
-
+ this->layout_commit();
// activate the main_surface right away
/*if (surface_id == static_cast<unsigned>(this->layers.main_surface)) {
HMI_DEBUG("wm", "Activating main_surface (%d)", surface_id);
}
void App::emit_activated(char const *label) {
- this->api.send_event(kListEventName[Event_Active], label);
+ this->send_event(kListEventName[Event_Active], label);
}
void App::emit_deactivated(char const *label) {
- this->api.send_event(kListEventName[Event_Inactive], label);
+ this->send_event(kListEventName[Event_Inactive], label);
}
void App::emit_syncdraw(char const *label, char const *area) {
- this->api.send_event(kListEventName[Event_SyncDraw], label, area);
+ this->send_event(kListEventName[Event_SyncDraw], label, area);
}
void App::emit_flushdraw(char const *label) {
- this->api.send_event(kListEventName[Event_FlushDraw], label);
+ this->send_event(kListEventName[Event_FlushDraw], label);
}
void App::emit_visible(char const *label, bool is_visible) {
- this->api.send_event(is_visible ? kListEventName[Event_Visible] : kListEventName[Event_Invisible], label);
+ this->send_event(is_visible ? kListEventName[Event_Visible] : kListEventName[Event_Invisible], label);
}
void App::emit_invisible(char const *label) {
this->controller->layers[*lid]->add_surface(
this->controller->surfaces[sid].get());
+ this->layout_commit();
return nullptr;
}
// FOR CES DEMO >>>
if ((0 == strcmp(label, "Radio"))
|| (0 == strcmp(label, "MediaPlayer"))
+ || (0 == strcmp(label, "Music"))
|| (0 == strcmp(label, "Navigation"))) {
for (auto i = surface_bg.begin(); i != surface_bg.end(); ++i) {
if (id == *i) {
// FOR CES DEMO >>>
if ((0 == strcmp(label, "Radio"))
|| (0 == strcmp(label, "MediaPlayer"))
+ || (0 == strcmp(label, "Music"))
|| (0 == strcmp(label, "Navigation"))) {
// Store id