[mutter] wayland: Don't set_focus when the device has been released
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland: Don't set_focus when the device has been released
- Date: Sat, 6 Sep 2014 01:07:02 +0000 (UTC)
commit 4d75de006cde2ca428b7da1439e445f817fc7a29
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Fri Sep 5 18:00:09 2014 -0700
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.
src/wayland/meta-wayland-keyboard.c | 5 +++++
src/wayland/meta-wayland-pointer.c | 5 +++++
2 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/wayland/meta-wayland-keyboard.c b/src/wayland/meta-wayland-keyboard.c
index 7015fae..1306bd3 100644
--- a/src/wayland/meta-wayland-keyboard.c
+++ b/src/wayland/meta-wayland-keyboard.c
@@ -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;
diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c
index 27c3e8c..4b0811a 100644
--- a/src/wayland/meta-wayland-pointer.c
+++ b/src/wayland/meta-wayland-pointer.c
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]