[mutter] wayland/keyboard: Cleanup xkb state managing
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland/keyboard: Cleanup xkb state managing
- Date: Wed, 12 Oct 2016 02:01:51 +0000 (UTC)
commit d639c28e3b87ffea3745ef2c834f0d241c9238fc
Author: Jonas Ådahl <jadahl gmail com>
Date: Wed Sep 21 11:24:47 2016 +0800
wayland/keyboard: Cleanup xkb state managing
Initialize and cleanup properly in a _init()/_destroy() function pair.
https://bugzilla.gnome.org/show_bug.cgi?id=771646
src/wayland/meta-wayland-keyboard.c | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/wayland/meta-wayland-keyboard.c b/src/wayland/meta-wayland-keyboard.c
index fd32483..6e85964 100644
--- a/src/wayland/meta-wayland-keyboard.c
+++ b/src/wayland/meta-wayland-keyboard.c
@@ -611,8 +611,6 @@ meta_wayland_keyboard_enable (MetaWaylandKeyboard *keyboard)
wl_list_init (&keyboard->resource_list);
wl_list_init (&keyboard->focus_resource_list);
- keyboard->xkb_info.keymap_fd = -1;
-
keyboard->grab = &keyboard->default_grab;
keyboard->settings = g_settings_new ("org.gnome.desktop.peripherals.keyboard");
@@ -641,6 +639,12 @@ meta_wayland_keyboard_enable (MetaWaylandKeyboard *keyboard)
}
static void
+meta_wayland_xkb_info_init (MetaWaylandXkbInfo *xkb_info)
+{
+ xkb_info->keymap_fd = -1;
+}
+
+static void
meta_wayland_xkb_info_destroy (MetaWaylandXkbInfo *xkb_info)
{
g_clear_pointer (&xkb_info->keymap, xkb_keymap_unref);
@@ -652,7 +656,10 @@ meta_wayland_xkb_info_destroy (MetaWaylandXkbInfo *xkb_info)
xkb_info->keymap_area = NULL;
}
if (xkb_info->keymap_fd >= 0)
- close (xkb_info->keymap_fd);
+ {
+ close (xkb_info->keymap_fd);
+ xkb_info->keymap_fd = -1;
+ }
}
void
@@ -957,6 +964,8 @@ meta_wayland_keyboard_end_grab (MetaWaylandKeyboard *keyboard)
static void
meta_wayland_keyboard_init (MetaWaylandKeyboard *keyboard)
{
+ meta_wayland_xkb_info_init (&keyboard->xkb_info);
+
keyboard->default_grab.interface = &default_keyboard_grab_interface;
keyboard->default_grab.keyboard = keyboard;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]