wayland: Check whether Xwayland window had a prior surface in generic code

Since commit 8df2a1452c (As pointed out by Robert Mader) we just happened
do this check when doing the first lookup for a Wayland surface for a
XWayland window, when we are later notifying upon surface creation we just
set the relation with no further checks.

The cases pointed out in the comment (eg. window changing decoration) might
presumably happen in a quick enough sequence that we have two scheduled
associations on the fly, so move this check to the more generic
meta_xwayland_associate_window_with_surface() which is called on both
immediate and delayed paths.

https://gitlab.gnome.org/GNOME/mutter/issues/361
This commit is contained in:
Carlos Garnacho 2019-02-06 23:04:13 +01:00 committed by Carlos Garnacho
parent 803ffc19a4
commit 8a9a78ec8a

View File

@ -67,6 +67,16 @@ meta_xwayland_associate_window_with_surface (MetaWindow *window,
{
MetaDisplay *display = window->display;
/* If the window has an existing surface, like if we're
* undecorating or decorating the window, then we need
* to detach the window from its old surface.
*/
if (window->surface)
{
meta_wayland_surface_set_window (window->surface, NULL);
window->surface = NULL;
}
if (!meta_wayland_surface_assign_role (surface,
META_TYPE_WAYLAND_SURFACE_ROLE_XWAYLAND,
NULL))
@ -97,16 +107,6 @@ associate_window_with_surface_id (MetaXWaylandManager *manager,
{
struct wl_resource *resource;
/* If the window has an existing surface, like if we're
* undecorating or decorating the window, then we need
* to detach the window from its old surface.
*/
if (window->surface)
{
meta_wayland_surface_set_window (window->surface, NULL);
window->surface = NULL;
}
resource = wl_client_get_object (manager->client, surface_id);
if (resource)
{