X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fwayland.cpp;h=e22f4a64210346a1ad6f61da27fd5b522d6ee445;hb=432f97a9d47eb6ddd5b347d20b8548593cf66e8b;hp=a5129799a8a903aead53d37e735c988f71f6290c;hpb=d34b46aae11efe3f5060067d1f2ee3ed3eac2b7e;p=staging%2Fwindowmanager.git diff --git a/src/wayland.cpp b/src/wayland.cpp index a512979..e22f4a6 100644 --- a/src/wayland.cpp +++ b/src/wayland.cpp @@ -194,12 +194,12 @@ constexpr struct ivi_controller_listener listener = { controller::controller(struct wl_registry *r, uint32_t name, uint32_t version) : wayland_proxy( - wl_registry_bind(r, name, &ivi_controller_interface, version)) - , surfaces{} - , layers{} - , screens{} - , pending{} - , output_size{} { + wl_registry_bind(r, name, &ivi_controller_interface, version)), + surfaces{}, + layers{}, + screens{}, + pending{}, + output_size{} { ivi_controller_add_listener(this->proxy, &listener, this); } @@ -306,9 +306,7 @@ constexpr struct ivi_controller_layer_listener layer_listener = { }; } -layer::layer(uint32_t i, struct controller *c) - : layer(i, 0, 0, c) { -} +layer::layer(uint32_t i, struct controller *c) : layer(i, 0, 0, c) {} layer::layer(uint32_t i, int32_t w, int32_t h, struct controller *c) : wayland_proxy(ivi_controller_layer_create(c->proxy, i, w, h)), @@ -324,32 +322,38 @@ layer::~layer() { void controller::layer_visibility(uint32_t id, int32_t visibility) { logdebug("genivi::layer %s @ %p v %i", __func__, this->proxy, visibility); + this->layers[id]->visibility = visibility; } void controller::layer_opacity(uint32_t id, float opacity) { logdebug("genivi::layer %s @ %p o %f", __func__, this->proxy, opacity); + this->layers[id]->opacity = opacity; } void controller::layer_source_rectangle(uint32_t id, int32_t x, int32_t y, int32_t width, int32_t height) { logdebug("genivi::layer %s @ %p x %i y %i w %i h %i", __func__, this->proxy, x, y, width, height); + this->layers[id]->src_rect = rect{uint32_t(width), uint32_t(height), x, y}; } void controller::layer_destination_rectangle(uint32_t id, int32_t x, int32_t y, int32_t width, int32_t height) { logdebug("genivi::layer %s @ %p x %i y %i w %i h %i", __func__, this->proxy, x, y, width, height); + this->layers[id]->dst_rect = rect{uint32_t(width), uint32_t(height), x, y}; } void controller::layer_configuration(uint32_t id, int32_t width, int32_t height) { logdebug("genivi::layer %s @ %p w %i h %i", __func__, this->proxy, width, height); + this->layers[id]->size = size{uint32_t(width), uint32_t(height)}; } void controller::layer_orientation(uint32_t id, int32_t orientation) { logdebug("genivi::layer %s @ %p o %i", __func__, this->proxy, orientation); + this->layers[id]->orientation = orientation; } void controller::layer_screen(uint32_t id, struct wl_output *screen) { @@ -482,22 +486,19 @@ surface::~surface() { void controller::surface_visibility(uint32_t id, int32_t visibility) { logdebug("genivi::surface %s @ %p v %i", __func__, this->proxy, visibility); - struct surface *s = this->surfaces[id].get(); - s->visibility = visibility; + this->surfaces[id]->visibility = visibility; } void controller::surface_opacity(uint32_t id, float opacity) { logdebug("genivi::surface %s @ %p o %f", __func__, this->proxy, opacity); - struct surface *s = this->surfaces[id].get(); - s->opacity = opacity; + this->surfaces[id]->opacity = opacity; } void controller::surface_source_rectangle(uint32_t id, int32_t x, int32_t y, int32_t width, int32_t height) { logdebug("genivi::surface %s @ %p x %i y %i w %i h %i", __func__, this->proxy, x, y, width, height); - struct surface *s = this->surfaces[id].get(); - s->src_rect = rect{uint32_t(width), uint32_t(height), x, y}; + this->surfaces[id]->src_rect = rect{uint32_t(width), uint32_t(height), x, y}; } void controller::surface_destination_rectangle(uint32_t id, int32_t x, @@ -505,30 +506,30 @@ void controller::surface_destination_rectangle(uint32_t id, int32_t x, int32_t height) { logdebug("genivi::surface %s @ %p x %i y %i w %i h %i", __func__, this->proxy, x, y, width, height); - struct surface *s = this->surfaces[id].get(); - s->dst_rect = rect{uint32_t(width), uint32_t(height), x, y}; + this->surfaces[id]->dst_rect = rect{uint32_t(width), uint32_t(height), x, y}; } void controller::surface_configuration(uint32_t id, int32_t width, int32_t height) { 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; + auto &s = this->surfaces[id]; + 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); + uint32_t lid = id == 0x16180 ? 1000 : 100; + c->layers[lid]->add_surface(c->surfaces[id].get()); + c->layers[lid]->set_visibility(1); }); } void controller::surface_orientation(uint32_t id, int32_t orientation) { logdebug("genivi::surface %s @ %p o %i", __func__, this->proxy, orientation); - struct surface *s = this->surfaces[id].get(); - s->orientation = orientation; + this->surfaces[id]->orientation = orientation; } void controller::surface_pixelformat(uint32_t id, int32_t pixelformat) {