diff options
author | Simon Ser <contact@emersion.fr> | 2021-06-29 13:41:47 +0200 |
---|---|---|
committer | Simon Zeni <simon@bl4ckb0ne.ca> | 2021-06-29 10:32:17 -0400 |
commit | 7cbcc65ad00e195a821cf955dd2302b6b0ec1bf0 (patch) | |
tree | 036170a8658c0a562a32f7e85a15a7f8d02180bc | |
parent | ddc98bf5935e57df028269fabbb588767710a184 (diff) |
surface: make wlr_subsurface_create private
Same as [1], but for wlr_subsurface.
[1]: https://github.com/swaywm/wlroots/pull/2814
-rw-r--r-- | include/types/wlr_surface.h | 6 | ||||
-rw-r--r-- | include/wlr/types/wlr_surface.h | 8 | ||||
-rw-r--r-- | types/wlr_compositor.c | 3 | ||||
-rw-r--r-- | types/wlr_surface.c | 19 |
4 files changed, 10 insertions, 26 deletions
diff --git a/include/types/wlr_surface.h b/include/types/wlr_surface.h index bc30d2c9..b8c7d02d 100644 --- a/include/types/wlr_surface.h +++ b/include/types/wlr_surface.h @@ -11,4 +11,10 @@ struct wlr_renderer; struct wlr_surface *surface_create(struct wl_client *client, uint32_t version, uint32_t id, struct wlr_renderer *renderer); +/** + * Create a new subsurface resource with the provided new ID. + */ +struct wlr_subsurface *subsurface_create(struct wlr_surface *surface, + struct wlr_surface *parent, uint32_t version, uint32_t id); + #endif diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h index 00db6cd8..72dc4b30 100644 --- a/include/wlr/types/wlr_surface.h +++ b/include/wlr/types/wlr_surface.h @@ -214,14 +214,6 @@ bool wlr_surface_has_buffer(struct wlr_surface *surface); struct wlr_texture *wlr_surface_get_texture(struct wlr_surface *surface); /** - * Create a new subsurface resource with the provided new ID. If `resource_list` - * is non-NULL, adds the subsurface's resource to the list. - */ -struct wlr_subsurface *wlr_subsurface_create(struct wlr_surface *surface, - struct wlr_surface *parent, uint32_t version, uint32_t id, - struct wl_list *resource_list); - -/** * Get the root of the subsurface tree for this surface. Can return NULL if * a surface in the tree has been destroyed. */ diff --git a/types/wlr_compositor.c b/types/wlr_compositor.c index 22f0cd32..7ad68454 100644 --- a/types/wlr_compositor.c +++ b/types/wlr_compositor.c @@ -67,8 +67,7 @@ static void subcompositor_handle_get_subsurface(struct wl_client *client, return; } - wlr_subsurface_create(surface, parent, wl_resource_get_version(resource), - id, NULL); + subsurface_create(surface, parent, wl_resource_get_version(resource), id); } static const struct wl_subcompositor_interface subcompositor_impl = { diff --git a/types/wlr_surface.c b/types/wlr_surface.c index 8f863733..969645eb 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -15,7 +15,6 @@ #include "util/time.h" #define CALLBACK_VERSION 1 -#define SUBSURFACE_VERSION 1 static int min(int fst, int snd) { if (fst < snd) { @@ -860,7 +859,6 @@ static struct wlr_subsurface *subsurface_from_resource( static void subsurface_resource_destroy(struct wl_resource *resource) { struct wlr_subsurface *subsurface = subsurface_from_resource(resource); - wl_list_remove(wl_resource_get_link(resource)); subsurface_destroy(subsurface); } @@ -1133,11 +1131,8 @@ static void subsurface_handle_surface_destroy(struct wl_listener *listener, subsurface_destroy(subsurface); } -struct wlr_subsurface *wlr_subsurface_create(struct wlr_surface *surface, - struct wlr_surface *parent, uint32_t version, uint32_t id, - struct wl_list *resource_list) { - assert(version <= SUBSURFACE_VERSION); - +struct wlr_subsurface *subsurface_create(struct wlr_surface *surface, + struct wlr_surface *parent, uint32_t version, uint32_t id) { struct wl_client *client = wl_resource_get_client(surface->resource); struct wlr_subsurface *subsurface = @@ -1156,8 +1151,7 @@ struct wlr_subsurface *wlr_subsurface_create(struct wlr_surface *surface, return NULL; } wl_resource_set_implementation(subsurface->resource, - &subsurface_implementation, subsurface, - subsurface_resource_destroy); + &subsurface_implementation, subsurface, subsurface_resource_destroy); wl_signal_init(&subsurface->events.destroy); wl_signal_init(&subsurface->events.map); @@ -1176,13 +1170,6 @@ struct wlr_subsurface *wlr_subsurface_create(struct wlr_surface *surface, surface->role_data = subsurface; - struct wl_list *resource_link = wl_resource_get_link(subsurface->resource); - if (resource_list != NULL) { - wl_list_insert(resource_list, resource_link); - } else { - wl_list_init(resource_link); - } - wlr_signal_emit_safe(&parent->events.new_subsurface, subsurface); return subsurface; |