[mutter/wayland] pointer/keyboard: Properly handle destruction
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wayland] pointer/keyboard: Properly handle destruction
- Date: Thu, 20 Feb 2014 16:35:14 +0000 (UTC)
commit 7ebf5aa69a990b0713699d684303aba2f83993a9
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Feb 20 11:29:28 2014 -0500
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.
src/wayland/meta-wayland-keyboard.c | 18 ++++++------------
src/wayland/meta-wayland-pointer.c | 20 +++++++-------------
2 files changed, 13 insertions(+), 25 deletions(-)
---
diff --git a/src/wayland/meta-wayland-keyboard.c b/src/wayland/meta-wayland-keyboard.c
index 5b98c4f..e07b6f2 100644
--- a/src/wayland/meta-wayland-keyboard.c
+++ b/src/wayland/meta-wayland-keyboard.c
@@ -218,27 +218,21 @@ err_keymap_str:
}
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
diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c
index 2a72fc1..88ced65 100644
--- a/src/wayland/meta-wayland-pointer.c
+++ b/src/wayland/meta-wayland-pointer.c
@@ -56,27 +56,21 @@
static void meta_wayland_pointer_end_popup_grab (MetaWaylandPointer *pointer);
static void
-release_focus (MetaWaylandPointer *pointer)
-{
- wl_list_remove (&pointer->focus_surface_listener.link);
- wl_list_remove (&pointer->focus_resource_listener.link);
-
- pointer->focus_resource = NULL;
- pointer->focus_surface = NULL;
-}
-
-static void
pointer_handle_focus_surface_destroy (struct wl_listener *listener, void *data)
{
MetaWaylandPointer *pointer = wl_container_of (listener, pointer, focus_surface_listener);
- release_focus (pointer);
+
+ wl_list_remove (&pointer->focus_surface_listener.link);
+ pointer->focus_surface = NULL;
}
static void
pointer_handle_focus_resource_destroy (struct wl_listener *listener, void *data)
{
MetaWaylandPointer *pointer = wl_container_of (listener, pointer, focus_resource_listener);
- release_focus (pointer);
+
+ wl_list_remove (&pointer->focus_resource_listener.link);
+ pointer->focus_resource = NULL;
}
static void
@@ -302,7 +296,7 @@ meta_wayland_pointer_init (MetaWaylandPointer *pointer)
void
meta_wayland_pointer_release (MetaWaylandPointer *pointer)
{
- release_focus (pointer);
+ /* Do nothing. */
}
static struct wl_resource *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]