Tk Source Code

Artifact [17555c1b]
Login

Artifact 17555c1bb7f5bc439382bc05fafcbeba18d4fe48:

Attachment "xkbkeycodetokeysym.diff" to ticket [3599928f] added by stwo 2013-01-10 22:13:23.
--- tkUnixKey.c
+++ tkUnixKey.c
@@ -9,11 +9,16 @@
  * See the file "license.terms" for information on usage and redistribution of
  * this file, and for a DISCLAIMER OF ALL WARRANTIES.
  */
 
 #include "tkInt.h"
-#include <X11/XKBlib.h>
+
+#ifdef HAVE_XKBKEYCODETOKEYSYM
+#  include <X11/XKBlib.h>
+#else
+#  define XkbKeycodeToKeysym(D,K,G,L) XKeycodeToKeysym(D,K,L)
+#endif
 
 /*
  * Prototypes for local functions defined in this file:
  */
 

--- configure.in
+++ configure.in
@@ -605,10 +605,40 @@
     fi
     AC_SUBST(XFT_CFLAGS)
     AC_SUBST(XFT_LIBS)
     AC_SUBST(UNIX_FONT_OBJS)
 fi
+
+#--------------------------------------------------------------------
+#	Check for XkbKeycodeToKeysym.
+#--------------------------------------------------------------------
+
+if test $tk_aqua = no; then
+    tk_oldCFlags=$CFLAGS
+    tk_oldLibs=$LIBS
+    CFLAGS="$CFLAGS $XINCLUDES"
+    LIBS="$LIBS $XLIBSW"
+    AC_CHECK_HEADER(X11/XKBlib.h, [
+	xkblib_header_found=yes
+    ], [
+	xkblib_header_found=no
+    ], [#include <X11/Xlib.h>])
+    if test $xkblib_header_found = "yes" ; then
+	AC_CHECK_LIB(X11, XkbKeycodeToKeysym, [
+	    xkbkeycodetokeysym_found=yes
+	], [
+	    xkbkeycodetokeysym_found=no
+	])
+    else
+	xkbkeycodetokeysym_found=no
+    fi
+    if test $xkbkeycodetokeysym_found = "yes" ; then
+	AC_DEFINE(HAVE_XKBKEYCODETOKEYSYM, 1, [Do we have XkbKeycodeToKeysym?])
+    fi
+    CFLAGS=$tk_oldCFlags
+    LIBS=$tk_oldLibs
+fi
 
 #--------------------------------------------------------------------
 #	Figure out whether "char" is unsigned.  If so, set a
 #	#define for __CHAR_UNSIGNED__.
 #--------------------------------------------------------------------