Update for recent changes in wayland core protocol
authorChris Michael <cp.michael@samsung.com>
Mon, 24 Jun 2013 09:51:21 +0000 (10:51 +0100)
committerChris Michael <cp.michael@samsung.com>
Mon, 24 Jun 2013 09:51:21 +0000 (10:51 +0100)
Signed-off-by: Chris Michael <cp.michael@samsung.com>
src/bin/e_wayland/e_comp.c
src/bin/e_wayland/e_output.c
src/bin/e_wayland/e_region.c
src/bin/e_wayland/e_region.h
src/bin/e_wayland/e_surface.c
src/bin/e_wayland/e_surface.h

index 2095a3373bdd26be445939ba51b9939c3faea810..d85272c09cf463b93a197146f87abd9bbe1a3d2b 100644 (file)
@@ -462,15 +462,13 @@ _e_comp_cb_region_create(struct wl_client *client, struct wl_resource *resource,
    if (!(comp = resource->data)) return;
 
    /* try to create a new region */
-   if (!(reg = e_region_new(id)))
+   if (!(reg = e_region_new(client, id)))
      {
         wl_resource_post_no_memory(resource);
         return;
      }
 
-   reg->resource.destroy = _e_comp_cb_region_destroy;
-
-   wl_client_add_resource(client, &reg->resource);
+   wl_resource_set_destructor(reg->resource, _e_comp_cb_region_destroy);
 }
 
 static void 
@@ -479,7 +477,7 @@ _e_comp_cb_region_destroy(struct wl_resource *resource)
    E_Region *reg;
 
    /* try to get the region from this resource */
-   if (!(reg = container_of(resource, E_Region, resource)))
+   if (!(reg = wl_resource_get_user_data(resource)))
      return;
 
    /* free the region */
index f392626b3ba2ab4ff62e45f2f14bc41cfcaa05e2..a75888b45069deca1093e7e5d2bad1a2093459f5 100644 (file)
@@ -104,8 +104,8 @@ e_output_repaint(E_Output *output, unsigned int secs)
    /* send surface frame callback done */
    wl_list_for_each_safe(cb, cbnext, &frames, link)
      {
-        wl_callback_send_done(&cb->resource, secs);
-        wl_resource_destroy(&cb->resource);
+        wl_callback_send_done(cb->resource, secs);
+        wl_resource_destroy(cb->resource);
      }
 }
 
index c9ee546e0fe4dadf62843019b5d3c9a8f80b8ff6..b3d2ae21a92ca26f9a77f5b96c6a374fa2703835 100644 (file)
@@ -14,20 +14,19 @@ static const struct wl_region_interface _e_region_interface =
 };
 
 EAPI E_Region *
-e_region_new(unsigned int id)
+e_region_new(struct wl_client *client, unsigned int id)
 {
    E_Region *reg;
 
    /* try to allocation space for a new region */
    if (!(reg = E_NEW_RAW(E_Region, 1))) return NULL;
 
-   reg->resource.object.id = id;
-   reg->resource.object.interface = &wl_region_interface;
-   reg->resource.object.implementation = (void (**)(void))&_e_region_interface;
-   reg->resource.data = reg;
-
    pixman_region32_init(&reg->region);
 
+   reg->resource = 
+     wl_client_add_object(client, &wl_region_interface, 
+                          &_e_region_interface, id, reg);
+
    return reg;
 }
 
index 6739e1c1bbcc805fd110f604a9740c8198b42ab1..5683d2410d1312559d597ca0ab4f0a1094938d09 100644 (file)
@@ -8,11 +8,11 @@ typedef struct _E_Region E_Region;
 
 struct _E_Region
 {
-   struct wl_resource resource;
+   struct wl_resource *resource;
    pixman_region32_t region;
 };
 
-EAPI E_Region *e_region_new(unsigned int id);
+EAPI E_Region *e_region_new(struct wl_client *client, unsigned int id);
 
 # endif
 #endif
index 6567bd5f4bca47f75a79f469f4350b281cf0e0c3..56247b58fa6f81f4488156950929bfb270d290ba 100644 (file)
@@ -5,7 +5,7 @@ static void _e_surface_cb_destroy(struct wl_client *client EINA_UNUSED, struct w
 static void _e_surface_cb_attach(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *buffer_resource, int x, int y);
 static void _e_surface_cb_damage(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, int x, int y, int w, int h);
 static void _e_surface_cb_commit(struct wl_client *client EINA_UNUSED, struct wl_resource *resource);
-static void _e_surface_cb_frame(struct wl_client *client, struct wl_resource *resource, unsigned int id);
+static void _e_surface_cb_frame(struct wl_client *client, struct wl_resource *resource, unsigned int callback);
 static void _e_surface_cb_opaque_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *region_resource);
 static void _e_surface_cb_input_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *region_resource);
 static void _e_surface_cb_buffer_destroy(struct wl_listener *listener, void *data EINA_UNUSED);
@@ -132,7 +132,7 @@ e_surface_destroy(E_Surface *es)
 
    /* remove any pending frame callbacks */
    wl_list_for_each_safe(cb, cbnext, &es->pending.frames, link)
-     wl_resource_destroy(&cb->resource);
+     wl_resource_destroy(cb->resource);
 
    pixman_region32_fini(&es->pending.damage);
    pixman_region32_fini(&es->pending.opaque);
@@ -157,7 +157,7 @@ e_surface_destroy(E_Surface *es)
 
    /* remove any active frame callbacks */
    wl_list_for_each_safe(cb, cbnext, &es->frames, link)
-     wl_resource_destroy(&cb->resource);
+     wl_resource_destroy(cb->resource);
 
    /* EINA_LIST_FOREACH(_e_comp->inputs, l, seat) */
    /*   { */
@@ -191,7 +191,7 @@ e_surface_damage_calculate(E_Surface *es, pixman_region32_t *opaque)
    if (es->buffer.reference.buffer)
      {
         /* if this is an shm buffer, flush any pending damage */
-        if (wl_shm_buffer_get(es->buffer.reference.buffer))
+        if (wl_shm_buffer_get(&es->buffer.reference.buffer->resource))
           {
              if (_e_comp->renderer->damage_flush)
                _e_comp->renderer->damage_flush(es);
@@ -303,7 +303,7 @@ _e_surface_cb_attach(struct wl_client *client EINA_UNUSED, struct wl_resource *r
    struct wl_buffer *buffer = NULL;
 
    /* try to cast the resource to our surface */
-   if (!(es = resource->data)) return;
+   if (!(es = wl_resource_get_user_data(resource))) return;
 
    /* if we have a buffer resource, get a wl_buffer from it */
    if (buffer_resource) buffer = buffer_resource->data;
@@ -407,13 +407,13 @@ _e_surface_cb_commit(struct wl_client *client EINA_UNUSED, struct wl_resource *r
 }
 
 static void 
-_e_surface_cb_frame(struct wl_client *client, struct wl_resource *resource, unsigned int id)
+_e_surface_cb_frame(struct wl_client *client, struct wl_resource *resource, unsigned int callback)
 {
    E_Surface *es;
    E_Surface_Frame *cb;
 
    /* try to cast the resource to our surface */
-   if (!(es = resource->data)) return;
+   if (!(es = wl_resource_get_user_data(resource))) return;
 
    /* try to create a new frame callback */
    if (!(cb = E_NEW_RAW(E_Surface_Frame, 1)))
@@ -422,15 +422,10 @@ _e_surface_cb_frame(struct wl_client *client, struct wl_resource *resource, unsi
         return;
      }
 
-   /* setup the callback object */
-   cb->resource.object.interface = &wl_callback_interface;
-   cb->resource.object.id = id;
-   cb->resource.destroy = _e_surface_frame_cb_destroy;
-   cb->resource.client = client;
-   cb->resource.data = cb;
+   cb->resource = 
+     wl_client_add_object(client, &wl_callback_interface, NULL, callback, cb);
 
-   /* add this callback to the client */
-   wl_client_add_resource(client, &cb->resource);
+   wl_resource_set_destructor(cb->resource, _e_surface_frame_cb_destroy);
 
    /* append the callback to pending frames */
    wl_list_insert(es->pending.frames.prev, &cb->link);
@@ -502,7 +497,7 @@ _e_surface_frame_cb_destroy(struct wl_resource *resource)
    E_Surface_Frame *cb;
 
    /* try to cast the resource to our callback */
-   if (!(cb = resource->data)) return;
+   if (!(cb = wl_resource_get_user_data(resource))) return;
 
    wl_list_remove(&cb->link);
 
index 19234976c7f4959cf25a407c9ce7c2cc0a95740d..5b2911e8e8dd5fd213459363144ce259f4cdfd96 100644 (file)
@@ -71,7 +71,7 @@ struct _E_Surface
 
 struct _E_Surface_Frame
 {
-   struct wl_resource resource;
+   struct wl_resource *resource;
    struct wl_list link;
 };