Lines Matching refs:client
129 struct wl_client *client; member
149 struct wl_display *display = resource->client->display; in log_closure()
189 if (res && res->client != resource->client) { in verify_objects()
210 if (resource->client->error) in handle_array()
214 resource->client->error = 1; in handle_array()
222 resource->client->error = 1; in handle_array()
228 if (send_func(closure, resource->client->connection)) in handle_array()
229 resource->client->error = 1; in handle_array()
283 struct wl_client *client = resource->client; in wl_resource_post_error_vargs() local
295 if (client->error || !client->display_resource) in wl_resource_post_error_vargs()
298 wl_resource_post_event(client->display_resource, in wl_resource_post_error_vargs()
300 client->error = 1; in wl_resource_post_error_vargs()
316 destroy_client_with_error(struct wl_client *client, const char *reason) in destroy_client_with_error() argument
318 wl_log("%s (pid %u)\n", reason, client->ucred.pid); in destroy_client_with_error()
319 wl_client_destroy(client); in destroy_client_with_error()
325 struct wl_client *client = data; in wl_client_connection_data() local
326 struct wl_connection *connection = client->connection; in wl_client_connection_data()
337 wl_client_destroy(client); in wl_client_connection_data()
342 destroy_client_with_error(client, "socket error"); in wl_client_connection_data()
350 client, "failed to flush client connection"); in wl_client_connection_data()
353 wl_event_source_fd_update(client->source, in wl_client_connection_data()
363 client, "failed to read client connection"); in wl_client_connection_data()
375 resource = wl_map_lookup(&client->objects, p[0]); in wl_client_connection_data()
376 resource_flags = wl_map_lookup_flags(&client->objects, p[0]); in wl_client_connection_data()
378 wl_resource_post_error(client->display_resource, in wl_client_connection_data()
386 wl_resource_post_error(client->display_resource, in wl_client_connection_data()
399 wl_resource_post_error(client->display_resource, in wl_client_connection_data()
410 closure = wl_connection_demarshal(client->connection, size, in wl_client_connection_data()
411 &client->objects, message); in wl_client_connection_data()
417 wl_closure_lookup_objects(closure, &client->objects) < 0) { in wl_client_connection_data()
418 wl_resource_post_error(client->display_resource, in wl_client_connection_data()
433 object, opcode, client); in wl_client_connection_data()
441 if (client->error) in wl_client_connection_data()
447 if (client->error) { in wl_client_connection_data()
448 destroy_client_with_error(client, in wl_client_connection_data()
467 wl_client_flush(struct wl_client *client) in wl_client_flush() argument
469 wl_connection_flush(client->connection); in wl_client_flush()
480 wl_client_get_display(struct wl_client *client) in wl_client_get_display() argument
482 return client->display; in wl_client_get_display()
486 bind_display(struct wl_client *client, struct wl_display *display);
516 struct wl_client *client; in wl_client_create() local
519 client = zalloc(sizeof *client); in wl_client_create()
520 if (client == NULL) in wl_client_create()
523 wl_priv_signal_init(&client->resource_created_signal); in wl_client_create()
524 client->display = display; in wl_client_create()
525 client->source = wl_event_loop_add_fd(display->loop, fd, in wl_client_create()
527 wl_client_connection_data, client); in wl_client_create()
529 if (!client->source) in wl_client_create()
532 len = sizeof client->ucred; in wl_client_create()
534 &client->ucred, &len) < 0) in wl_client_create()
537 client->connection = wl_connection_create(fd); in wl_client_create()
538 if (client->connection == NULL) in wl_client_create()
541 wl_map_init(&client->objects, WL_MAP_SERVER_SIDE); in wl_client_create()
543 if (wl_map_insert_at(&client->objects, 0, 0, NULL) < 0) in wl_client_create()
546 wl_priv_signal_init(&client->destroy_signal); in wl_client_create()
547 if (bind_display(client, display) < 0) in wl_client_create()
550 wl_list_insert(display->client_list.prev, &client->link); in wl_client_create()
552 wl_priv_signal_emit(&display->create_client_signal, client); in wl_client_create()
554 return client; in wl_client_create()
557 wl_map_release(&client->objects); in wl_client_create()
558 wl_connection_destroy(client->connection); in wl_client_create()
560 wl_event_source_remove(client->source); in wl_client_create()
562 free(client); in wl_client_create()
586 wl_client_get_credentials(struct wl_client *client, in wl_client_get_credentials() argument
590 *pid = client->ucred.pid; in wl_client_get_credentials()
592 *uid = client->ucred.uid; in wl_client_get_credentials()
594 *gid = client->ucred.gid; in wl_client_get_credentials()
627 wl_client_get_fd(struct wl_client *client) in wl_client_get_fd() argument
629 return wl_connection_get_fd(client->connection); in wl_client_get_fd()
644 wl_client_get_object(struct wl_client *client, uint32_t id) in wl_client_get_object() argument
646 return wl_map_lookup(&client->objects, id); in wl_client_get_object()
650 wl_client_post_no_memory(struct wl_client *client) in wl_client_post_no_memory() argument
652 wl_resource_post_error(client->display_resource, in wl_client_post_no_memory()
668 wl_client_post_implementation_error(struct wl_client *client, in wl_client_post_implementation_error() argument
674 wl_resource_post_error_vargs(client->display_resource, in wl_client_post_implementation_error()
683 wl_resource_post_error(resource->client->display_resource, in wl_resource_post_no_memory()
702 struct wl_map *map = &resource->client->objects; in resource_is_deprecated()
735 struct wl_client *client = resource->client; in wl_resource_destroy() local
740 flags = wl_map_lookup_flags(&client->objects, id); in wl_resource_destroy()
744 if (client->display_resource) { in wl_resource_destroy()
745 wl_resource_queue_event(client->display_resource, in wl_resource_destroy()
748 wl_map_insert_at(&client->objects, 0, id, NULL); in wl_resource_destroy()
750 wl_map_remove(&client->objects, id); in wl_resource_destroy()
775 wl_resource_find_for_client(struct wl_list *list, struct wl_client *client) in wl_resource_find_for_client() argument
779 if (client == NULL) in wl_resource_find_for_client()
783 if (resource->client == client) in wl_resource_find_for_client()
793 return resource->client; in wl_resource_get_client()
884 wl_client_add_destroy_listener(struct wl_client *client, in wl_client_add_destroy_listener() argument
887 wl_priv_signal_add(&client->destroy_signal, listener); in wl_client_add_destroy_listener()
891 wl_client_get_destroy_listener(struct wl_client *client, in wl_client_get_destroy_listener() argument
894 return wl_priv_signal_get(&client->destroy_signal, notify); in wl_client_get_destroy_listener()
898 wl_client_destroy(struct wl_client *client) in wl_client_destroy() argument
902 wl_priv_signal_final_emit(&client->destroy_signal, client); in wl_client_destroy()
904 wl_client_flush(client); in wl_client_destroy()
905 wl_map_for_each(&client->objects, destroy_resource, &serial); in wl_client_destroy()
906 wl_map_release(&client->objects); in wl_client_destroy()
907 wl_event_source_remove(client->source); in wl_client_destroy()
908 close(wl_connection_destroy(client->connection)); in wl_client_destroy()
909 wl_list_remove(&client->link); in wl_client_destroy()
910 wl_list_remove(&client->resource_created_signal.listener_list); in wl_client_destroy()
911 free(client); in wl_client_destroy()
920 wl_global_is_visible(const struct wl_client *client, in wl_global_is_visible() argument
923 struct wl_display *display = client->display; in wl_global_is_visible()
926 display->global_filter(client, global, display->global_filter_data)); in wl_global_is_visible()
930 registry_bind(struct wl_client *client, in registry_bind() argument
961 else if (!wl_global_is_visible(client, global)) in registry_bind()
966 global->bind(client, global->data, version, id); in registry_bind()
974 display_sync(struct wl_client *client, in display_sync() argument
980 callback = wl_resource_create(client, &wl_callback_interface, 1, id); in display_sync()
982 wl_client_post_no_memory(client); in display_sync()
986 serial = wl_display_get_serial(client->display); in display_sync()
998 display_get_registry(struct wl_client *client, in display_get_registry() argument
1006 wl_resource_create(client, &wl_registry_interface, 1, id); in display_get_registry()
1008 wl_client_post_no_memory(client); in display_get_registry()
1020 if (wl_global_is_visible(client, global) && !global->removed) in display_get_registry()
1036 resource->client->display_resource = NULL; in destroy_client_display_resource()
1040 bind_display(struct wl_client *client, struct wl_display *display) in bind_display() argument
1042 client->display_resource = in bind_display()
1043 wl_resource_create(client, &wl_display_interface, 1, 1); in bind_display()
1044 if (client->display_resource == NULL) { in bind_display()
1050 wl_resource_set_implementation(client->display_resource, in bind_display()
1380 struct wl_client *client, *next; in wl_display_flush_clients() local
1383 wl_list_for_each_safe(client, next, &display->client_list, link) { in wl_display_flush_clients()
1384 ret = wl_connection_flush(client->connection); in wl_display_flush_clients()
1386 wl_event_source_fd_update(client->source, in wl_display_flush_clients()
1390 wl_client_destroy(client); in wl_display_flush_clients()
1410 struct wl_client *client; in wl_display_destroy_clients() local
1422 client = wl_container_of(pos, client, link); in wl_display_destroy_clients()
1424 wl_client_destroy(client); in wl_display_destroy_clients()
1784 wl_resource_create(struct wl_client *client, in wl_resource_create() argument
1795 id = wl_map_insert_new(&client->objects, 0, NULL); in wl_resource_create()
1805 resource->client = client; in wl_resource_create()
1810 if (wl_map_insert_at(&client->objects, 0, id, resource) < 0) { in wl_resource_create()
1811 wl_resource_post_error(client->display_resource, in wl_resource_create()
1818 wl_priv_signal_emit(&client->resource_created_signal, resource); in wl_resource_create()
1971 wl_client_get_link(struct wl_client *client) in wl_client_get_link() argument
1973 return &client->link; in wl_client_get_link()
1989 struct wl_client *client; in wl_client_from_link() local
1991 return wl_container_of(link, client, link); in wl_client_from_link()
2005 wl_client_add_resource_created_listener(struct wl_client *client, in wl_client_add_resource_created_listener() argument
2008 wl_priv_signal_add(&client->resource_created_signal, listener); in wl_client_add_resource_created_listener()
2045 wl_client_for_each_resource(struct wl_client *client, in wl_client_for_each_resource() argument
2054 wl_map_for_each(&client->objects, resource_iterator_helper, &context); in wl_client_for_each_resource()
2195 wl_client_add_resource(struct wl_client *client,
2199 wl_client_add_resource(struct wl_client *client, in wl_client_add_resource() argument
2204 wl_map_insert_new(&client->objects, in wl_client_add_resource()
2206 } else if (wl_map_insert_at(&client->objects, WL_MAP_ENTRY_LEGACY, in wl_client_add_resource()
2208 wl_resource_post_error(client->display_resource, in wl_client_add_resource()
2215 resource->client = client; in wl_client_add_resource()
2222 wl_client_add_object(struct wl_client *client,
2228 wl_client_add_object(struct wl_client *client, in wl_client_add_object() argument
2234 resource = wl_resource_create(client, interface, -1, id); in wl_client_add_object()
2236 wl_client_post_no_memory(client); in wl_client_add_object()
2245 wl_client_new_object(struct wl_client *client,
2250 wl_client_new_object(struct wl_client *client, in wl_client_new_object() argument
2256 resource = wl_resource_create(client, interface, -1, 0); in wl_client_new_object()
2258 wl_client_post_no_memory(client); in wl_client_new_object()