wayland: fix pointer focus for destroyed surfaces

We had an assertion in meta_wayland_surface_free() that after
a repick() we would not choose the freed surface, but that didn't
consider surfaces destroyed while holding the implicit pointer
grab (ie, because the user clicked on the X button). In that case,
we need to bypass the grab infrastructure and explicitly unfocus
the dead surface.

https://bugzilla.gnome.org/show_bug.cgi?id=706982
This commit is contained in:
Giovanni Campagna
2013-08-28 16:23:34 +02:00
parent 7bd4e6ecb0
commit ad4053ab84
3 changed files with 29 additions and 2 deletions

View File

@ -324,3 +324,21 @@ meta_wayland_pointer_end_modal (MetaWaylandPointer *pointer)
meta_wayland_pointer_end_grab (pointer);
g_slice_free (MetaWaylandPointerGrab, grab);
}
/* Called when the focused resource is destroyed */
void
meta_wayland_pointer_destroy_focus (MetaWaylandPointer *pointer)
{
if (pointer->grab == &pointer->default_grab)
{
/* The surface was destroyed, but had the implicit pointer grab.
Bypass the grab interface. */
g_assert (pointer->button_count > 0);
/* Note: we focus the NULL interface, not the current one, because
we have button down, and the clients would be confused if the
pointer enters the surface.
*/
meta_wayland_pointer_set_focus (pointer, NULL, 0, 0);
}
}