Lines Matching full:client
135 struct wl_client *client; member
155 struct wl_display *display = resource->client->display; in log_closure()
195 if (res && res->client != resource->client) { in verify_objects()
198 "client in a '%s.%s' for a different " in verify_objects()
199 "client.\n", object->interface->name, in verify_objects()
216 if (resource->client->error) in handle_array()
220 resource->client->error = 1; in handle_array()
228 resource->client->error = 1; in handle_array()
234 if (send_func(closure, resource->client->connection)) in handle_array()
235 resource->client->error = 1; in handle_array()
289 struct wl_client *client = resource->client; in wl_resource_post_error_vargs() local
295 * When a client aborts, its resources are destroyed in id order, in wl_resource_post_error_vargs()
299 * already dead client. in wl_resource_post_error_vargs()
301 if (client->error || !client->display_resource) in wl_resource_post_error_vargs()
304 wl_resource_post_event(client->display_resource, in wl_resource_post_error_vargs()
306 client->error = 1; in wl_resource_post_error_vargs()
322 destroy_client_with_error(struct wl_client *client, const char *reason) in destroy_client_with_error() argument
324 wl_log("%s (pid %u)\n", reason, client->pid); in destroy_client_with_error()
325 wl_client_destroy(client); in destroy_client_with_error()
331 struct wl_client *client = data; in wl_client_connection_data() local
332 struct wl_connection *connection = client->connection; in wl_client_connection_data()
343 wl_client_destroy(client); in wl_client_connection_data()
348 destroy_client_with_error(client, "socket error"); in wl_client_connection_data()
356 client, "failed to flush client connection"); in wl_client_connection_data()
359 wl_event_source_fd_update(client->source, in wl_client_connection_data()
369 client, "failed to read client connection"); in wl_client_connection_data()
381 resource = wl_map_lookup(&client->objects, p[0]); in wl_client_connection_data()
382 resource_flags = wl_map_lookup_flags(&client->objects, p[0]); in wl_client_connection_data()
384 wl_resource_post_error(client->display_resource, in wl_client_connection_data()
392 wl_resource_post_error(client->display_resource, in wl_client_connection_data()
405 wl_resource_post_error(client->display_resource, in wl_client_connection_data()
416 closure = wl_connection_demarshal(client->connection, size, in wl_client_connection_data()
417 &client->objects, message); in wl_client_connection_data()
423 wl_closure_lookup_objects(closure, &client->objects) < 0) { in wl_client_connection_data()
424 wl_resource_post_error(client->display_resource, in wl_client_connection_data()
439 object, opcode, client); in wl_client_connection_data()
447 if (client->error) in wl_client_connection_data()
453 if (client->error) { in wl_client_connection_data()
454 destroy_client_with_error(client, in wl_client_connection_data()
455 "error in client communication"); in wl_client_connection_data()
461 /** Flush pending events to the client
463 * \param client The client object
468 * flushes all queued up events for a client immediately.
473 wl_client_flush(struct wl_client *client) in wl_client_flush() argument
475 wl_connection_flush(client->connection); in wl_client_flush()
478 /** Get the display object for the given client
480 * \param client The client object
481 * \return The display object the client is associated with.
486 wl_client_get_display(struct wl_client *client) in wl_client_get_display() argument
488 return client->display; in wl_client_get_display()
492 bind_display(struct wl_client *client, struct wl_display *display);
494 /** Create a client for the given file descriptor
497 * \param fd The file descriptor for the socket to the client
498 * \return The new client object or NULL on failure.
501 * function will create a wl_client struct and add the new client to
502 * the compositors client list. At that point, the client is
503 * initialized and ready to run, as if the client had connected to the
504 * servers listening socket. When the client eventually sends
509 * wl_display_connect_to_fd() on the client side or used with the
510 * WAYLAND_SOCKET environment variable on the client side.
513 * be notified by this function after the client is fully constructed.
522 struct wl_client *client; in wl_client_create() local
524 client = zalloc(sizeof *client); in wl_client_create()
525 if (client == NULL) in wl_client_create()
528 wl_priv_signal_init(&client->resource_created_signal); in wl_client_create()
529 client->display = display; in wl_client_create()
530 client->source = wl_event_loop_add_fd(display->loop, fd, in wl_client_create()
532 wl_client_connection_data, client); in wl_client_create()
534 if (!client->source) in wl_client_create()
537 if (wl_os_socket_peercred(fd, &client->uid, &client->gid, in wl_client_create()
538 &client->pid) != 0) in wl_client_create()
541 client->connection = wl_connection_create(fd); in wl_client_create()
542 if (client->connection == NULL) in wl_client_create()
545 wl_map_init(&client->objects, WL_MAP_SERVER_SIDE); in wl_client_create()
547 if (wl_map_insert_at(&client->objects, 0, 0, NULL) < 0) in wl_client_create()
550 wl_priv_signal_init(&client->destroy_signal); in wl_client_create()
551 wl_priv_signal_init(&client->destroy_late_signal); in wl_client_create()
552 if (bind_display(client, display) < 0) in wl_client_create()
555 wl_list_insert(display->client_list.prev, &client->link); in wl_client_create()
557 wl_priv_signal_emit(&display->create_client_signal, client); in wl_client_create()
559 return client; in wl_client_create()
562 wl_map_release(&client->objects); in wl_client_create()
563 wl_connection_destroy(client->connection); in wl_client_create()
565 wl_event_source_remove(client->source); in wl_client_create()
567 free(client); in wl_client_create()
571 /** Return Unix credentials for the client
573 * \param client The display object
579 * for the given client. The credentials come from getsockopt() with
580 * SO_PEERCRED, on the client socket fd. All the pointers can be
584 * to identify a client.
594 wl_client_get_credentials(struct wl_client *client, in wl_client_get_credentials() argument
598 *pid = client->pid; in wl_client_get_credentials()
600 *uid = client->uid; in wl_client_get_credentials()
602 *gid = client->gid; in wl_client_get_credentials()
605 /** Get the file descriptor for the client
607 * \param client The display object
610 * This function returns the file descriptor for the given client.
612 * Be sure to use the file descriptor from the client for inspection only.
620 * If you would like to distinguish just between the client and the compositor
621 * itself from the client's request, it can be done by getting the client
622 * credentials and by checking the PID of the client and the compositor's PID.
627 * a client if there are additional information provided from the client's
629 * from the client's file descriptor. The compositor can validate the client's
635 wl_client_get_fd(struct wl_client *client) in wl_client_get_fd() argument
637 return wl_connection_get_fd(client->connection); in wl_client_get_fd()
640 /** Look up an object in the client name space
642 * \param client The client object
646 * This looks up an object in the client object name space by its
652 wl_client_get_object(struct wl_client *client, uint32_t id) in wl_client_get_object() argument
654 return wl_map_lookup(&client->objects, id); in wl_client_get_object()
658 wl_client_post_no_memory(struct wl_client *client) in wl_client_post_no_memory() argument
660 wl_resource_post_error(client->display_resource, in wl_client_post_no_memory()
666 * \param client The client object
671 * the client.
676 wl_client_post_implementation_error(struct wl_client *client, in wl_client_post_implementation_error() argument
682 wl_resource_post_error_vargs(client->display_resource, in wl_client_post_implementation_error()
691 wl_resource_post_error(resource->client->display_resource, in wl_resource_post_no_memory()
710 struct wl_map *map = &resource->client->objects; in resource_is_deprecated()
743 struct wl_client *client = resource->client; in wl_resource_destroy() local
748 flags = wl_map_lookup_flags(&client->objects, id); in wl_resource_destroy()
752 if (client->display_resource) { in wl_resource_destroy()
753 wl_resource_queue_event(client->display_resource, in wl_resource_destroy()
756 wl_map_insert_at(&client->objects, 0, id, NULL); in wl_resource_destroy()
758 wl_map_remove(&client->objects, id); in wl_resource_destroy()
783 wl_resource_find_for_client(struct wl_list *list, struct wl_client *client) in wl_resource_find_for_client() argument
787 if (client == NULL) in wl_resource_find_for_client()
791 if (resource->client == client) in wl_resource_find_for_client()
801 return resource->client; in wl_resource_get_client()
895 * before any of that client's resources have been destroyed.
903 wl_client_add_destroy_listener(struct wl_client *client, in wl_client_add_destroy_listener() argument
906 wl_priv_signal_add(&client->destroy_signal, listener); in wl_client_add_destroy_listener()
910 wl_client_get_destroy_listener(struct wl_client *client, in wl_client_get_destroy_listener() argument
913 return wl_priv_signal_get(&client->destroy_signal, notify); in wl_client_get_destroy_listener()
920 * complete, after all of that client's resources have been destroyed.
929 wl_client_add_destroy_late_listener(struct wl_client *client, in wl_client_add_destroy_late_listener() argument
932 wl_priv_signal_add(&client->destroy_late_signal, listener); in wl_client_add_destroy_late_listener()
936 wl_client_get_destroy_late_listener(struct wl_client *client, in wl_client_get_destroy_late_listener() argument
939 return wl_priv_signal_get(&client->destroy_late_signal, notify); in wl_client_get_destroy_late_listener()
943 wl_client_destroy(struct wl_client *client) in wl_client_destroy() argument
947 wl_priv_signal_final_emit(&client->destroy_signal, client); in wl_client_destroy()
949 wl_client_flush(client); in wl_client_destroy()
950 wl_map_for_each(&client->objects, destroy_resource, &serial); in wl_client_destroy()
951 wl_map_release(&client->objects); in wl_client_destroy()
952 wl_event_source_remove(client->source); in wl_client_destroy()
953 close(wl_connection_destroy(client->connection)); in wl_client_destroy()
955 wl_priv_signal_final_emit(&client->destroy_late_signal, client); in wl_client_destroy()
957 wl_list_remove(&client->link); in wl_client_destroy()
958 wl_list_remove(&client->resource_created_signal.listener_list); in wl_client_destroy()
959 free(client); in wl_client_destroy()
968 wl_global_is_visible(const struct wl_client *client, in wl_global_is_visible() argument
971 struct wl_display *display = client->display; in wl_global_is_visible()
974 display->global_filter(client, global, display->global_filter_data)); in wl_global_is_visible()
978 registry_bind(struct wl_client *client, in registry_bind() argument
1009 else if (!wl_global_is_visible(client, global)) in registry_bind()
1014 global->bind(client, global->data, version, id); in registry_bind()
1022 display_sync(struct wl_client *client, in display_sync() argument
1028 callback = wl_resource_create(client, &wl_callback_interface, 1, id); in display_sync()
1030 wl_client_post_no_memory(client); in display_sync()
1034 serial = wl_display_get_serial(client->display); in display_sync()
1046 display_get_registry(struct wl_client *client, in display_get_registry() argument
1054 wl_resource_create(client, &wl_registry_interface, 1, id); in display_get_registry()
1056 wl_client_post_no_memory(client); in display_get_registry()
1068 if (wl_global_is_visible(client, global) && !global->removed) in display_get_registry()
1084 resource->client->display_resource = NULL; in destroy_client_display_resource()
1088 bind_display(struct wl_client *client, struct wl_display *display) in bind_display() argument
1090 client->display_resource = in bind_display()
1091 wl_resource_create(client, &wl_display_interface, 1, 1); in bind_display()
1092 if (client->display_resource == NULL) { in bind_display()
1093 /* DON'T send no-memory error to client - it has no in bind_display()
1098 wl_resource_set_implementation(client->display_resource, in bind_display()
1264 * given client, and during wl_global binding to determine whether
1265 * a given client should be allowed to bind to a global.
1273 * The filter should be installed before any client connects and should always
1274 * take the same decision given a client and a global. Not doing so will result
1329 if (wl_global_is_visible(resource->client, global)) in wl_global_create()
1372 if (wl_global_is_visible(resource->client, global)) in wl_global_remove()
1397 * \param client Client for which to look up the global.
1399 * client.
1406 const struct wl_client *client) in wl_global_get_name() argument
1408 return wl_global_is_visible(client, global) ? global->name : 0; in wl_global_get_name()
1522 struct wl_client *client, *next; in wl_display_flush_clients() local
1525 wl_list_for_each_safe(client, next, &display->client_list, link) { in wl_display_flush_clients()
1526 ret = wl_connection_flush(client->connection); in wl_display_flush_clients()
1528 wl_event_source_fd_update(client->source, in wl_display_flush_clients()
1532 wl_client_destroy(client); in wl_display_flush_clients()
1542 * all client resources are closed properly. Destroying a client from within
1552 struct wl_client *client; in wl_display_destroy_clients() local
1554 /* Move the whole client list to a temporary head because some new clients in wl_display_destroy_clients()
1560 /* wl_list_for_each_safe isn't enough here: it fails if the next client is in wl_display_destroy_clients()
1564 client = wl_container_of(pos, client, link); in wl_display_destroy_clients()
1566 wl_client_destroy(client); in wl_display_destroy_clients()
1866 /** Registers a listener for the client connection signal.
1867 * When a new client object is created, \a listener will be notified, carrying
1916 * \param client The client owner of the new resource.
1927 wl_resource_create(struct wl_client *client, in wl_resource_create() argument
1938 id = wl_map_insert_new(&client->objects, 0, NULL); in wl_resource_create()
1953 resource->client = client; in wl_resource_create()
1958 if (wl_map_insert_at(&client->objects, 0, id, resource) < 0) { in wl_resource_create()
1960 wl_resource_post_error(client->display_resource, in wl_resource_create()
1968 wl_priv_signal_emit(&client->resource_created_signal, resource); in wl_resource_create()
2042 * object advertises when a client binds to it. Adding a format to
2045 * compositor must be able to handle the pixel format when a client
2110 /** Get the link by which a client is inserted in the client list
2112 * \param client The client object
2121 wl_client_get_link(struct wl_client *client) in wl_client_get_link() argument
2123 return &client->link; in wl_client_get_link()
2139 struct wl_client *client; in wl_client_from_link() local
2141 return wl_container_of(link, client, link); in wl_client_from_link()
2144 /** Add a listener for the client's resource creation signal
2146 * \param client The client object
2149 * When a new resource is created for this client the listener
2155 wl_client_add_resource_created_listener(struct wl_client *client, in wl_client_add_resource_created_listener() argument
2158 wl_priv_signal_add(&client->resource_created_signal, listener); in wl_client_add_resource_created_listener()
2175 /** Iterate over all the resources of a client
2177 * \param client The client object
2182 * resource owned by the client. The \a user_data will be passed
2195 wl_client_for_each_resource(struct wl_client *client, in wl_client_for_each_resource() argument
2204 wl_map_for_each(&client->objects, resource_iterator_helper, &context); in wl_client_for_each_resource()
2408 wl_client_add_resource(struct wl_client *client,
2412 wl_client_add_resource(struct wl_client *client, in wl_client_add_resource() argument
2417 wl_map_insert_new(&client->objects, in wl_client_add_resource()
2421 } else if (wl_map_insert_at(&client->objects, WL_MAP_ENTRY_LEGACY, in wl_client_add_resource()
2424 wl_resource_post_error(client->display_resource, in wl_client_add_resource()
2432 resource->client = client; in wl_client_add_resource()
2439 wl_client_add_object(struct wl_client *client,
2445 wl_client_add_object(struct wl_client *client, in wl_client_add_object() argument
2451 resource = wl_resource_create(client, interface, -1, id); in wl_client_add_object()
2453 wl_client_post_no_memory(client); in wl_client_add_object()
2462 wl_client_new_object(struct wl_client *client,
2467 wl_client_new_object(struct wl_client *client, in wl_client_new_object() argument
2473 resource = wl_resource_create(client, interface, -1, 0); in wl_client_new_object()
2475 wl_client_post_no_memory(client); in wl_client_new_object()