xdg-shell: don't return anything from create_xdg_surface()

This commit is contained in:
Kirill Primak 2023-07-26 10:57:02 +03:00 committed by Simon Ser
parent ce615a44c0
commit f0cc712af1
2 changed files with 5 additions and 9 deletions

View File

@ -8,8 +8,7 @@
extern const struct wlr_surface_role xdg_toplevel_surface_role; extern const struct wlr_surface_role xdg_toplevel_surface_role;
extern const struct wlr_surface_role xdg_popup_surface_role; extern const struct wlr_surface_role xdg_popup_surface_role;
struct wlr_xdg_surface *create_xdg_surface( void create_xdg_surface(struct wlr_xdg_client *client, struct wlr_surface *wlr_surface,
struct wlr_xdg_client *client, struct wlr_surface *wlr_surface,
uint32_t id); uint32_t id);
void destroy_xdg_surface(struct wlr_xdg_surface *surface); void destroy_xdg_surface(struct wlr_xdg_surface *surface);
void destroy_xdg_surface_role_object(struct wlr_xdg_surface *surface); void destroy_xdg_surface_role_object(struct wlr_xdg_surface *surface);

View File

@ -326,14 +326,13 @@ void xdg_surface_role_destroy(struct wlr_surface *wlr_surface) {
free(surface); free(surface);
} }
struct wlr_xdg_surface *create_xdg_surface( void create_xdg_surface(struct wlr_xdg_client *client, struct wlr_surface *wlr_surface,
struct wlr_xdg_client *client, struct wlr_surface *wlr_surface,
uint32_t id) { uint32_t id) {
struct wlr_xdg_surface *surface = struct wlr_xdg_surface *surface =
calloc(1, sizeof(struct wlr_xdg_surface)); calloc(1, sizeof(struct wlr_xdg_surface));
if (surface == NULL) { if (surface == NULL) {
wl_client_post_no_memory(client->client); wl_client_post_no_memory(client->client);
return NULL; return;
} }
surface->client = client; surface->client = client;
@ -345,7 +344,7 @@ struct wlr_xdg_surface *create_xdg_surface(
if (surface->resource == NULL) { if (surface->resource == NULL) {
free(surface); free(surface);
wl_client_post_no_memory(client->client); wl_client_post_no_memory(client->client);
return NULL; return;
} }
if (wlr_surface_has_buffer(surface->surface)) { if (wlr_surface_has_buffer(surface->surface)) {
@ -354,7 +353,7 @@ struct wlr_xdg_surface *create_xdg_surface(
wl_resource_post_error(client->resource, wl_resource_post_error(client->resource,
XDG_SURFACE_ERROR_UNCONFIGURED_BUFFER, XDG_SURFACE_ERROR_UNCONFIGURED_BUFFER,
"xdg_surface must not have a buffer at creation"); "xdg_surface must not have a buffer at creation");
return NULL; return;
} }
wl_list_init(&surface->configure_list); wl_list_init(&surface->configure_list);
@ -376,8 +375,6 @@ struct wlr_xdg_surface *create_xdg_surface(
&xdg_surface_implementation, surface, &xdg_surface_implementation, surface,
xdg_surface_handle_resource_destroy); xdg_surface_handle_resource_destroy);
wl_list_insert(&client->surfaces, &surface->link); wl_list_insert(&client->surfaces, &surface->link);
return surface;
} }
void destroy_xdg_surface_role_object(struct wlr_xdg_surface *surface) { void destroy_xdg_surface_role_object(struct wlr_xdg_surface *surface) {