summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
Diffstat (limited to 'unix')
-rwxr-xr-xunix/configure71
-rw-r--r--unix/configure.in19
-rw-r--r--unix/tkUnixEvent.c10
3 files changed, 97 insertions, 3 deletions
diff --git a/unix/configure b/unix/configure
index d8a271d..7f31ae7 100755
--- a/unix/configure
+++ b/unix/configure
@@ -10769,6 +10769,77 @@ _ACEOF
fi
#--------------------------------------------------------------------
+# Check whether XKeycodeToKeysym is deprecated in X11 headers.
+#--------------------------------------------------------------------
+
+if test $tk_aqua = no; then
+ echo "$as_me:$LINENO: checking whether XKeycodeToKeysym is deprecated" >&5
+echo $ECHO_N "checking whether XKeycodeToKeysym is deprecated... $ECHO_C" >&6
+ tk_oldCFlags=$CFLAGS
+ CFLAGS="$CFLAGS -Werror"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+ #include <X11/Xlib.h>
+
+int
+main ()
+{
+
+ XKeycodeToKeysym(0,0,0);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+cat >>confdefs.h <<\_ACEOF
+#define XKEYCODETOKEYSYM_IS_DEPRECATED 1
+_ACEOF
+
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ CFLAGS=$tk_oldCFlags
+fi
+
+#--------------------------------------------------------------------
# XXX Do this last.
# It might modify XLIBSW which could affect other tests.
#
diff --git a/unix/configure.in b/unix/configure.in
index 3c59369..bc22472 100644
--- a/unix/configure.in
+++ b/unix/configure.in
@@ -589,6 +589,25 @@ if test $tk_aqua = no; then
fi
#--------------------------------------------------------------------
+# Check whether XKeycodeToKeysym is deprecated in X11 headers.
+#--------------------------------------------------------------------
+
+if test $tk_aqua = no; then
+ AC_MSG_CHECKING([whether XKeycodeToKeysym is deprecated])
+ tk_oldCFlags=$CFLAGS
+ CFLAGS="$CFLAGS -Werror"
+ AC_TRY_LINK([
+ #include <X11/Xlib.h>
+ ], [
+ XKeycodeToKeysym(0,0,0);
+ ], [
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(XKEYCODETOKEYSYM_IS_DEPRECATED, 1, [Is XKeycodeToKeysym deprecated?])
+ ], AC_MSG_RESULT([no]))
+ CFLAGS=$tk_oldCFlags
+fi
+
+#--------------------------------------------------------------------
# XXX Do this last.
# It might modify XLIBSW which could affect other tests.
#
diff --git a/unix/tkUnixEvent.c b/unix/tkUnixEvent.c
index 9b32502..b7f8f75 100644
--- a/unix/tkUnixEvent.c
+++ b/unix/tkUnixEvent.c
@@ -128,7 +128,7 @@ TkpOpenDisplay(
int minor = 0;
int reason = 0;
unsigned int use_xkb = 0;
-#ifdef TCL_THREADS
+#if defined(XKEYCODETOKEYSYM_IS_DEPRECATED) && defined(TCL_THREADS)
static int xinited = 0;
TCL_DECLARE_MUTEX(xinitMutex);
@@ -137,8 +137,12 @@ TkpOpenDisplay(
if (!xinited) {
/* Necessary for threaded apps, of no consequence otherwise */
/* need only be called once, but must be called before *any* */
- /* Xlib call is made. */
- XInitThreads();
+ /* Xlib call is made. If xinitMutex is still NULL after the */
+ /* Tcl_MutexLock call, Tcl was compiled without threads so */
+ /* we cannot use XInitThreads() either. */
+ if (xinitMutex != NULL){
+ XInitThreads();
+ }
xinited = 1;
}
Tcl_MutexUnlock(&xinitMutex);