aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2018-01-24 16:07:36 -0500
committerMike Blumenkrantz <zmike@osg.samsung.com>2018-01-24 16:18:51 -0500
commita524ab1fe3c20f194d1df5d8f6603593cf5872e3 (patch)
tree19157e593d61141f6d41ad1aeea17054b9a88389
parentecore-x: re-add implementation of ecore_x_connection_get() (diff)
downloadefl-a524ab1fe3c20f194d1df5d8f6603593cf5872e3.tar.gz
ecore-x: add some useful xkb function wrappers
@feature
-rw-r--r--src/lib/ecore_x/Ecore_X.h2
-rw-r--r--src/lib/ecore_x/ecore_x.c36
2 files changed, 38 insertions, 0 deletions
diff --git a/src/lib/ecore_x/Ecore_X.h b/src/lib/ecore_x/Ecore_X.h
index b0955553ee..cb55dfa3ee 100644
--- a/src/lib/ecore_x/Ecore_X.h
+++ b/src/lib/ecore_x/Ecore_X.h
@@ -2729,6 +2729,8 @@ EAPI Ecore_X_Illume_Window_State ecore_x_e_illume_window_state_get(Eco
EAPI void ecore_x_e_illume_window_state_send(Ecore_X_Window win, Ecore_X_Illume_Window_State state); /**< @since 1.9 */
EAPI void ecore_x_xkb_select_group(int group); /* @since 1.7 */
+EAPI Eina_Bool ecore_x_xkb_track_state(void); /** @since 1.21 */
+EAPI Eina_Bool ecore_x_xkb_state_get(Ecore_X_Xkb_State *state); /** @since 1.21 */
EAPI void ecore_x_e_window_rotation_supported_set(Ecore_X_Window root, Eina_Bool enabled); /**< @since 1.9 */
EAPI Eina_Bool ecore_x_e_window_rotation_supported_get(Ecore_X_Window root); /**< @since 1.9 */
diff --git a/src/lib/ecore_x/ecore_x.c b/src/lib/ecore_x/ecore_x.c
index 81eae65294..bab8a41f6d 100644
--- a/src/lib/ecore_x/ecore_x.c
+++ b/src/lib/ecore_x/ecore_x.c
@@ -2536,6 +2536,42 @@ ecore_x_xkb_select_group(int group)
#endif
}
+EAPI Eina_Bool
+ecore_x_xkb_track_state(void)
+{
+ Eina_Bool ret = EINA_FALSE;
+#ifdef ECORE_XKB
+ EINA_SAFETY_ON_NULL_RETURN_VAL(_ecore_x_disp, EINA_FALSE);
+ ret = XkbSelectEvents(_ecore_x_disp, XkbUseCoreKbd, XkbStateNotifyMask, XkbStateNotifyMask);
+ if (_ecore_xlib_sync) ecore_x_sync();
+#endif
+ return ret;
+}
+
+EAPI Eina_Bool
+ecore_x_xkb_state_get(Ecore_X_Xkb_State *state)
+{
+ Eina_Bool ret = EINA_FALSE;
+#ifdef ECORE_XKB
+ XkbStateRec xkbstate;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(_ecore_x_disp, EINA_FALSE);
+ ret = XkbGetState(_ecore_x_disp, XkbUseCoreKbd, &xkbstate);
+ if (!ret) return ret;
+
+ state->group = xkbstate.group;
+ state->base_group = xkbstate.base_group;
+ state->latched_group = xkbstate.latched_group;
+ state->locked_group = xkbstate.locked_group;
+
+ state->mods = xkbstate.mods;
+ state->base_mods = xkbstate.base_mods;
+ state->latched_mods = xkbstate.latched_mods;
+ state->locked_mods = xkbstate.locked_mods;
+#endif
+ return ret;
+}
+
/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/