wayland: Don't set_focus when the device has been released

It's possible for a released pointer to have repick / set_focus on it as
part of sync_input_focus. When the pointer is actually re-init'd, it
will memset 0, which can cause corruption as our destroy listener has
already been added.

Released devices should be idempotent, so just make sure method calls on
them don't have any effect.
This commit is contained in:
Jasper St. Pierre 2014-09-05 18:00:09 -07:00
parent e19516ec5a
commit 4d75de006c
2 changed files with 10 additions and 0 deletions

View File

@ -380,6 +380,8 @@ meta_wayland_keyboard_release (MetaWaylandKeyboard *keyboard)
wl_array_release (&keyboard->pressed_keys);
g_object_unref (keyboard->settings);
keyboard->display = NULL;
}
static void
@ -517,6 +519,9 @@ void
meta_wayland_keyboard_set_focus (MetaWaylandKeyboard *keyboard,
MetaWaylandSurface *surface)
{
if (keyboard->display == NULL)
return;
if (keyboard->focus_surface == surface)
return;

View File

@ -216,6 +216,8 @@ meta_wayland_pointer_release (MetaWaylandPointer *pointer)
{
meta_wayland_pointer_set_focus (pointer, NULL);
set_cursor_surface (pointer, NULL);
pointer->display = NULL;
}
static int
@ -476,6 +478,9 @@ void
meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer,
MetaWaylandSurface *surface)
{
if (pointer->display == NULL)
return;
if (pointer->focus_surface == surface)
return;