// Third level objects
this->display->roundtrip();
- return init_layout();
+ return init_layers();
}
int App::dispatch_events() {
// | | | | | | |_ | | (_| | |_| | (_) | |_| | |_| | | |
// |_|_| |_|_|\__|___|_|\__,_|\__, |\___/ \__,_|\__| | | |
// |_____| |___/ \_\/_/
-int App::init_layout() {
+int App::init_layers() {
if (!this->controller) {
logerror("ivi_controller global not available");
return -1;
void redraw_fix(App *app, std::unique_ptr<genivi::surface> &s, int x, int y, int w, int h) {
{ // XXX: Work around weston redraw issues
// trigger an update by changing the source dimensions!
- s->set_configuration(w, h);
- s->set_source_rectangle(0, 0, w, h);
- s->set_destination_rectangle(x, y, w, h);
+ s->set_configuration(w + 1, h);
+ s->set_source_rectangle(0, 0, w + 1, h);
+ s->set_destination_rectangle(x, y, w + 1, h);
app->controller->commit_changes();
app->display->roundtrip();
std::this_thread::sleep_for(100ms);
// Set a different size then what we actually want.
- s->set_configuration(w + 1, h);
- s->set_source_rectangle(0, 0, w + 1, h);
- s->set_destination_rectangle(x, y, w + 1, h);
+ s->set_configuration(w, h);
+ s->set_source_rectangle(0, 0, w, h);
+ s->set_destination_rectangle(x, y, w, h);
app->controller->commit_changes();
app->display->roundtrip();
-
- std::this_thread::sleep_for(100ms);
}
}
} // namespace
-void App::surface_set_layout(uint32_t surface_id) {
+void App::surface_init_layout(uint32_t surface_id) {
if (!this->controller->surface_exists(surface_id)) {
logerror("Surface %d does not exist", int(surface_id));
return;
h = this->controller->output_size.h + 1 + h;
}
- redraw_fix(this, s, x, y, w, h);
-
// configure surface to wxh dimensions
s->set_configuration(w, h);
this->controller->commit_changes();
this->display->roundtrip();
+ redraw_fix(this, s, x, y, w, h);
+
this->controller->layers[layer_id]->add_surface(s.get());
// activate the main_surface right away
// Set all others invisible
for (auto &i : this->controller->surfaces) {
auto &si = this->controller->sprops[i.second->id];
- if (int(si.id) != this->layers.main_surface) {
- i.second->set_visibility(0);
- this->controller->commit_changes();
- this->display->flush();
+ if (si.visibility != 0 && int(si.id) != this->layers.main_surface) {
+ this->deactivate(i.second->id);
}
}
- s->set_visibility(1);
+ this->activate(s->id);
// commit changes
this->controller->commit_changes();
this->display->flush();
- this->emit_activated(drawing_name);
-
// no error
return nullptr;
}
return "Cannot deactivate main_surface";
}
+ this->deactivate(surface_id);
-
- this->emit_deactivated(drawing_name);
-
+ this->controller->commit_changes();
+ this->display->flush();
return nullptr;
}
logdebug("surface_id is %u", surface_id);
- this->surface_set_layout(surface_id);
+ this->surface_init_layout(surface_id);
}
void App::surface_removed(uint32_t surface_id) {
return Err<int>("Surface already present");
}
+void App::activate(unsigned id) {
+ this->controller->surfaces[id]->set_visibility(1);
+ this->emit_activated(this->lookup_name(id).value_or("unknown-name").c_str());
+}
+
+void App::deactivate(unsigned id) {
+ this->controller->surfaces[id]->set_visibility(0);
+ this->emit_deactivated(this->lookup_name(id).value_or("unknown-name").c_str());
+}
+
// _ _ _ _ _ _ _
// | |__ (_)_ __ __| (_)_ __ __ _ __ _ _ __ (_) (_)_ __ ___ _ __ | |
// | '_ \| | '_ \ / _` | | '_ \ / _` | / _` | '_ \| | | | '_ ` _ \| '_ \| |