mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 11:32:04 +00:00
wayland/wl_shell: Dismiss popup when parent is destroyed
Dismiss the popup when the parent is destroyed, and do this in the destructor of the parent object. This makes the parent destory listener unnecessary, since we already handle the parent child unlinking explicitly in the object destructor. https://bugzilla.gnome.org/show_bug.cgi?id=763431
This commit is contained in:
parent
61c717abb3
commit
a89aa1d8cc
@ -69,6 +69,12 @@ wl_shell_surface_destructor (struct wl_resource *resource)
|
|||||||
MetaWaylandSurface *child_surface = l->data;
|
MetaWaylandSurface *child_surface = l->data;
|
||||||
|
|
||||||
child_surface->wl_shell.parent_surface = NULL;
|
child_surface->wl_shell.parent_surface = NULL;
|
||||||
|
|
||||||
|
if (child_surface->popup.parent == surface)
|
||||||
|
{
|
||||||
|
meta_wayland_popup_dismiss (child_surface->popup.popup);
|
||||||
|
child_surface->popup.parent = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (surface->wl_shell.parent_surface)
|
if (surface->wl_shell.parent_surface)
|
||||||
@ -84,7 +90,6 @@ wl_shell_surface_destructor (struct wl_resource *resource)
|
|||||||
|
|
||||||
if (surface->popup.popup)
|
if (surface->popup.popup)
|
||||||
{
|
{
|
||||||
wl_list_remove (&surface->popup.parent_destroy_listener.link);
|
|
||||||
surface->popup.parent = NULL;
|
surface->popup.parent = NULL;
|
||||||
|
|
||||||
meta_wayland_popup_dismiss (surface->popup.popup);
|
meta_wayland_popup_dismiss (surface->popup.popup);
|
||||||
@ -252,17 +257,6 @@ wl_shell_surface_set_fullscreen (struct wl_client *client,
|
|||||||
META_WL_SHELL_SURFACE_STATE_FULLSCREEN);
|
META_WL_SHELL_SURFACE_STATE_FULLSCREEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
handle_wl_shell_popup_parent_destroyed (struct wl_listener *listener,
|
|
||||||
void *data)
|
|
||||||
{
|
|
||||||
MetaWaylandSurface *surface =
|
|
||||||
wl_container_of (listener, surface, popup.parent_destroy_listener);
|
|
||||||
|
|
||||||
wl_list_remove (&surface->popup.parent_destroy_listener.link);
|
|
||||||
surface->popup.parent = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
create_popup (MetaWaylandSurface *surface)
|
create_popup (MetaWaylandSurface *surface)
|
||||||
{
|
{
|
||||||
@ -300,7 +294,6 @@ wl_shell_surface_set_popup (struct wl_client *client,
|
|||||||
if (surface->popup.popup)
|
if (surface->popup.popup)
|
||||||
{
|
{
|
||||||
surface->popup.parent = NULL;
|
surface->popup.parent = NULL;
|
||||||
wl_list_remove (&surface->popup.parent_destroy_listener.link);
|
|
||||||
|
|
||||||
meta_wayland_popup_dismiss (surface->popup.popup);
|
meta_wayland_popup_dismiss (surface->popup.popup);
|
||||||
}
|
}
|
||||||
@ -314,12 +307,6 @@ wl_shell_surface_set_popup (struct wl_client *client,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
surface->popup.parent = parent_surf;
|
|
||||||
surface->popup.parent_destroy_listener.notify =
|
|
||||||
handle_wl_shell_popup_parent_destroyed;
|
|
||||||
wl_resource_add_destroy_listener (parent_surf->resource,
|
|
||||||
&surface->popup.parent_destroy_listener);
|
|
||||||
|
|
||||||
set_wl_shell_surface_parent (surface, parent_surf);
|
set_wl_shell_surface_parent (surface, parent_surf);
|
||||||
surface->wl_shell.popup_seat = seat;
|
surface->wl_shell.popup_seat = seat;
|
||||||
surface->wl_shell.x = x;
|
surface->wl_shell.x = x;
|
||||||
|
Loading…
Reference in New Issue
Block a user