commit 6e324f8

Michael Forney  ·  2013-06-21 07:57:18 +0000 UTC
parent 312d612
Use wl_resource_find_for_client
4 files changed,  +2, -26
M util.c
M util.h
+1, -1
1@@ -42,7 +42,7 @@ void swc_keyboard_set_focus(struct swc_keyboard * keyboard,
2     if (surface)
3     {
4         client = wl_resource_get_client(surface->resource);
5-        resource = swc_find_resource_for_client(&keyboard->resources, client);
6+        resource = wl_resource_find_for_client(&keyboard->resources, client);
7 
8         printf("keyboard: focusing surface: %p\n", surface);
9 
+1, -1
1@@ -44,7 +44,7 @@ void swc_pointer_set_focus(struct swc_pointer * pointer,
2     if (surface)
3     {
4         client = wl_resource_get_client(surface->resource);
5-        resource = swc_find_resource_for_client(&pointer->resources, client);
6+        resource = wl_resource_find_for_client(&pointer->resources, client);
7 
8         printf("pointer: focusing surface: %p\n", surface);
9 
M util.c
+0, -21
 1@@ -9,24 +9,3 @@ void swc_unbind_resource(struct wl_resource * resource)
 2     free(resource);
 3 }
 4 
 5-struct wl_resource * swc_find_resource_for_client(struct wl_list * resources,
 6-                                                  struct wl_client * client)
 7-{
 8-    struct wl_resource * resource;
 9-
10-    printf("looking for client %p\n", client);
11-
12-    wl_list_for_each(resource, resources, link)
13-    {
14-        if (wl_resource_get_client(resource) == client)
15-        {
16-            printf("found client\n");
17-            return resource;
18-        }
19-    }
20-
21-    printf("couldn't find resource\n");
22-
23-    return NULL;
24-}
25-
M util.h
+0, -3
1@@ -5,8 +5,5 @@
2 
3 void swc_unbind_resource(struct wl_resource * resource);
4 
5-struct wl_resource * swc_find_resource_for_client(struct wl_list * resources,
6-                                                  struct wl_client * client);
7-
8 #endif
9