diff --git a/clutter/evdev/clutter-device-manager-evdev.c b/clutter/evdev/clutter-device-manager-evdev.c index 51e45509b..7b833b5e2 100644 --- a/clutter/evdev/clutter-device-manager-evdev.c +++ b/clutter/evdev/clutter-device-manager-evdev.c @@ -1846,6 +1846,38 @@ clutter_evdev_get_keyboard_map (ClutterDeviceManager *evdev) return xkb_state_get_keymap (manager_evdev->priv->main_seat->xkb); } +/** + * clutter_evdev_set_keyboard_layout_index: (skip) + * @evdev: the #ClutterDeviceManager created by the evdev backend + * @idx: the xkb layout index to set + * + * Sets the xkb layout index on the backend's #xkb_state . + * + * Since: 1.20 + * Stability: unstable + */ +void +clutter_evdev_set_keyboard_layout_index (ClutterDeviceManager *evdev, + xkb_layout_index_t idx) +{ + ClutterDeviceManagerEvdev *manager_evdev; + xkb_mod_mask_t depressed_mods; + xkb_mod_mask_t latched_mods; + xkb_mod_mask_t locked_mods; + struct xkb_state *state; + + g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER_EVDEV (evdev), NULL); + + manager_evdev = CLUTTER_DEVICE_MANAGER_EVDEV (evdev); + state = manager_evdev->priv->main_seat->xkb; + + depressed_mods = xkb_state_serialize_mods (state, XKB_STATE_MODS_DEPRESSED); + latched_mods = xkb_state_serialize_mods (state, XKB_STATE_MODS_LATCHED); + locked_mods = xkb_state_serialize_mods (state, XKB_STATE_MODS_LOCKED); + + xkb_state_update_mask (state, depressed_mods, latched_mods, locked_mods, 0, 0, idx); +} + /** * clutter_evdev_set_pointer_constrain_callback: * @evdev: the #ClutterDeviceManager created by the evdev backend diff --git a/clutter/evdev/clutter-evdev.h b/clutter/evdev/clutter-evdev.h index d5f9deb3c..423913948 100644 --- a/clutter/evdev/clutter-evdev.h +++ b/clutter/evdev/clutter-evdev.h @@ -97,6 +97,10 @@ void clutter_evdev_set_keyboard_map (ClutterDeviceManager *evdev CLUTTER_AVAILABLE_IN_1_18 struct xkb_keymap * clutter_evdev_get_keyboard_map (ClutterDeviceManager *evdev); +CLUTTER_AVAILABLE_IN_1_20 +void clutter_evdev_set_keyboard_layout_index (ClutterDeviceManager *evdev, + xkb_layout_index_t idx); + CLUTTER_AVAILABLE_IN_1_18 void clutter_evdev_set_keyboard_repeat (ClutterDeviceManager *evdev, gboolean repeat,