namespace rm {
App *context;
-const char *g_new_role; // TODO: workaround
+std::string g_new_role; // TODO: workaround
static void eventHandler(json_object* json_out) {
context->updateWindowResource(json_out);
}
void App::updateWindowResource(json_object* json_out) {
- HMI_DEBUG("wm", "role:%s", rm::g_new_role);
+ HMI_DEBUG("wm", "role:%s", rm::g_new_role.c_str());
// Check parking brake state
json_object* json_parking_brake;
// Get category
const char* category = nullptr;
std::string str_category;
- if (nullptr != rm::g_new_role) {
- str_category = this->pm_.roleToCategory(rm::g_new_role);
- category = str_category.c_str();
- HMI_DEBUG("wm", "role:%s category:%s", rm::g_new_role, category);
- }
+ str_category = this->pm_.roleToCategory(rm::g_new_role.c_str());
+ category = str_category.c_str();
+ HMI_DEBUG("wm", "role:%s category:%s", rm::g_new_role.c_str(), category);
// Update layout
- if (this->lm_.updateLayout(json_out, rm::g_new_role, category)) {
+ if (this->lm_.updateLayout(json_out, rm::g_new_role.c_str(), category)) {
HMI_DEBUG("wm", "Layer is changed!!");
// Allocate surface
if (nullptr != new_area) {
json_object_object_add(json_in, "area", json_object_new_string(new_area));
}
- rm::g_new_role = new_role; // TODO: workaround
+
+ // TODO: workaround
+ if (nullptr != new_role) {
+ rm::g_new_role = std::string(new_role);
+ }
+ else {
+ rm::g_new_role = std::string("");
+ }
+
this->pm_.inputEvent(json_in);
// Release json_object
for (unsigned i = 0, iend = this->pending_end_draw.size(); i < iend; i++) {
auto n = this->lookup_name(this->pending_end_draw[i]);
+ int surface_id = this->pending_end_draw[i];
+
if (n && *n == role) {
std::swap(this->pending_end_draw[i], this->pending_end_draw[iend - 1]);
this->pending_end_draw.resize(iend - 1);
- this->activate(this->pending_end_draw[i]);
+ this->activate(surface_id);
this->emit_flushdraw(drawing_name);
this->emitScreenUpdated(appid);
}
HMI_DEBUG("wm", "Surface rect { %d, %d, %d, %d }",
size.x, size.y, size.w, size.h);
+ // Enqueue flushDraw event
+ this->enqueue_flushdraw(surface_id);
+
// Emit syncDraw event
const char* drawing_name = this->role2drawingname_[role].c_str();
this->emit_syncdraw(drawing_name, area,
size.x, size.y, size.w, size.h);
-
- // Enqueue flushDraw event
- this->enqueue_flushdraw(surface_id);
}
void App::setAccelPedalPos(double val) {