gdkwindow-wayland: Destroy the wl_surface too when hiding a window

wl_surfaces can't switch roles, so destroying the xdg_surface but not
the wl_surface means that we could get an error when trying to re-map
the surface.

We could fix this by not destroying the xdg resource and only do it at
finalization time, but it's just as easy to just create a new wl_surface.
This commit is contained in:
Jasper St. Pierre 2014-06-19 15:04:09 -04:00
parent 6926c6d9f8
commit 87e2a7d4b2

View File

@ -1068,8 +1068,7 @@ gdk_wayland_window_show (GdkWindow *window,
}
static void
gdk_wayland_window_hide_surface (GdkWindow *window,
gboolean is_destroy)
gdk_wayland_window_hide_surface (GdkWindow *window)
{
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
@ -1086,19 +1085,11 @@ gdk_wayland_window_hide_surface (GdkWindow *window,
impl->xdg_popup = NULL;
}
if (!is_destroy)
{
wl_surface_attach (impl->surface, NULL, 0, 0);
wl_surface_commit (impl->surface);
}
else
{
wl_surface_destroy (impl->surface);
impl->surface = NULL;
wl_surface_destroy (impl->surface);
impl->surface = NULL;
g_slist_free (impl->outputs);
impl->outputs = NULL;
}
g_slist_free (impl->outputs);
impl->outputs = NULL;
}
impl->mapped = FALSE;
@ -1107,7 +1098,7 @@ gdk_wayland_window_hide_surface (GdkWindow *window,
static void
gdk_wayland_window_hide (GdkWindow *window)
{
gdk_wayland_window_hide_surface (window, FALSE);
gdk_wayland_window_hide_surface (window);
_gdk_window_clear_update_area (window);
}
@ -1121,7 +1112,7 @@ gdk_window_wayland_withdraw (GdkWindow *window)
g_assert (!GDK_WINDOW_IS_MAPPED (window));
gdk_wayland_window_hide_surface (window, FALSE);
gdk_wayland_window_hide_surface (window);
}
}
@ -1332,7 +1323,7 @@ gdk_wayland_window_destroy (GdkWindow *window,
*/
g_return_if_fail (!foreign_destroy);
gdk_wayland_window_hide_surface (window, TRUE);
gdk_wayland_window_hide_surface (window);
if (impl->cairo_surface)
cairo_surface_finish (impl->cairo_surface);