From a326934ecaf6c89c933a655d06ab44fd4dcbf800 Mon Sep 17 00:00:00 2001 From: Seunghun Lee Date: Thu, 13 Jun 2024 12:30:12 +0900 Subject: [PATCH] compositor: Add destroy signal of E_Surface As a thin wrapper of ds_surface, E_Surface is bound to ds_surface. That is, E_Surface become inert if ds_surface is destroyed. E_Surface should be separated from the life cycle of E_Client, but it's hard to do it for now because E_Surface is tightly coupled with E_Client - It provides many functionalities related to comp_data member variable of E_Client. So, let the destroy signal of E_Surface emit when the destroy signal of ds_surface is emitted. Change-Id: Ie5cf65a20c9765e78b8d1caecfd20883b464357f --- src/bin/server/e_compositor.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/bin/server/e_compositor.c b/src/bin/server/e_compositor.c index 4c49f7c..9cdc120 100644 --- a/src/bin/server/e_compositor.c +++ b/src/bin/server/e_compositor.c @@ -46,6 +46,7 @@ struct _E_Surface struct { + struct wl_signal destroy; struct wl_signal parent_destroy; } events; }; @@ -265,13 +266,13 @@ e_surface_from_resource(struct wl_resource *surface_resource) EINTERN void e_surface_destroy_listener_add(E_Surface *surface, struct wl_listener *listener) { - wl_signal_add(&surface->base.destroy_signal, listener); + wl_signal_add(&surface->events.destroy, listener); } EINTERN struct wl_listener * e_surface_destroy_listener_get(E_Surface *surface, wl_notify_func_t notify) { - return wl_signal_get(&surface->base.destroy_signal, notify); + return wl_signal_get(&surface->events.destroy, notify); } EINTERN void @@ -659,6 +660,7 @@ _e_surface_create(E_Client *ec) e_object_ref(E_OBJECT(ec)); surface->ec = ec; + wl_signal_init(&surface->events.destroy); wl_signal_init(&surface->events.parent_destroy); wl_signal_init(&surface->base.destroy_signal); wl_signal_init(&surface->base.apply_viewport_signal); @@ -1230,11 +1232,7 @@ _e_surface_cb_destroy(struct wl_listener *listener, void *data) surface = wl_container_of(listener, surface, destroy); - if (surface->surface_viewport) - { - ds_surface_viewport_release(surface->surface_viewport); - surface->surface_viewport = NULL; - } + wl_signal_emit(&surface->events.destroy, surface); wl_list_remove(&surface->destroy.link); wl_list_remove(&surface->commit.link); -- 2.7.4