summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcus Fritzsch <marcus_fritzsch@mentor.com>2017-08-31 17:27:02 +0200
committerMarcus Fritzsch <marcus_fritzsch@mentor.com>2017-09-04 16:54:02 +0200
commit4a67c02ff81303b9e95537cbbaddf422d99f2fbd (patch)
tree5b500be392b1501b118d81e1b04dfbf4be615251
parent74826b4760a3946e3f196a00c6a9f292a810f855 (diff)
app: remove previous work around experiments, add one that fixes HomeScreen
Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
-rw-r--r--src/app.cpp65
1 files changed, 44 insertions, 21 deletions
diff --git a/src/app.cpp b/src/app.cpp
index 7ff353f..6d47928 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -270,6 +270,35 @@ int App::init_layout() {
return 0;
}
+namespace {
+
+// This can fix the HomeScreen...
+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);
+ app->controller->commit_changes();
+ app->display->roundtrip();
+
+ // wait some time, for the process to do its thing...
+ using namespace std::chrono_literals;
+ 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);
+ app->controller->commit_changes();
+ app->display->roundtrip();
+
+ std::this_thread::sleep_for(100ms);
+ }
+}
+
+} // namespace
+
void App::surface_set_layout(uint32_t surface_id) {
if (!this->controller->surface_exists(surface_id)) {
logerror("Surface %d does not exist", int(surface_id));
@@ -305,20 +334,29 @@ void App::surface_set_layout(uint32_t surface_id) {
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);
+
// set source reactangle, even if we should not need to set it.
s->set_source_rectangle(0, 0, w, h);
+
// set destination to the display rectangle
s->set_destination_rectangle(x, y, w, h);
- // XXX: The main_surface will be visible regardless
- //s->set_visibility(
- // surface_id == static_cast<unsigned>(this->layers.main_surface) ? 1 : 0);
+ s->set_visibility(0);
+ s->set_opacity(256);
+
+ this->controller->commit_changes();
+ this->display->roundtrip();
+
this->controller->layers[layer_id]->add_surface(s.get());
+ // activate the main_surface right away
if (surface_id == static_cast<unsigned>(this->layers.main_surface)) {
logdebug("Activating main_surface (%d)", surface_id);
+
this->activate_surface(surface_id);
}
@@ -341,8 +379,10 @@ char const *App::activate_surface(uint32_t surface_id) {
// Set all others invisible
for (auto &i : this->controller->surfaces) {
auto &si = this->controller->sprops[i.second->id];
- if (si.id != s->id && int(si.id) != this->layers.main_surface) {
+ if (int(si.id) != this->layers.main_surface) {
i.second->set_visibility(0);
+ this->controller->commit_changes();
+ this->display->flush();
}
}
s->set_visibility(1);
@@ -351,23 +391,6 @@ char const *App::activate_surface(uint32_t surface_id) {
this->controller->commit_changes();
this->display->flush();
- auto set_vis = [&s, this](int id, int vis) {
- using namespace std::chrono_literals;
-
- std::this_thread::sleep_for(200ms);
- char *buf;
- asprintf(&buf, "LayerManagerControl set surface %d visibility %d", id, vis);
- //system("LayerManagerControl get scene");
- //system("sleep 0.1");
- system(buf);
-
- //s->set_visibility(vis);
- //this->controller->commit_changes();
- //this->display->roundtrip();
- };
- set_vis(s->id, 0);
- set_vis(s->id, 1);
-
// Current active surface is the first in last_active
this->last_active.push_front(s->id);
/// // XXX: I am not sure I even need 5 elements...