commit 85150be6ceb5a567a1bff30fd24d660871a6d2fb
parent 06e5a78c1dc4a58abdb2a2472ae9dfcdaa75719b
Author: Michael Forney <mforney@mforney.org>
Date: Thu, 13 Jun 2013 20:35:05 -0700
Add swc_find_resource_for_client
Diffstat:
2 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/util.c b/util.c
@@ -1,6 +1,7 @@
#include "util.h"
#include <stdlib.h>
+#include <stdio.h>
void swc_unbind_resource(struct wl_resource * resource)
{
@@ -8,3 +9,24 @@ void swc_unbind_resource(struct wl_resource * resource)
free(resource);
}
+struct wl_resource * swc_find_resource_for_client(struct wl_list * resources,
+ struct wl_client * client)
+{
+ struct wl_resource * resource;
+
+ printf("looking for client %p\n", client);
+
+ wl_list_for_each(resource, resources, link)
+ {
+ if (wl_resource_get_client(resource) == client)
+ {
+ printf("found client\n");
+ return resource;
+ }
+ }
+
+ printf("couldn't find resource\n");
+
+ return NULL;
+}
+
diff --git a/util.h b/util.h
@@ -16,5 +16,8 @@ void swc_client_add_object(struct wl_clientstruct wl_resource * resource, );
void swc_unbind_resource(struct wl_resource * resource);
+struct wl_resource * swc_find_resource_for_client(struct wl_list * resources,
+ struct wl_client * client);
+
#endif