Ecore_X: Add api function (and code) to retrieve actual keycode from

keyname (needed to handle input from x11 to wayland clients).



SVN revision: 67591
This commit is contained in:
Christopher Michael 2012-01-29 20:29:30 +00:00
parent 7dbd7c03e6
commit 3beb6bb400
3 changed files with 27 additions and 0 deletions

View File

@ -3408,6 +3408,13 @@ EAPI Eina_Bool
EAPI const char *
ecore_x_keysym_string_get(int keysym);
/**
* Given a keyname, return the keycode representing that key
*
* @since 1.2.0
*/
EAPI int ecore_x_keysym_keycode_get(const char *keyname);
typedef struct _Ecore_X_Image Ecore_X_Image;
EAPI Ecore_X_Image *

View File

@ -279,6 +279,14 @@ ecore_x_keysym_string_get(int keysym)
return _ecore_xcb_keymap_keysym_to_string(keysym);
}
EAPI int
ecore_x_keysym_keycode_get(const char *keyname)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
return _ecore_xcb_keymap_string_to_keycode(keyname);
}
/* local functions */
static int
_ecore_xcb_keymap_mask_get(void *reply,

View File

@ -153,3 +153,15 @@ ecore_x_keysym_string_get(int keysym)
return XKeysymToString(keysym);
}
EAPI int
ecore_x_keysym_keycode_get(const char *keyname)
{
int keycode = 0;
if (!strncmp(keyname, "Keycode-", 8))
keycode = atoi(keyname + 8);
else
keycode = XKeysymToKeycode(_ecore_x_disp, XStringToKeysym(keyname));
return keycode;
}