@ -56,6 +56,7 @@ struct weston_desktop_wl_shell_surface {
bool added ;
bool added ;
struct weston_desktop_seat * popup_seat ;
struct weston_desktop_seat * popup_seat ;
enum weston_desktop_wl_shell_surface_state state ;
enum weston_desktop_wl_shell_surface_state state ;
struct wl_listener wl_surface_resource_destroy_listener ;
} ;
} ;
static void
static void
@ -185,6 +186,8 @@ weston_desktop_wl_shell_surface_destroy(struct weston_desktop_surface *dsurface,
{
{
struct weston_desktop_wl_shell_surface * surface = user_data ;
struct weston_desktop_wl_shell_surface * surface = user_data ;
wl_list_remove ( & surface - > wl_surface_resource_destroy_listener . link ) ;
weston_desktop_wl_shell_surface_maybe_ungrab ( surface ) ;
weston_desktop_wl_shell_surface_maybe_ungrab ( surface ) ;
weston_desktop_surface_unset_relative_to ( surface - > surface ) ;
weston_desktop_surface_unset_relative_to ( surface - > surface ) ;
if ( surface - > added )
if ( surface - > added )
@ -403,6 +406,19 @@ static const struct weston_desktop_surface_implementation weston_desktop_wl_shel
. destroy = weston_desktop_wl_shell_surface_destroy ,
. destroy = weston_desktop_wl_shell_surface_destroy ,
} ;
} ;
static void
wl_surface_resource_destroyed ( struct wl_listener * listener ,
void * data )
{
struct weston_desktop_wl_shell_surface * surface =
wl_container_of ( listener , surface ,
wl_surface_resource_destroy_listener ) ;
/* the wl_shell_surface spec says that wl_shell_surfaces are to be
* destroyed automatically when the wl_surface is destroyed . */
weston_desktop_surface_destroy ( surface - > surface ) ;
}
static void
static void
weston_desktop_wl_shell_protocol_get_shell_surface ( struct wl_client * wl_client ,
weston_desktop_wl_shell_protocol_get_shell_surface ( struct wl_client * wl_client ,
struct wl_resource * resource ,
struct wl_resource * resource ,
@ -435,6 +451,11 @@ weston_desktop_wl_shell_protocol_get_shell_surface(struct wl_client *wl_client,
return ;
return ;
}
}
surface - > wl_surface_resource_destroy_listener . notify =
wl_surface_resource_destroyed ;
wl_resource_add_destroy_listener ( wsurface - > resource ,
& surface - > wl_surface_resource_destroy_listener ) ;
surface - > resource =
surface - > resource =
weston_desktop_surface_add_resource ( surface - > surface ,
weston_desktop_surface_add_resource ( surface - > surface ,
& wl_shell_surface_interface ,
& wl_shell_surface_interface ,