wayland: set surfaces fullscreen when configured.
authorMarcus Fritzsch <marcus_fritzsch@mentor.com>
Fri, 23 Jun 2017 10:41:25 +0000 (12:41 +0200)
committerMarcus Fritzsch <marcus_fritzsch@mentor.com>
Tue, 8 Aug 2017 15:24:00 +0000 (17:24 +0200)
Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
src/main.cpp
src/wayland.cpp

index 67687af..20f04e5 100644 (file)
@@ -64,6 +64,9 @@ void init_layout(struct conn &c) {
    struct genivi::screen &s = *c.c->screens.begin()->second;
    auto &layers = c.c->layers;
 
+   // XXX: Write output dimensions to ivi controller...
+   c.c->output_size = genivi::size{uint32_t(o.width), uint32_t(o.height)};
+
    // Setup our dummy scene...
    if (layers.find(100) == layers.end()) {
       logdebug("Creating layer 100 with output dimensions (%ux%u)", o.width, o.height);
index a512979..3983da8 100644 (file)
@@ -514,14 +514,14 @@ void controller::surface_configuration(uint32_t id, int32_t width,
    logdebug("genivi::surface %s @ %p w %i h %i", __func__, this->proxy, width,
             height);
    struct surface *s = this->surfaces[id].get();
-   bool center = s->size.w != width && s->size.h != height;
+   bool center = int(s->size.w) != int(width) && int(s->size.h) != int(height);
    s->size = size{uint32_t(width), uint32_t(height)};
    if (center)
-         auto const s = c->surfaces.find(id);
-         if (s != c->surfaces.end())
-            s->second->set_destination_rectangle(
-               800 / 2 - width / 2, 600 / 2 - height / 2, width, height);
-      add_task("fullscreen surface", [id, width, height](struct controller *c) {
+      add_task("fullscreen surface", [id](struct controller *c) {
+         c->surfaces[id]->set_destination_rectangle(0, 0, c->output_size.w, c->output_size.h);
+         c->surfaces[id]->set_visibility(1);
+         c->layers[100]->add_surface(c->surfaces[id].get());
+         c->layers[100]->set_visibility(1);
       });
 }