Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSayamindu Dasgupta <sayamindu@gmail.com>2009-03-26 22:44:43 (GMT)
committer Sayamindu Dasgupta <sayamindu@gmail.com>2009-03-26 22:44:43 (GMT)
commitbec7f286f7a707af68f084f249cf84d98c52b5a4 (patch)
tree970e9c6256a9918728c9700424393ac23483ea94
parenta70120bfc9fde3259458b407fe2f672552adf100 (diff)
Added method get_active_group_index() to get the currently active group index
-rw-r--r--pyxkb.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/pyxkb.c b/pyxkb.c
index 4bcf75b..51d54a0 100644
--- a/pyxkb.c
+++ b/pyxkb.c
@@ -222,6 +222,21 @@ pyxkbconfig_set_variants(PyObject *self, PyObject *args)
return Py_BuildValue("b", ret_value);
}
+static PyObject *
+pyxkbconfig_get_active_group_index(PyObject *self, PyObject *args)
+{
+ gint group_index;
+ XklState *state;
+
+ /* I'm not sure why the following line is not working in initpyxkb() */
+ xkl_engine_start_listen(engine, XKLL_TRACK_KEYBOARD_STATE);
+ state = xkl_engine_get_current_state(engine);
+ group_index = state->group;
+ xkl_engine_stop_listen(engine);
+
+ return Py_BuildValue("i", group_index);
+}
+
/* Method table */
static PyMethodDef pyxkb_methods[] = {
@@ -245,6 +260,9 @@ static PyMethodDef pyxkb_methods[] = {
"Sets layout"},
{"set_variants", pyxkbconfig_set_variants, METH_VARARGS,
"Sets variants (must be valid for the active layout(s))"},
+ {"get_active_group_index", pyxkbconfig_get_active_group_index,
+ METH_VARARGS,
+ "Gets the index number of the currently active group"},
{NULL, NULL, 0, NULL}
};