[mutter/wayland] wayland: Remove needless indirection



commit e34792d9f0a949aa9d7f49471029e28f1bb69a21
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Mar 11 16:00:34 2014 -0400

    wayland: Remove needless indirection

 src/wayland/meta-wayland-data-device.c |   35 ++++---------------------------
 src/wayland/meta-wayland-seat.h        |    6 -----
 2 files changed, 5 insertions(+), 36 deletions(-)
---
diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c
index 696f190..fe7b237 100644
--- a/src/wayland/meta-wayland-data-device.c
+++ b/src/wayland/meta-wayland-data-device.c
@@ -48,7 +48,7 @@ data_offer_accept (struct wl_client *client,
    * this be a wl_data_device request? */
 
   if (offer->source)
-    offer->source->accept (offer->source, serial, mime_type);
+    wl_data_source_send_target (offer->source->resource, mime_type);
 }
 
 static void
@@ -58,9 +58,9 @@ data_offer_receive (struct wl_client *client, struct wl_resource *resource,
   MetaWaylandDataOffer *offer = wl_resource_get_user_data (resource);
 
   if (offer->source)
-    offer->source->send (offer->source, mime_type, fd);
-  else
-    close (fd);
+    wl_data_source_send_send (offer->source->resource, mime_type, fd);
+
+  close (fd);
 }
 
 static void
@@ -391,7 +391,7 @@ meta_wayland_seat_set_selection (MetaWaylandSeat *seat,
 
   if (seat->selection_data_source)
     {
-      seat->selection_data_source->cancel (seat->selection_data_source);
+      wl_data_source_send_cancelled (seat->selection_data_source->resource);
       wl_list_remove (&seat->selection_data_source_listener.link);
       seat->selection_data_source = NULL;
     }
@@ -462,27 +462,6 @@ destroy_data_source (struct wl_resource *resource)
 }
 
 static void
-client_source_accept (MetaWaylandDataSource *source,
-                      guint32 time, const char *mime_type)
-{
-  wl_data_source_send_target (source->resource, mime_type);
-}
-
-static void
-client_source_send (MetaWaylandDataSource *source,
-                    const char *mime_type, int32_t fd)
-{
-  wl_data_source_send_send (source->resource, mime_type, fd);
-  close (fd);
-}
-
-static void
-client_source_cancel (MetaWaylandDataSource *source)
-{
-  wl_data_source_send_cancelled (source->resource);
-}
-
-static void
 create_data_source (struct wl_client *client,
                     struct wl_resource *resource, guint32 id)
 {
@@ -494,10 +473,6 @@ create_data_source (struct wl_client *client,
   wl_resource_set_implementation (source->resource, &data_source_interface,
                                  source, destroy_data_source);
 
-  source->accept = client_source_accept;
-  source->send = client_source_send;
-  source->cancel = client_source_cancel;
-
   wl_array_init (&source->mime_types);
 }
 
diff --git a/src/wayland/meta-wayland-seat.h b/src/wayland/meta-wayland-seat.h
index cee2ea6..4293193 100644
--- a/src/wayland/meta-wayland-seat.h
+++ b/src/wayland/meta-wayland-seat.h
@@ -43,12 +43,6 @@ struct _MetaWaylandDataSource
 {
   struct wl_resource *resource;
   struct wl_array mime_types;
-
-  void (*accept) (MetaWaylandDataSource * source,
-                  uint32_t serial, const char *mime_type);
-  void (*send) (MetaWaylandDataSource * source,
-                const char *mime_type, int32_t fd);
-  void (*cancel) (MetaWaylandDataSource * source);
 };
 
 struct _MetaWaylandSeat


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]