Hi,
ecore_x is calling XKeycodeToKeysym from xlib, but this function has
issues. It has been deprecated 6 months ago in X.org and it is
suggested to use XkbKeycodeToKeysym instead:
https://bugs.freedesktop.org/show_bug.cgi?id=25732
So I made a wrapper function that makes use of XkbKeycodeToKeysym when
possible or fallback to XKeycodeToKeysym. I'm ready to commit it but I
would like to have comments about the patch, because, well, you know the
surrounding code better than me :-)
--
Jérôme Pinot
http://ngc891.blogdns.net/
Index: ecore/src/lib/ecore_x/xlib/ecore_x_test.c
===
--- ecore/src/lib/ecore_x/xlib/ecore_x_test.c (revision 71640)
+++ ecore/src/lib/ecore_x/xlib/ecore_x_test.c (working copy)
@@ -98,9 +98,9 @@
return EINA_FALSE;
keycode = XKeysymToKeycode(_ecore_x_disp, keysym);
-if (XKeycodeToKeysym(_ecore_x_disp, keycode, 0) != keysym)
+if (_ecore_x_XKeycodeToKeysym(_ecore_x_disp, keycode, 0) != keysym)
{
- if (XKeycodeToKeysym(_ecore_x_disp, keycode, 1) == keysym)
+ if (_ecore_x_XKeycodeToKeysym(_ecore_x_disp, keycode, 1) ==
keysym)
shift = 1;
else
keycode = 0;
Index: ecore/src/lib/ecore_x/xlib/ecore_x_private.h
===
--- ecore/src/lib/ecore_x/xlib/ecore_x_private.h(revision 71640)
+++ ecore/src/lib/ecore_x/xlib/ecore_x_private.h(working copy)
@@ -372,6 +372,7 @@
double mry);
void _ecore_x_modifiers_get(void);
+KeySym _ecore_x_XKeycodeToKeysym(Display *display, KeyCode keycode, int index);
//#define LOGFNS 1
Index: ecore/src/lib/ecore_x/xlib/ecore_x.c
===
--- ecore/src/lib/ecore_x/xlib/ecore_x.c(revision 71640)
+++ ecore/src/lib/ecore_x/xlib/ecore_x.c(working copy)
@@ -211,6 +211,16 @@
#endif /* ifdef LOGRT */
+/* wrapper to use XkbKeycodeToKeysym when possible */
+KeySym
+_ecore_x_XKeycodeToKeysym(Display *display, KeyCode keycode, int index)
+{
+#ifdef ECORE_XKB
+ return XkbKeycodeToKeysym(display, keycode, 0, index);
+#endif
+ return XKeycodeToKeysym(display, keycode, index);
+}
+
void
_ecore_x_modifiers_get(void)
{
@@ -1056,7 +1066,8 @@
{
for (j = 0; j 8; j++)
{
- sym2 = XKeycodeToKeysym(_ecore_x_disp, mod-modifiermap[i], j);
+ sym2 = _ecore_x_XKeycodeToKeysym(_ecore_x_disp,
+mod-modifiermap[i], j);
if (sym2 != 0)
break;
}
Index: ecore/src/lib/ecore_x/xlib/ecore_x_events.c
===
--- ecore/src/lib/ecore_x/xlib/ecore_x_events.c (revision 71640)
+++ ecore/src/lib/ecore_x/xlib/ecore_x_events.c (working copy)
@@ -278,8 +278,8 @@
int val;
_ecore_x_last_event_mouse_move = 0;
- keyname = XKeysymToString(XKeycodeToKeysym(xevent-display,
- xevent-keycode, 0));
+ keyname = XKeysymToString(_ecore_x_XKeycodeToKeysym(xevent-display,
+ xevent-keycode, 0));
if (!keyname)
{
snprintf(keyname_buffer,
signature.asc
Description: Digital signature
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel