Lines Matching refs:client
121 struct wl_client *client; member
140 struct wl_display *display = resource->client->display; in log_closure()
174 resource->client->error = 1; in wl_resource_post_event_array()
178 if (wl_closure_send(closure, resource->client->connection)) in wl_resource_post_event_array()
179 resource->client->error = 1; in wl_resource_post_event_array()
213 resource->client->error = 1; in wl_resource_queue_event_array()
217 if (wl_closure_queue(closure, resource->client->connection)) in wl_resource_queue_event_array()
218 resource->client->error = 1; in wl_resource_queue_event_array()
244 struct wl_client *client = resource->client; in wl_resource_post_error() local
252 client->error = 1; in wl_resource_post_error()
261 if (!client->display_resource) in wl_resource_post_error()
264 wl_resource_post_event(client->display_resource, in wl_resource_post_error()
271 struct wl_client *client = data; in wl_client_connection_data() local
272 struct wl_connection *connection = client->connection; in wl_client_connection_data()
283 wl_client_destroy(client); in wl_client_connection_data()
290 wl_client_destroy(client); in wl_client_connection_data()
293 wl_event_source_fd_update(client->source, in wl_client_connection_data()
302 wl_client_destroy(client); in wl_client_connection_data()
314 resource = wl_map_lookup(&client->objects, p[0]); in wl_client_connection_data()
315 resource_flags = wl_map_lookup_flags(&client->objects, p[0]); in wl_client_connection_data()
317 wl_resource_post_error(client->display_resource, in wl_client_connection_data()
325 wl_resource_post_error(client->display_resource, in wl_client_connection_data()
338 wl_resource_post_error(client->display_resource, in wl_client_connection_data()
349 closure = wl_connection_demarshal(client->connection, size, in wl_client_connection_data()
350 &client->objects, message); in wl_client_connection_data()
356 wl_closure_lookup_objects(closure, &client->objects) < 0) { in wl_client_connection_data()
357 wl_resource_post_error(client->display_resource, in wl_client_connection_data()
372 object, opcode, client); in wl_client_connection_data()
380 if (client->error) in wl_client_connection_data()
386 if (client->error) in wl_client_connection_data()
387 wl_client_destroy(client); in wl_client_connection_data()
404 wl_client_flush(struct wl_client *client) in wl_client_flush() argument
406 wl_connection_flush(client->connection); in wl_client_flush()
417 wl_client_get_display(struct wl_client *client) in wl_client_get_display() argument
419 return client->display; in wl_client_get_display()
423 bind_display(struct wl_client *client, struct wl_display *display);
453 struct wl_client *client; in wl_client_create() local
456 client = zalloc(sizeof *client); in wl_client_create()
457 if (client == NULL) in wl_client_create()
460 wl_signal_init(&client->resource_created_signal); in wl_client_create()
461 client->display = display; in wl_client_create()
462 client->source = wl_event_loop_add_fd(display->loop, fd, in wl_client_create()
464 wl_client_connection_data, client); in wl_client_create()
466 if (!client->source) in wl_client_create()
469 len = sizeof client->ucred; in wl_client_create()
471 &client->ucred, &len) < 0) in wl_client_create()
474 client->connection = wl_connection_create(fd); in wl_client_create()
475 if (client->connection == NULL) in wl_client_create()
478 wl_map_init(&client->objects, WL_MAP_SERVER_SIDE); in wl_client_create()
480 if (wl_map_insert_at(&client->objects, 0, 0, NULL) < 0) in wl_client_create()
483 wl_signal_init(&client->destroy_signal); in wl_client_create()
484 if (bind_display(client, display) < 0) in wl_client_create()
487 wl_list_insert(display->client_list.prev, &client->link); in wl_client_create()
489 wl_signal_emit(&display->create_client_signal, client); in wl_client_create()
491 return client; in wl_client_create()
494 wl_map_release(&client->objects); in wl_client_create()
495 wl_connection_destroy(client->connection); in wl_client_create()
497 wl_event_source_remove(client->source); in wl_client_create()
499 free(client); in wl_client_create()
523 wl_client_get_credentials(struct wl_client *client, in wl_client_get_credentials() argument
527 *pid = client->ucred.pid; in wl_client_get_credentials()
529 *uid = client->ucred.uid; in wl_client_get_credentials()
531 *gid = client->ucred.gid; in wl_client_get_credentials()
564 wl_client_get_fd(struct wl_client *client) in wl_client_get_fd() argument
566 return wl_connection_get_fd(client->connection); in wl_client_get_fd()
581 wl_client_get_object(struct wl_client *client, uint32_t id) in wl_client_get_object() argument
583 return wl_map_lookup(&client->objects, id); in wl_client_get_object()
587 wl_client_post_no_memory(struct wl_client *client) in wl_client_post_no_memory() argument
589 wl_resource_post_error(client->display_resource, in wl_client_post_no_memory()
596 wl_resource_post_error(resource->client->display_resource, in wl_resource_post_no_memory()
604 struct wl_client *client = resource->client; in destroy_resource() local
609 flags = wl_map_lookup_flags(&client->objects, resource->object.id); in destroy_resource()
622 struct wl_client *client = resource->client; in wl_resource_destroy() local
629 if (client->display_resource) { in wl_resource_destroy()
630 wl_resource_queue_event(client->display_resource, in wl_resource_destroy()
633 wl_map_insert_at(&client->objects, 0, id, NULL); in wl_resource_destroy()
635 wl_map_remove(&client->objects, id); in wl_resource_destroy()
660 wl_resource_find_for_client(struct wl_list *list, struct wl_client *client) in wl_resource_find_for_client() argument
664 if (client == NULL) in wl_resource_find_for_client()
668 if (resource->client == client) in wl_resource_find_for_client()
678 return resource->client; in wl_resource_get_client()
742 wl_client_add_destroy_listener(struct wl_client *client, in wl_client_add_destroy_listener() argument
745 wl_signal_add(&client->destroy_signal, listener); in wl_client_add_destroy_listener()
749 wl_client_get_destroy_listener(struct wl_client *client, in wl_client_get_destroy_listener() argument
752 return wl_signal_get(&client->destroy_signal, notify); in wl_client_get_destroy_listener()
756 wl_client_destroy(struct wl_client *client) in wl_client_destroy() argument
760 wl_signal_emit(&client->destroy_signal, client); in wl_client_destroy()
762 wl_client_flush(client); in wl_client_destroy()
763 wl_map_for_each(&client->objects, destroy_resource, &serial); in wl_client_destroy()
764 wl_map_release(&client->objects); in wl_client_destroy()
765 wl_event_source_remove(client->source); in wl_client_destroy()
766 close(wl_connection_destroy(client->connection)); in wl_client_destroy()
767 wl_list_remove(&client->link); in wl_client_destroy()
768 wl_list_remove(&client->resource_created_signal.listener_list); in wl_client_destroy()
769 free(client); in wl_client_destroy()
773 registry_bind(struct wl_client *client, in registry_bind() argument
799 global->bind(client, global->data, version, id); in registry_bind()
807 display_sync(struct wl_client *client, in display_sync() argument
813 callback = wl_resource_create(client, &wl_callback_interface, 1, id); in display_sync()
815 wl_client_post_no_memory(client); in display_sync()
819 serial = wl_display_get_serial(client->display); in display_sync()
831 display_get_registry(struct wl_client *client, in display_get_registry() argument
839 wl_resource_create(client, &wl_registry_interface, 1, id); in display_get_registry()
841 wl_client_post_no_memory(client); in display_get_registry()
868 resource->client->display_resource = NULL; in destroy_client_display_resource()
872 bind_display(struct wl_client *client, struct wl_display *display) in bind_display() argument
874 client->display_resource = in bind_display()
875 wl_resource_create(client, &wl_display_interface, 1, 1); in bind_display()
876 if (client->display_resource == NULL) { in bind_display()
882 wl_resource_set_implementation(client->display_resource, in bind_display()
1117 struct wl_client *client, *next; in wl_display_flush_clients() local
1120 wl_list_for_each_safe(client, next, &display->client_list, link) { in wl_display_flush_clients()
1121 ret = wl_connection_flush(client->connection); in wl_display_flush_clients()
1123 wl_event_source_fd_update(client->source, in wl_display_flush_clients()
1127 wl_client_destroy(client); in wl_display_flush_clients()
1476 wl_resource_create(struct wl_client *client, in wl_resource_create() argument
1487 id = wl_map_insert_new(&client->objects, 0, NULL); in wl_resource_create()
1496 resource->client = client; in wl_resource_create()
1501 if (wl_map_insert_at(&client->objects, 0, id, resource) < 0) { in wl_resource_create()
1502 wl_resource_post_error(client->display_resource, in wl_resource_create()
1509 wl_signal_emit(&client->resource_created_signal, resource); in wl_resource_create()
1662 wl_client_get_link(struct wl_client *client) in wl_client_get_link() argument
1664 return &client->link; in wl_client_get_link()
1694 wl_client_add_resource_created_listener(struct wl_client *client, in wl_client_add_resource_created_listener() argument
1697 wl_signal_add(&client->resource_created_signal, listener); in wl_client_add_resource_created_listener()
1734 wl_client_for_each_resource(struct wl_client *client, in wl_client_for_each_resource() argument
1743 wl_map_for_each(&client->objects, resource_iterator_helper, &context); in wl_client_for_each_resource()
1749 wl_client_add_resource(struct wl_client *client,
1753 wl_client_add_resource(struct wl_client *client, in wl_client_add_resource() argument
1758 wl_map_insert_new(&client->objects, in wl_client_add_resource()
1760 } else if (wl_map_insert_at(&client->objects, WL_MAP_ENTRY_LEGACY, in wl_client_add_resource()
1762 wl_resource_post_error(client->display_resource, in wl_client_add_resource()
1769 resource->client = client; in wl_client_add_resource()
1776 wl_client_add_object(struct wl_client *client,
1782 wl_client_add_object(struct wl_client *client, in wl_client_add_object() argument
1788 resource = wl_resource_create(client, interface, -1, id); in wl_client_add_object()
1790 wl_client_post_no_memory(client); in wl_client_add_object()
1799 wl_client_new_object(struct wl_client *client,
1804 wl_client_new_object(struct wl_client *client, in wl_client_new_object() argument
1810 resource = wl_resource_create(client, interface, -1, 0); in wl_client_new_object()
1812 wl_client_post_no_memory(client); in wl_client_new_object()