summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCasey Dahlin <cdahlin@redhat.com>2012-04-19 22:50:07 -0400
committerKristian Høgsberg <krh@bitplanet.net>2012-04-20 13:11:06 -0400
commit96d8a75ec013626b04039f5ca09a28f3af42fee0 (patch)
tree9b7d025c49d6fccb09ff39f2841f758d1d186a58
parent9521d5e5534496db2b3e03592129994793a7c9c2 (diff)
Change find_resource_for_surface to find_resource_for_client
This function has generic applications and should be made generic. Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
-rw-r--r--src/compositor.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/src/compositor.c b/src/compositor.c
index abf5ce9..3354d21 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1125,6 +1125,19 @@ surface_destroy(struct wl_client *client, struct wl_resource *resource)
wl_resource_destroy(resource);
}
+static struct wl_resource *
+find_resource_for_client(struct wl_list *list, struct wl_client *client)
+{
+ struct wl_resource *r;
+
+ wl_list_for_each(r, list, link) {
+ if (r->client == client)
+ return r;
+ }
+
+ return NULL;
+}
+
WL_EXPORT void
weston_surface_assign_output(struct weston_surface *es)
{
@@ -1769,23 +1782,6 @@ notify_keyboard_focus(struct wl_input_device *device, struct wl_array *keys)
}
}
-/* TODO: share this function with wayland-server.c */
-static struct wl_resource *
-find_resource_for_surface(struct wl_list *list, struct wl_surface *surface)
-{
- struct wl_resource *r;
-
- if (!surface)
- return NULL;
-
- wl_list_for_each(r, list, link) {
- if (r->client == surface->resource.client)
- return r;
- }
-
- return NULL;
-}
-
static void
lose_touch_focus_resource(struct wl_listener *listener, void *data)
{
@@ -1818,8 +1814,8 @@ touch_set_focus(struct weston_input_device *device,
if (surface) {
resource =
- find_resource_for_surface(&input_device->resource_list,
- surface);
+ find_resource_for_client(&input_device->resource_list,
+ surface->resource.client);
if (!resource) {
fprintf(stderr, "couldn't find resource\n");
return;