[PATCH 1/3] Change find_resource_for_surface to find_resource_for_client

Kristian Høgsberg krh at bitplanet.net
Fri Apr 20 06:36:25 PDT 2012


On Fri, Apr 20, 2012 at 5:23 AM, Tiago Vignatti
<tiago.vignatti at linux.intel.com> wrote:
> On 04/20/2012 05:50 AM, cdahlin at redhat.com wrote:
>>
>> From: Casey Dahlin<cdahlin at redhat.com>
>>
>> This function has generic applications and should be made generic.
>
>
> this looks good. But we have already find_resource_for_surface in
> libwayland-server, it's just not exported. So I'd say this kind of
> modification should go there instead.

No, it's an awkward five line helper function that I don't want to
make public API.

Kristian

>> Signed-off-by: Casey Dahlin<cdahlin at redhat.com>
>> ---
>>  src/compositor.c |   35 ++++++++++++++++-------------------
>>  1 files changed, 16 insertions(+), 19 deletions(-)
>>
>> diff --git a/src/compositor.c b/src/compositor.c
>> index 17daac4..3065f81 100644
>> --- a/src/compositor.c
>> +++ b/src/compositor.c
>> @@ -1112,6 +1112,20 @@ surface_destroy(struct wl_client *client, struct
>> wl_resource *resource)
>>        wl_resource_destroy(resource);
>>  }
>>
>> +/* TODO: share this function with wayland-server.c */
>> +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)
>>  {
>> @@ -1742,23 +1756,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)
>>  {
>> @@ -1791,8 +1788,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;
>
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list