wayland: Notify modifiers after keymap changes
Anytime the keymap is changed, either directly, or indirectly through the keyboard capability being released/initialized, there should be a notification of the modifiers being changed too. https://bugzilla.gnome.org/show_bug.cgi?id=733563
This commit is contained in:
parent
1d8e4bdd6d
commit
32565e096d
@ -60,6 +60,8 @@
|
|||||||
|
|
||||||
#include "meta-wayland-private.h"
|
#include "meta-wayland-private.h"
|
||||||
|
|
||||||
|
static void meta_wayland_keyboard_update_xkb_state (MetaWaylandKeyboard *keyboard);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
unbind_resource (struct wl_resource *resource)
|
unbind_resource (struct wl_resource *resource)
|
||||||
{
|
{
|
||||||
@ -147,8 +149,7 @@ meta_wayland_keyboard_take_keymap (MetaWaylandKeyboard *keyboard,
|
|||||||
xkb_keymap_unref (xkb_info->keymap);
|
xkb_keymap_unref (xkb_info->keymap);
|
||||||
xkb_info->keymap = keymap;
|
xkb_info->keymap = keymap;
|
||||||
|
|
||||||
xkb_state_unref (xkb_info->state);
|
meta_wayland_keyboard_update_xkb_state (keyboard);
|
||||||
xkb_info->state = xkb_state_new (keymap);
|
|
||||||
|
|
||||||
keymap_str = xkb_map_get_as_string (xkb_info->keymap);
|
keymap_str = xkb_map_get_as_string (xkb_info->keymap);
|
||||||
if (keymap_str == NULL)
|
if (keymap_str == NULL)
|
||||||
@ -259,6 +260,36 @@ notify_modifiers (MetaWaylandKeyboard *keyboard, uint32_t serial,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_wayland_keyboard_update_xkb_state (MetaWaylandKeyboard *keyboard)
|
||||||
|
{
|
||||||
|
MetaWaylandXkbInfo *xkb_info = &keyboard->xkb_info;
|
||||||
|
xkb_mod_mask_t latched, locked, group;
|
||||||
|
|
||||||
|
/* Preserve latched/locked modifiers state */
|
||||||
|
if (xkb_info->state)
|
||||||
|
{
|
||||||
|
latched = xkb_state_serialize_mods (xkb_info->state, XKB_STATE_MODS_LATCHED);
|
||||||
|
locked = xkb_state_serialize_mods (xkb_info->state, XKB_STATE_MODS_LOCKED);
|
||||||
|
group = xkb_state_serialize_layout (xkb_info->state, XKB_STATE_LAYOUT_EFFECTIVE);
|
||||||
|
xkb_state_unref (xkb_info->state);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
latched = locked = group = 0;
|
||||||
|
|
||||||
|
xkb_info->state = xkb_state_new (xkb_info->keymap);
|
||||||
|
|
||||||
|
if (latched || locked || group)
|
||||||
|
xkb_state_update_mask (xkb_info->state, 0, latched, locked, 0, 0, group);
|
||||||
|
|
||||||
|
notify_modifiers (keyboard,
|
||||||
|
wl_display_next_serial (keyboard->display),
|
||||||
|
xkb_state_serialize_mods (xkb_info->state, XKB_STATE_MODS_DEPRESSED),
|
||||||
|
xkb_state_serialize_mods (xkb_info->state, XKB_STATE_MODS_LATCHED),
|
||||||
|
xkb_state_serialize_mods (xkb_info->state, XKB_STATE_MODS_LOCKED),
|
||||||
|
xkb_state_serialize_layout (xkb_info->state, XKB_STATE_LAYOUT_EFFECTIVE));
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_wayland_keyboard_init (MetaWaylandKeyboard *keyboard,
|
meta_wayland_keyboard_init (MetaWaylandKeyboard *keyboard,
|
||||||
struct wl_display *display)
|
struct wl_display *display)
|
||||||
|
Loading…
Reference in New Issue
Block a user