Tk Source Code

Check-in [c98f76a4]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix for [3613668] by not calling XInitThreads when either 1) Tcl is compiled without threads 2) X11 library is too old. A more direct test would be more desirable, but for now this should be fine.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c98f76a4b86d507ced2f7b153cbb6ba790e8e5f4
User & Date: jan.nijtmans 2013-05-23 08:30:25
Context
2013-05-23
13:31
Extra bit of safety. Since we check whether xinitMutex is "still NULL" to detect a threads-disabled Tcl, we should be explicitly certain it has an initial value of NULL. check-in: 7779a1c4 user: dgp tags: trunk
08:30
Fix for [3613668] by not calling XInitThreads when either 1) Tcl is compiled without threads 2) X11 library is too old. A more direct test would be more desirable, but for now this should be fine. check-in: c98f76a4 user: jan.nijtmans tags: trunk
2013-05-22
07:57
Only call XInitThreads() when we have a very new X11 library. Checked by looking whether XKeycodeToKeysym() is deprecated, which also happend in some very new X11 version. Closed-Leaf check-in: 67d17edf user: jan.nijtmans tags: bug-3613668
2013-05-19
19:47
Fix for FreeBSD, and remove support for old FreeBSD versions. Patch by Pietro Cerutti check-in: 28b0c4de user: jan.nijtmans tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.







1
2
3
4
5
6
7






2013-05-19  Jan Nijtmans  <[email protected]>

	* unix/tcl.m4:     Fix for FreeBSD, and remove support for older
	* unix/configure:  FreeBSD versions. Patch by Pietro Cerutti.

2013-04-10  Jan Nijtmans  <[email protected]>

>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
2013-05-23  Jan Nijtmans  <[email protected]>

	* unix/tcl.m4:     [Bug 3613668]: XFilterEvent() hangs.
	* unix/configure:
	* unix/tkUnixEvent.c:

2013-05-19  Jan Nijtmans  <[email protected]>

	* unix/tcl.m4:     Fix for FreeBSD, and remove support for older
	* unix/configure:  FreeBSD versions. Patch by Pietro Cerutti.

2013-04-10  Jan Nijtmans  <[email protected]>

Changes to unix/configure.

10763
10764
10765
10766
10767
10768
10769







































































10770
10771
10772
10773
10774
10775
10776
#define HAVE_XKBKEYCODETOKEYSYM 1
_ACEOF

    fi
    CFLAGS=$tk_oldCFlags
    LIBS=$tk_oldLibs
fi








































































#--------------------------------------------------------------------
# XXX Do this last.
# It might modify XLIBSW which could affect other tests.
#
# Check whether the header and library for the XScreenSaver
# extension are available, and set HAVE_XSS if so.







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
#define HAVE_XKBKEYCODETOKEYSYM 1
_ACEOF

    fi
    CFLAGS=$tk_oldCFlags
    LIBS=$tk_oldLibs
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.
#
# Check whether the header and library for the XScreenSaver
# extension are available, and set HAVE_XSS if so.

Changes to unix/configure.in.

583
584
585
586
587
588
589



















590
591
592
593
594
595
596
    fi
    if test $xkbkeycodetokeysym_found = "yes" ; then
	AC_DEFINE(HAVE_XKBKEYCODETOKEYSYM, 1, [Do we have XkbKeycodeToKeysym?])
    fi
    CFLAGS=$tk_oldCFlags
    LIBS=$tk_oldLibs
fi




















#--------------------------------------------------------------------
# XXX Do this last.
# It might modify XLIBSW which could affect other tests.
#
# Check whether the header and library for the XScreenSaver
# extension are available, and set HAVE_XSS if so.







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
    fi
    if test $xkbkeycodetokeysym_found = "yes" ; then
	AC_DEFINE(HAVE_XKBKEYCODETOKEYSYM, 1, [Do we have XkbKeycodeToKeysym?])
    fi
    CFLAGS=$tk_oldCFlags
    LIBS=$tk_oldLibs
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.
#
# Check whether the header and library for the XScreenSaver
# extension are available, and set HAVE_XSS if so.

Changes to unix/tkUnixEvent.c.

124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139


140

141

142
143
144
145
146
147
148
    Display *display;
    int event = 0;
    int error = 0;
    int major = 1;
    int minor = 0;
    int reason = 0;
    unsigned int use_xkb = 0;
#ifdef TCL_THREADS
    static int xinited = 0;
    TCL_DECLARE_MUTEX(xinitMutex);

    if (!xinited) {
	Tcl_MutexLock(&xinitMutex);
	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();

	    xinited = 1;
	}
	Tcl_MutexUnlock(&xinitMutex);
    }
#endif

    /*







|








>
>
|
>
|
>







124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
    Display *display;
    int event = 0;
    int error = 0;
    int major = 1;
    int minor = 0;
    int reason = 0;
    unsigned int use_xkb = 0;
#if defined(XKEYCODETOKEYSYM_IS_DEPRECATED) && defined(TCL_THREADS)
    static int xinited = 0;
    TCL_DECLARE_MUTEX(xinitMutex);

    if (!xinited) {
	Tcl_MutexLock(&xinitMutex);
	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. 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);
    }
#endif

    /*