mirror of
https://github.com/brl/mutter.git
synced 2025-01-09 03:02:46 +00:00
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
This commit is contained in:
parent
35b8f8c072
commit
2783375f8f
@ -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");
|
||||
@ -640,6 +638,12 @@ meta_wayland_keyboard_enable (MetaWaylandKeyboard *keyboard)
|
||||
maybe_restore_numlock_state (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)
|
||||
{
|
||||
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user