pointer/keyboard: Properly handle destruction
If the client destroys the pointer resource, we shouldn't unfocus the surface, and we should regrab it when the client gets the pointer resource again. This also fixes a crash at surface destruction because of the unchecked wl_link_remove that will happen on both pointer and surface destroy.
This commit is contained in:
@ -217,28 +217,22 @@ err_keymap_str:
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
release_focus (MetaWaylandKeyboard *keyboard)
|
||||
{
|
||||
wl_list_remove (&keyboard->focus_surface_listener.link);
|
||||
wl_list_remove (&keyboard->focus_resource_listener.link);
|
||||
|
||||
keyboard->focus_resource = NULL;
|
||||
keyboard->focus_surface = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
keyboard_handle_focus_surface_destroy (struct wl_listener *listener, void *data)
|
||||
{
|
||||
MetaWaylandKeyboard *keyboard = wl_container_of (listener, keyboard, focus_surface_listener);
|
||||
release_focus (keyboard);
|
||||
|
||||
wl_list_remove (&keyboard->focus_surface_listener.link);
|
||||
keyboard->focus_surface = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
keyboard_handle_focus_resource_destroy (struct wl_listener *listener, void *data)
|
||||
{
|
||||
MetaWaylandKeyboard *keyboard = wl_container_of (listener, keyboard, focus_resource_listener);
|
||||
release_focus (keyboard);
|
||||
|
||||
wl_list_remove (&keyboard->focus_resource_listener.link);
|
||||
keyboard->focus_resource = NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
Reference in New Issue
Block a user