diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/wayland.cpp | 23 | ||||
-rw-r--r-- | src/wayland.hpp | 18 |
2 files changed, 30 insertions, 11 deletions
diff --git a/src/wayland.cpp b/src/wayland.cpp index 98c4270..4f1dbd1 100644 --- a/src/wayland.cpp +++ b/src/wayland.cpp @@ -16,9 +16,15 @@ namespace wl { // |_| |___/ display::display() : d(std::unique_ptr<wl_display, void (*)(wl_display *)>( - wl_display_connect(NULL), wl_display_disconnect)), + wl_display_connect(NULL), + [](wl_display *d) { + logdebug("wl::display %s @ %p", __func__, d); + wl_display_disconnect(d); + })), r(std::make_unique<registry>(d.get())) {} +display::~display() {} + bool display::ok() const { return d.get() != nullptr && wl_display_get_error(d.get()) == 0; } @@ -52,8 +58,7 @@ registry::registry(wl_display *d) : wayland_proxy(wl_display_get_registry(d)) { } registry::~registry() { - wl_registry_destroy(this->proxy); - this->proxy = nullptr; + logdebug("wl::registry %s @ %p", __func__, this->proxy); } void registry::add_global_handler(char const *iface, binder bind) { @@ -223,7 +228,7 @@ void layer_visibility(void *data, void layer_opacity(void *data, struct ivi_controller_layer *ivi_controller_layer, wl_fixed_t opacity) { - static_cast<layer *>(data)->opacity(opacity); + static_cast<layer *>(data)->opacity(wl_fixed_to_double(opacity)); } void layer_source_rectangle(void *data, @@ -284,8 +289,8 @@ void layer::visibility(int32_t visibility) { logdebug("genivi::layer %s @ %p v %i", __func__, this->proxy, visibility); } -void layer::opacity(wl_fixed_t opacity) { - logdebug("genivi::layer %s @ %p o %i", __func__, this->proxy, opacity); +void layer::opacity(float opacity) { + logdebug("genivi::layer %s @ %p o %f", __func__, this->proxy, opacity); } void layer::source_rectangle(int32_t x, int32_t y, int32_t width, @@ -334,7 +339,7 @@ void surface_visibility(void *data, void surface_opacity(void *data, struct ivi_controller_surface *ivi_controller_surface, wl_fixed_t opacity) { - static_cast<surface *>(data)->opacity(opacity); + static_cast<surface *>(data)->opacity(wl_fixed_to_double(opacity)); } void surface_source_rectangle( @@ -423,8 +428,8 @@ void surface::visibility(int32_t visibility) { logdebug("genivi::surface %s @ %p v %i", __func__, this->proxy, visibility); } -void surface::opacity(wl_fixed_t opacity) { - logdebug("genivi::surface %s @ %p o %i", __func__, this->proxy, opacity); +void surface::opacity(float opacity) { + logdebug("genivi::surface %s @ %p o %f", __func__, this->proxy, opacity); } void surface::source_rectangle(int32_t x, int32_t y, int32_t width, diff --git a/src/wayland.hpp b/src/wayland.hpp index d0d9c90..38f8946 100644 --- a/src/wayland.hpp +++ b/src/wayland.hpp @@ -51,6 +51,7 @@ struct display { std::unique_ptr<registry> r; display(); + ~display(); bool ok() const; void roundtrip(); int dispatch(); @@ -121,7 +122,7 @@ struct surface : public wayland_proxy<ivi_controller_surface> { // Events void visibility(int32_t visibility); - void opacity(wl_fixed_t opacity); + void opacity(float opacity); void source_rectangle(int32_t x, int32_t y, int32_t width, int32_t height); void destination_rectangle(int32_t x, int32_t y, int32_t width, int32_t height); @@ -149,7 +150,7 @@ struct layer : public wayland_proxy<ivi_controller_layer> { // Events void visibility(int32_t visibility); - void opacity(wl_fixed_t opacity); + void opacity(float opacity); void source_rectangle(int32_t x, int32_t y, int32_t width, int32_t height); void destination_rectangle(int32_t x, int32_t y, int32_t width, int32_t height); @@ -157,6 +158,19 @@ struct layer : public wayland_proxy<ivi_controller_layer> { void orientation(int32_t orientation); void screen(struct wl_output *screen); void destroyed(); + + // Requests + void set_visibility(uint32_t visibility); + void set_opacity(wl_fixed_t opacity); + void set_source_rectangle(int32_t x, int32_t y, int32_t width, int32_t height); + void set_destination_rectangle(int32_t x, int32_t y, int32_t width, int32_t height); + void set_configuration(int32_t width, int32_t height); + void set_orientation(int32_t orientation); + void screenshot(const char *filename); + void clear_surfaces(); + void add_surface(struct surface *surface); + void remove_surface(struct surface *surface); + void set_render_order(struct wl_array *id_surfaces); }; // |