[clutter/clutter-1.20] evdev: Add API to set the xkb layout index



commit f95493e7bff650f7c2da4d8bfe50a498cc652ddf
Author: Rui Matos <tiagomatos gmail com>
Date:   Sun Jul 6 17:43:14 2014 +0200

    evdev: Add API to set the xkb layout index
    
    https://bugzilla.gnome.org/show_bug.cgi?id=733202

 clutter/evdev/clutter-device-manager-evdev.c |   32 ++++++++++++++++++++++++++
 clutter/evdev/clutter-evdev.h                |    4 +++
 2 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/clutter/evdev/clutter-device-manager-evdev.c b/clutter/evdev/clutter-device-manager-evdev.c
index 51e4550..7b833b5 100644
--- a/clutter/evdev/clutter-device-manager-evdev.c
+++ b/clutter/evdev/clutter-device-manager-evdev.c
@@ -1847,6 +1847,38 @@ clutter_evdev_get_keyboard_map (ClutterDeviceManager *evdev)
 }
 
 /**
+ * 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
  * @callback: the callback
diff --git a/clutter/evdev/clutter-evdev.h b/clutter/evdev/clutter-evdev.h
index d5f9deb..4239139 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,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]