wayland: cast wl_fixed_to_double() return to float for our interface
[staging/windowmanager.git] / src / wayland.cpp
index 0862475..1078a14 100644 (file)
@@ -15,14 +15,18 @@ namespace wl {
 //  \__,_|_|___/ .__/|_|\__,_|\__, |
 //             |_|            |___/
 display::display()
-   : d(std::unique_ptr<struct wl_display,
-                       std::function<void(struct wl_display *)>>(
+   : d(std::unique_ptr<struct wl_display, void (*)(struct wl_display *)>(
         wl_display_connect(NULL),
+#ifdef DEBUG_OUTPUT
         [](struct wl_display *d) {
            logdebug("wl::display ~display @ %p", d);
            wl_display_disconnect(d);
         })),
-     r(!d ? nullptr : std::make_unique<struct registry>(d.get())) {}
+#else
+        &wl_display_disconnect)),
+#endif
+     r(d.get()) {
+}
 
 display::~display() {}
 
@@ -74,8 +78,8 @@ void registry::global(uint32_t name, char const *iface, uint32_t v) {
    auto b = this->bindings.find(iface);
    if (b != this->bindings.end())
       b->second(this->proxy, name, v);
-   logdebug("wl::registry @ %p global n %u i %s v %u", this->proxy, name,
-            iface, v);
+   logdebug("wl::registry @ %p global n %u i %s v %u", this->proxy, name, iface,
+            v);
 }
 
 void registry::global_remove(uint32_t name) {}
@@ -263,7 +267,8 @@ void layer_opacity(void *data,
                    struct ivi_controller_layer *ivi_controller_layer,
                    wl_fixed_t opacity) {
    static_cast<struct layer *>(data)->parent->layer_opacity(
-      static_cast<struct layer *>(data)->id, wl_fixed_to_double(opacity));
+      static_cast<struct layer *>(data)->id,
+      float(wl_fixed_to_double(opacity)));
 }
 
 void layer_source_rectangle(void *data,
@@ -318,14 +323,14 @@ 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, int32_t w, int32_t h, struct controller *c)
-   : wayland_proxy(ivi_controller_layer_create(c->proxy, i, w, h))
-   , controlled_entity(c, i)
-   , dst_rect{}
-   , src_rect{}
-   , size{}
-   , orientation{}
-   , visibility{}
-   , opacity{} {
+   : wayland_proxy(ivi_controller_layer_create(c->proxy, i, w, h)),
+     controlled_entity(c, i),
+     dst_rect{},
+     src_rect{},
+     size{},
+     orientation{},
+     visibility{},
+     opacity{} {
    ivi_controller_layer_add_listener(this->proxy, &layer_listener, this);
 }
 
@@ -398,7 +403,8 @@ void surface_opacity(void *data,
                      struct ivi_controller_surface *ivi_controller_surface,
                      wl_fixed_t opacity) {
    static_cast<struct surface *>(data)->parent->surface_opacity(
-      static_cast<struct surface *>(data)->id, wl_fixed_to_double(opacity));
+      static_cast<struct surface *>(data)->id,
+      float(wl_fixed_to_double(opacity)));
 }
 
 void surface_source_rectangle(