clutter/evdev: Add API to get current layout index

We set the layout index when changing keyboard layout, but have no way
to get it back would so be needed. Add that.

https://bugzilla.gnome.org/show_bug.cgi?id=786408
This commit is contained in:
Jonas Ådahl 2017-08-17 16:17:45 +08:00
parent a6d67b164a
commit 5685449e15
2 changed files with 18 additions and 0 deletions

View File

@ -2602,6 +2602,21 @@ clutter_evdev_set_keyboard_layout_index (ClutterDeviceManager *evdev,
xkb_state_update_mask (state, depressed_mods, latched_mods, locked_mods, 0, 0, idx);
}
/**
* clutter_evdev_get_keyboard_layout_index: (skip)
*/
xkb_layout_index_t
clutter_evdev_get_keyboard_layout_index (ClutterDeviceManager *evdev)
{
ClutterDeviceManagerEvdev *manager_evdev;
struct xkb_state *state;
manager_evdev = CLUTTER_DEVICE_MANAGER_EVDEV (evdev);
state = manager_evdev->priv->main_seat->xkb;
return xkb_state_serialize_layout (state, XKB_STATE_LAYOUT_LOCKED);
}
/**
* clutter_evdev_set_keyboard_numlock: (skip)
* @evdev: the #ClutterDeviceManager created by the evdev backend

View File

@ -120,6 +120,9 @@ CLUTTER_AVAILABLE_IN_1_20
void clutter_evdev_set_keyboard_layout_index (ClutterDeviceManager *evdev,
xkb_layout_index_t idx);
CLUTTER_AVAILABLE_IN_MUTTER
xkb_layout_index_t clutter_evdev_get_keyboard_layout_index (ClutterDeviceManager *evdev);
CLUTTER_AVAILABLE_IN_1_26
void clutter_evdev_set_keyboard_numlock (ClutterDeviceManager *evdev,
gboolean numlock_state);