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); wl_array_release (&keyboard->pressed_keys);
g_object_unref (keyboard->settings); g_object_unref (keyboard->settings);
keyboard->display = NULL;
} }
static void static void
@ -517,6 +519,9 @@ void
meta_wayland_keyboard_set_focus (MetaWaylandKeyboard *keyboard, meta_wayland_keyboard_set_focus (MetaWaylandKeyboard *keyboard,
MetaWaylandSurface *surface) MetaWaylandSurface *surface)
{ {
if (keyboard->display == NULL)
return;
if (keyboard->focus_surface == surface) if (keyboard->focus_surface == surface)
return; return;

View File

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