Update e_wayland for recent Wayland 1.2 changes
authorChris Michael <cp.michael@samsung.com>
Tue, 16 Jul 2013 06:40:57 +0000 (07:40 +0100)
committerChris Michael <cp.michael@samsung.com>
Tue, 16 Jul 2013 06:40:57 +0000 (07:40 +0100)
Signed-off-by: Chris Michael <cp.michael@samsung.com>
src/bin/e_wayland/e_buffer.h
src/bin/e_wayland/e_comp.c
src/bin/e_wayland/e_region.c
src/bin/e_wayland/e_surface.c
src/bin/e_wayland/e_surface.h

index c6c045c4ec0710faa6c5ac83c6e02dc3359b0deb..13f2ed20d859c3277ab67cacff1c88c7140bb612 100644 (file)
@@ -24,7 +24,7 @@ struct _E_Buffer
    union
      {
         struct wl_shm_buffer *shm_buffer;
-        struct wl_buffer *legacy_buffer;
+        void *legacy_buffer;
      };
 
    Evas_Coord w, h;
index 4b3ce411a0ac4212943e96454916142037218e08..8bbd74a903e3097c7d63042945747bd381913377 100644 (file)
@@ -112,8 +112,8 @@ e_compositor_init(E_Compositor *comp, void *display)
    wl_signal_init(&comp->signals.seat);
 
    /* try to add the compositor to the displays global list */
-   if (!wl_display_add_global(comp->wl.display, &wl_compositor_interface, 
-                              comp, _e_comp_cb_bind))
+   if (!wl_global_create(comp->wl.display, &wl_compositor_interface, 
+                         3, comp, _e_comp_cb_bind))
      {
         ERR("Could not add compositor to globals: %m");
         goto global_err;
@@ -131,9 +131,8 @@ e_compositor_init(E_Compositor *comp, void *display)
      }
 
    /* initialize the data device manager */
-   if (!wl_display_add_global(comp->wl.display, 
-                              &wl_data_device_manager_interface, NULL, 
-                              _e_comp_cb_bind_manager))
+   if (!wl_global_create(comp->wl.display, &wl_data_device_manager_interface, 
+                         1, NULL, _e_comp_cb_bind_manager))
      {
         ERR("Could not add data device manager to globals: %m");
         goto global_err;
@@ -385,20 +384,24 @@ static void
 _e_comp_cb_bind(struct wl_client *client, void *data, unsigned int version EINA_UNUSED, unsigned int id)
 {
    E_Compositor *comp;
+   struct wl_resource *res;
 
    if (!(comp = data)) return;
 
-   /* add the compositor to the client */
-   wl_client_add_object(client, &wl_compositor_interface, 
-                        &_e_compositor_interface, id, comp);
+   res = wl_resource_create(client, &wl_compositor_interface, 
+                            MIN(version, 3), id);
+   if (res)
+     wl_resource_set_implementation(res, &_e_compositor_interface, comp, NULL);
 }
 
 static void 
 _e_comp_cb_bind_manager(struct wl_client *client, void *data EINA_UNUSED, unsigned int version EINA_UNUSED, unsigned int id)
 {
-   /* add the data device manager to the client */
-   wl_client_add_object(client, &wl_data_device_manager_interface, 
-                        &_e_manager_interface, id, NULL);
+   struct wl_resource *res;
+
+   res = wl_resource_create(client, &wl_data_device_manager_interface, 1, id);
+   if (res)
+     wl_resource_set_implementation(res, &_e_manager_interface, NULL, NULL);
 }
 
 static void 
@@ -413,7 +416,7 @@ _e_comp_cb_surface_create(struct wl_client *client, struct wl_resource *resource
    if (!(comp = resource->data)) return;
 
    /* try to create a new surface */
-   if (!(es = e_surface_new(client, id)))
+   if (!(es = e_surface_new(client, resource, id)))
      {
         wl_resource_post_no_memory(resource);
         return;
@@ -527,11 +530,11 @@ _e_comp_data_device_cb_get(struct wl_client *client, struct wl_resource *resourc
 
    if (!(seat = wl_resource_get_user_data(seat_resource))) return;
 
-   res = wl_client_add_object(client, &wl_data_device_interface, 
-                              &_e_data_device_interface, id, seat);
+   res = wl_resource_create(client, &wl_data_device_interface, 1, id);
 
    wl_list_insert(&seat->drag_resources, wl_resource_get_link(res));
-   wl_resource_set_destructor(res, _e_comp_data_device_cb_unbind);
+   wl_resource_set_implementation(res, &_e_data_device_interface, 
+                                  seat, _e_comp_data_device_cb_unbind);
 }
 
 static void 
index f938873999458eb19ecb0b751688b0301972ad1b..cef7e5117bb84771338871677707801e8fc898dd 100644 (file)
@@ -1,6 +1,7 @@
 #include "e.h"
 
 /* local function prototypes */
+static void _e_region_destroy(struct wl_resource *resource);
 static void _e_region_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource);
 static void _e_region_cb_add(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, int x, int y, int w, int h);
 static void _e_region_cb_subtract(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, int x, int y, int w, int h);
@@ -24,13 +25,24 @@ e_region_new(struct wl_client *client, unsigned int id)
    pixman_region32_init(&reg->region);
 
    reg->resource = 
-     wl_client_add_object(client, &wl_region_interface, 
-                          &_e_region_interface, id, reg);
+     wl_resource_create(client, &wl_region_interface, 1, id);
+   wl_resource_set_implementation(reg->resource, &_e_region_interface, 
+                                  reg, _e_region_destroy);
 
    return reg;
 }
 
 /* local functions */
+static void 
+_e_region_destroy(struct wl_resource *resource)
+{
+   E_Region *reg;
+
+   if (!(reg = wl_resource_get_user_data(resource))) return;
+   pixman_region32_fini(&reg->region);
+   E_FREE(reg);
+}
+
 static void 
 _e_region_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
 {
index db93665cbba2f6d88cc67b92bf2321c2e3e0af39..f158dcbded7f98dde60d82471d052ee12f7db13a 100644 (file)
@@ -27,7 +27,7 @@ static const struct wl_surface_interface _e_surface_interface =
 };
 
 EAPI E_Surface *
-e_surface_new(struct wl_client *client, unsigned int id)
+e_surface_new(struct wl_client *client, struct wl_resource *resource, unsigned int id)
 {
    E_Surface *es;
 
@@ -62,8 +62,10 @@ e_surface_new(struct wl_client *client, unsigned int id)
                              UINT32_MAX, UINT32_MAX);
 
    es->wl.resource = 
-     wl_client_add_object(client, &wl_surface_interface, 
-                          &_e_surface_interface, id, es);
+     wl_resource_create(client, &wl_surface_interface, 
+                        wl_resource_get_version(resource), id);
+   wl_resource_set_implementation(es->wl.resource, 
+                                  &_e_surface_interface, es, NULL);
 
    return es;
 }
@@ -460,9 +462,10 @@ _e_surface_cb_frame(struct wl_client *client, struct wl_resource *resource, unsi
      }
 
    cb->resource = 
-     wl_client_add_object(client, &wl_callback_interface, NULL, callback, cb);
+     wl_resource_create(client, &wl_callback_interface, 1, callback);
 
-   wl_resource_set_destructor(cb->resource, _e_surface_frame_cb_destroy);
+   wl_resource_set_implementation(cb->resource, NULL, cb, 
+                                  _e_surface_frame_cb_destroy);
 
    /* append the callback to pending frames */
    wl_list_insert(es->pending.frames.prev, &cb->link);
index 260c2d5987ba7ec098409d66f9bf41d801424529..d0b8ced772297d9bd4c35650044db73b687936fc 100644 (file)
@@ -77,7 +77,7 @@ struct _E_Surface_Frame
    struct wl_list link;
 };
 
-EAPI E_Surface *e_surface_new(struct wl_client *client, unsigned int id);
+EAPI E_Surface *e_surface_new(struct wl_client *client, struct wl_resource *resource, unsigned int id);
 EAPI void e_surface_attach(E_Surface *es, E_Buffer *buffer);
 EAPI void e_surface_unmap(E_Surface *es);
 EAPI void e_surface_damage(E_Surface *es);