Import Tk 8.6.11
This commit is contained in:
@@ -129,20 +129,22 @@ TCL_SRC_DIR_NATIVE = $(shell $(CYGPATH) '$(TCL_SRC_DIR)')
|
||||
DLLSUFFIX = @DLLSUFFIX@
|
||||
LIBSUFFIX = @LIBSUFFIX@
|
||||
EXESUFFIX = @EXESUFFIX@
|
||||
VER = @TK_MAJOR_VERSION@@TK_MINOR_VERSION@
|
||||
DOTVER = @TK_MAJOR_VERSION@.@TK_MINOR_VERSION@
|
||||
|
||||
TK_STUB_LIB_FILE = @TK_STUB_LIB_FILE@
|
||||
TK_LIB_FILE = @TK_LIB_FILE@
|
||||
TK_DLL_FILE = @TK_DLL_FILE@
|
||||
TEST_DLL_FILE = tktest$(VER)${DLLSUFFIX}
|
||||
TEST_LIB_FILE = @LIBPREFIX@tktest$(VER)${LIBSUFFIX}
|
||||
TEST_LIB_FILE = @LIBPREFIX@tktest$(VER)${DLLSUFFIX}.a
|
||||
|
||||
SHARED_LIBRARIES = $(TK_DLL_FILE) $(TK_STUB_LIB_FILE)
|
||||
STATIC_LIBRARIES = $(TK_LIB_FILE)
|
||||
|
||||
WISH = wish$(VER)${EXESUFFIX}
|
||||
TKTEST = tktest${EXEEXT}
|
||||
CAT32 = cat32$(EXEEXT)
|
||||
MAN2TCL = man2tcl$(EXEEXT)
|
||||
TKTEST = tktest${EXESUFFIX}
|
||||
CAT32 = cat32${EXESUFFIX}
|
||||
MAN2TCL = man2tcl${EXESUFFIX}
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
@@ -150,7 +152,7 @@ MAN2TCL = man2tcl$(EXEEXT)
|
||||
# makefile to look into these paths when resolving .c to .obj
|
||||
# dependencies.
|
||||
|
||||
VPATH = $(GENERIC_DIR):$(TTK_DIR):$(WIN_DIR):$(UNIX_DIR):$(XLIB_DIR):$(RC_DIR)
|
||||
VPATH = $(GENERIC_DIR):$(TTK_DIR):$(WIN_DIR):$(XLIB_DIR):$(RC_DIR)
|
||||
|
||||
# warning flags
|
||||
CFLAGS_WARNING = @CFLAGS_WARNING@
|
||||
@@ -168,7 +170,7 @@ LDFLAGS_OPTIMIZE = @LDFLAGS_OPTIMIZE@
|
||||
#CFLAGS = $(CFLAGS_DEBUG)
|
||||
#CFLAGS = $(CFLAGS_OPTIMIZE)
|
||||
#CFLAGS = $(CFLAGS_DEBUG) $(CFLAGS_OPTIMIZE)
|
||||
CFLAGS = @CFLAGS@ @CFLAGS_DEFAULT@ -DUNICODE -D_UNICODE -D_ATL_XP_TARGETING
|
||||
CFLAGS = @CFLAGS@ @CFLAGS_DEFAULT@ -D_ATL_XP_TARGETING=1 -D__USE_MINGW_ANSI_STDIO=0
|
||||
|
||||
# Special compiler flags to use when building man2tcl on Windows.
|
||||
MAN2TCLFLAGS = @MAN2TCLFLAGS@
|
||||
@@ -184,15 +186,12 @@ CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@ @LDFLAGS_DEFAULT@
|
||||
LDFLAGS_CONSOLE = @LDFLAGS_CONSOLE@
|
||||
LDFLAGS_WINDOW = @LDFLAGS_WINDOW@
|
||||
EXEEXT = @EXEEXT@
|
||||
OBJEXT = @OBJEXT@
|
||||
STLIB_LD = @STLIB_LD@
|
||||
SHLIB_LD = @SHLIB_LD@
|
||||
SHLIB_LD_LIBS = @SHLIB_LD_LIBS@
|
||||
SHLIB_CFLAGS = @SHLIB_CFLAGS@
|
||||
SHLIB_SUFFIX = @SHLIB_SUFFIX@
|
||||
VER = @TK_MAJOR_VERSION@@TK_MINOR_VERSION@
|
||||
DOTVER = @TK_MAJOR_VERSION@.@TK_MINOR_VERSION@
|
||||
LIBS = $(TCL_STUB_LIB_FILE) @LIBS@ @LIBS_GUI@
|
||||
RMDIR = rm -rf
|
||||
MKDIR = mkdir -p
|
||||
@@ -630,7 +629,7 @@ ${TEST_DLL_FILE}: ${TKTEST_OBJS} ${TK_STUB_LIB_FILE}
|
||||
$(TCL_SRC_DIR)/win/cat.c:
|
||||
|
||||
cat32.${OBJEXT}: $(TCL_SRC_DIR)/win/cat.c
|
||||
$(CC) -c $(CC_SWITCHES) "$(TCL_SRC_DIR)/win/cat.c" $(CC_OBJNAME)
|
||||
$(CC) -c $(CC_SWITCHES) -DUNICODE -D_UNICODE "$(TCL_SRC_DIR)/win/cat.c" $(CC_OBJNAME)
|
||||
|
||||
$(CAT32): cat32.${OBJEXT}
|
||||
$(CC) $(CFLAGS) cat32.$(OBJEXT) $(CC_EXENAME) $(LIBS) $(LDFLAGS_CONSOLE)
|
||||
@@ -656,10 +655,10 @@ ${TK_LIB_FILE}: ${TK_OBJS}
|
||||
# Special case object file targets
|
||||
|
||||
winMain.$(OBJEXT): winMain.c
|
||||
$(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME)
|
||||
$(CC) -c $(CC_SWITCHES) -DUNICODE=1 -D_UNICODE=1 @DEPARG@ $(CC_OBJNAME)
|
||||
|
||||
testMain.$(OBJEXT): winMain.c
|
||||
$(CC) -c $(CC_SWITCHES) @DEPARG@ -DTK_TEST $(CC_OBJNAME)
|
||||
$(CC) -c $(CC_SWITCHES) -DTK_TEST -DUNICODE=1 -D_UNICODE=1 @DEPARG@ $(CC_OBJNAME)
|
||||
|
||||
tkTest.$(OBJEXT): tkTest.c
|
||||
$(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME)
|
||||
@@ -674,11 +673,18 @@ tkSquare.$(OBJEXT): tkSquare.c
|
||||
$(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME)
|
||||
|
||||
tkMain2.$(OBJEXT): tkMain.c
|
||||
$(CC) -c $(CC_SWITCHES) -DBUILD_tk -DTK_ASCII_MAIN @DEPARG@ $(CC_OBJNAME)
|
||||
$(CC) -c $(CC_SWITCHES) -DBUILD_tk -DUNICODE=1 -D_UNICODE=1 @DEPARG@ $(CC_OBJNAME)
|
||||
|
||||
tkUnixMenubu.$(OBJEXT): ${UNIX_DIR}/tkUnixMenubu.c
|
||||
$(CC) -c $(CC_SWITCHES) -DBUILD_tk -DBUILD_ttk @DEPARG@ $(CC_OBJNAME)
|
||||
|
||||
tkUnixScale.$(OBJEXT): ${UNIX_DIR}/tkUnixScale.c
|
||||
$(CC) -c $(CC_SWITCHES) -DBUILD_tk -DBUILD_ttk @DEPARG@ $(CC_OBJNAME)
|
||||
|
||||
# Extra dependency info
|
||||
tkConsole.$(OBJEXT): configure Makefile
|
||||
tkMain.$(OBJEXT): configure Makefile
|
||||
tkMain2.$(OBJEXT): configure Makefile
|
||||
tkWindow.$(OBJEXT): configure Makefile
|
||||
|
||||
# Add the object extension to the implicit rules. By default .obj is not
|
||||
@@ -699,7 +705,7 @@ tkWindow.$(OBJEXT): configure Makefile
|
||||
depend:
|
||||
|
||||
cleanhelp:
|
||||
$(RM) *.hlp *.cnt *.hpj *.GID *.rtf man2tcl${EXEEXT}
|
||||
$(RM) *.hlp *.cnt *.hpj *.GID *.rtf man2tcl.exe
|
||||
|
||||
clean: cleanhelp
|
||||
$(RM) *.lib *.a *.exp *.dll *.res *.${OBJEXT} *~ \#* TAGS a.out
|
||||
|
||||
266
win/configure
vendored
266
win/configure
vendored
@@ -1312,7 +1312,7 @@ SHELL=/bin/sh
|
||||
TK_VERSION=8.6
|
||||
TK_MAJOR_VERSION=8
|
||||
TK_MINOR_VERSION=6
|
||||
TK_PATCH_LEVEL=".10"
|
||||
TK_PATCH_LEVEL=".11"
|
||||
VER=$TK_MAJOR_VERSION$TK_MINOR_VERSION
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@@ -3090,14 +3090,6 @@ if test "${enable_shared+set}" = set; then
|
||||
else
|
||||
tcl_ok=yes
|
||||
fi;
|
||||
|
||||
if test "${enable_shared+set}" = set; then
|
||||
enableval="$enable_shared"
|
||||
tcl_ok=$enableval
|
||||
else
|
||||
tcl_ok=yes
|
||||
fi
|
||||
|
||||
if test "$tcl_ok" = "yes" ; then
|
||||
echo "$as_me:$LINENO: result: shared" >&5
|
||||
echo "${ECHO_T}shared" >&6
|
||||
@@ -3311,78 +3303,6 @@ fi
|
||||
# after SC_ENABLE_SHARED checks the configure switches.
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
# On IRIX 5.3, sys/types and inttypes.h are conflicting.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
|
||||
inttypes.h stdint.h unistd.h
|
||||
do
|
||||
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||
echo "$as_me:$LINENO: checking for $ac_header" >&5
|
||||
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
|
||||
if eval "test \"\${$as_ac_Header+set}\" = set"; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
|
||||
#include <$ac_header>
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
(eval $ac_compile) 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_objext'
|
||||
{ (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
|
||||
eval "$as_ac_Header=yes"
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
eval "$as_ac_Header=no"
|
||||
fi
|
||||
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
|
||||
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
|
||||
if test `eval echo '${'$as_ac_Header'}'` = yes; then
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
|
||||
|
||||
|
||||
# Step 0: Enable 64 bit support?
|
||||
@@ -3541,14 +3461,14 @@ echo "${ECHO_T}$ac_cv_cross" >&6
|
||||
if test "$ac_cv_cross" = "yes"; then
|
||||
case "$do64bit" in
|
||||
amd64|x64|yes)
|
||||
CC="x86_64-w64-mingw32-gcc"
|
||||
CC="x86_64-w64-mingw32-${CC}"
|
||||
LD="x86_64-w64-mingw32-ld"
|
||||
AR="x86_64-w64-mingw32-ar"
|
||||
RANLIB="x86_64-w64-mingw32-ranlib"
|
||||
RC="x86_64-w64-mingw32-windres"
|
||||
;;
|
||||
*)
|
||||
CC="i686-w64-mingw32-gcc"
|
||||
CC="i686-w64-mingw32-${CC}"
|
||||
LD="i686-w64-mingw32-ld"
|
||||
AR="i686-w64-mingw32-ar"
|
||||
RANLIB="i686-w64-mingw32-ranlib"
|
||||
@@ -3785,7 +3705,7 @@ echo "$as_me: error: ${CC} does not support the -shared option.
|
||||
SHLIB_LD='${CC} -shared'
|
||||
SHLIB_LD_LIBS='${LIBS}'
|
||||
MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -o \$@ ${extra_ldflags} \
|
||||
-Wl,--out-implib,\$(patsubst %.dll,lib%.a,\$@)"
|
||||
-Wl,--out-implib,\$(patsubst %.dll,lib%.dll.a,\$@)"
|
||||
# DLLSUFFIX is separate because it is the building block for
|
||||
# users of tclConfig.sh that may build shared or static.
|
||||
DLLSUFFIX="\${DBGX}.dll"
|
||||
@@ -3797,10 +3717,19 @@ echo "$as_me: error: ${CC} does not support the -shared option.
|
||||
|
||||
CFLAGS_DEBUG=-g
|
||||
CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
|
||||
CFLAGS_WARNING="-Wall -Wdeclaration-after-statement"
|
||||
CFLAGS_WARNING="-Wall -Wpointer-arith"
|
||||
LDFLAGS_DEBUG=
|
||||
LDFLAGS_OPTIMIZE=
|
||||
|
||||
case "${CC}" in
|
||||
*++)
|
||||
CFLAGS_WARNING="${CFLAGS_WARNING} -Wno-format"
|
||||
;;
|
||||
*)
|
||||
CFLAGS_WARNING="${CFLAGS_WARNING} -Wdeclaration-after-statement"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Specify the CC output file names based on the target name
|
||||
CC_OBJNAME="-o \$@"
|
||||
CC_EXENAME="-o \$@"
|
||||
@@ -3923,29 +3852,15 @@ echo "${ECHO_T}using shared flags" >&6
|
||||
LIBSUFFIX="\${DBGX}.lib"
|
||||
LIBFLAGSUFFIX="\${DBGX}"
|
||||
|
||||
# This is a 2-stage check to make sure we have the 64-bit SDK
|
||||
# We have to know where the SDK is installed.
|
||||
# This magic is based on MS Platform SDK for Win2003 SP1 - hobbs
|
||||
if test "$do64bit" != "no" ; then
|
||||
if test "x${MSSDK}x" = "xx" ; then
|
||||
MSSDK="C:/Progra~1/Microsoft Platform SDK"
|
||||
fi
|
||||
MSSDK=`echo "$MSSDK" | sed -e 's!\\\!/!g'`
|
||||
PATH64=""
|
||||
case "$do64bit" in
|
||||
amd64|x64|yes)
|
||||
MACHINE="AMD64" ; # assume AMD64 as default 64-bit build
|
||||
PATH64="${MSSDK}/Bin/Win64/x86/AMD64"
|
||||
;;
|
||||
ia64)
|
||||
MACHINE="IA64"
|
||||
PATH64="${MSSDK}/Bin/Win64"
|
||||
;;
|
||||
esac
|
||||
if test ! -d "${PATH64}" ; then
|
||||
{ echo "$as_me:$LINENO: WARNING: Could not find 64-bit $MACHINE SDK" >&5
|
||||
echo "$as_me: WARNING: Could not find 64-bit $MACHINE SDK" >&2;}
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5
|
||||
echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6
|
||||
fi
|
||||
@@ -3961,81 +3876,12 @@ echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6
|
||||
esac
|
||||
|
||||
if test "$do64bit" != "no" ; then
|
||||
# The space-based-path will work for the Makefile, but will
|
||||
# not work if AC_TRY_COMPILE is called. TEA has the
|
||||
# TEA_PATH_NOSPACE to avoid this issue.
|
||||
# Check if _WIN64 is already recognized, and if so we don't
|
||||
# need to modify CC.
|
||||
echo "$as_me:$LINENO: checking whether _WIN64 is declared" >&5
|
||||
echo $ECHO_N "checking whether _WIN64 is declared... $ECHO_C" >&6
|
||||
if test "${ac_cv_have_decl__WIN64+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
int
|
||||
main ()
|
||||
{
|
||||
#ifndef _WIN64
|
||||
char *p = (char *) _WIN64;
|
||||
#endif
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
(eval $ac_compile) 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_objext'
|
||||
{ (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
|
||||
ac_cv_have_decl__WIN64=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_have_decl__WIN64=no
|
||||
fi
|
||||
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_have_decl__WIN64" >&5
|
||||
echo "${ECHO_T}$ac_cv_have_decl__WIN64" >&6
|
||||
if test $ac_cv_have_decl__WIN64 = yes; then
|
||||
:
|
||||
else
|
||||
CC="\"${PATH64}/cl.exe\" -I\"${MSSDK}/Include\" \
|
||||
-I\"${MSSDK}/Include/crt\" \
|
||||
-I\"${MSSDK}/Include/crt/sys\""
|
||||
fi
|
||||
|
||||
RC="\"${MSSDK}/bin/rc.exe\""
|
||||
RC="rc"
|
||||
CFLAGS_DEBUG="-nologo -Zi -Od ${runtime}d"
|
||||
# Do not use -O2 for Win64 - this has proved buggy in code gen.
|
||||
CFLAGS_OPTIMIZE="-nologo -O1 ${runtime}"
|
||||
lflags="${lflags} -nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\""
|
||||
LINKBIN="\"${PATH64}/link.exe\""
|
||||
lflags="${lflags} -nologo -MACHINE:${MACHINE}"
|
||||
LINKBIN="link"
|
||||
# Avoid 'unresolved external symbol __security_cookie' errors.
|
||||
# c.f. http://support.microsoft.com/?id=894573
|
||||
LIBS="$LIBS bufferoverflowU.lib"
|
||||
@@ -4497,6 +4343,78 @@ _ACEOF
|
||||
# man2tcl needs this so that it can use errno.h
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
# On IRIX 5.3, sys/types and inttypes.h are conflicting.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
|
||||
inttypes.h stdint.h unistd.h
|
||||
do
|
||||
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||
echo "$as_me:$LINENO: checking for $ac_header" >&5
|
||||
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
|
||||
if eval "test \"\${$as_ac_Header+set}\" = set"; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
|
||||
#include <$ac_header>
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
(eval $ac_compile) 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_objext'
|
||||
{ (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
|
||||
eval "$as_ac_Header=yes"
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
eval "$as_ac_Header=no"
|
||||
fi
|
||||
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
|
||||
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
|
||||
if test `eval echo '${'$as_ac_Header'}'` = yes; then
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
|
||||
if test "${ac_cv_header_errno_h+set}" = set; then
|
||||
echo "$as_me:$LINENO: checking for errno.h" >&5
|
||||
echo $ECHO_N "checking for errno.h... $ECHO_C" >&6
|
||||
@@ -5031,7 +4949,11 @@ TK_EXPORT_FILE_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}"
|
||||
eval "TK_SRC_DIR=\"`cd $srcdir/..; pwd`\""
|
||||
|
||||
eval "TK_DLL_FILE=tk$VER${DLLSUFFIX}"
|
||||
eval "TK_LIB_FILE=${LIBPREFIX}tk$VER${LIBSUFFIX}"
|
||||
if test ${SHARED_BUILD} = 0 ; then
|
||||
eval "TK_LIB_FILE=${LIBPREFIX}tk${VER}${LIBSUFFIX}"
|
||||
else
|
||||
eval "TK_LIB_FILE=${LIBPREFIX}tk${VER}${DLLSUFFIX}.a"
|
||||
fi
|
||||
|
||||
eval "TK_STUB_LIB_FILE=${LIBPREFIX}tkstub${VER}${LIBSUFFIX}"
|
||||
# FIXME: All of this var junk needs to be done in tcl.m4 !!!!
|
||||
|
||||
@@ -14,7 +14,7 @@ SHELL=/bin/sh
|
||||
TK_VERSION=8.6
|
||||
TK_MAJOR_VERSION=8
|
||||
TK_MINOR_VERSION=6
|
||||
TK_PATCH_LEVEL=".10"
|
||||
TK_PATCH_LEVEL=".11"
|
||||
VER=$TK_MAJOR_VERSION$TK_MINOR_VERSION
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@@ -166,7 +166,11 @@ TK_EXPORT_FILE_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}"
|
||||
eval "TK_SRC_DIR=\"`cd $srcdir/..; pwd`\""
|
||||
|
||||
eval "TK_DLL_FILE=tk$VER${DLLSUFFIX}"
|
||||
eval "TK_LIB_FILE=${LIBPREFIX}tk$VER${LIBSUFFIX}"
|
||||
if test ${SHARED_BUILD} = 0 ; then
|
||||
eval "TK_LIB_FILE=${LIBPREFIX}tk${VER}${LIBSUFFIX}"
|
||||
else
|
||||
eval "TK_LIB_FILE=${LIBPREFIX}tk${VER}${DLLSUFFIX}.a"
|
||||
fi
|
||||
|
||||
eval "TK_STUB_LIB_FILE=${LIBPREFIX}tkstub${VER}${LIBSUFFIX}"
|
||||
# FIXME: All of this var junk needs to be done in tcl.m4 !!!!
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
# 64-bit compiler, if your SDK has it.
|
||||
#
|
||||
# Examples:
|
||||
# Assumign Tcl sources lie in ../../tcl
|
||||
# Assuming Tcl sources lie in ../../tcl
|
||||
# c:\tcl_src\win\>nmake -f makefile.vc release
|
||||
# If Tcl sources are not in ../../tcl, use the TCLDIR macro to specify dir
|
||||
# c:\tcl_src\win\>nmake -f makefile.vc release TCLDIR=c:\src\tcl
|
||||
@@ -66,7 +66,7 @@
|
||||
# c:\tcl_src\win\>nmake -f makefile.vc test
|
||||
# Install Tk in location specified by INSTALLDIR macro
|
||||
# c:\tcl_src\win\>nmake -f makefile.vc install INSTALLDIR=c:\progra~1\tcl
|
||||
# Build release with PDF files
|
||||
# Build release with PDB files
|
||||
# c:\tcl_src\win\>nmake -f makefile.vc release OPTS=pdbs
|
||||
# Build debug version
|
||||
# c:\tcl_src\win\>nmake -f makefile.vc release OPTS=symbols
|
||||
@@ -306,8 +306,7 @@ PRJ_INCLUDES = -I"$(BITMAPDIR)" -I"$(XLIBDIR)"
|
||||
|
||||
CONFIG_DEFS =/DSTDC_HEADERS=1 /DHAVE_SYS_TYPES_H=1 /DHAVE_SYS_STAT_H=1 \
|
||||
/DHAVE_STDLIB_H=1 /DHAVE_STRING_H=1 /DHAVE_MEMORY_H=1 \
|
||||
/DHAVE_STRINGS_H=1 /DHAVE_INTTYPES_H=1 \
|
||||
/DSUPPORT_CONFIG_EMBEDDED /DUNICODE /D_UNICODE \
|
||||
/DHAVE_STRINGS_H=1 \
|
||||
!if $(HAVE_UXTHEME_H)
|
||||
/DHAVE_UXTHEME_H=1 \
|
||||
!endif
|
||||
@@ -455,7 +454,7 @@ $(TKTEST): $(TKTESTOBJS) $(TKSTUBLIB) $(TKIMPLIB)
|
||||
|
||||
|
||||
$(CAT32): $(_TCLDIR)\win\cat.c
|
||||
$(cc32) $(cflags) $(crt) /D_CRT_NONSTDC_NO_DEPRECATE /DCONSOLE -Fo$(TMP_DIR)\ $?
|
||||
$(cc32) $(cflags) $(crt) /D_CRT_NONSTDC_NO_DEPRECATE /DCONSOLE /DUNICODE /D_UNICODE -Fo$(TMP_DIR)\ $?
|
||||
$(CONEXECMD) /DCONSOLE -stack:16384 $(TMP_DIR)\cat.obj
|
||||
$(_VC_MANIFEST_EMBED_EXE)
|
||||
|
||||
@@ -531,7 +530,7 @@ install-pdbs:
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
$(TMP_DIR)\testMain.obj: $(WIN_DIR)\winMain.c
|
||||
$(cc32) $(appcflags_nostubs) /DTK_TEST \
|
||||
$(cc32) $(appcflags_nostubs) /DTK_TEST /DUNICODE /D_UNICODE \
|
||||
/DTCL_USE_STATIC_PACKAGES=$(TCL_USE_STATIC_PACKAGES) \
|
||||
-Fo$@ $?
|
||||
|
||||
@@ -548,12 +547,12 @@ $(TMP_DIR)\tkSquare.obj: $(GENERICDIR)\tkSquare.c
|
||||
$(cc32) $(appcflags_nostubs) -Fo$@ $?
|
||||
|
||||
$(TMP_DIR)\winMain.obj: $(WIN_DIR)\winMain.c
|
||||
$(cc32) $(appcflags_nostubs) \
|
||||
$(cc32) $(appcflags_nostubs) /DUNICODE /D_UNICODE \
|
||||
/DTCL_USE_STATIC_PACKAGES=$(TCL_USE_STATIC_PACKAGES) \
|
||||
-Fo$@ $?
|
||||
|
||||
$(TMP_DIR)\tkMain2.obj: $(GENERICDIR)\tkMain.c
|
||||
$(cc32) $(pkgcflags) /DTK_ASCII_MAIN -Fo$@ $?
|
||||
$(cc32) $(pkgcflags) /DUNICODE /D_UNICODE -Fo$@ $?
|
||||
|
||||
# The following objects are part of the stub library and should not
|
||||
# be built as DLL objects but none of the symbols should be exported
|
||||
|
||||
@@ -31,11 +31,11 @@ macro to the name of the project makefile.
|
||||
# We extract version numbers using the nmakehlp program. For now use
|
||||
# the local copy of nmakehlp. Once we locate Tcl, we will use that
|
||||
# one if it is newer.
|
||||
!if [$(CC) -nologo "nmakehlp.c" -link -subsystem:console > nul]
|
||||
!if [$(CC) -nologo -DNDEBUG "nmakehlp.c" -link -subsystem:console > nul]
|
||||
!endif
|
||||
|
||||
# First locate the Tcl directory that we are working with.
|
||||
!ifdef TCLDIR
|
||||
!if "$(TCLDIR)" != ""
|
||||
|
||||
_RULESDIR = $(TCLDIR:/=\)
|
||||
|
||||
|
||||
346
win/rules.vc
346
win/rules.vc
@@ -6,7 +6,7 @@
|
||||
# compiler switches, defining common targets and macros. The Tcl makefile
|
||||
# directly includes this. Extensions include it via "rules-ext.vc".
|
||||
#
|
||||
# See TIP 477 (https://core.tcl-lang.org/tips/doc/trunk/tip/477.md) for
|
||||
# See TIP 477 (https://core.tcl-lang.org/tips/doc/main/tip/477.md) for
|
||||
# detailed documentation.
|
||||
#
|
||||
# See the file "license.terms" for information on usage and redistribution
|
||||
@@ -24,7 +24,7 @@ _RULES_VC = 1
|
||||
# For modifications that are not backward-compatible, you *must* change
|
||||
# the major version.
|
||||
RULES_VERSION_MAJOR = 1
|
||||
RULES_VERSION_MINOR = 4
|
||||
RULES_VERSION_MINOR = 8
|
||||
|
||||
# The PROJECT macro must be defined by parent makefile.
|
||||
!if "$(PROJECT)" == ""
|
||||
@@ -302,7 +302,7 @@ TCLDIR = $(_INSTALLDIR)\..
|
||||
_TCLDIR = $(_INSTALLDIR)\..
|
||||
_TCL_H = $(_TCLDIR)\include\tcl.h
|
||||
|
||||
!else # exist(...) && ! $(NEED_TCL_SOURCE)
|
||||
!else # exist(...) && !$(NEED_TCL_SOURCE)
|
||||
|
||||
!if [echo _TCLDIR = \> nmakehlp.out] \
|
||||
|| [nmakehlp -L generic\tcl.h >> nmakehlp.out]
|
||||
@@ -313,7 +313,7 @@ TCLINSTALL = 0
|
||||
TCLDIR = $(_TCLDIR)
|
||||
_TCL_H = $(_TCLDIR)\generic\tcl.h
|
||||
|
||||
!endif # exist(...) && ! $(NEED_TCL_SOURCE)
|
||||
!endif # exist(...) && !$(NEED_TCL_SOURCE)
|
||||
|
||||
!endif # TCLDIR
|
||||
|
||||
@@ -415,9 +415,6 @@ _INSTALLDIR=$(_INSTALLDIR)\lib
|
||||
# NATIVE_ARCH - set to IX86 or AMD64 for the host machine
|
||||
# MACHINE - same as $(ARCH) - legacy
|
||||
# _VC_MANIFEST_EMBED_{DLL,EXE} - commands for embedding a manifest if needed
|
||||
# CFG_ENCODING - set to an character encoding.
|
||||
# TBD - this is passed to compiler as TCL_CFGVAL_ENCODING but can't
|
||||
# see where it is used
|
||||
|
||||
cc32 = $(CC) # built-in default.
|
||||
link32 = link
|
||||
@@ -503,10 +500,6 @@ _VC_MANIFEST_EMBED_EXE=if exist $@.manifest mt -nologo -manifest $@.manifest -ou
|
||||
_VC_MANIFEST_EMBED_DLL=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;2
|
||||
!endif
|
||||
|
||||
!ifndef CFG_ENCODING
|
||||
CFG_ENCODING = \"cp1252\"
|
||||
!endif
|
||||
|
||||
################################################################
|
||||
# 4. Build the nmakehlp program
|
||||
# This is a helper app we need to overcome nmake's limiting
|
||||
@@ -514,7 +507,7 @@ CFG_ENCODING = \"cp1252\"
|
||||
# information about supported compiler options etc.
|
||||
#
|
||||
# Tcl itself will always use the nmakehlp.c program which is
|
||||
# in its own source. This is the "master" copy and kept updated.
|
||||
# in its own source. It will be kept updated there.
|
||||
#
|
||||
# Extensions built against an installed Tcl will use the installed
|
||||
# copy of Tcl's nmakehlp.c if there is one and their own version
|
||||
@@ -537,7 +530,7 @@ NMAKEHLPC = nmakehlp.c
|
||||
!if exist("$(_TCLDIR)\lib\nmake\nmakehlp.c")
|
||||
NMAKEHLPC = $(_TCLDIR)\lib\nmake\nmakehlp.c
|
||||
!endif
|
||||
!else # ! $(TCLINSTALL)
|
||||
!else # !$(TCLINSTALL)
|
||||
!if exist("$(_TCLDIR)\win\nmakehlp.c")
|
||||
NMAKEHLPC = $(_TCLDIR)\win\nmakehlp.c
|
||||
!endif
|
||||
@@ -659,8 +652,130 @@ LINKERFLAGS = $(LINKERFLAGS) -ltcg
|
||||
!endif
|
||||
!endif
|
||||
|
||||
|
||||
################################################################
|
||||
# 6. Extract various version numbers from headers
|
||||
# For Tcl and Tk, version numbers are extracted from tcl.h and tk.h
|
||||
# respectively. For extensions, versions are extracted from the
|
||||
# configure.in or configure.ac from the TEA configuration if it
|
||||
# exists, and unset otherwise.
|
||||
# Sets the following macros:
|
||||
# TCL_MAJOR_VERSION
|
||||
# TCL_MINOR_VERSION
|
||||
# TCL_RELEASE_SERIAL
|
||||
# TCL_PATCH_LEVEL
|
||||
# TCL_PATCH_LETTER
|
||||
# TCL_VERSION
|
||||
# TK_MAJOR_VERSION
|
||||
# TK_MINOR_VERSION
|
||||
# TK_RELEASE_SERIAL
|
||||
# TK_PATCH_LEVEL
|
||||
# TK_PATCH_LETTER
|
||||
# TK_VERSION
|
||||
# DOTVERSION - set as (for example) 2.5
|
||||
# VERSION - set as (for example 25)
|
||||
#--------------------------------------------------------------
|
||||
|
||||
!if [echo REM = This file is generated from rules.vc > versions.vc]
|
||||
!endif
|
||||
!if [echo TCL_MAJOR_VERSION = \>> versions.vc] \
|
||||
&& [nmakehlp -V "$(_TCL_H)" TCL_MAJOR_VERSION >> versions.vc]
|
||||
!endif
|
||||
!if [echo TCL_MINOR_VERSION = \>> versions.vc] \
|
||||
&& [nmakehlp -V "$(_TCL_H)" TCL_MINOR_VERSION >> versions.vc]
|
||||
!endif
|
||||
!if [echo TCL_RELEASE_SERIAL = \>> versions.vc] \
|
||||
&& [nmakehlp -V "$(_TCL_H)" TCL_RELEASE_SERIAL >> versions.vc]
|
||||
!endif
|
||||
!if [echo TCL_PATCH_LEVEL = \>> versions.vc] \
|
||||
&& [nmakehlp -V "$(_TCL_H)" TCL_PATCH_LEVEL >> versions.vc]
|
||||
!endif
|
||||
|
||||
!if defined(_TK_H)
|
||||
!if [echo TK_MAJOR_VERSION = \>> versions.vc] \
|
||||
&& [nmakehlp -V $(_TK_H) TK_MAJOR_VERSION >> versions.vc]
|
||||
!endif
|
||||
!if [echo TK_MINOR_VERSION = \>> versions.vc] \
|
||||
&& [nmakehlp -V $(_TK_H) TK_MINOR_VERSION >> versions.vc]
|
||||
!endif
|
||||
!if [echo TK_RELEASE_SERIAL = \>> versions.vc] \
|
||||
&& [nmakehlp -V "$(_TK_H)" TK_RELEASE_SERIAL >> versions.vc]
|
||||
!endif
|
||||
!if [echo TK_PATCH_LEVEL = \>> versions.vc] \
|
||||
&& [nmakehlp -V $(_TK_H) TK_PATCH_LEVEL >> versions.vc]
|
||||
!endif
|
||||
!endif # _TK_H
|
||||
|
||||
!include versions.vc
|
||||
|
||||
TCL_VERSION = $(TCL_MAJOR_VERSION)$(TCL_MINOR_VERSION)
|
||||
TCL_DOTVERSION = $(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION)
|
||||
!if [nmakehlp -f $(TCL_PATCH_LEVEL) "a"]
|
||||
TCL_PATCH_LETTER = a
|
||||
!elseif [nmakehlp -f $(TCL_PATCH_LEVEL) "b"]
|
||||
TCL_PATCH_LETTER = b
|
||||
!else
|
||||
TCL_PATCH_LETTER = .
|
||||
!endif
|
||||
|
||||
!if defined(_TK_H)
|
||||
|
||||
TK_VERSION = $(TK_MAJOR_VERSION)$(TK_MINOR_VERSION)
|
||||
TK_DOTVERSION = $(TK_MAJOR_VERSION).$(TK_MINOR_VERSION)
|
||||
!if [nmakehlp -f $(TK_PATCH_LEVEL) "a"]
|
||||
TK_PATCH_LETTER = a
|
||||
!elseif [nmakehlp -f $(TK_PATCH_LEVEL) "b"]
|
||||
TK_PATCH_LETTER = b
|
||||
!else
|
||||
TK_PATCH_LETTER = .
|
||||
!endif
|
||||
|
||||
!endif
|
||||
|
||||
# Set DOTVERSION and VERSION
|
||||
!if $(DOING_TCL)
|
||||
|
||||
DOTVERSION = $(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION)
|
||||
VERSION = $(TCL_VERSION)
|
||||
|
||||
!elseif $(DOING_TK)
|
||||
|
||||
DOTVERSION = $(TK_DOTVERSION)
|
||||
VERSION = $(TK_VERSION)
|
||||
|
||||
!else # Doing a non-Tk extension
|
||||
|
||||
# If parent makefile has not defined DOTVERSION, try to get it from TEA
|
||||
# first from a configure.in file, and then from configure.ac
|
||||
!ifndef DOTVERSION
|
||||
!if [echo DOTVERSION = \> versions.vc] \
|
||||
|| [nmakehlp -V $(ROOT)\configure.in ^[$(PROJECT)^] >> versions.vc]
|
||||
!if [echo DOTVERSION = \> versions.vc] \
|
||||
|| [nmakehlp -V $(ROOT)\configure.ac ^[$(PROJECT)^] >> versions.vc]
|
||||
!error *** Could not figure out extension version. Please define DOTVERSION in parent makefile before including rules.vc.
|
||||
!endif
|
||||
!endif
|
||||
!include versions.vc
|
||||
!endif # DOTVERSION
|
||||
VERSION = $(DOTVERSION:.=)
|
||||
|
||||
!endif # $(DOING_TCL) ... etc.
|
||||
|
||||
# Windows RC files have 3 version components. Ensure this irrespective
|
||||
# of how many components the package has specified. Basically, ensure
|
||||
# minimum 4 components by appending 4 0's and then pick out the first 4.
|
||||
# Also take care of the fact that DOTVERSION may have "a" or "b" instead
|
||||
# of "." separating the version components.
|
||||
DOTSEPARATED=$(DOTVERSION:a=.)
|
||||
DOTSEPARATED=$(DOTSEPARATED:b=.)
|
||||
!if [echo RCCOMMAVERSION = \> versions.vc] \
|
||||
|| [for /f "tokens=1,2,3,4,5* delims=." %a in ("$(DOTSEPARATED).0.0.0.0") do echo %a,%b,%c,%d >> versions.vc]
|
||||
!error *** Could not generate RCCOMMAVERSION ***
|
||||
!endif
|
||||
!include versions.vc
|
||||
|
||||
########################################################################
|
||||
# 6. Parse the OPTS macro to work out the requested build configuration.
|
||||
# 7. Parse the OPTS macro to work out the requested build configuration.
|
||||
# Based on this, we will construct the actual switches to be passed to the
|
||||
# compiler and linker using the macros defined in the previous section.
|
||||
# The following macros are defined by this section based on OPTS
|
||||
@@ -674,9 +789,10 @@ LINKERFLAGS = $(LINKERFLAGS) -ltcg
|
||||
# MSVCRT - 1 -> link to dynamic C runtime even when building static Tcl build
|
||||
# 0 -> link to static C runtime for static Tcl build.
|
||||
# Does not impact shared Tcl builds (STATIC_BUILD == 0)
|
||||
# Default: 1 for Tcl 8.7 and up, 0 otherwise.
|
||||
# TCL_USE_STATIC_PACKAGES - 1 -> statically link the registry and dde extensions
|
||||
# in the Tcl shell. 0 -> keep them as shared libraries
|
||||
# Does not impact shared Tcl builds.
|
||||
# in the Tcl and Wish shell. 0 -> keep them as shared libraries. Does
|
||||
# not impact shared Tcl builds. Implied by STATIC_BUILD since Tcl 8.7.
|
||||
# USE_THREAD_ALLOC - 1 -> Use a shared global free pool for allocation.
|
||||
# 0 -> Use the non-thread allocator.
|
||||
# UNCHECKED - 1 -> when doing a debug build with symbols, use the release
|
||||
@@ -685,7 +801,9 @@ LINKERFLAGS = $(LINKERFLAGS) -ltcg
|
||||
# CONFIG_CHECK - 1 -> check current build configuration against Tcl
|
||||
# configuration (ignored for Tcl itself)
|
||||
# _USE_64BIT_TIME_T - forces a build using 64-bit time_t for 32-bit build
|
||||
# (CRT library should support this)
|
||||
# (CRT library should support this, not needed for Tcl 9.x)
|
||||
# TCL_UTF_MAX=4 - forces a build allowing 4-byte UTF-8 sequences internally.
|
||||
# (Not needed for Tcl 9.x)
|
||||
# Further, LINKERFLAGS are modified based on above.
|
||||
|
||||
# Default values for all the above
|
||||
@@ -728,11 +846,8 @@ MSVCRT = 0
|
||||
!else
|
||||
!if [nmakehlp -f $(OPTS) "msvcrt"]
|
||||
!message *** Doing msvcrt
|
||||
MSVCRT = 1
|
||||
!else
|
||||
!if !$(STATIC_BUILD)
|
||||
MSVCRT = 1
|
||||
!else
|
||||
!if $(TCL_MAJOR_VERSION) == 8 && $(TCL_MINOR_VERSION) < 7 && $(STATIC_BUILD)
|
||||
MSVCRT = 0
|
||||
!endif
|
||||
!endif
|
||||
@@ -741,24 +856,26 @@ MSVCRT = 0
|
||||
!if [nmakehlp -f $(OPTS) "staticpkg"] && $(STATIC_BUILD)
|
||||
!message *** Doing staticpkg
|
||||
TCL_USE_STATIC_PACKAGES = 1
|
||||
!else
|
||||
TCL_USE_STATIC_PACKAGES = 0
|
||||
!endif
|
||||
|
||||
!if [nmakehlp -f $(OPTS) "nothreads"]
|
||||
!message *** Compile explicitly for non-threaded tcl
|
||||
TCL_THREADS = 0
|
||||
USE_THREAD_ALLOC= 0
|
||||
!else
|
||||
TCL_THREADS = 1
|
||||
USE_THREAD_ALLOC= 1
|
||||
!endif
|
||||
|
||||
!if $(TCL_MAJOR_VERSION) == 8
|
||||
!if [nmakehlp -f $(OPTS) "time64bit"]
|
||||
!message *** Force 64-bit time_t
|
||||
_USE_64BIT_TIME_T = 1
|
||||
!endif
|
||||
|
||||
!if [nmakehlp -f $(OPTS) "utfmax"]
|
||||
!message *** Force allowing 4-byte UTF-8 sequences internally
|
||||
TCL_UTF_MAX = 4
|
||||
!endif
|
||||
!endif
|
||||
|
||||
# Yes, it's weird that the "symbols" option controls DEBUG and
|
||||
# the "pdbs" option controls SYMBOLS. That's historical.
|
||||
!if [nmakehlp -f $(OPTS) "symbols"]
|
||||
@@ -842,7 +959,7 @@ This compiler does not support profile guided optimization.
|
||||
!endif
|
||||
|
||||
################################################################
|
||||
# 7. Parse the STATS macro to configure code instrumentation
|
||||
# 8. Parse the STATS macro to configure code instrumentation
|
||||
# The following macros are set by this section:
|
||||
# TCL_MEM_DEBUG - 1 -> enables memory allocation instrumentation
|
||||
# 0 -> disables
|
||||
@@ -872,7 +989,7 @@ TCL_COMPILE_DEBUG = 0
|
||||
!endif
|
||||
|
||||
####################################################################
|
||||
# 8. Parse the CHECKS macro to configure additional compiler checks
|
||||
# 9. Parse the CHECKS macro to configure additional compiler checks
|
||||
# The following macros are set by this section:
|
||||
# WARNINGS - compiler switches that control the warnings level
|
||||
# TCL_NO_DEPRECATED - 1 -> disable support for deprecated functions
|
||||
@@ -904,86 +1021,6 @@ WARNINGS = $(WARNINGS) -Wp64
|
||||
|
||||
!endif
|
||||
|
||||
################################################################
|
||||
# 9. Extract various version numbers
|
||||
# For Tcl and Tk, version numbers are extracted from tcl.h and tk.h
|
||||
# respectively. For extensions, versions are extracted from the
|
||||
# configure.in or configure.ac from the TEA configuration if it
|
||||
# exists, and unset otherwise.
|
||||
# Sets the following macros:
|
||||
# TCL_MAJOR_VERSION
|
||||
# TCL_MINOR_VERSION
|
||||
# TCL_PATCH_LEVEL
|
||||
# TCL_VERSION
|
||||
# TK_MAJOR_VERSION
|
||||
# TK_MINOR_VERSION
|
||||
# TK_PATCH_LEVEL
|
||||
# TK_VERSION
|
||||
# DOTVERSION - set as (for example) 2.5
|
||||
# VERSION - set as (for example 25)
|
||||
#--------------------------------------------------------------
|
||||
|
||||
!if [echo REM = This file is generated from rules.vc > versions.vc]
|
||||
!endif
|
||||
!if [echo TCL_MAJOR_VERSION = \>> versions.vc] \
|
||||
&& [nmakehlp -V "$(_TCL_H)" TCL_MAJOR_VERSION >> versions.vc]
|
||||
!endif
|
||||
!if [echo TCL_MINOR_VERSION = \>> versions.vc] \
|
||||
&& [nmakehlp -V "$(_TCL_H)" TCL_MINOR_VERSION >> versions.vc]
|
||||
!endif
|
||||
!if [echo TCL_PATCH_LEVEL = \>> versions.vc] \
|
||||
&& [nmakehlp -V "$(_TCL_H)" TCL_PATCH_LEVEL >> versions.vc]
|
||||
!endif
|
||||
|
||||
!if defined(_TK_H)
|
||||
!if [echo TK_MAJOR_VERSION = \>> versions.vc] \
|
||||
&& [nmakehlp -V $(_TK_H) TK_MAJOR_VERSION >> versions.vc]
|
||||
!endif
|
||||
!if [echo TK_MINOR_VERSION = \>> versions.vc] \
|
||||
&& [nmakehlp -V $(_TK_H) TK_MINOR_VERSION >> versions.vc]
|
||||
!endif
|
||||
!if [echo TK_PATCH_LEVEL = \>> versions.vc] \
|
||||
&& [nmakehlp -V $(_TK_H) TK_PATCH_LEVEL >> versions.vc]
|
||||
!endif
|
||||
!endif # _TK_H
|
||||
|
||||
!include versions.vc
|
||||
|
||||
TCL_VERSION = $(TCL_MAJOR_VERSION)$(TCL_MINOR_VERSION)
|
||||
TCL_DOTVERSION = $(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION)
|
||||
!if defined(_TK_H)
|
||||
TK_VERSION = $(TK_MAJOR_VERSION)$(TK_MINOR_VERSION)
|
||||
TK_DOTVERSION = $(TK_MAJOR_VERSION).$(TK_MINOR_VERSION)
|
||||
!endif
|
||||
|
||||
# Set DOTVERSION and VERSION
|
||||
!if $(DOING_TCL)
|
||||
|
||||
DOTVERSION = $(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION)
|
||||
VERSION = $(TCL_VERSION)
|
||||
|
||||
!elseif $(DOING_TK)
|
||||
|
||||
DOTVERSION = $(TK_DOTVERSION)
|
||||
VERSION = $(TK_VERSION)
|
||||
|
||||
!else # Doing a non-Tk extension
|
||||
|
||||
# If parent makefile has not defined DOTVERSION, try to get it from TEA
|
||||
# first from a configure.in file, and then from configure.ac
|
||||
!ifndef DOTVERSION
|
||||
!if [echo DOTVERSION = \> versions.vc] \
|
||||
|| [nmakehlp -V $(ROOT)\configure.in ^[$(PROJECT)^] >> versions.vc]
|
||||
!if [echo DOTVERSION = \> versions.vc] \
|
||||
|| [nmakehlp -V $(ROOT)\configure.ac ^[$(PROJECT)^] >> versions.vc]
|
||||
!error *** Could not figure out extension version. Please define DOTVERSION in parent makefile before including rules.vc.
|
||||
!endif
|
||||
!endif
|
||||
!include versions.vc
|
||||
!endif # DOTVERSION
|
||||
VERSION = $(DOTVERSION:.=)
|
||||
|
||||
!endif # $(DOING_TCL) ... etc.
|
||||
|
||||
################################################################
|
||||
# 10. Construct output directory and file paths
|
||||
@@ -1029,7 +1066,7 @@ BUILDDIRTOP =$(BUILDDIRTOP)_$(MACHINE)
|
||||
BUILDDIRTOP =$(BUILDDIRTOP)_VC$(VCVER)
|
||||
!endif
|
||||
|
||||
!if !$(DEBUG) || $(DEBUG) && $(UNCHECKED)
|
||||
!if !$(DEBUG) || $(TCL_VERSION) > 86 || $(DEBUG) && $(UNCHECKED)
|
||||
SUFX = $(SUFX:g=)
|
||||
!endif
|
||||
|
||||
@@ -1080,20 +1117,35 @@ OUT_DIR = $(TMP_DIR)
|
||||
# The name of the stubs library for the project being built
|
||||
STUBPREFIX = $(PROJECT)stub
|
||||
|
||||
#
|
||||
# Set up paths to various Tcl executables and libraries needed by extensions
|
||||
!if $(DOING_TCL)
|
||||
#
|
||||
|
||||
# TIP 430. Unused for 8.6 but no harm defining it to allow a common rules.vc
|
||||
!if "$(TCL_PATCH_LETTER)" == "."
|
||||
TCLSCRIPTZIPNAME = libtcl_$(TCL_MAJOR_VERSION)_$(TCL_MINOR_VERSION)_$(TCL_RELEASE_SERIAL).zip
|
||||
!else
|
||||
TCLSCRIPTZIPNAME = libtcl_$(TCL_MAJOR_VERSION)_$(TCL_MINOR_VERSION)_$(TCL_PATCH_LETTER)$(TCL_RELEASE_SERIAL).zip
|
||||
!endif
|
||||
!if "$(TK_PATCH_LETTER)" == "."
|
||||
TKSCRIPTZIPNAME = libtk_$(TK_MAJOR_VERSION)_$(TK_MINOR_VERSION)_$(TK_RELEASE_SERIAL).zip
|
||||
!else
|
||||
TKSCRIPTZIPNAME = libtk_$(TK_MAJOR_VERSION)_$(TK_MINOR_VERSION)_$(TK_PATCH_LETTER)$(TK_RELEASE_SERIAL).zip
|
||||
!endif
|
||||
|
||||
!if $(DOING_TCL)
|
||||
TCLSHNAME = $(PROJECT)sh$(VERSION)$(SUFX).exe
|
||||
TCLSH = $(OUT_DIR)\$(TCLSHNAME)
|
||||
TCLIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib
|
||||
TCLLIBNAME = $(PROJECT)$(VERSION)$(SUFX).$(EXT)
|
||||
TCLLIB = $(OUT_DIR)\$(TCLLIBNAME)
|
||||
TCLSCRIPTZIP = $(OUT_DIR)\$(TCLSCRIPTZIPNAME)
|
||||
|
||||
TCLSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib
|
||||
TCLSTUBLIB = $(OUT_DIR)\$(TCLSTUBLIBNAME)
|
||||
TCL_INCLUDES = -I"$(WIN_DIR)" -I"$(GENERICDIR)"
|
||||
|
||||
!else # ! $(DOING_TCL)
|
||||
!else # !$(DOING_TCL)
|
||||
|
||||
!if $(TCLINSTALL) # Building against an installed Tcl
|
||||
|
||||
@@ -1115,6 +1167,7 @@ TCLIMPLIB = $(_TCLDIR)\lib\tcl$(TCL_VERSION)t$(SUFX:t=).lib
|
||||
TCL_LIBRARY = $(_TCLDIR)\lib
|
||||
TCLREGLIB = $(_TCLDIR)\lib\tclreg13$(SUFX:t=).lib
|
||||
TCLDDELIB = $(_TCLDIR)\lib\tcldde14$(SUFX:t=).lib
|
||||
TCLSCRIPTZIP = $(_TCLDIR)\lib\$(TCLSCRIPTZIPNAME)
|
||||
TCLTOOLSDIR = \must\have\tcl\sources\to\build\this\target
|
||||
TCL_INCLUDES = -I"$(_TCLDIR)\include"
|
||||
|
||||
@@ -1134,6 +1187,7 @@ TCLIMPLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)t$(SUFX:t=).lib
|
||||
TCL_LIBRARY = $(_TCLDIR)\library
|
||||
TCLREGLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclreg13$(SUFX:t=).lib
|
||||
TCLDDELIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcldde14$(SUFX:t=).lib
|
||||
TCLSCRIPTZIP = $(_TCLDIR)\win\$(BUILDDIRTOP)\$(TCLSCRIPTZIPNAME)
|
||||
TCLTOOLSDIR = $(_TCLDIR)\tools
|
||||
TCL_INCLUDES = -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win"
|
||||
|
||||
@@ -1166,7 +1220,8 @@ WISH = $(OUT_DIR)\$(WISHNAME)
|
||||
TKSTUBLIB = $(OUT_DIR)\$(TKSTUBLIBNAME)
|
||||
TKIMPLIB = $(OUT_DIR)\$(TKIMPLIBNAME)
|
||||
TKLIB = $(OUT_DIR)\$(TKLIBNAME)
|
||||
TK_INCLUDES = -I"$(WIN_DIR)" -I"$(GENERICDIR)"
|
||||
TK_INCLUDES = -I"$(WIN_DIR)" -I"$(GENERICDIR)"
|
||||
TKSCRIPTZIP = $(OUT_DIR)\$(TKSCRIPTZIPNAME)
|
||||
|
||||
!else # effectively NEED_TK
|
||||
|
||||
@@ -1181,7 +1236,10 @@ TKIMPLIBNAME = tk$(TK_VERSION)$(SUFX:t=).lib
|
||||
TKIMPLIB = $(_TKDIR)\lib\$(TKIMPLIBNAME)
|
||||
!endif
|
||||
TK_INCLUDES = -I"$(_TKDIR)\include"
|
||||
TKSCRIPTZIP = $(_TKDIR)\lib\$(TKSCRIPTZIPNAME)
|
||||
|
||||
!else # Building against Tk sources
|
||||
|
||||
WISH = $(_TKDIR)\win\$(BUILDDIRTOP)\$(WISHNAME)
|
||||
TKSTUBLIB = $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKSTUBLIBNAME)
|
||||
TKIMPLIB = $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKIMPLIBNAME)
|
||||
@@ -1192,7 +1250,10 @@ TKIMPLIBNAME = tk$(TK_VERSION)$(SUFX:t=).lib
|
||||
TKIMPLIB = $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKIMPLIBNAME)
|
||||
!endif
|
||||
TK_INCLUDES = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib"
|
||||
TKSCRIPTZIP = $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKSCRIPTZIPNAME)
|
||||
|
||||
!endif # TKINSTALL
|
||||
|
||||
tklibs = "$(TKSTUBLIB)" "$(TKIMPLIB)"
|
||||
|
||||
!endif # $(DOING_TK)
|
||||
@@ -1233,6 +1294,7 @@ BIN_INSTALL_DIR = $(_INSTALLDIR)\bin
|
||||
DOC_INSTALL_DIR = $(_INSTALLDIR)\doc
|
||||
!if $(DOING_TCL)
|
||||
SCRIPT_INSTALL_DIR = $(_INSTALLDIR)\lib\$(PROJECT)$(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION)
|
||||
MODULE_INSTALL_DIR = $(_INSTALLDIR)\lib\tcl$(TCL_MAJOR_VERSION)
|
||||
!else # DOING_TK
|
||||
SCRIPT_INSTALL_DIR = $(_INSTALLDIR)\lib\$(PROJECT)$(TK_MAJOR_VERSION).$(TK_MINOR_VERSION)
|
||||
!endif
|
||||
@@ -1277,7 +1339,15 @@ INCLUDE_INSTALL_DIR = $(_INSTALLDIR)\..\include
|
||||
# baselibs - minimum Windows libraries required. Parent makefile can
|
||||
# define PRJ_LIBS before including rules.rc if additional libs are needed
|
||||
|
||||
OPTDEFINES = /DTCL_CFGVAL_ENCODING=$(CFG_ENCODING) /DSTDC_HEADERS
|
||||
OPTDEFINES = /DSTDC_HEADERS
|
||||
!if $(VCVERSION) > 1600
|
||||
OPTDEFINES = $(OPTDEFINES) /DHAVE_STDINT_H=1
|
||||
!else
|
||||
OPTDEFINES = $(OPTDEFINES) /DMP_NO_STDINT=1
|
||||
!endif
|
||||
!if $(VCVERSION) >= 1800
|
||||
OPTDEFINES = $(OPTDEFINES) /DHAVE_INTTYPES_H=1 /DHAVE_STDBOOL_H=1
|
||||
!endif
|
||||
|
||||
!if $(TCL_MEM_DEBUG)
|
||||
OPTDEFINES = $(OPTDEFINES) /DTCL_MEM_DEBUG
|
||||
@@ -1293,6 +1363,11 @@ OPTDEFINES = $(OPTDEFINES) /DUSE_THREAD_ALLOC=1
|
||||
!endif
|
||||
!if $(STATIC_BUILD)
|
||||
OPTDEFINES = $(OPTDEFINES) /DSTATIC_BUILD
|
||||
!elseif $(TCL_VERSION) > 86
|
||||
OPTDEFINES = $(OPTDEFINES) /DTCL_WITH_EXTERNAL_TOMMATH
|
||||
!if "$(MACHINE)" == "AMD64"
|
||||
OPTDEFINES = $(OPTDEFINES) /DMP_64BIT
|
||||
!endif
|
||||
!endif
|
||||
!if $(TCL_NO_DEPRECATED)
|
||||
OPTDEFINES = $(OPTDEFINES) /DTCL_NO_DEPRECATED
|
||||
@@ -1301,7 +1376,7 @@ OPTDEFINES = $(OPTDEFINES) /DTCL_NO_DEPRECATED
|
||||
!if $(USE_STUBS)
|
||||
# Note we do not define USE_TCL_STUBS even when building tk since some
|
||||
# test targets in tk do not use stubs
|
||||
!if ! $(DOING_TCL)
|
||||
!if !$(DOING_TCL)
|
||||
USE_STUBS_DEFS = /DUSE_TCL_STUBS /DUSE_TCLOO_STUBS
|
||||
!if $(NEED_TK)
|
||||
USE_STUBS_DEFS = $(USE_STUBS_DEFS) /DUSE_TK_STUBS
|
||||
@@ -1322,15 +1397,20 @@ OPTDEFINES = $(OPTDEFINES) /DTCL_CFG_PROFILED
|
||||
OPTDEFINES = $(OPTDEFINES) /DTCL_CFG_DO64BIT
|
||||
!endif
|
||||
!if $(VCVERSION) < 1300
|
||||
OPTDEFINES = $(OPTDEFINES) /DNO_STRTOI64
|
||||
OPTDEFINES = $(OPTDEFINES) /DNO_STRTOI64=1
|
||||
!endif
|
||||
|
||||
!if "$(TCL_MAJOR_VERSION)" == "8"
|
||||
!if "$(_USE_64BIT_TIME_T)" == "1"
|
||||
OPTDEFINES = $(OPTDEFINES) /D_USE_64BIT_TIME_T
|
||||
OPTDEFINES = $(OPTDEFINES) /D_USE_64BIT_TIME_T=1
|
||||
!endif
|
||||
!if "$(TCL_UTF_MAX)" == "4"
|
||||
OPTDEFINES = $(OPTDEFINES) /DTCL_UTF_MAX=4
|
||||
!endif
|
||||
|
||||
# _ATL_XP_TARGETING - Newer SDK's need this to build for XP
|
||||
COMPILERFLAGS = /D_ATL_XP_TARGETING
|
||||
!endif
|
||||
|
||||
# Like the TEA system only set this non empty for non-Tk extensions
|
||||
# Note: some extensions use PACKAGE_NAME and others use PACKAGE_TCLNAME
|
||||
@@ -1455,18 +1535,6 @@ lflags = -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug)
|
||||
lflags = $(lflags) -nodefaultlib:libucrt.lib
|
||||
!endif
|
||||
|
||||
# Old linkers (Visual C++ 6 in particular) will link for fast loading
|
||||
# on Win98. Since we do not support Win98 any more, we specify nowin98
|
||||
# as recommended for NT and later. However, this is only required by
|
||||
# IX86 on older compilers and only needed if we are not doing a static build.
|
||||
|
||||
!if "$(MACHINE)" == "IX86" && !$(STATIC_BUILD)
|
||||
!if [nmakehlp -l -opt:nowin98 $(LINKER_TESTFLAGS)]
|
||||
# Align sections for PE size savings.
|
||||
lflags = $(lflags) -opt:nowin98
|
||||
!endif
|
||||
!endif
|
||||
|
||||
dlllflags = $(lflags) -dll
|
||||
conlflags = $(lflags) -subsystem:console
|
||||
guilflags = $(lflags) -subsystem:windows
|
||||
@@ -1508,7 +1576,7 @@ GUIEXECMD = $(link32) $(guilflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs)
|
||||
RESCMD = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \
|
||||
$(TCL_INCLUDES) \
|
||||
/DDEBUG=$(DEBUG) -d UNCHECKED=$(UNCHECKED) \
|
||||
/DCOMMAVERSION=$(DOTVERSION:.=,),0 \
|
||||
/DCOMMAVERSION=$(RCCOMMAVERSION) \
|
||||
/DDOTVERSION=\"$(DOTVERSION)\" \
|
||||
/DVERSION=\"$(VERSION)\" \
|
||||
/DSUFX=\"$(SUFX)\" \
|
||||
@@ -1524,11 +1592,11 @@ default-target: $(DEFAULT_BUILD_TARGET)
|
||||
!if $(MULTIPLATFORM_INSTALL)
|
||||
default-pkgindex:
|
||||
@echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \
|
||||
[list load [file join $$dir $(PLATFORM_IDENTIFY) $(PRJLIBNAME)]] > $(OUT_DIR)\pkgIndex.tcl
|
||||
[list load [file join $$dir $(PLATFORM_IDENTIFY) $(PRJLIBNAME)] [string totitle $(PRJ_PACKAGE_TCLNAME)]] > $(OUT_DIR)\pkgIndex.tcl
|
||||
!else
|
||||
default-pkgindex:
|
||||
@echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \
|
||||
[list load [file join $$dir $(PRJLIBNAME)]] > $(OUT_DIR)\pkgIndex.tcl
|
||||
[list load [file join $$dir $(PRJLIBNAME)] [string totitle $(PRJ_PACKAGE_TCLNAME)]] > $(OUT_DIR)\pkgIndex.tcl
|
||||
!endif
|
||||
|
||||
default-pkgindex-tea:
|
||||
@@ -1574,6 +1642,8 @@ default-install-pdbs:
|
||||
@if not exist "$(LIB_INSTALL_DIR)" mkdir "$(LIB_INSTALL_DIR)"
|
||||
@$(CPY) "$(OUT_DIR)\*.pdb" "$(LIB_INSTALL_DIR)\"
|
||||
|
||||
# "emacs font-lock highlighting fix
|
||||
|
||||
default-install-docs-html:
|
||||
@echo Installing documentation files to '$(DOC_INSTALL_DIR)'
|
||||
@if not exist "$(DOC_INSTALL_DIR)" mkdir "$(DOC_INSTALL_DIR)"
|
||||
@@ -1636,7 +1706,7 @@ default-shell: default-setup $(PROJECT)
|
||||
!ifdef RCFILE
|
||||
|
||||
# Note: don't use $** in below rule because there may be other dependencies
|
||||
# and only the "master" rc must be passed to the resource compiler
|
||||
# and only the "main" rc must be passed to the resource compiler
|
||||
$(TMP_DIR)\$(PROJECT).res: $(RCDIR)\$(PROJECT).rc
|
||||
$(RESCMD) $(RCDIR)\$(PROJECT).rc
|
||||
|
||||
@@ -1690,7 +1760,7 @@ DISABLE_IMPLICIT_RULES = 0
|
||||
|
||||
!if !$(DISABLE_IMPLICIT_RULES)
|
||||
# Implicit rule definitions - only for building library objects. For stubs and
|
||||
# main application, the master makefile should define explicit rules.
|
||||
# main application, the makefile should define explicit rules.
|
||||
|
||||
{$(ROOT)}.c{$(TMP_DIR)}.obj::
|
||||
$(CCPKGCMD) @<<
|
||||
@@ -1731,15 +1801,15 @@ $<
|
||||
# When building an extension, certain configuration options should
|
||||
# match the ones used when Tcl was built. Here we check and
|
||||
# warn on a mismatch.
|
||||
!if ! $(DOING_TCL)
|
||||
!if !$(DOING_TCL)
|
||||
|
||||
!if $(TCLINSTALL) # Building against an installed Tcl
|
||||
!if exist("$(_TCLDIR)\lib\nmake\tcl.nmake")
|
||||
TCLNMAKECONFIG = "$(_TCLDIR)\lib\nmake\tcl.nmake"
|
||||
!endif
|
||||
!else # ! $(TCLINSTALL) - building against Tcl source
|
||||
!if exist("$(OUT_DIR)\tcl.nmake")
|
||||
TCLNMAKECONFIG = "$(OUT_DIR)\tcl.nmake"
|
||||
!else # !$(TCLINSTALL) - building against Tcl source
|
||||
!if exist("$(_TCLDIR)\win\$(BUILDDIRTOP)\tcl.nmake")
|
||||
TCLNMAKECONFIG = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcl.nmake"
|
||||
!endif
|
||||
!endif # TCLINSTALL
|
||||
|
||||
@@ -1760,7 +1830,7 @@ TCLNMAKECONFIG = "$(OUT_DIR)\tcl.nmake"
|
||||
|
||||
!endif # TCLNMAKECONFIG
|
||||
|
||||
!endif # ! $(DOING_TCL)
|
||||
!endif # !$(DOING_TCL)
|
||||
|
||||
|
||||
#----------------------------------------------------------
|
||||
|
||||
224
win/stubs.c
224
win/stubs.c
@@ -1,4 +1,4 @@
|
||||
#include "tk.h"
|
||||
#include "tkInt.h"
|
||||
|
||||
/*
|
||||
* Undocumented Xlib internal function
|
||||
@@ -8,6 +8,8 @@ int
|
||||
_XInitImageFuncPtrs(
|
||||
XImage *image)
|
||||
{
|
||||
(void)image;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -21,6 +23,9 @@ XSetWMClientMachine(
|
||||
Window w,
|
||||
XTextProperty *text_prop)
|
||||
{
|
||||
(void)display;
|
||||
(void)w;
|
||||
(void)text_prop;
|
||||
}
|
||||
|
||||
Status
|
||||
@@ -29,7 +34,11 @@ XStringListToTextProperty(
|
||||
int count,
|
||||
XTextProperty *text_prop_return)
|
||||
{
|
||||
return (Status) 0;
|
||||
(void)list;
|
||||
(void)count;
|
||||
(void)text_prop_return;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -47,54 +56,36 @@ XChangeProperty(
|
||||
_Xconst unsigned char *data,
|
||||
int nelements)
|
||||
{
|
||||
return Success;
|
||||
}
|
||||
(void)display;
|
||||
(void)w;
|
||||
(void)property;
|
||||
(void)type;
|
||||
(void)format;
|
||||
(void)mode;
|
||||
(void)data;
|
||||
(void)nelements;
|
||||
|
||||
Cursor
|
||||
XCreateGlyphCursor(
|
||||
Display *display,
|
||||
Font source_font,
|
||||
Font mask_font,
|
||||
unsigned int source_char,
|
||||
unsigned int mask_char,
|
||||
XColor _Xconst *foreground_color,
|
||||
XColor _Xconst *background_color)
|
||||
{
|
||||
return 1;
|
||||
return Success;
|
||||
}
|
||||
|
||||
XIC
|
||||
XCreateIC(XIM xim, ...)
|
||||
{
|
||||
(void)xim;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Cursor
|
||||
XCreatePixmapCursor(
|
||||
Display *display,
|
||||
Pixmap source,
|
||||
Pixmap mask,
|
||||
XColor *foreground_color,
|
||||
XColor *background_color,
|
||||
unsigned int x,
|
||||
unsigned int y)
|
||||
{
|
||||
return (Cursor) NULL;
|
||||
}
|
||||
|
||||
int
|
||||
XDeleteProperty(
|
||||
Display *display,
|
||||
Window w,
|
||||
Atom property)
|
||||
{
|
||||
return Success;
|
||||
}
|
||||
(void)display;
|
||||
(void)w;
|
||||
(void)property;
|
||||
|
||||
void
|
||||
XDestroyIC(
|
||||
XIC ic)
|
||||
{
|
||||
return Success;
|
||||
}
|
||||
|
||||
Bool
|
||||
@@ -102,6 +93,9 @@ XFilterEvent(
|
||||
XEvent *event,
|
||||
Window window)
|
||||
{
|
||||
(void)event;
|
||||
(void)window;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -110,6 +104,9 @@ XForceScreenSaver(
|
||||
Display *display,
|
||||
int mode)
|
||||
{
|
||||
(void)display;
|
||||
(void)mode;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -118,6 +115,9 @@ XFreeCursor(
|
||||
Display *display,
|
||||
Cursor cursor)
|
||||
{
|
||||
(void)display;
|
||||
(void)cursor;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -125,6 +125,8 @@ GContext
|
||||
XGContextFromGC(
|
||||
GC gc)
|
||||
{
|
||||
(void)gc;
|
||||
|
||||
return (GContext) NULL;
|
||||
}
|
||||
|
||||
@@ -133,6 +135,9 @@ XGetAtomName(
|
||||
Display *display,
|
||||
Atom atom)
|
||||
{
|
||||
(void)display;
|
||||
(void)atom;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -142,6 +147,10 @@ XGetWindowAttributes(
|
||||
Window w,
|
||||
XWindowAttributes *window_attributes_return)
|
||||
{
|
||||
(void)display;
|
||||
(void)w;
|
||||
(void)window_attributes_return;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -152,7 +161,12 @@ XGetWMColormapWindows(
|
||||
Window **windows_return,
|
||||
int *count_return)
|
||||
{
|
||||
return (Status) 0;
|
||||
(void)display;
|
||||
(void)w;
|
||||
(void)windows_return;
|
||||
(void)count_return;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -161,6 +175,10 @@ XIconifyWindow(
|
||||
Window w,
|
||||
int screen_number)
|
||||
{
|
||||
(void)display;
|
||||
(void)w;
|
||||
(void)screen_number;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -170,6 +188,10 @@ XListHosts(
|
||||
int *nhosts_return,
|
||||
Bool *state_return)
|
||||
{
|
||||
(void)display;
|
||||
(void)nhosts_return;
|
||||
(void)state_return;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -181,6 +203,12 @@ XLookupColor(
|
||||
XColor *exact_def_return,
|
||||
XColor *screen_def_return)
|
||||
{
|
||||
(void)display;
|
||||
(void)colormap;
|
||||
(void)color_name;
|
||||
(void)exact_def_return;
|
||||
(void)screen_def_return;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -189,6 +217,9 @@ XNextEvent(
|
||||
Display *display,
|
||||
XEvent *event_return)
|
||||
{
|
||||
(void)display;
|
||||
(void)event_return;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -197,6 +228,9 @@ XPutBackEvent(
|
||||
Display *display,
|
||||
XEvent *event)
|
||||
{
|
||||
(void)display;
|
||||
(void)event;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -207,6 +241,11 @@ XQueryColors(
|
||||
XColor *defs_in_out,
|
||||
int ncolors)
|
||||
{
|
||||
(void)display;
|
||||
(void)colormap;
|
||||
(void)defs_in_out;
|
||||
(void)ncolors;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -219,6 +258,13 @@ XQueryTree(
|
||||
Window **children_return,
|
||||
unsigned int *nchildren_return)
|
||||
{
|
||||
(void)display;
|
||||
(void)w;
|
||||
(void)root_return;
|
||||
(void)parent_return;
|
||||
(void)children_return;
|
||||
(void)nchildren_return;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -226,6 +272,8 @@ int
|
||||
XRefreshKeyboardMapping(
|
||||
XMappingEvent *event_map)
|
||||
{
|
||||
(void)event_map;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -234,6 +282,9 @@ XRootWindow(
|
||||
Display *display,
|
||||
int screen_number)
|
||||
{
|
||||
(void)display;
|
||||
(void)screen_number;
|
||||
|
||||
return (Window) NULL;
|
||||
}
|
||||
|
||||
@@ -243,6 +294,10 @@ XSelectInput(
|
||||
Window w,
|
||||
long event_mask)
|
||||
{
|
||||
(void)display;
|
||||
(void)w;
|
||||
(void)event_mask;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -254,6 +309,12 @@ XSendEvent(
|
||||
long event_mask,
|
||||
XEvent *event_send)
|
||||
{
|
||||
(void)display;
|
||||
(void)w;
|
||||
(void)propagate;
|
||||
(void)event_mask;
|
||||
(void)event_send;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -264,6 +325,11 @@ XSetCommand(
|
||||
char **argv,
|
||||
int argc)
|
||||
{
|
||||
(void)display;
|
||||
(void)w;
|
||||
(void)argv;
|
||||
(void)argc;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -271,6 +337,8 @@ XErrorHandler
|
||||
XSetErrorHandler(
|
||||
XErrorHandler handler)
|
||||
{
|
||||
(void)handler;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -280,6 +348,10 @@ XSetIconName(
|
||||
Window w,
|
||||
_Xconst char *icon_name)
|
||||
{
|
||||
(void)display;
|
||||
(void)w;
|
||||
(void)icon_name;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -289,6 +361,10 @@ XSetWindowBackground(
|
||||
Window w,
|
||||
unsigned long background_pixel)
|
||||
{
|
||||
(void)display;
|
||||
(void)w;
|
||||
(void)background_pixel;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -298,6 +374,10 @@ XSetWindowBackgroundPixmap(
|
||||
Window w,
|
||||
Pixmap background_pixmap)
|
||||
{
|
||||
(void)display;
|
||||
(void)w;
|
||||
(void)background_pixmap;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -307,6 +387,10 @@ XSetWindowBorder(
|
||||
Window w,
|
||||
unsigned long border_pixel)
|
||||
{
|
||||
(void)display;
|
||||
(void)w;
|
||||
(void)border_pixel;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -316,6 +400,10 @@ XSetWindowBorderPixmap(
|
||||
Window w,
|
||||
Pixmap border_pixmap)
|
||||
{
|
||||
(void)display;
|
||||
(void)w;
|
||||
(void)border_pixmap;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -325,6 +413,10 @@ XSetWindowBorderWidth(
|
||||
Window w,
|
||||
unsigned int width)
|
||||
{
|
||||
(void)display;
|
||||
(void)w;
|
||||
(void)width;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -334,6 +426,10 @@ XSetWindowColormap(
|
||||
Window w,
|
||||
Colormap colormap)
|
||||
{
|
||||
(void)display;
|
||||
(void)w;
|
||||
(void)colormap;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -348,6 +444,15 @@ XTranslateCoordinates(
|
||||
int *dest_y_return,
|
||||
Window *child_return)
|
||||
{
|
||||
(void)display;
|
||||
(void)src_w;
|
||||
(void)dest_w;
|
||||
(void)src_x;
|
||||
(void)src_y;
|
||||
(void)dest_x_return;
|
||||
(void)dest_y_return;
|
||||
(void)child_return;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -358,6 +463,11 @@ XWindowEvent(
|
||||
long event_mask,
|
||||
XEvent *event_return)
|
||||
{
|
||||
(void)display;
|
||||
(void)w;
|
||||
(void)event_mask;
|
||||
(void)event_return;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -367,6 +477,10 @@ XWithdrawWindow(
|
||||
Window w,
|
||||
int screen_number)
|
||||
{
|
||||
(void)display;
|
||||
(void)w;
|
||||
(void)screen_number;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -379,6 +493,13 @@ XmbLookupString(
|
||||
KeySym *keysym_return,
|
||||
Status *status_return)
|
||||
{
|
||||
(void)ic;
|
||||
(void)event;
|
||||
(void)buffer_return;
|
||||
(void)bytes_buffer;
|
||||
(void)keysym_return;
|
||||
(void)status_return;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -389,7 +510,7 @@ XGetWindowProperty(
|
||||
Atom property,
|
||||
long long_offset,
|
||||
long long_length,
|
||||
Bool delete,
|
||||
Bool del,
|
||||
Atom req_type,
|
||||
Atom *actual_type_return,
|
||||
int *actual_format_return,
|
||||
@@ -397,6 +518,14 @@ XGetWindowProperty(
|
||||
unsigned long *bytes_after_return,
|
||||
unsigned char **prop_return)
|
||||
{
|
||||
(void)display;
|
||||
(void)w;
|
||||
(void)property;
|
||||
(void)long_offset;
|
||||
(void)long_length;
|
||||
(void)del;
|
||||
(void)req_type;
|
||||
|
||||
*actual_type_return = None;
|
||||
*actual_format_return = 0;
|
||||
*nitems_return = 0;
|
||||
@@ -413,6 +542,8 @@ int
|
||||
XFlush(
|
||||
Display *display)
|
||||
{
|
||||
(void)display;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -420,6 +551,8 @@ int
|
||||
XGrabServer(
|
||||
Display *display)
|
||||
{
|
||||
(void)display;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -427,6 +560,8 @@ int
|
||||
XUngrabServer(
|
||||
Display *display)
|
||||
{
|
||||
(void)display;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -453,6 +588,8 @@ XSynchronize(
|
||||
Display *display,
|
||||
Bool onoff)
|
||||
{
|
||||
(void)onoff;
|
||||
|
||||
display->request++;
|
||||
return NULL;
|
||||
}
|
||||
@@ -462,6 +599,8 @@ XSync(
|
||||
Display *display,
|
||||
Bool discard)
|
||||
{
|
||||
(void)discard;
|
||||
|
||||
display->request++;
|
||||
return 0;
|
||||
}
|
||||
@@ -472,3 +611,16 @@ XVisualIDFromVisual(
|
||||
{
|
||||
return visual->visualid;
|
||||
}
|
||||
|
||||
int
|
||||
XOffsetRegion(
|
||||
Region rgn,
|
||||
int dx,
|
||||
int dy)
|
||||
{
|
||||
(void)rgn;
|
||||
(void)dx;
|
||||
(void)dy;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
53
win/tcl.m4
53
win/tcl.m4
@@ -364,14 +364,6 @@ AC_DEFUN([SC_ENABLE_SHARED], [
|
||||
AC_ARG_ENABLE(shared,
|
||||
[ --enable-shared build and link with shared libraries (default: on)],
|
||||
[tcl_ok=$enableval], [tcl_ok=yes])
|
||||
|
||||
if test "${enable_shared+set}" = set; then
|
||||
enableval="$enable_shared"
|
||||
tcl_ok=$enableval
|
||||
else
|
||||
tcl_ok=yes
|
||||
fi
|
||||
|
||||
if test "$tcl_ok" = "yes" ; then
|
||||
AC_MSG_RESULT([shared])
|
||||
SHARED_BUILD=1
|
||||
@@ -583,14 +575,14 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
|
||||
if test "$ac_cv_cross" = "yes"; then
|
||||
case "$do64bit" in
|
||||
amd64|x64|yes)
|
||||
CC="x86_64-w64-mingw32-gcc"
|
||||
CC="x86_64-w64-mingw32-${CC}"
|
||||
LD="x86_64-w64-mingw32-ld"
|
||||
AR="x86_64-w64-mingw32-ar"
|
||||
RANLIB="x86_64-w64-mingw32-ranlib"
|
||||
RC="x86_64-w64-mingw32-windres"
|
||||
;;
|
||||
*)
|
||||
CC="i686-w64-mingw32-gcc"
|
||||
CC="i686-w64-mingw32-${CC}"
|
||||
LD="i686-w64-mingw32-ld"
|
||||
AR="i686-w64-mingw32-ar"
|
||||
RANLIB="i686-w64-mingw32-ranlib"
|
||||
@@ -715,7 +707,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
|
||||
SHLIB_LD='${CC} -shared'
|
||||
SHLIB_LD_LIBS='${LIBS}'
|
||||
MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -o \[$]@ ${extra_ldflags} \
|
||||
-Wl,--out-implib,\$(patsubst %.dll,lib%.a,\[$]@)"
|
||||
-Wl,--out-implib,\$(patsubst %.dll,lib%.dll.a,\[$]@)"
|
||||
# DLLSUFFIX is separate because it is the building block for
|
||||
# users of tclConfig.sh that may build shared or static.
|
||||
DLLSUFFIX="\${DBGX}.dll"
|
||||
@@ -727,10 +719,19 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
|
||||
|
||||
CFLAGS_DEBUG=-g
|
||||
CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
|
||||
CFLAGS_WARNING="-Wall -Wdeclaration-after-statement"
|
||||
CFLAGS_WARNING="-Wall -Wpointer-arith"
|
||||
LDFLAGS_DEBUG=
|
||||
LDFLAGS_OPTIMIZE=
|
||||
|
||||
case "${CC}" in
|
||||
*++)
|
||||
CFLAGS_WARNING="${CFLAGS_WARNING} -Wno-format"
|
||||
;;
|
||||
*)
|
||||
CFLAGS_WARNING="${CFLAGS_WARNING} -Wdeclaration-after-statement"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Specify the CC output file names based on the target name
|
||||
CC_OBJNAME="-o \[$]@"
|
||||
CC_EXENAME="-o \[$]@"
|
||||
@@ -806,28 +807,15 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
|
||||
LIBSUFFIX="\${DBGX}.lib"
|
||||
LIBFLAGSUFFIX="\${DBGX}"
|
||||
|
||||
# This is a 2-stage check to make sure we have the 64-bit SDK
|
||||
# We have to know where the SDK is installed.
|
||||
# This magic is based on MS Platform SDK for Win2003 SP1 - hobbs
|
||||
if test "$do64bit" != "no" ; then
|
||||
if test "x${MSSDK}x" = "xx" ; then
|
||||
MSSDK="C:/Progra~1/Microsoft Platform SDK"
|
||||
fi
|
||||
MSSDK=`echo "$MSSDK" | sed -e 's!\\\!/!g'`
|
||||
PATH64=""
|
||||
case "$do64bit" in
|
||||
amd64|x64|yes)
|
||||
MACHINE="AMD64" ; # assume AMD64 as default 64-bit build
|
||||
PATH64="${MSSDK}/Bin/Win64/x86/AMD64"
|
||||
;;
|
||||
ia64)
|
||||
MACHINE="IA64"
|
||||
PATH64="${MSSDK}/Bin/Win64"
|
||||
;;
|
||||
esac
|
||||
if test ! -d "${PATH64}" ; then
|
||||
AC_MSG_WARN([Could not find 64-bit $MACHINE SDK])
|
||||
fi
|
||||
AC_MSG_RESULT([ Using 64-bit $MACHINE mode])
|
||||
fi
|
||||
|
||||
@@ -842,21 +830,12 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
|
||||
esac
|
||||
|
||||
if test "$do64bit" != "no" ; then
|
||||
# The space-based-path will work for the Makefile, but will
|
||||
# not work if AC_TRY_COMPILE is called. TEA has the
|
||||
# TEA_PATH_NOSPACE to avoid this issue.
|
||||
# Check if _WIN64 is already recognized, and if so we don't
|
||||
# need to modify CC.
|
||||
AC_CHECK_DECL([_WIN64], [],
|
||||
[CC="\"${PATH64}/cl.exe\" -I\"${MSSDK}/Include\" \
|
||||
-I\"${MSSDK}/Include/crt\" \
|
||||
-I\"${MSSDK}/Include/crt/sys\""])
|
||||
RC="\"${MSSDK}/bin/rc.exe\""
|
||||
RC="rc"
|
||||
CFLAGS_DEBUG="-nologo -Zi -Od ${runtime}d"
|
||||
# Do not use -O2 for Win64 - this has proved buggy in code gen.
|
||||
CFLAGS_OPTIMIZE="-nologo -O1 ${runtime}"
|
||||
lflags="${lflags} -nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\""
|
||||
LINKBIN="\"${PATH64}/link.exe\""
|
||||
lflags="${lflags} -nologo -MACHINE:${MACHINE}"
|
||||
LINKBIN="link"
|
||||
# Avoid 'unresolved external symbol __security_cookie' errors.
|
||||
# c.f. http://support.microsoft.com/?id=894573
|
||||
LIBS="$LIBS bufferoverflowU.lib"
|
||||
|
||||
@@ -134,7 +134,7 @@ DllMain(
|
||||
"leaq %[registration], %%rdx" "\n\t"
|
||||
"movq %%gs:0, %%rax" "\n\t"
|
||||
"movq %%rax, 0x0(%%rdx)" "\n\t" /* link */
|
||||
"leaq 1f, %%rax" "\n\t"
|
||||
"leaq 1f(%%rip), %%rax" "\n\t"
|
||||
"movq %%rax, 0x8(%%rdx)" "\n\t" /* handler */
|
||||
"movq %%rbp, 0x10(%%rdx)" "\n\t" /* rbp */
|
||||
"movq %%rsp, 0x18(%%rdx)" "\n\t" /* rsp */
|
||||
@@ -150,7 +150,7 @@ DllMain(
|
||||
* Call TkFinalize
|
||||
*/
|
||||
|
||||
"movq $0x0, 0x0(%%esp)" "\n\t"
|
||||
"movq $0x0, 0x0(%%rsp)" "\n\t"
|
||||
"call TkFinalize" "\n\t"
|
||||
|
||||
/*
|
||||
|
||||
@@ -78,8 +78,9 @@ TkSelGetSelection(
|
||||
CloseClipboard();
|
||||
goto error;
|
||||
}
|
||||
data = GlobalLock(handle);
|
||||
Tcl_WinTCharToUtf((LPCTSTR)data, -1, &ds);
|
||||
data = (char *)GlobalLock(handle);
|
||||
Tcl_DStringInit(&ds);
|
||||
Tcl_WCharToUtfDString((WCHAR *)data, wcslen((WCHAR *)data), &ds);
|
||||
GlobalUnlock(handle);
|
||||
} else if (IsClipboardFormatAvailable(CF_TEXT)) {
|
||||
/*
|
||||
@@ -100,7 +101,7 @@ TkSelGetSelection(
|
||||
|
||||
Tcl_DStringInit(&ds);
|
||||
Tcl_DStringAppend(&ds, "cp######", -1);
|
||||
data = GlobalLock(handle);
|
||||
data = (char *)GlobalLock(handle);
|
||||
|
||||
/*
|
||||
* Even though the documentation claims that GetLocaleInfo expects
|
||||
@@ -130,7 +131,7 @@ TkSelGetSelection(
|
||||
CloseClipboard();
|
||||
goto error;
|
||||
}
|
||||
data = GlobalLock(handle);
|
||||
data = (char *)GlobalLock(handle);
|
||||
Tcl_ExternalToUtfDString(encoding, data, -1, &ds);
|
||||
GlobalUnlock(handle);
|
||||
if (encoding) {
|
||||
@@ -157,7 +158,8 @@ TkSelGetSelection(
|
||||
Tcl_DStringAppend(&ds, "\n", 1);
|
||||
}
|
||||
len = wcslen(fname);
|
||||
Tcl_WinTCharToUtf((LPCTSTR)fname, len * sizeof(WCHAR), &dsTmp);
|
||||
Tcl_DStringInit(&dsTmp);
|
||||
Tcl_WCharToUtfDString(fname, len, &dsTmp);
|
||||
Tcl_DStringAppend(&ds, Tcl_DStringValue(&dsTmp),
|
||||
Tcl_DStringLength(&dsTmp));
|
||||
Tcl_DStringFree(&dsTmp);
|
||||
@@ -232,6 +234,8 @@ XSetSelectionOwner(
|
||||
{
|
||||
HWND hwnd = owner ? TkWinGetHWND(owner) : NULL;
|
||||
Tk_Window tkwin;
|
||||
(void)display;
|
||||
(void)time;
|
||||
|
||||
/*
|
||||
* This is a gross hack because the Tk_InternAtom interface is broken. It
|
||||
@@ -281,6 +285,7 @@ TkWinClipboardRender(
|
||||
char *buffer, *p, *rawText, *endPtr;
|
||||
int length;
|
||||
Tcl_DString ds;
|
||||
(void)format;
|
||||
|
||||
for (targetPtr = dispPtr->clipTargetPtr; targetPtr != NULL;
|
||||
targetPtr = targetPtr->nextPtr) {
|
||||
@@ -312,7 +317,7 @@ TkWinClipboardRender(
|
||||
* Copy the data and change EOL characters.
|
||||
*/
|
||||
|
||||
buffer = rawText = ckalloc(length + 1);
|
||||
buffer = rawText = (char *)ckalloc(length + 1);
|
||||
if (targetPtr != NULL) {
|
||||
for (cbPtr = targetPtr->firstBufferPtr; cbPtr != NULL;
|
||||
cbPtr = cbPtr->nextPtr) {
|
||||
@@ -328,7 +333,7 @@ TkWinClipboardRender(
|
||||
*buffer = '\0';
|
||||
|
||||
Tcl_DStringInit(&ds);
|
||||
Tcl_WinUtfToTChar(rawText, -1, &ds);
|
||||
Tcl_UtfToWCharDString(rawText, -1, &ds);
|
||||
ckfree(rawText);
|
||||
handle = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE,
|
||||
Tcl_DStringLength(&ds) + 2);
|
||||
@@ -336,7 +341,7 @@ TkWinClipboardRender(
|
||||
Tcl_DStringFree(&ds);
|
||||
return;
|
||||
}
|
||||
buffer = GlobalLock(handle);
|
||||
buffer = (char *)GlobalLock(handle);
|
||||
memcpy(buffer, Tcl_DStringValue(&ds),
|
||||
Tcl_DStringLength(&ds) + 2);
|
||||
GlobalUnlock(handle);
|
||||
@@ -367,6 +372,8 @@ TkSelUpdateClipboard(
|
||||
TkClipboardTarget *targetPtr)
|
||||
{
|
||||
HWND hwnd = TkWinGetHWND(winPtr->window);
|
||||
(void)targetPtr;
|
||||
|
||||
UpdateClipboard(hwnd);
|
||||
}
|
||||
|
||||
@@ -419,7 +426,7 @@ UpdateClipboard(
|
||||
void
|
||||
TkSelEventProc(
|
||||
Tk_Window tkwin, /* Window for which event was targeted. */
|
||||
register XEvent *eventPtr) /* X event: either SelectionClear,
|
||||
XEvent *eventPtr) /* X event: either SelectionClear,
|
||||
* SelectionRequest, or SelectionNotify. */
|
||||
{
|
||||
if (eventPtr->type == SelectionClear) {
|
||||
@@ -446,8 +453,9 @@ TkSelEventProc(
|
||||
|
||||
void
|
||||
TkSelPropProc(
|
||||
register XEvent *eventPtr) /* X PropertyChange event. */
|
||||
XEvent *eventPtr) /* X PropertyChange event. */
|
||||
{
|
||||
(void)eventPtr;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -103,7 +103,7 @@ TkGetCursorByName(
|
||||
|
||||
/*
|
||||
* All cursor names are valid lists of one element (for
|
||||
* Unix-compatability), even unadorned system cursor names.
|
||||
* Unix-compatibility), even unadorned system cursor names.
|
||||
*/
|
||||
|
||||
if (Tcl_SplitList(interp, string, &argc, &argv) != TCL_OK) {
|
||||
|
||||
@@ -423,7 +423,7 @@ typedef struct IFileSaveDialogVtbl {
|
||||
ULONG ( STDMETHODCALLTYPE *Release )( IFileSaveDialog *);
|
||||
HRESULT ( STDMETHODCALLTYPE *Show )(
|
||||
IFileSaveDialog *, HWND);
|
||||
HRESULT ( STDMETHODCALLTYPE *SetFileTypes )( IFileSaveDialog * this,
|
||||
HRESULT ( STDMETHODCALLTYPE *SetFileTypes )( IFileSaveDialog *,
|
||||
UINT, const TCLCOMDLG_FILTERSPEC *);
|
||||
HRESULT ( STDMETHODCALLTYPE *SetFileTypeIndex )(
|
||||
IFileSaveDialog *, UINT);
|
||||
@@ -589,8 +589,7 @@ static UINT APIENTRY OFNHookProc(HWND hdlg, UINT uMsg, WPARAM wParam,
|
||||
LPARAM lParam);
|
||||
static LRESULT CALLBACK MsgBoxCBTProc(int nCode, WPARAM wParam, LPARAM lParam);
|
||||
static void SetTkDialog(ClientData clientData);
|
||||
static const char *ConvertExternalFilename(WCHAR *filename,
|
||||
Tcl_DString *dsPtr);
|
||||
static const char *ConvertExternalFilename(LPCWSTR, Tcl_DString *);
|
||||
static void LoadShellProcs(void);
|
||||
|
||||
|
||||
@@ -630,20 +629,21 @@ struct ShellProcPointers {
|
||||
* ShellProcs is populated.
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void LoadShellProcs()
|
||||
static void LoadShellProcs(void)
|
||||
{
|
||||
static HMODULE shell32_handle = NULL;
|
||||
|
||||
if (shell32_handle != NULL)
|
||||
return; /* We have already been through here. */
|
||||
if (shell32_handle != NULL) {
|
||||
return; /* We have already been through here. */
|
||||
}
|
||||
|
||||
shell32_handle = GetModuleHandleW(L"shell32.dll");
|
||||
if (shell32_handle == NULL) /* Should never happen but check anyways. */
|
||||
return;
|
||||
if (shell32_handle == NULL) { /* Should never happen but check anyways. */
|
||||
return;
|
||||
}
|
||||
|
||||
ShellProcs.SHCreateItemFromParsingName =
|
||||
(SHCreateItemFromParsingNameProc*) GetProcAddress(shell32_handle,
|
||||
"SHCreateItemFromParsingName");
|
||||
ShellProcs.SHCreateItemFromParsingName = (SHCreateItemFromParsingNameProc*)
|
||||
(void *)GetProcAddress(shell32_handle, "SHCreateItemFromParsingName");
|
||||
}
|
||||
|
||||
|
||||
@@ -719,7 +719,7 @@ void
|
||||
TkWinDialogDebug(
|
||||
int debug)
|
||||
{
|
||||
ThreadSpecificData *tsdPtr =
|
||||
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
|
||||
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
|
||||
|
||||
tsdPtr->debugFlag = debug;
|
||||
@@ -751,7 +751,7 @@ Tk_ChooseColorObjCmd(
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tk_Window tkwin = clientData, parent;
|
||||
Tk_Window tkwin = (Tk_Window)clientData, parent;
|
||||
HWND hWnd;
|
||||
int i, oldMode, winCode, result;
|
||||
CHOOSECOLORW chooseColor;
|
||||
@@ -789,7 +789,7 @@ Tk_ChooseColorObjCmd(
|
||||
chooseColor.lpCustColors = dwCustColors;
|
||||
chooseColor.Flags = CC_RGBINIT | CC_FULLOPEN | CC_ENABLEHOOK;
|
||||
chooseColor.lCustData = (LPARAM) NULL;
|
||||
chooseColor.lpfnHook = (LPOFNHOOKPROC) ColorDlgHookProc;
|
||||
chooseColor.lpfnHook = (LPOFNHOOKPROC)(void *)ColorDlgHookProc;
|
||||
chooseColor.lpTemplateName = (LPWSTR) interp;
|
||||
|
||||
for (i = 1; i < objc; i += 2) {
|
||||
@@ -905,10 +905,11 @@ ColorDlgHookProc(
|
||||
WPARAM wParam, /* First message parameter. */
|
||||
LPARAM lParam) /* Second message parameter. */
|
||||
{
|
||||
ThreadSpecificData *tsdPtr =
|
||||
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
|
||||
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
|
||||
const char *title;
|
||||
CHOOSECOLOR *ccPtr;
|
||||
(void)wParam;
|
||||
|
||||
if (WM_INITDIALOG == uMsg) {
|
||||
|
||||
@@ -922,7 +923,8 @@ ColorDlgHookProc(
|
||||
if ((title != NULL) && (title[0] != '\0')) {
|
||||
Tcl_DString ds;
|
||||
|
||||
SetWindowTextW(hDlg, (LPCWSTR)Tcl_WinUtfToTChar(title,-1,&ds));
|
||||
Tcl_DStringInit(&ds);
|
||||
SetWindowTextW(hDlg, Tcl_UtfToWCharDString(title, -1, &ds));
|
||||
Tcl_DStringFree(&ds);
|
||||
}
|
||||
if (tsdPtr->debugFlag) {
|
||||
@@ -1084,8 +1086,8 @@ ParseOFNOptions(
|
||||
}
|
||||
|
||||
ZeroMemory(optsPtr, sizeof(*optsPtr));
|
||||
// optsPtr->forceXPStyle = 1;
|
||||
optsPtr->tkwin = clientData;
|
||||
/* optsPtr->forceXPStyle = 1; */
|
||||
optsPtr->tkwin = (Tk_Window)clientData;
|
||||
optsPtr->confirmOverwrite = 1; /* By default we ask for confirmation */
|
||||
Tcl_DStringInit(&optsPtr->utfDirString);
|
||||
optsPtr->file[0] = 0;
|
||||
@@ -1146,7 +1148,7 @@ ParseOFNOptions(
|
||||
Tcl_DStringFree(&ds);
|
||||
break;
|
||||
case FILE_PARENT:
|
||||
optsPtr->tkwin = Tk_NameToWindow(interp, string, clientData);
|
||||
optsPtr->tkwin = Tk_NameToWindow(interp, string, (Tk_Window)clientData);
|
||||
if (optsPtr->tkwin == NULL)
|
||||
goto error_return;
|
||||
break;
|
||||
@@ -1201,11 +1203,11 @@ error_return: /* interp should already hold error */
|
||||
* If new dialogs are available, COM is also initialized.
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
static int VistaFileDialogsAvailable()
|
||||
static int VistaFileDialogsAvailable(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
IFileDialog *fdlgPtr = NULL;
|
||||
ThreadSpecificData *tsdPtr =
|
||||
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
|
||||
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
|
||||
|
||||
if (tsdPtr->newFileDialogsState == FDLG_STATE_INIT) {
|
||||
@@ -1267,7 +1269,7 @@ static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
|
||||
IShellItem *dirIf = NULL;
|
||||
LPWSTR wstr;
|
||||
Tcl_Obj *resultObj = NULL;
|
||||
ThreadSpecificData *tsdPtr =
|
||||
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
|
||||
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
|
||||
int oldMode;
|
||||
|
||||
@@ -1371,8 +1373,9 @@ static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
|
||||
const char *src;
|
||||
|
||||
src = Tcl_GetString(optsPtr->extObj);
|
||||
wstr = (LPWSTR) Tcl_WinUtfToTChar(src, optsPtr->extObj->length, &ds);
|
||||
if (wstr[0] == L'.')
|
||||
Tcl_DStringInit(&ds);
|
||||
wstr = Tcl_UtfToWCharDString(src, optsPtr->extObj->length, &ds);
|
||||
if (wstr[0] == '.')
|
||||
++wstr;
|
||||
hr = fdlgIf->lpVtbl->SetDefaultExtension(fdlgIf, wstr);
|
||||
Tcl_DStringFree(&ds);
|
||||
@@ -1385,7 +1388,8 @@ static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
|
||||
const char *src;
|
||||
|
||||
src = Tcl_GetString(optsPtr->titleObj);
|
||||
wstr = (LPWSTR) Tcl_WinUtfToTChar(src, optsPtr->titleObj->length, &ds);
|
||||
Tcl_DStringInit(&ds);
|
||||
wstr = Tcl_UtfToWCharDString(src, optsPtr->titleObj->length, &ds);
|
||||
hr = fdlgIf->lpVtbl->SetTitle(fdlgIf, wstr);
|
||||
Tcl_DStringFree(&ds);
|
||||
if (FAILED(hr))
|
||||
@@ -1407,7 +1411,7 @@ static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
|
||||
if (normPath) {
|
||||
LPCWSTR nativePath;
|
||||
Tcl_IncrRefCount(normPath);
|
||||
nativePath = Tcl_FSGetNativePath(normPath); /* Points INTO normPath*/
|
||||
nativePath = (LPCWSTR)Tcl_FSGetNativePath(normPath); /* Points INTO normPath*/
|
||||
if (nativePath) {
|
||||
hr = ShellProcs.SHCreateItemFromParsingName(
|
||||
nativePath, NULL,
|
||||
@@ -1511,7 +1515,8 @@ static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
|
||||
Tcl_DString ftds;
|
||||
Tcl_Obj *ftobj;
|
||||
|
||||
Tcl_WinTCharToUtf((LPCTSTR)filterPtr[ftix-1].pszName, -1, &ftds);
|
||||
Tcl_DStringInit(&ftds);
|
||||
Tcl_WCharToUtfDString(filterPtr[ftix-1].pszName, wcslen(filterPtr[ftix-1].pszName), &ftds);
|
||||
ftobj = Tcl_NewStringObj(Tcl_DStringValue(&ftds),
|
||||
Tcl_DStringLength(&ftds));
|
||||
Tcl_ObjSetVar2(interp, optsPtr->typeVariableObj, NULL,
|
||||
@@ -1573,7 +1578,7 @@ static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper
|
||||
Tcl_DString utfFilterString, ds;
|
||||
Tcl_DString extString, filterString, dirString, titleString;
|
||||
const char *str;
|
||||
ThreadSpecificData *tsdPtr =
|
||||
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
|
||||
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
|
||||
|
||||
ZeroMemory(&ofnData, sizeof(OFNData));
|
||||
@@ -1598,7 +1603,7 @@ static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper
|
||||
ofn.nMaxFile = TK_MULTI_MAX_PATH;
|
||||
ofn.Flags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR
|
||||
| OFN_EXPLORER| OFN_ENABLEHOOK| OFN_ENABLESIZING;
|
||||
ofn.lpfnHook = (LPOFNHOOKPROC) OFNHookProc;
|
||||
ofn.lpfnHook = (LPOFNHOOKPROC)(void *)OFNHookProc;
|
||||
ofn.lCustData = (LPARAM) &ofnData;
|
||||
|
||||
if (oper != OFN_FILE_SAVE) {
|
||||
@@ -1618,24 +1623,26 @@ static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper
|
||||
*/
|
||||
|
||||
ofnData.dynFileBufferSize = 512;
|
||||
ofnData.dynFileBuffer = ckalloc(512 * sizeof(WCHAR));
|
||||
ofnData.dynFileBuffer = (WCHAR *)ckalloc(512 * sizeof(WCHAR));
|
||||
}
|
||||
|
||||
if (optsPtr->extObj != NULL) {
|
||||
str = Tcl_GetString(optsPtr->extObj);
|
||||
if (str[0] == '.')
|
||||
++str;
|
||||
Tcl_WinUtfToTChar(str, -1, &extString);
|
||||
ofn.lpstrDefExt = (WCHAR *) Tcl_DStringValue(&extString);
|
||||
str = Tcl_GetString(optsPtr->extObj);
|
||||
if (str[0] == '.') {
|
||||
++str;
|
||||
}
|
||||
Tcl_DStringInit(&extString);
|
||||
ofn.lpstrDefExt = Tcl_UtfToWCharDString(str, -1, &extString);
|
||||
}
|
||||
|
||||
Tcl_WinUtfToTChar(Tcl_DStringValue(&utfFilterString),
|
||||
Tcl_DStringInit(&filterString);
|
||||
ofn.lpstrFilter = Tcl_UtfToWCharDString(Tcl_DStringValue(&utfFilterString),
|
||||
Tcl_DStringLength(&utfFilterString), &filterString);
|
||||
ofn.lpstrFilter = (WCHAR *) Tcl_DStringValue(&filterString);
|
||||
ofn.nFilterIndex = filterIndex;
|
||||
|
||||
if (Tcl_DStringValue(&optsPtr->utfDirString)[0] != '\0') {
|
||||
Tcl_WinUtfToTChar(Tcl_DStringValue(&optsPtr->utfDirString),
|
||||
Tcl_DStringInit(&dirString);
|
||||
Tcl_UtfToWCharDString(Tcl_DStringValue(&optsPtr->utfDirString),
|
||||
Tcl_DStringLength(&optsPtr->utfDirString), &dirString);
|
||||
} else {
|
||||
/*
|
||||
@@ -1651,7 +1658,8 @@ static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper
|
||||
Tcl_DStringValue(&optsPtr->utfDirString), &cwd) == NULL)) {
|
||||
Tcl_ResetResult(interp);
|
||||
} else {
|
||||
Tcl_WinUtfToTChar(Tcl_DStringValue(&cwd),
|
||||
Tcl_DStringInit(&dirString);
|
||||
Tcl_UtfToWCharDString(Tcl_DStringValue(&cwd),
|
||||
Tcl_DStringLength(&cwd), &dirString);
|
||||
}
|
||||
Tcl_DStringFree(&cwd);
|
||||
@@ -1659,8 +1667,8 @@ static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper
|
||||
ofn.lpstrInitialDir = (WCHAR *) Tcl_DStringValue(&dirString);
|
||||
|
||||
if (optsPtr->titleObj != NULL) {
|
||||
Tcl_WinUtfToTChar(Tcl_GetString(optsPtr->titleObj), -1, &titleString);
|
||||
ofn.lpstrTitle = (WCHAR *) Tcl_DStringValue(&titleString);
|
||||
Tcl_DStringInit(&titleString);
|
||||
ofn.lpstrTitle = Tcl_UtfToWCharDString(Tcl_GetString(optsPtr->titleObj), -1, &titleString);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1913,10 +1921,11 @@ OFNHookProc(
|
||||
WPARAM wParam, /* Message parameter */
|
||||
LPARAM lParam) /* Message parameter */
|
||||
{
|
||||
ThreadSpecificData *tsdPtr =
|
||||
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
|
||||
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
|
||||
OPENFILENAME *ofnPtr;
|
||||
OFNData *ofnData;
|
||||
(void)wParam;
|
||||
|
||||
if (uMsg == WM_INITDIALOG) {
|
||||
TkWinSetUserData(hdlg, lParam);
|
||||
@@ -1961,7 +1970,7 @@ OFNHookProc(
|
||||
|
||||
if ((selsize > 1) && (dirsize > 0)) {
|
||||
if (ofnData->dynFileBufferSize < buffersize) {
|
||||
buffer = ckrealloc(buffer, buffersize * sizeof(WCHAR));
|
||||
buffer = (WCHAR *)ckrealloc(buffer, buffersize * sizeof(WCHAR));
|
||||
ofnData->dynFileBufferSize = buffersize;
|
||||
ofnData->dynFileBuffer = buffer;
|
||||
}
|
||||
@@ -2007,7 +2016,7 @@ OFNHookProc(
|
||||
if (TCL_PATH_ABSOLUTE ==
|
||||
Tcl_GetPathType(Tcl_DStringValue(&tmpfile))) {
|
||||
/* re-get the full path to the start of the buffer */
|
||||
buffer = (WCHAR *) ofnData->dynFileBuffer;
|
||||
buffer = ofnData->dynFileBuffer;
|
||||
SendMessageW(hdlg, CDM_GETSPEC, selsize, (LPARAM) buffer);
|
||||
} else {
|
||||
*(buffer-1) = '\\';
|
||||
@@ -2093,7 +2102,7 @@ MakeFilter(
|
||||
*/
|
||||
const char *defaultFilter = "All Files (*.*)";
|
||||
|
||||
p = filterStr = ckalloc(30);
|
||||
p = filterStr = (char *)ckalloc(30);
|
||||
|
||||
strcpy(p, defaultFilter);
|
||||
p+= strlen(defaultFilter);
|
||||
@@ -2107,13 +2116,12 @@ MakeFilter(
|
||||
*p = '\0';
|
||||
|
||||
} else {
|
||||
size_t len;
|
||||
int len;
|
||||
|
||||
if (valuePtr == NULL) {
|
||||
len = 0;
|
||||
} else {
|
||||
(void) Tcl_GetString(valuePtr);
|
||||
len = valuePtr->length;
|
||||
(void) Tcl_GetStringFromObj(valuePtr, &len);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2130,7 +2138,7 @@ MakeFilter(
|
||||
* twice the size of the string to format the filter
|
||||
*/
|
||||
|
||||
filterStr = ckalloc(len * 3);
|
||||
filterStr = (char *)ckalloc(len * 3);
|
||||
|
||||
for (filterPtr = flist.filters, p = filterStr; filterPtr;
|
||||
filterPtr = filterPtr->next) {
|
||||
@@ -2283,7 +2291,7 @@ static int MakeFilterVista(
|
||||
|
||||
Tcl_DStringInit(&ds);
|
||||
Tcl_DStringInit(&patterns);
|
||||
dlgFilterPtr = ckalloc(flist.numFilters * sizeof(*dlgFilterPtr));
|
||||
dlgFilterPtr = (TCLCOMDLG_FILTERSPEC *)ckalloc(flist.numFilters * sizeof(*dlgFilterPtr));
|
||||
|
||||
for (i = 0, filterPtr = flist.filters;
|
||||
filterPtr;
|
||||
@@ -2297,10 +2305,11 @@ static int MakeFilterVista(
|
||||
initialIndex = i+1; /* Windows filter indices are 1-based */
|
||||
|
||||
/* First stash away the text description of the pattern */
|
||||
Tcl_WinUtfToTChar(filterPtr->name, -1, &ds);
|
||||
Tcl_DStringInit(&ds);
|
||||
Tcl_UtfToWCharDString(filterPtr->name, -1, &ds);
|
||||
nbytes = Tcl_DStringLength(&ds); /* # bytes, not Unicode chars */
|
||||
nbytes += sizeof(WCHAR); /* Terminating \0 */
|
||||
dlgFilterPtr[i].pszName = ckalloc(nbytes);
|
||||
dlgFilterPtr[i].pszName = (LPCWSTR)ckalloc(nbytes);
|
||||
memmove((void *) dlgFilterPtr[i].pszName, Tcl_DStringValue(&ds), nbytes);
|
||||
Tcl_DStringFree(&ds);
|
||||
|
||||
@@ -2325,10 +2334,11 @@ static int MakeFilterVista(
|
||||
}
|
||||
|
||||
/* Again we need a Unicode form of the string */
|
||||
Tcl_WinUtfToTChar(Tcl_DStringValue(&patterns), -1, &ds);
|
||||
Tcl_DStringInit(&ds);
|
||||
Tcl_UtfToWCharDString(Tcl_DStringValue(&patterns), -1, &ds);
|
||||
nbytes = Tcl_DStringLength(&ds); /* # bytes, not Unicode chars */
|
||||
nbytes += sizeof(WCHAR); /* Terminating \0 */
|
||||
dlgFilterPtr[i].pszSpec = ckalloc(nbytes);
|
||||
dlgFilterPtr[i].pszSpec = (LPCWSTR)ckalloc(nbytes);
|
||||
memmove((void *)dlgFilterPtr[i].pszSpec, Tcl_DStringValue(&ds), nbytes);
|
||||
Tcl_DStringFree(&ds);
|
||||
Tcl_DStringSetLength(&patterns, 0);
|
||||
@@ -2424,7 +2434,7 @@ Tk_ChooseDirectoryObjCmd(
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
WCHAR path[MAX_PATH];
|
||||
WCHAR path[MAX_PATH];
|
||||
int oldMode, result;
|
||||
LPCITEMIDLIST pidl; /* Returned by browser */
|
||||
BROWSEINFOW bInfo; /* Used by browser */
|
||||
@@ -2461,14 +2471,15 @@ Tk_ChooseDirectoryObjCmd(
|
||||
if (utfDir[0] != '\0') {
|
||||
LPCWSTR uniStr;
|
||||
|
||||
Tcl_WinUtfToTChar(Tcl_DStringValue(&ofnOpts.utfDirString), -1,
|
||||
Tcl_DStringInit(&tempString);
|
||||
Tcl_UtfToWCharDString(Tcl_DStringValue(&ofnOpts.utfDirString), -1,
|
||||
&tempString);
|
||||
uniStr = (WCHAR *) Tcl_DStringValue(&tempString);
|
||||
uniStr = (WCHAR *) Tcl_DStringValue(&tempString);
|
||||
|
||||
/* Convert possible relative path to full path to keep dialog happy. */
|
||||
/* Convert possible relative path to full path to keep dialog happy. */
|
||||
|
||||
GetFullPathNameW(uniStr, MAX_PATH, saveDir, NULL);
|
||||
wcsncpy(cdCBData.initDir, saveDir, MAX_PATH);
|
||||
GetFullPathNameW(uniStr, MAX_PATH, saveDir, NULL);
|
||||
wcsncpy(cdCBData.initDir, saveDir, MAX_PATH);
|
||||
}
|
||||
|
||||
/* XXX - rest of this (original) code has no error checks at all. */
|
||||
@@ -2493,8 +2504,8 @@ Tk_ChooseDirectoryObjCmd(
|
||||
bInfo.lParam = (LPARAM) &cdCBData;
|
||||
|
||||
if (ofnOpts.titleObj != NULL) {
|
||||
bInfo.lpszTitle = (LPCWSTR)Tcl_WinUtfToTChar(
|
||||
Tcl_GetString(ofnOpts.titleObj), -1, &titleString);
|
||||
Tcl_DStringInit(&titleString);
|
||||
bInfo.lpszTitle = Tcl_UtfToWCharDString(Tcl_GetString(ofnOpts.titleObj), -1, &titleString);
|
||||
} else {
|
||||
bInfo.lpszTitle = L"Please choose a directory, then select OK.";
|
||||
}
|
||||
@@ -2618,7 +2629,7 @@ ChooseDirectoryValidateProc(
|
||||
Tcl_DString tempString;
|
||||
Tcl_DString initDirString;
|
||||
WCHAR string[MAX_PATH];
|
||||
ThreadSpecificData *tsdPtr =
|
||||
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
|
||||
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
|
||||
|
||||
if (tsdPtr->debugFlag) {
|
||||
@@ -2637,7 +2648,8 @@ ChooseDirectoryValidateProc(
|
||||
* like ~ are converted correctly.
|
||||
*/
|
||||
|
||||
Tcl_WinTCharToUtf((LPCTSTR) lParam, -1, &initDirString);
|
||||
Tcl_DStringInit(&initDirString);
|
||||
Tcl_WCharToUtfDString((WCHAR *) lParam, wcslen((WCHAR *) lParam), &initDirString);
|
||||
if (Tcl_TranslateFileName(chooseDirSharedData->interp,
|
||||
Tcl_DStringValue(&initDirString), &tempString) == NULL) {
|
||||
/*
|
||||
@@ -2648,12 +2660,11 @@ ChooseDirectoryValidateProc(
|
||||
chooseDirSharedData->retDir[0] = '\0';
|
||||
return 1;
|
||||
}
|
||||
Tcl_DStringFree(&initDirString);
|
||||
Tcl_WinUtfToTChar(Tcl_DStringValue(&tempString), -1, &initDirString);
|
||||
Tcl_DStringFree(&tempString);
|
||||
wcsncpy(string, (WCHAR *) Tcl_DStringValue(&initDirString),
|
||||
Tcl_DStringSetLength(&initDirString, 0);
|
||||
wcsncpy(string, Tcl_UtfToWCharDString(Tcl_DStringValue(&tempString), -1, &initDirString),
|
||||
MAX_PATH);
|
||||
Tcl_DStringFree(&initDirString);
|
||||
Tcl_DStringFree(&tempString);
|
||||
|
||||
if (SetCurrentDirectoryW(string) == 0) {
|
||||
|
||||
@@ -2700,10 +2711,10 @@ ChooseDirectoryValidateProc(
|
||||
|
||||
if (SHGetPathFromIDListW((LPITEMIDLIST) lParam, selDir)) {
|
||||
SendMessageW(hwnd, BFFM_SETSTATUSTEXTW, 0, (LPARAM) selDir);
|
||||
// enable the OK button
|
||||
/* enable the OK button */
|
||||
SendMessageW(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 1);
|
||||
} else {
|
||||
// disable the OK button
|
||||
/* disable the OK button */
|
||||
SendMessageW(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 0);
|
||||
}
|
||||
UpdateWindow(hwnd);
|
||||
@@ -2734,8 +2745,8 @@ ChooseDirectoryValidateProc(
|
||||
ULONG ulCount, ulAttr;
|
||||
|
||||
if (SUCCEEDED(psfFolder->lpVtbl->ParseDisplayName(
|
||||
psfFolder, hwnd, NULL, (WCHAR *)
|
||||
initDir, &ulCount,&pidlMain,&ulAttr))
|
||||
psfFolder, hwnd, NULL, initDir,
|
||||
&ulCount,&pidlMain,&ulAttr))
|
||||
&& (pidlMain != NULL)) {
|
||||
SendMessageW(hwnd, BFFM_SETSELECTIONW, FALSE,
|
||||
(LPARAM) pidlMain);
|
||||
@@ -2781,7 +2792,7 @@ Tk_MessageBoxObjCmd(
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
{
|
||||
Tk_Window tkwin = clientData, parent;
|
||||
Tk_Window tkwin = (Tk_Window)clientData, parent;
|
||||
HWND hWnd;
|
||||
Tcl_Obj *messageObj, *titleObj, *detailObj, *tmpObj;
|
||||
int defaultBtn, icon, type;
|
||||
@@ -2795,7 +2806,7 @@ Tk_MessageBoxObjCmd(
|
||||
MSG_DEFAULT, MSG_DETAIL, MSG_ICON, MSG_MESSAGE,
|
||||
MSG_PARENT, MSG_TITLE, MSG_TYPE
|
||||
};
|
||||
ThreadSpecificData *tsdPtr =
|
||||
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
|
||||
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
|
||||
Tcl_DString titleBuf, tmpBuf;
|
||||
LPCWSTR titlePtr, tmpPtr;
|
||||
@@ -2929,10 +2940,12 @@ Tk_MessageBoxObjCmd(
|
||||
tsdPtr->hMsgBoxHook = SetWindowsHookExW(WH_CBT, MsgBoxCBTProc, NULL,
|
||||
GetCurrentThreadId());
|
||||
src = Tcl_GetString(tmpObj);
|
||||
tmpPtr = (LPCWSTR)Tcl_WinUtfToTChar(src, tmpObj->length, &tmpBuf);
|
||||
Tcl_DStringInit(&tmpBuf);
|
||||
tmpPtr = Tcl_UtfToWCharDString(src, tmpObj->length, &tmpBuf);
|
||||
if (titleObj != NULL) {
|
||||
src = Tcl_GetString(titleObj);
|
||||
titlePtr = (LPCWSTR)Tcl_WinUtfToTChar(src, titleObj->length, &titleBuf);
|
||||
Tcl_DStringInit(&titleBuf);
|
||||
titlePtr = Tcl_UtfToWCharDString(src, titleObj->length, &titleBuf);
|
||||
} else {
|
||||
titlePtr = L"";
|
||||
Tcl_DStringInit(&titleBuf);
|
||||
@@ -2963,7 +2976,7 @@ MsgBoxCBTProc(
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
ThreadSpecificData *tsdPtr =
|
||||
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
|
||||
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
|
||||
|
||||
if (nCode == HCBT_CREATEWND) {
|
||||
@@ -3010,7 +3023,7 @@ static void
|
||||
SetTkDialog(
|
||||
ClientData clientData)
|
||||
{
|
||||
ThreadSpecificData *tsdPtr =
|
||||
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
|
||||
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
|
||||
char buf[32];
|
||||
|
||||
@@ -3024,12 +3037,13 @@ SetTkDialog(
|
||||
|
||||
static const char *
|
||||
ConvertExternalFilename(
|
||||
WCHAR *filename,
|
||||
LPCWSTR filename,
|
||||
Tcl_DString *dsPtr)
|
||||
{
|
||||
char *p;
|
||||
|
||||
Tcl_WinTCharToUtf((LPCTSTR)filename, -1, dsPtr);
|
||||
Tcl_DStringInit(dsPtr);
|
||||
Tcl_WCharToUtfDString(filename, wcslen(filename), dsPtr);
|
||||
for (p = Tcl_DStringValue(dsPtr); *p != '\0'; p++) {
|
||||
/*
|
||||
* Change the pathname to the Tcl "normalized" pathname, where back
|
||||
@@ -3066,7 +3080,8 @@ GetFontObj(
|
||||
int pt = 0;
|
||||
|
||||
resObj = Tcl_NewListObj(0, NULL);
|
||||
Tcl_WinTCharToUtf((LPCTSTR)plf->lfFaceName, -1, &ds);
|
||||
Tcl_DStringInit(&ds);
|
||||
Tcl_WCharToUtfDString(plf->lfFaceName, wcslen(plf->lfFaceName), &ds);
|
||||
Tcl_ListObjAppendElement(NULL, resObj,
|
||||
Tcl_NewStringObj(Tcl_DStringValue(&ds), -1));
|
||||
Tcl_DStringFree(&ds);
|
||||
@@ -3101,7 +3116,7 @@ ApplyLogfont(
|
||||
Tcl_Obj **objv, **tmpv;
|
||||
|
||||
Tcl_ListObjGetElements(NULL, cmdObj, &objc, &objv);
|
||||
tmpv = ckalloc(sizeof(Tcl_Obj *) * (objc + 2));
|
||||
tmpv = (Tcl_Obj **)ckalloc(sizeof(Tcl_Obj *) * (objc + 2));
|
||||
memcpy(tmpv, objv, sizeof(Tcl_Obj *) * objc);
|
||||
tmpv[objc] = GetFontObj(hdc, logfontPtr);
|
||||
TkBackgroundEvalObjv(interp, objc+1, tmpv, TCL_EVAL_GLOBAL);
|
||||
@@ -3139,7 +3154,7 @@ HookProc(
|
||||
CHOOSEFONT *pcf = (CHOOSEFONT *) lParam;
|
||||
HWND hwndCtrl;
|
||||
static HookData *phd = NULL;
|
||||
ThreadSpecificData *tsdPtr =
|
||||
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
|
||||
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
|
||||
|
||||
if (WM_INITDIALOG == msg && lParam != 0) {
|
||||
@@ -3152,7 +3167,8 @@ HookProc(
|
||||
if (phd->titleObj != NULL) {
|
||||
Tcl_DString title;
|
||||
|
||||
Tcl_WinUtfToTChar(Tcl_GetString(phd->titleObj), -1, &title);
|
||||
Tcl_DStringInit(&title);
|
||||
Tcl_UtfToWCharDString(Tcl_GetString(phd->titleObj), -1, &title);
|
||||
if (Tcl_DStringLength(&title) > 0) {
|
||||
SetWindowTextW(hwndDlg, (LPCWSTR) Tcl_DStringValue(&title));
|
||||
}
|
||||
@@ -3281,14 +3297,14 @@ FontchooserConfigureCmd(
|
||||
int objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tk_Window tkwin = clientData;
|
||||
Tk_Window tkwin = (Tk_Window)clientData;
|
||||
HookData *hdPtr = NULL;
|
||||
int i, r = TCL_OK;
|
||||
static const char *const optionStrings[] = {
|
||||
"-parent", "-title", "-font", "-command", "-visible", NULL
|
||||
};
|
||||
|
||||
hdPtr = Tcl_GetAssocData(interp, "::tk::fontchooser", NULL);
|
||||
hdPtr = (HookData *)Tcl_GetAssocData(interp, "::tk::fontchooser", NULL);
|
||||
|
||||
/*
|
||||
* With no arguments we return all the options in a dict.
|
||||
@@ -3425,14 +3441,16 @@ FontchooserShowCmd(
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
Tcl_DString ds;
|
||||
Tk_Window tkwin = clientData, parent;
|
||||
Tk_Window tkwin = (Tk_Window)clientData, parent;
|
||||
CHOOSEFONTW cf;
|
||||
LOGFONTW lf;
|
||||
HDC hdc;
|
||||
HookData *hdPtr;
|
||||
int r = TCL_OK, oldMode = 0;
|
||||
(void)objc;
|
||||
(void)objv;
|
||||
|
||||
hdPtr = Tcl_GetAssocData(interp, "::tk::fontchooser", NULL);
|
||||
hdPtr = (HookData *)Tcl_GetAssocData(interp, "::tk::fontchooser", NULL);
|
||||
|
||||
parent = tkwin;
|
||||
if (hdPtr->parentObj) {
|
||||
@@ -3469,8 +3487,8 @@ FontchooserShowCmd(
|
||||
}
|
||||
fontPtr = (TkFont *) f;
|
||||
cf.Flags |= CF_INITTOLOGFONTSTRUCT;
|
||||
Tcl_WinUtfToTChar(fontPtr->fa.family, -1, &ds);
|
||||
wcsncpy(lf.lfFaceName, (WCHAR *)Tcl_DStringValue(&ds),
|
||||
Tcl_DStringInit(&ds);
|
||||
wcsncpy(lf.lfFaceName, Tcl_UtfToWCharDString(fontPtr->fa.family, -1, &ds),
|
||||
LF_FACESIZE-1);
|
||||
Tcl_DStringFree(&ds);
|
||||
lf.lfFaceName[LF_FACESIZE-1] = 0;
|
||||
@@ -3533,12 +3551,15 @@ FontchooserShowCmd(
|
||||
|
||||
static int
|
||||
FontchooserHideCmd(
|
||||
ClientData clientData, /* Main window */
|
||||
ClientData dummy, /* Main window */
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
HookData *hdPtr = Tcl_GetAssocData(interp, "::tk::fontchooser", NULL);
|
||||
HookData *hdPtr = (HookData *)Tcl_GetAssocData(interp, "::tk::fontchooser", NULL);
|
||||
(void)dummy;
|
||||
(void)objc;
|
||||
(void)objv;
|
||||
|
||||
if (hdPtr->hwnd && IsWindow(hdPtr->hwnd)) {
|
||||
EndDialog(hdPtr->hwnd, 0);
|
||||
@@ -3558,9 +3579,10 @@ FontchooserHideCmd(
|
||||
*/
|
||||
|
||||
static void
|
||||
DeleteHookData(ClientData clientData, Tcl_Interp *interp)
|
||||
DeleteHookData(ClientData clientData, Tcl_Interp *dummy)
|
||||
{
|
||||
HookData *hdPtr = clientData;
|
||||
HookData *hdPtr = (HookData *)clientData;
|
||||
(void)dummy;
|
||||
|
||||
if (hdPtr->parentObj) {
|
||||
Tcl_DecrRefCount(hdPtr->parentObj);
|
||||
@@ -3597,9 +3619,10 @@ const TkEnsemble tkFontchooserEnsemble[] = {
|
||||
};
|
||||
|
||||
int
|
||||
TkInitFontchooser(Tcl_Interp *interp, ClientData clientData)
|
||||
TkInitFontchooser(Tcl_Interp *interp, ClientData dummy)
|
||||
{
|
||||
HookData *hdPtr = ckalloc(sizeof(HookData));
|
||||
HookData *hdPtr = (HookData *)ckalloc(sizeof(HookData));
|
||||
(void)dummy;
|
||||
|
||||
memset(hdPtr, 0, sizeof(HookData));
|
||||
Tcl_SetAssocData(interp, "::tk::fontchooser", DeleteHookData, hdPtr);
|
||||
|
||||
181
win/tkWinFont.c
181
win/tkWinFont.c
@@ -29,7 +29,8 @@
|
||||
#define FONTMAP_SHIFT 10
|
||||
|
||||
#define FONTMAP_BITSPERPAGE (1 << FONTMAP_SHIFT)
|
||||
#define FONTMAP_PAGES (0x30000 / FONTMAP_BITSPERPAGE)
|
||||
#define FONTMAP_NUMCHARS 0x40000
|
||||
#define FONTMAP_PAGES (FONTMAP_NUMCHARS / FONTMAP_BITSPERPAGE)
|
||||
|
||||
typedef struct FontFamily {
|
||||
struct FontFamily *nextPtr; /* Next in list of all known font families. */
|
||||
@@ -214,8 +215,8 @@ static int LoadFontRanges(HDC hdc, HFONT hFont,
|
||||
USHORT **startCount, USHORT **endCount,
|
||||
int *symbolPtr);
|
||||
static void MultiFontTextOut(HDC hdc, WinFont *fontPtr,
|
||||
const char *source, int numBytes, int x, int y,
|
||||
double angle);
|
||||
const char *source, int numBytes,
|
||||
double x, double y, double angle);
|
||||
static void ReleaseFont(WinFont *fontPtr);
|
||||
static inline void ReleaseSubFont(SubFont *subFontPtr);
|
||||
static int SeenName(const char *name, Tcl_DString *dsPtr);
|
||||
@@ -299,8 +300,8 @@ TkpGetNativeFont(
|
||||
}
|
||||
|
||||
tkwin = (Tk_Window) ((TkWindow *) tkwin)->mainPtr->winPtr;
|
||||
fontPtr = ckalloc(sizeof(WinFont));
|
||||
InitFont(tkwin, GetStockObject(object), 0, fontPtr);
|
||||
fontPtr = (WinFont *)ckalloc(sizeof(WinFont));
|
||||
InitFont(tkwin, (HFONT)GetStockObject(object), 0, fontPtr);
|
||||
|
||||
return (TkFont *) fontPtr;
|
||||
}
|
||||
@@ -557,7 +558,7 @@ TkpGetFontFromAttributes(
|
||||
hFont = GetScreenFont(faPtr, faceName,
|
||||
(int)(TkFontGetPixels(tkwin, faPtr->size) + 0.5), 0.0);
|
||||
if (tkFontPtr == NULL) {
|
||||
fontPtr = ckalloc(sizeof(WinFont));
|
||||
fontPtr = (WinFont *)ckalloc(sizeof(WinFont));
|
||||
} else {
|
||||
fontPtr = (WinFont *) tkFontPtr;
|
||||
ReleaseFont(fontPtr);
|
||||
@@ -653,14 +654,16 @@ TkpGetFontFamilies(
|
||||
static int CALLBACK
|
||||
WinFontFamilyEnumProc(
|
||||
ENUMLOGFONTW *lfPtr, /* Logical-font data. */
|
||||
NEWTEXTMETRIC *tmPtr, /* Physical-font data (not used). */
|
||||
int fontType, /* Type of font (not used). */
|
||||
TCL_UNUSED(NEWTEXTMETRIC *), /* Physical-font data (not used). */
|
||||
TCL_UNUSED(int), /* Type of font (not used). */
|
||||
LPARAM lParam) /* Result object to hold result. */
|
||||
{
|
||||
WCHAR *faceName = lfPtr->elfLogFont.lfFaceName;
|
||||
Tcl_Obj *resultObj = (Tcl_Obj *) lParam;
|
||||
Tcl_DString faceString;
|
||||
|
||||
Tcl_WinTCharToUtf((LPCTSTR)lfPtr->elfLogFont.lfFaceName, -1, &faceString);
|
||||
Tcl_DStringInit(&faceString);
|
||||
Tcl_WCharToUtfDString(faceName, wcslen(faceName), &faceString);
|
||||
Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(
|
||||
Tcl_DStringValue(&faceString), Tcl_DStringLength(&faceString)));
|
||||
Tcl_DStringFree(&faceString);
|
||||
@@ -749,7 +752,7 @@ TkpGetFontAttrsForChar(
|
||||
* Get the font attributes.
|
||||
*/
|
||||
|
||||
oldfont = SelectObject(hdc, thisSubFontPtr->hFont0);
|
||||
oldfont = (HFONT)SelectObject(hdc, thisSubFontPtr->hFont0);
|
||||
GetTextMetricsW(hdc, &tm);
|
||||
SelectObject(hdc, oldfont);
|
||||
ReleaseDC(fontPtr->hwnd, hdc);
|
||||
@@ -827,7 +830,7 @@ Tk_MeasureChars(
|
||||
|
||||
hdc = GetDC(fontPtr->hwnd);
|
||||
lastSubFontPtr = &fontPtr->subFontArray[0];
|
||||
oldFont = SelectObject(hdc, lastSubFontPtr->hFont0);
|
||||
oldFont = (HFONT)SelectObject(hdc, lastSubFontPtr->hFont0);
|
||||
|
||||
/*
|
||||
* A three step process:
|
||||
@@ -1013,7 +1016,7 @@ TkpMeasureCharsInContext(
|
||||
Tk_Font tkfont, /* Font in which characters will be drawn. */
|
||||
const char *source, /* UTF-8 string to be displayed. Need not be
|
||||
* '\0' terminated. */
|
||||
int numBytes, /* Maximum number of bytes to consider from
|
||||
TCL_UNUSED(int), /* Maximum number of bytes to consider from
|
||||
* source string in all. */
|
||||
int rangeStart, /* Index of first byte to measure. */
|
||||
int rangeLength, /* Length of range to measure in bytes. */
|
||||
@@ -1035,7 +1038,6 @@ TkpMeasureCharsInContext(
|
||||
int *lengthPtr) /* Filled with x-location just after the
|
||||
* terminating character. */
|
||||
{
|
||||
(void) numBytes; /*unused*/
|
||||
return Tk_MeasureChars(tkfont, source + rangeStart, rangeLength,
|
||||
maxLength, flags, lengthPtr);
|
||||
}
|
||||
@@ -1061,7 +1063,7 @@ Tk_DrawChars(
|
||||
Display *display, /* Display on which to draw. */
|
||||
Drawable drawable, /* Window or pixmap in which to draw. */
|
||||
GC gc, /* Graphics context for drawing characters. */
|
||||
Tk_Font tkfont, /* Font in which characters will be drawn;
|
||||
TCL_UNUSED(Tk_Font), /* Font in which characters will be drawn;
|
||||
* must be the same as font used in GC. */
|
||||
const char *source, /* UTF-8 string to be displayed. Need not be
|
||||
* '\0' terminated. All Tk meta-characters
|
||||
@@ -1116,7 +1118,7 @@ Tk_DrawChars(
|
||||
|
||||
stipple = CreatePatternBrush(twdPtr->bitmap.handle);
|
||||
SetBrushOrgEx(dc, gc->ts_x_origin, gc->ts_y_origin, NULL);
|
||||
oldBrush = SelectObject(dc, stipple);
|
||||
oldBrush = (HBRUSH)SelectObject(dc, stipple);
|
||||
|
||||
SetTextAlign(dcMem, TA_LEFT | TA_BASELINE);
|
||||
SetTextColor(dcMem, gc->foreground);
|
||||
@@ -1131,7 +1133,7 @@ Tk_DrawChars(
|
||||
GetTextMetricsW(dcMem, &tm);
|
||||
size.cx -= tm.tmOverhang;
|
||||
bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy);
|
||||
oldBitmap = SelectObject(dcMem, bitmap);
|
||||
oldBitmap = (HBITMAP)SelectObject(dcMem, bitmap);
|
||||
|
||||
/*
|
||||
* The following code is tricky because fonts are rendered in multiple
|
||||
@@ -1185,7 +1187,7 @@ Tk_DrawChars(
|
||||
GetTextMetricsW(dcMem, &tm);
|
||||
size.cx -= tm.tmOverhang;
|
||||
bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy);
|
||||
oldBitmap = SelectObject(dcMem, bitmap);
|
||||
oldBitmap = (HBITMAP)SelectObject(dcMem, bitmap);
|
||||
|
||||
MultiFontTextOut(dcMem, fontPtr, source, numBytes, 0, tm.tmAscent,
|
||||
0.0);
|
||||
@@ -1208,7 +1210,7 @@ TkDrawAngledChars(
|
||||
Display *display, /* Display on which to draw. */
|
||||
Drawable drawable, /* Window or pixmap in which to draw. */
|
||||
GC gc, /* Graphics context for drawing characters. */
|
||||
Tk_Font tkfont, /* Font in which characters will be drawn;
|
||||
TCL_UNUSED(Tk_Font), /* Font in which characters will be drawn;
|
||||
* must be the same as font used in GC. */
|
||||
const char *source, /* UTF-8 string to be displayed. Need not be
|
||||
* '\0' terminated. All Tk meta-characters
|
||||
@@ -1264,7 +1266,7 @@ TkDrawAngledChars(
|
||||
|
||||
stipple = CreatePatternBrush(twdPtr->bitmap.handle);
|
||||
SetBrushOrgEx(dc, gc->ts_x_origin, gc->ts_y_origin, NULL);
|
||||
oldBrush = SelectObject(dc, stipple);
|
||||
oldBrush = (HBRUSH)SelectObject(dc, stipple);
|
||||
|
||||
SetTextAlign(dcMem, TA_LEFT | TA_BASELINE);
|
||||
SetTextColor(dcMem, gc->foreground);
|
||||
@@ -1279,7 +1281,7 @@ TkDrawAngledChars(
|
||||
GetTextMetricsW(dcMem, &tm);
|
||||
size.cx -= tm.tmOverhang;
|
||||
bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy);
|
||||
oldBitmap = SelectObject(dcMem, bitmap);
|
||||
oldBitmap = (HBITMAP)SelectObject(dcMem, bitmap);
|
||||
|
||||
/*
|
||||
* The following code is tricky because fonts are rendered in multiple
|
||||
@@ -1290,11 +1292,11 @@ TkDrawAngledChars(
|
||||
*/
|
||||
|
||||
PatBlt(dcMem, 0, 0, size.cx, size.cy, BLACKNESS);
|
||||
MultiFontTextOut(dc, fontPtr, source, numBytes, (int)x, (int)y, angle);
|
||||
MultiFontTextOut(dc, fontPtr, source, numBytes, x, y, angle);
|
||||
BitBlt(dc, (int)x, (int)y - tm.tmAscent, size.cx, size.cy, dcMem,
|
||||
0, 0, 0xEA02E9);
|
||||
PatBlt(dcMem, 0, 0, size.cx, size.cy, WHITENESS);
|
||||
MultiFontTextOut(dc, fontPtr, source, numBytes, (int)x, (int)y, angle);
|
||||
MultiFontTextOut(dc, fontPtr, source, numBytes, x, y, angle);
|
||||
BitBlt(dc, (int)x, (int)y - tm.tmAscent, size.cx, size.cy, dcMem,
|
||||
0, 0, 0x8A0E06);
|
||||
|
||||
@@ -1311,7 +1313,7 @@ TkDrawAngledChars(
|
||||
SetTextAlign(dc, TA_LEFT | TA_BASELINE);
|
||||
SetTextColor(dc, gc->foreground);
|
||||
SetBkMode(dc, TRANSPARENT);
|
||||
MultiFontTextOut(dc, fontPtr, source, numBytes, (int)x, (int)y, angle);
|
||||
MultiFontTextOut(dc, fontPtr, source, numBytes, x, y, angle);
|
||||
} else {
|
||||
HBITMAP oldBitmap, bitmap;
|
||||
HDC dcMem;
|
||||
@@ -1333,7 +1335,7 @@ TkDrawAngledChars(
|
||||
GetTextMetricsW(dcMem, &tm);
|
||||
size.cx -= tm.tmOverhang;
|
||||
bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy);
|
||||
oldBitmap = SelectObject(dcMem, bitmap);
|
||||
oldBitmap = (HBITMAP)SelectObject(dcMem, bitmap);
|
||||
|
||||
MultiFontTextOut(dcMem, fontPtr, source, numBytes, 0, tm.tmAscent,
|
||||
angle);
|
||||
@@ -1359,7 +1361,10 @@ TkDrawAngledChars(
|
||||
* Draw a string of characters on the screen like Tk_DrawChars(), but
|
||||
* with access to all the characters on the line for context. On Windows
|
||||
* this context isn't consulted, so we just call Tk_DrawChars().
|
||||
*
|
||||
*
|
||||
* Note: TK_DRAW_IN_CONTEXT being currently defined only on macOS, this
|
||||
* function is unused (and possibly unfinished). See [7655f65ae7].
|
||||
*
|
||||
* Results:
|
||||
* None.
|
||||
*
|
||||
@@ -1383,7 +1388,7 @@ TkpDrawCharsInContext(
|
||||
* is passed to this function. If they are not
|
||||
* stripped out, they will be displayed as
|
||||
* regular printing characters. */
|
||||
int numBytes, /* Number of bytes in string. */
|
||||
TCL_UNUSED(int), /* Number of bytes in string. */
|
||||
int rangeStart, /* Index of first byte to draw. */
|
||||
int rangeLength, /* Length of range to draw in bytes. */
|
||||
int x, int y) /* Coordinates at which to place origin of the
|
||||
@@ -1392,13 +1397,42 @@ TkpDrawCharsInContext(
|
||||
{
|
||||
int widthUntilStart;
|
||||
|
||||
(void) numBytes; /*unused*/
|
||||
|
||||
Tk_MeasureChars(tkfont, source, rangeStart, -1, 0, &widthUntilStart);
|
||||
Tk_DrawChars(display, drawable, gc, tkfont, source + rangeStart,
|
||||
rangeLength, x+widthUntilStart, y);
|
||||
}
|
||||
|
||||
void
|
||||
TkpDrawAngledCharsInContext(
|
||||
Display *display, /* Display on which to draw. */
|
||||
Drawable drawable, /* Window or pixmap in which to draw. */
|
||||
GC gc, /* Graphics context for drawing characters. */
|
||||
Tk_Font tkfont, /* Font in which characters will be drawn; must
|
||||
* be the same as font used in GC. */
|
||||
const char * source, /* UTF-8 string to be displayed. Need not be
|
||||
* '\0' terminated. All Tk meta-characters
|
||||
* (tabs, control characters, and newlines)
|
||||
* should be stripped out of the string that is
|
||||
* passed to this function. If they are not
|
||||
* stripped out, they will be displayed as
|
||||
* regular printing characters. */
|
||||
int numBytes, /* Number of bytes in string. */
|
||||
int rangeStart, /* Index of first byte to draw. */
|
||||
int rangeLength, /* Length of range to draw in bytes. */
|
||||
double x, double y, /* Coordinates at which to place origin of the
|
||||
* whole (not just the range) string when
|
||||
* drawing. */
|
||||
double angle) /* What angle to put text at, in degrees. */
|
||||
{
|
||||
int widthUntilStart;
|
||||
double sinA = sin(angle * PI/180.0), cosA = cos(angle * PI/180.0);
|
||||
(void) numBytes; /*unused*/
|
||||
|
||||
Tk_MeasureChars(tkfont, source, rangeStart, -1, 0, &widthUntilStart);
|
||||
TkDrawAngledChars(display, drawable, gc, tkfont, source + rangeStart,
|
||||
rangeLength, x+cosA*widthUntilStart, y-sinA*widthUntilStart, angle);
|
||||
}
|
||||
|
||||
/*
|
||||
*-------------------------------------------------------------------------
|
||||
*
|
||||
@@ -1426,7 +1460,7 @@ MultiFontTextOut(
|
||||
* following string. */
|
||||
const char *source, /* Potentially multilingual UTF-8 string. */
|
||||
int numBytes, /* Length of string in bytes. */
|
||||
int x, int y, /* Coordinates at which to place origin of
|
||||
double x, double y, /* Coordinates at which to place origin of
|
||||
* string when drawing. */
|
||||
double angle)
|
||||
{
|
||||
@@ -1438,6 +1472,7 @@ MultiFontTextOut(
|
||||
const char *p, *end, *next;
|
||||
SubFont *lastSubFontPtr, *thisSubFontPtr;
|
||||
TEXTMETRICW tm;
|
||||
double sinA = sin(angle * PI/180.0), cosA = cos(angle * PI/180.0);
|
||||
|
||||
lastSubFontPtr = &fontPtr->subFontArray[0];
|
||||
oldFont = SelectFont(hdc, fontPtr, lastSubFontPtr, angle);
|
||||
@@ -1460,14 +1495,15 @@ MultiFontTextOut(
|
||||
familyPtr = lastSubFontPtr->familyPtr;
|
||||
Tcl_UtfToExternalDString(familyPtr->encoding, source,
|
||||
(int) (p - source), &runString);
|
||||
familyPtr->textOutProc(hdc, x-(tm.tmOverhang/2), y,
|
||||
familyPtr->textOutProc(hdc, (int)(x-(double)tm.tmOverhang/2.0), y,
|
||||
(WCHAR *)Tcl_DStringValue(&runString),
|
||||
Tcl_DStringLength(&runString)>>familyPtr->isWideFont);
|
||||
Tcl_DStringLength(&runString) >> familyPtr->isWideFont);
|
||||
familyPtr->getTextExtentPoint32Proc(hdc,
|
||||
(WCHAR *)Tcl_DStringValue(&runString),
|
||||
Tcl_DStringLength(&runString) >> familyPtr->isWideFont,
|
||||
&size);
|
||||
x += size.cx;
|
||||
x += cosA*size.cx;
|
||||
y -= sinA*size.cx;
|
||||
Tcl_DStringFree(&runString);
|
||||
}
|
||||
lastSubFontPtr = thisSubFontPtr;
|
||||
@@ -1481,7 +1517,7 @@ MultiFontTextOut(
|
||||
familyPtr = lastSubFontPtr->familyPtr;
|
||||
Tcl_UtfToExternalDString(familyPtr->encoding, source,
|
||||
(int) (p - source), &runString);
|
||||
familyPtr->textOutProc(hdc, x-(tm.tmOverhang/2), y,
|
||||
familyPtr->textOutProc(hdc, (int)(x-(double)tm.tmOverhang/2.0), y,
|
||||
(WCHAR *)Tcl_DStringValue(&runString),
|
||||
Tcl_DStringLength(&runString) >> familyPtr->isWideFont);
|
||||
Tcl_DStringFree(&runString);
|
||||
@@ -1497,9 +1533,9 @@ SelectFont(
|
||||
double angle)
|
||||
{
|
||||
if (angle == 0.0) {
|
||||
return SelectObject(hdc, subFontPtr->hFont0);
|
||||
return (HFONT)SelectObject(hdc, subFontPtr->hFont0);
|
||||
} else if (angle == subFontPtr->angle) {
|
||||
return SelectObject(hdc, subFontPtr->hFontAngled);
|
||||
return (HFONT)SelectObject(hdc, subFontPtr->hFontAngled);
|
||||
} else {
|
||||
if (subFontPtr->hFontAngled) {
|
||||
DeleteObject(subFontPtr->hFontAngled);
|
||||
@@ -1507,10 +1543,10 @@ SelectFont(
|
||||
subFontPtr->hFontAngled = GetScreenFont(&fontPtr->font.fa,
|
||||
subFontPtr->familyPtr->faceName, fontPtr->pixelSize, angle);
|
||||
if (subFontPtr->hFontAngled == NULL) {
|
||||
return SelectObject(hdc, subFontPtr->hFont0);
|
||||
return (HFONT)SelectObject(hdc, subFontPtr->hFont0);
|
||||
}
|
||||
subFontPtr->angle = angle;
|
||||
return SelectObject(hdc, subFontPtr->hFontAngled);
|
||||
return (HFONT)SelectObject(hdc, subFontPtr->hFontAngled);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1562,12 +1598,13 @@ InitFont(
|
||||
window = Tk_WindowId(tkwin);
|
||||
hwnd = (window == None) ? NULL : TkWinGetHWND(window);
|
||||
hdc = GetDC(hwnd);
|
||||
oldFont = SelectObject(hdc, hFont);
|
||||
oldFont = (HFONT)SelectObject(hdc, hFont);
|
||||
|
||||
GetTextMetricsW(hdc, &tm);
|
||||
|
||||
GetTextFaceW(hdc, LF_FACESIZE, buf);
|
||||
Tcl_WinTCharToUtf((LPCTSTR)buf, -1, &faceString);
|
||||
Tcl_DStringInit(&faceString);
|
||||
Tcl_WCharToUtfDString(buf, wcslen(buf), &faceString);
|
||||
|
||||
fontPtr->font.fid = (Font) fontPtr;
|
||||
fontPtr->hwnd = hwnd;
|
||||
@@ -1731,7 +1768,7 @@ AllocFontFamily(
|
||||
HDC hdc, /* HDC in which font can be selected. */
|
||||
HFONT hFont, /* Screen font whose FontFamily is to be
|
||||
* returned. */
|
||||
int base) /* Non-zero if this font family is to be used
|
||||
TCL_UNUSED(int)) /* Non-zero if this font family is to be used
|
||||
* in the base font of a font object. */
|
||||
{
|
||||
Tk_Uid faceName;
|
||||
@@ -1739,15 +1776,16 @@ AllocFontFamily(
|
||||
Tcl_DString faceString;
|
||||
Tcl_Encoding encoding;
|
||||
WCHAR buf[LF_FACESIZE];
|
||||
ThreadSpecificData *tsdPtr =
|
||||
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
|
||||
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
|
||||
|
||||
hFont = SelectObject(hdc, hFont);
|
||||
hFont = (HFONT)SelectObject(hdc, hFont);
|
||||
GetTextFaceW(hdc, LF_FACESIZE, buf);
|
||||
Tcl_WinTCharToUtf((LPCTSTR)buf, -1, &faceString);
|
||||
Tcl_DStringInit(&faceString);
|
||||
Tcl_WCharToUtfDString(buf, wcslen(buf), &faceString);
|
||||
faceName = Tk_GetUid(Tcl_DStringValue(&faceString));
|
||||
Tcl_DStringFree(&faceString);
|
||||
hFont = SelectObject(hdc, hFont);
|
||||
hFont = (HFONT)SelectObject(hdc, hFont);
|
||||
|
||||
familyPtr = tsdPtr->fontFamilyList;
|
||||
for ( ; familyPtr != NULL; familyPtr = familyPtr->nextPtr) {
|
||||
@@ -1757,7 +1795,7 @@ AllocFontFamily(
|
||||
}
|
||||
}
|
||||
|
||||
familyPtr = ckalloc(sizeof(FontFamily));
|
||||
familyPtr = (FontFamily *)ckalloc(sizeof(FontFamily));
|
||||
memset(familyPtr, 0, sizeof(FontFamily));
|
||||
familyPtr->nextPtr = tsdPtr->fontFamilyList;
|
||||
tsdPtr->fontFamilyList = familyPtr;
|
||||
@@ -1843,7 +1881,7 @@ FreeFontFamily(
|
||||
{
|
||||
int i;
|
||||
FontFamily **familyPtrPtr;
|
||||
ThreadSpecificData *tsdPtr =
|
||||
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
|
||||
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
|
||||
|
||||
if (familyPtr == NULL) {
|
||||
@@ -1920,7 +1958,7 @@ FindSubFontForChar(
|
||||
SubFont *subFontPtr;
|
||||
Tcl_DString ds;
|
||||
|
||||
if ((ch < BASE_CHARS) || (ch >= 0x30000)) {
|
||||
if ((ch < BASE_CHARS) || (ch >= FONTMAP_NUMCHARS)) {
|
||||
return &fontPtr->subFontArray[0];
|
||||
}
|
||||
|
||||
@@ -2028,8 +2066,8 @@ FindSubFontForChar(
|
||||
static int CALLBACK
|
||||
WinFontCanUseProc(
|
||||
ENUMLOGFONTW *lfPtr, /* Logical-font data. */
|
||||
NEWTEXTMETRIC *tmPtr, /* Physical-font data (not used). */
|
||||
int fontType, /* Type of font (not used). */
|
||||
TCL_UNUSED(NEWTEXTMETRIC *), /* Physical-font data (not used). */
|
||||
TCL_UNUSED(int), /* Type of font (not used). */
|
||||
LPARAM lParam) /* Result object to hold result. */
|
||||
{
|
||||
int ch;
|
||||
@@ -2047,7 +2085,10 @@ WinFontCanUseProc(
|
||||
fontPtr = canUsePtr->fontPtr;
|
||||
nameTriedPtr = canUsePtr->nameTriedPtr;
|
||||
|
||||
fallbackName = Tcl_WinTCharToUtf((LPCTSTR)lfPtr->elfLogFont.lfFaceName, -1, &faceString);
|
||||
fallbackName = (char *) lfPtr->elfLogFont.lfFaceName;
|
||||
Tcl_DStringInit(&faceString);
|
||||
Tcl_WCharToUtfDString((WCHAR *)fallbackName, wcslen((WCHAR *)fallbackName), &faceString);
|
||||
fallbackName = Tcl_DStringValue(&faceString);
|
||||
|
||||
if (SeenName(fallbackName, nameTriedPtr) == 0) {
|
||||
subFontPtr = CanUseFallback(hdc, fontPtr, fallbackName, ch,
|
||||
@@ -2090,7 +2131,7 @@ FontMapLookup(
|
||||
{
|
||||
int row, bitOffset;
|
||||
|
||||
if (ch < 0 || ch >= 0x30000) {
|
||||
if (ch < 0 || ch >= FONTMAP_NUMCHARS) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2134,7 +2175,7 @@ FontMapInsert(
|
||||
{
|
||||
int row, bitOffset;
|
||||
|
||||
if (ch >= 0 && ch < 0x30000) {
|
||||
if (ch >= 0 && ch < FONTMAP_NUMCHARS) {
|
||||
row = ch >> FONTMAP_SHIFT;
|
||||
if (subFontPtr->fontMap[row] == NULL) {
|
||||
FontMapLoadPage(subFontPtr, row);
|
||||
@@ -2172,11 +2213,11 @@ FontMapLoadPage(
|
||||
{
|
||||
FontFamily *familyPtr;
|
||||
Tcl_Encoding encoding;
|
||||
char src[XMaxTransChars], buf[16];
|
||||
USHORT *startCount, *endCount;
|
||||
int i, j, bitOffset, end, segCount;
|
||||
USHORT *startCount, *endCount;
|
||||
char buf[16], src[6];
|
||||
|
||||
subFontPtr->fontMap[row] = ckalloc(FONTMAP_BITSPERPAGE / 8);
|
||||
subFontPtr->fontMap[row] = (char *)ckalloc(FONTMAP_BITSPERPAGE / 8);
|
||||
memset(subFontPtr->fontMap[row], 0, FONTMAP_BITSPERPAGE / 8);
|
||||
|
||||
familyPtr = subFontPtr->familyPtr;
|
||||
@@ -2407,7 +2448,7 @@ CanUseFallback(
|
||||
if (fontPtr->numSubFonts >= SUBFONT_SPACE) {
|
||||
SubFont *newPtr;
|
||||
|
||||
newPtr = ckalloc(sizeof(SubFont) * (fontPtr->numSubFonts + 1));
|
||||
newPtr = (SubFont *)ckalloc(sizeof(SubFont) * (fontPtr->numSubFonts + 1));
|
||||
memcpy(newPtr, fontPtr->subFontArray,
|
||||
fontPtr->numSubFonts * sizeof(SubFont));
|
||||
if (fontPtr->subFontArray != fontPtr->staticSubFonts) {
|
||||
@@ -2455,7 +2496,6 @@ GetScreenFont(
|
||||
double angle) /* What is the desired orientation of the
|
||||
* font. */
|
||||
{
|
||||
Tcl_DString ds;
|
||||
HFONT hFont;
|
||||
LOGFONTW lf;
|
||||
|
||||
@@ -2474,9 +2514,7 @@ GetScreenFont(
|
||||
lf.lfQuality = DEFAULT_QUALITY;
|
||||
lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
|
||||
|
||||
Tcl_WinUtfToTChar(faceName, -1, &ds);
|
||||
wcsncpy(lf.lfFaceName, (WCHAR *)Tcl_DStringValue(&ds), LF_FACESIZE-1);
|
||||
Tcl_DStringFree(&ds);
|
||||
MultiByteToWideChar(CP_UTF8, 0, faceName, -1, lf.lfFaceName, LF_FACESIZE);
|
||||
lf.lfFaceName[LF_FACESIZE-1] = 0;
|
||||
hFont = CreateFontIndirectW(&lf);
|
||||
return hFont;
|
||||
@@ -2525,7 +2563,8 @@ FamilyExists(
|
||||
return 0;
|
||||
}
|
||||
|
||||
Tcl_WinUtfToTChar(faceName, -1, &faceString);
|
||||
Tcl_DStringInit(&faceString);
|
||||
Tcl_UtfToWCharDString(faceName, -1, &faceString);
|
||||
|
||||
/*
|
||||
* If the family exists, WinFontExistProc() will be called and
|
||||
@@ -2534,7 +2573,7 @@ FamilyExists(
|
||||
* non-zero value.
|
||||
*/
|
||||
|
||||
result = EnumFontFamiliesW(hdc, (WCHAR*) Tcl_DStringValue(&faceString),
|
||||
result = EnumFontFamiliesW(hdc, (WCHAR *)Tcl_DStringValue(&faceString),
|
||||
(FONTENUMPROCW) WinFontExistProc, 0);
|
||||
Tcl_DStringFree(&faceString);
|
||||
return (result == 0);
|
||||
@@ -2564,10 +2603,10 @@ FamilyOrAliasExists(
|
||||
|
||||
static int CALLBACK
|
||||
WinFontExistProc(
|
||||
ENUMLOGFONTW *lfPtr, /* Logical-font data. */
|
||||
NEWTEXTMETRIC *tmPtr, /* Physical-font data (not used). */
|
||||
int fontType, /* Type of font (not used). */
|
||||
LPARAM lParam) /* EnumFontData to hold result. */
|
||||
TCL_UNUSED(ENUMLOGFONTW *), /* Logical-font data. */
|
||||
TCL_UNUSED(NEWTEXTMETRIC *), /* Physical-font data (not used). */
|
||||
TCL_UNUSED(int), /* Type of font (not used). */
|
||||
TCL_UNUSED(LPARAM)) /* EnumFontData to hold result. */
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -2722,7 +2761,7 @@ LoadFontRanges(
|
||||
endCount = NULL;
|
||||
*symbolPtr = 0;
|
||||
|
||||
hFont = SelectObject(hdc, hFont);
|
||||
hFont = (HFONT)SelectObject(hdc, hFont);
|
||||
|
||||
i = 0;
|
||||
s = (char *) &i;
|
||||
@@ -2777,8 +2816,8 @@ LoadFontRanges(
|
||||
segCount = subTable.segment.segCountX2 / 2;
|
||||
cbData = segCount * sizeof(USHORT);
|
||||
|
||||
startCount = ckalloc(cbData);
|
||||
endCount = ckalloc(cbData);
|
||||
startCount = (USHORT *)ckalloc(cbData);
|
||||
endCount = (USHORT *)ckalloc(cbData);
|
||||
|
||||
offset = encTable.offset + sizeof(subTable.segment);
|
||||
GetFontData(hdc, cmapKey, (DWORD) offset, endCount, cbData);
|
||||
@@ -2821,8 +2860,8 @@ LoadFontRanges(
|
||||
|
||||
segCount = 1;
|
||||
cbData = segCount * sizeof(USHORT);
|
||||
startCount = ckalloc(cbData);
|
||||
endCount = ckalloc(cbData);
|
||||
startCount = (USHORT *)ckalloc(cbData);
|
||||
endCount = (USHORT *)ckalloc(cbData);
|
||||
startCount[0] = 0x0000;
|
||||
endCount[0] = 0x00ff;
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ int
|
||||
TkpInit(
|
||||
Tcl_Interp *interp)
|
||||
{
|
||||
(void)interp;
|
||||
/*
|
||||
* This is necessary for static initialization, and is ok otherwise
|
||||
* because TkWinXInit flips a static bit to do its work just once.
|
||||
@@ -137,21 +138,21 @@ TkpDisplayWarning(
|
||||
|
||||
len = MultiByteToWideChar(CP_UTF8, 0, title, -1, titleString, TK_MAX_WARN_LEN);
|
||||
msgString = &titleString[len + 1];
|
||||
titleString[TK_MAX_WARN_LEN - 1] = L'\0';
|
||||
titleString[TK_MAX_WARN_LEN - 1] = '\0';
|
||||
MultiByteToWideChar(CP_UTF8, 0, msg, -1, msgString, (TK_MAX_WARN_LEN - 1) - len);
|
||||
/*
|
||||
* Truncate MessageBox string if it is too long to not overflow the screen
|
||||
* and cause possible oversized window error.
|
||||
*/
|
||||
if (titleString[TK_MAX_WARN_LEN - 1] != L'\0') {
|
||||
if (titleString[TK_MAX_WARN_LEN - 1] != '\0') {
|
||||
memcpy(titleString + (TK_MAX_WARN_LEN - 5), L" ...", 5 * sizeof(WCHAR));
|
||||
}
|
||||
if (IsDebuggerPresent()) {
|
||||
titleString[len - 1] = L':';
|
||||
titleString[len] = L' ';
|
||||
titleString[len - 1] = ':';
|
||||
titleString[len] = ' ';
|
||||
OutputDebugStringW(titleString);
|
||||
} else {
|
||||
titleString[len - 1] = L'\0';
|
||||
titleString[len - 1] = '\0';
|
||||
MessageBoxW(NULL, msgString, titleString,
|
||||
MB_OK | MB_ICONEXCLAMATION | MB_SYSTEMMODAL
|
||||
| MB_SETFOREGROUND | MB_TOPMOST);
|
||||
@@ -196,7 +197,8 @@ TkWin32ErrorObj(
|
||||
*p = '\0';
|
||||
}
|
||||
|
||||
Tcl_WinTCharToUtf((LPCTSTR)lpBuffer, -1, &ds);
|
||||
Tcl_DStringInit(&ds);
|
||||
Tcl_WCharToUtfDString(lpBuffer, wcslen(lpBuffer), &ds);
|
||||
errPtr = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
|
||||
Tcl_DStringFree(&ds);
|
||||
|
||||
@@ -206,7 +208,6 @@ TkWin32ErrorObj(
|
||||
|
||||
return errPtr;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
|
||||
@@ -185,6 +185,7 @@ MODULE_SCOPE void TkWinSetupSystemFonts(TkMainInfo *mainPtr);
|
||||
|
||||
#define TK_THEME_WIN_CLASSIC 1
|
||||
#define TK_THEME_WIN_XP 2
|
||||
#define TK_THEME_WIN_VISTA 3
|
||||
|
||||
/*
|
||||
* The following is implemented in tkWinWm and used by tkWinEmbed.c
|
||||
|
||||
@@ -97,19 +97,20 @@ TkpGetString(
|
||||
* result. */
|
||||
{
|
||||
XKeyEvent *keyEv = &eventPtr->xkey;
|
||||
char buf[6];
|
||||
int len;
|
||||
char buf[6];
|
||||
|
||||
Tcl_DStringInit(dsPtr);
|
||||
if (keyEv->send_event == -1) {
|
||||
if (keyEv->nbytes > 0) {
|
||||
TkKeyEvent *ev = (TkKeyEvent *)keyEv;
|
||||
if (ev->nbytes > 0) {
|
||||
Tcl_ExternalToUtfDString(TkWinGetKeyInputEncoding(),
|
||||
keyEv->trans_chars, keyEv->nbytes, dsPtr);
|
||||
ev->trans_chars, ev->nbytes, dsPtr);
|
||||
}
|
||||
} else if (keyEv->send_event == -3) {
|
||||
|
||||
/*
|
||||
* Special case for WM_UNICHAR and win2000 multi-lingal IME input
|
||||
* Special case for WM_UNICHAR and win2000 multilingual IME input
|
||||
*/
|
||||
|
||||
len = TkUniCharToUtf(keyEv->keycode, buf);
|
||||
|
||||
237
win/tkWinMenu.c
237
win/tkWinMenu.c
@@ -233,13 +233,13 @@ GetNewID(
|
||||
TkMenuEntry *mePtr, /* The menu we are working with. */
|
||||
WORD *menuIDPtr) /* The resulting id. */
|
||||
{
|
||||
ThreadSpecificData *tsdPtr =
|
||||
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
|
||||
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
|
||||
WORD curID = tsdPtr->lastCommandID;
|
||||
|
||||
while (1) {
|
||||
Tcl_HashEntry *commandEntryPtr;
|
||||
int new;
|
||||
int isNew;
|
||||
|
||||
/*
|
||||
* Try the next ID number, taking care to wrap rather than stray
|
||||
@@ -255,8 +255,8 @@ GetNewID(
|
||||
}
|
||||
|
||||
commandEntryPtr = Tcl_CreateHashEntry(&tsdPtr->commandTable,
|
||||
INT2PTR(curID), &new);
|
||||
if (new) {
|
||||
INT2PTR(curID), &isNew);
|
||||
if (isNew) {
|
||||
Tcl_SetHashValue(commandEntryPtr, mePtr);
|
||||
*menuIDPtr = curID;
|
||||
tsdPtr->lastCommandID = curID;
|
||||
@@ -285,7 +285,7 @@ static void
|
||||
FreeID(
|
||||
WORD commandID)
|
||||
{
|
||||
ThreadSpecificData *tsdPtr =
|
||||
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
|
||||
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
|
||||
|
||||
/*
|
||||
@@ -328,7 +328,7 @@ TkpNewMenu(
|
||||
HMENU winMenuHdl;
|
||||
Tcl_HashEntry *hashEntryPtr;
|
||||
int newEntry;
|
||||
ThreadSpecificData *tsdPtr =
|
||||
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
|
||||
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
|
||||
|
||||
winMenuHdl = CreatePopupMenu();
|
||||
@@ -374,7 +374,7 @@ TkpDestroyMenu(
|
||||
{
|
||||
HMENU winMenuHdl = (HMENU) menuPtr->platformData;
|
||||
const char *searchName;
|
||||
ThreadSpecificData *tsdPtr =
|
||||
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
|
||||
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
|
||||
|
||||
if (menuPtr->menuFlags & MENU_RECONFIGURE_PENDING) {
|
||||
@@ -388,7 +388,7 @@ TkpDestroyMenu(
|
||||
if (menuPtr->menuFlags & MENU_SYSTEM_MENU) {
|
||||
TkMenuEntry *searchEntryPtr;
|
||||
Tcl_HashTable *tablePtr = TkGetMenuHashTable(menuPtr->interp);
|
||||
char *menuName = Tcl_GetHashKey(tablePtr,
|
||||
char *menuName = (char *)Tcl_GetHashKey(tablePtr,
|
||||
menuPtr->menuRefPtr->hashEntryPtr);
|
||||
|
||||
/*
|
||||
@@ -420,7 +420,7 @@ TkpDestroyMenu(
|
||||
|
||||
if (tsdPtr->menuHWND != NULL) {
|
||||
Tcl_HashEntry *hashEntryPtr =
|
||||
Tcl_FindHashEntry(&tsdPtr->winMenuTable, (char *) winMenuHdl);
|
||||
Tcl_FindHashEntry(&tsdPtr->winMenuTable, winMenuHdl);
|
||||
|
||||
if (hashEntryPtr != NULL) {
|
||||
Tcl_DeleteHashEntry(hashEntryPtr);
|
||||
@@ -492,16 +492,16 @@ GetEntryText(
|
||||
char *itemText;
|
||||
|
||||
if (mePtr->type == TEAROFF_ENTRY) {
|
||||
itemText = ckalloc(sizeof("(Tear-off)"));
|
||||
itemText = (char *)ckalloc(sizeof("(Tear-off)"));
|
||||
strcpy(itemText, "(Tear-off)");
|
||||
} else if (mePtr->imagePtr != NULL) {
|
||||
itemText = ckalloc(sizeof("(Image)"));
|
||||
itemText = (char *)ckalloc(sizeof("(Image)"));
|
||||
strcpy(itemText, "(Image)");
|
||||
} else if (mePtr->bitmapPtr != NULL) {
|
||||
itemText = ckalloc(sizeof("(Pixmap)"));
|
||||
itemText = (char *)ckalloc(sizeof("(Pixmap)"));
|
||||
strcpy(itemText, "(Pixmap)");
|
||||
} else if (mePtr->labelPtr == NULL || mePtr->labelLength == 0) {
|
||||
itemText = ckalloc(sizeof("( )"));
|
||||
itemText = (char *)ckalloc(sizeof("( )"));
|
||||
strcpy(itemText, "( )");
|
||||
} else {
|
||||
int i;
|
||||
@@ -511,6 +511,7 @@ GetEntryText(
|
||||
: Tcl_GetString(mePtr->accelPtr);
|
||||
const char *p, *next;
|
||||
Tcl_DString itemString;
|
||||
int ch;
|
||||
|
||||
/*
|
||||
* We have to construct the string with an ampersand preceeding the
|
||||
@@ -527,7 +528,7 @@ GetEntryText(
|
||||
if (*p == '&') {
|
||||
Tcl_DStringAppend(&itemString, "&", 1);
|
||||
}
|
||||
next = Tcl_UtfNext(p);
|
||||
next = p + TkUtfToUniChar(p, &ch);
|
||||
Tcl_DStringAppend(&itemString, p, (int) (next - p));
|
||||
}
|
||||
if (mePtr->accelLength > 0) {
|
||||
@@ -536,12 +537,12 @@ GetEntryText(
|
||||
if (*p == '&') {
|
||||
Tcl_DStringAppend(&itemString, "&", 1);
|
||||
}
|
||||
next = Tcl_UtfNext(p);
|
||||
next = p + TkUtfToUniChar(p, &ch);
|
||||
Tcl_DStringAppend(&itemString, p, (int) (next - p));
|
||||
}
|
||||
}
|
||||
|
||||
itemText = ckalloc(Tcl_DStringLength(&itemString) + 1);
|
||||
itemText = (char *)ckalloc(Tcl_DStringLength(&itemString) + 1);
|
||||
strcpy(itemText, Tcl_DStringValue(&itemString));
|
||||
Tcl_DStringFree(&itemString);
|
||||
}
|
||||
@@ -569,7 +570,7 @@ static void
|
||||
ReconfigureWindowsMenu(
|
||||
ClientData clientData) /* The menu we are rebuilding */
|
||||
{
|
||||
TkMenu *menuPtr = clientData;
|
||||
TkMenu *menuPtr = (TkMenu *)clientData;
|
||||
TkMenuEntry *mePtr;
|
||||
HMENU winMenuHdl = (HMENU) menuPtr->platformData;
|
||||
char *itemText = NULL;
|
||||
@@ -609,7 +610,8 @@ ReconfigureWindowsMenu(
|
||||
itemText = GetEntryText(menuPtr, mePtr);
|
||||
if ((menuPtr->menuType == MENUBAR)
|
||||
|| (menuPtr->menuFlags & MENU_SYSTEM_MENU)) {
|
||||
Tcl_WinUtfToTChar(itemText, -1, &translatedText);
|
||||
Tcl_DStringInit(&translatedText);
|
||||
Tcl_UtfToWCharDString(itemText, -1, &translatedText);
|
||||
lpNewItem = (LPCWSTR) Tcl_DStringValue(&translatedText);
|
||||
flags |= MF_STRING;
|
||||
} else {
|
||||
@@ -728,7 +730,7 @@ ReconfigureWindowsMenu(
|
||||
|
||||
if ((menuPtr->menuType == MENUBAR)
|
||||
&& (menuPtr->parentTopLevelPtr != NULL)) {
|
||||
HANDLE bar = TkWinGetWrapperWindow(menuPtr->parentTopLevelPtr);
|
||||
HWND bar = TkWinGetWrapperWindow(menuPtr->parentTopLevelPtr);
|
||||
|
||||
if (bar) {
|
||||
DrawMenuBar(bar);
|
||||
@@ -759,7 +761,7 @@ ReconfigureWindowsMenu(
|
||||
|
||||
int
|
||||
TkpPostMenu(
|
||||
Tcl_Interp *interp,
|
||||
Tcl_Interp *dummy,
|
||||
TkMenu *menuPtr,
|
||||
int x, int y, int index)
|
||||
{
|
||||
@@ -769,8 +771,9 @@ TkpPostMenu(
|
||||
POINT point;
|
||||
Tk_Window parentWindow = Tk_Parent(menuPtr->tkwin);
|
||||
int oldServiceMode = Tcl_GetServiceMode();
|
||||
ThreadSpecificData *tsdPtr =
|
||||
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
|
||||
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
|
||||
(void)dummy;
|
||||
|
||||
tsdPtr->inPostMenu++;
|
||||
CallPendingReconfigureImmediately(menuPtr);
|
||||
@@ -869,13 +872,14 @@ TkpPostMenu(
|
||||
|
||||
int
|
||||
TkpPostTearoffMenu(
|
||||
Tcl_Interp *interp, /* The interpreter of the menu */
|
||||
Tcl_Interp *dummy, /* The interpreter of the menu */
|
||||
TkMenu *menuPtr, /* The menu we are posting */
|
||||
int x, int y, int index) /* The root X,Y coordinates where we are
|
||||
* posting */
|
||||
{
|
||||
int vRootX, vRootY, vRootWidth, vRootHeight;
|
||||
int result;
|
||||
(void)dummy;
|
||||
|
||||
if (index >= menuPtr->numEntries) {
|
||||
index = menuPtr->numEntries - 1;
|
||||
@@ -1064,7 +1068,7 @@ TkWinEmbeddedMenuProc(
|
||||
{
|
||||
static int nIdles = 0;
|
||||
LRESULT lResult = 1;
|
||||
ThreadSpecificData *tsdPtr =
|
||||
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
|
||||
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
|
||||
|
||||
switch(message) {
|
||||
@@ -1140,15 +1144,16 @@ TkWinHandleMenuEvent(
|
||||
int returnResult = 0;
|
||||
TkMenu *menuPtr;
|
||||
TkMenuEntry *mePtr;
|
||||
ThreadSpecificData *tsdPtr =
|
||||
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
|
||||
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
|
||||
(void)phwnd;
|
||||
|
||||
switch (*pMessage) {
|
||||
case WM_UNINITMENUPOPUP:
|
||||
hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable,
|
||||
(char *) *pwParam);
|
||||
*pwParam);
|
||||
if (hashEntryPtr != NULL) {
|
||||
menuPtr = Tcl_GetHashValue(hashEntryPtr);
|
||||
menuPtr = (TkMenu *)Tcl_GetHashValue(hashEntryPtr);
|
||||
if ((menuPtr->menuRefPtr != NULL)
|
||||
&& (menuPtr->menuRefPtr->parentEntryPtr != NULL)) {
|
||||
TkPostSubmenu(menuPtr->interp,
|
||||
@@ -1160,10 +1165,10 @@ TkWinHandleMenuEvent(
|
||||
case WM_INITMENU:
|
||||
TkMenuInit();
|
||||
hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable,
|
||||
(char *) *pwParam);
|
||||
*pwParam);
|
||||
if (hashEntryPtr != NULL) {
|
||||
tsdPtr->oldServiceMode = Tcl_SetServiceMode(TCL_SERVICE_ALL);
|
||||
menuPtr = Tcl_GetHashValue(hashEntryPtr);
|
||||
menuPtr = (TkMenu *)Tcl_GetHashValue(hashEntryPtr);
|
||||
tsdPtr->modalMenuPtr = menuPtr;
|
||||
CallPendingReconfigureImmediately(menuPtr);
|
||||
RecursivelyClearActiveMenu(menuPtr);
|
||||
@@ -1199,7 +1204,7 @@ TkWinHandleMenuEvent(
|
||||
if (hashEntryPtr == NULL) {
|
||||
break;
|
||||
}
|
||||
mePtr = Tcl_GetHashValue(hashEntryPtr);
|
||||
mePtr = (TkMenuEntry *)Tcl_GetHashValue(hashEntryPtr);
|
||||
if (mePtr != NULL) {
|
||||
TkMenuReferences *menuRefPtr;
|
||||
TkMenuEntry *parentEntryPtr;
|
||||
@@ -1245,16 +1250,16 @@ TkWinHandleMenuEvent(
|
||||
|
||||
case WM_MENUCHAR: {
|
||||
hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable,
|
||||
(char *) *plParam);
|
||||
*plParam);
|
||||
if (hashEntryPtr != NULL) {
|
||||
int i, len, underline;
|
||||
Tcl_Obj *labelPtr;
|
||||
LPCWSTR wlabel;
|
||||
WCHAR *wlabel;
|
||||
int menuChar;
|
||||
Tcl_DString ds;
|
||||
|
||||
*plResult = 0;
|
||||
menuPtr = Tcl_GetHashValue(hashEntryPtr);
|
||||
menuPtr = (TkMenu *)Tcl_GetHashValue(hashEntryPtr);
|
||||
/*
|
||||
* Assume we have something directly convertable to Tcl_UniChar.
|
||||
* True at least for wide systems.
|
||||
@@ -1272,8 +1277,9 @@ TkWinHandleMenuEvent(
|
||||
const char *src = Tcl_GetStringFromObj(labelPtr, &len);
|
||||
|
||||
Tcl_DStringFree(&ds);
|
||||
wlabel = (LPCWSTR) Tcl_WinUtfToTChar(src, len, &ds);
|
||||
if ((underline < len) && (menuChar ==
|
||||
Tcl_DStringInit(&ds);
|
||||
wlabel = Tcl_UtfToWCharDString(src, len, &ds);
|
||||
if ((underline + 1 < len + 1) && (menuChar ==
|
||||
Tcl_UniCharToUpper(wlabel[underline]))) {
|
||||
*plResult = (2 << 16) | i;
|
||||
returnResult = 1;
|
||||
@@ -1325,7 +1331,7 @@ TkWinHandleMenuEvent(
|
||||
}
|
||||
mePtr = (TkMenuEntry *) itemPtr->itemData;
|
||||
menuPtr = mePtr->menuPtr;
|
||||
twdPtr = ckalloc(sizeof(TkWinDrawable));
|
||||
twdPtr = (TkWinDrawable *)ckalloc(sizeof(TkWinDrawable));
|
||||
twdPtr->type = TWD_WINDC;
|
||||
twdPtr->winDC.hdc = itemPtr->hDC;
|
||||
|
||||
@@ -1389,9 +1395,9 @@ TkWinHandleMenuEvent(
|
||||
menuPtr = NULL;
|
||||
if (*plParam != 0) {
|
||||
hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable,
|
||||
(char *) *plParam);
|
||||
*plParam);
|
||||
if (hashEntryPtr != NULL) {
|
||||
menuPtr = Tcl_GetHashValue(hashEntryPtr);
|
||||
menuPtr = (TkMenu *)Tcl_GetHashValue(hashEntryPtr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1416,7 +1422,7 @@ TkWinHandleMenuEvent(
|
||||
hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->commandTable,
|
||||
INT2PTR(entryIndex));
|
||||
if (hashEntryPtr != NULL) {
|
||||
mePtr = Tcl_GetHashValue(hashEntryPtr);
|
||||
mePtr = (TkMenuEntry *)Tcl_GetHashValue(hashEntryPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1505,7 +1511,7 @@ TkpSetWindowMenuBar(
|
||||
TkMenu *menuPtr) /* The menu we are inserting */
|
||||
{
|
||||
HMENU winMenuHdl;
|
||||
ThreadSpecificData *tsdPtr =
|
||||
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
|
||||
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
|
||||
|
||||
if (menuPtr != NULL) {
|
||||
@@ -1514,7 +1520,7 @@ TkpSetWindowMenuBar(
|
||||
|
||||
winMenuHdl = (HMENU) menuPtr->platformData;
|
||||
hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable,
|
||||
(char *) winMenuHdl);
|
||||
winMenuHdl);
|
||||
Tcl_DeleteHashEntry(hashEntryPtr);
|
||||
DestroyMenu(winMenuHdl);
|
||||
winMenuHdl = CreateMenu();
|
||||
@@ -1553,6 +1559,10 @@ TkpSetMainMenubar(
|
||||
const char *menuName) /* The name of the menu to put in front. If
|
||||
* NULL, use the default menu bar. */
|
||||
{
|
||||
(void)interp;
|
||||
(void)tkwin;
|
||||
(void)menuName;
|
||||
|
||||
/*
|
||||
* Nothing to do.
|
||||
*/
|
||||
@@ -1583,6 +1593,10 @@ GetMenuIndicatorGeometry(
|
||||
int *widthPtr, /* The resulting width */
|
||||
int *heightPtr) /* The resulting height */
|
||||
{
|
||||
(void)menuPtr;
|
||||
(void)tkfont;
|
||||
(void)fmPtr;
|
||||
|
||||
*heightPtr = indicatorDimensions[0];
|
||||
if (mePtr->hideMargin) {
|
||||
*widthPtr = 0;
|
||||
@@ -1631,7 +1645,13 @@ GetMenuAccelGeometry(
|
||||
{
|
||||
*heightPtr = fmPtr->linespace;
|
||||
if (mePtr->type == CASCADE_ENTRY) {
|
||||
*widthPtr = 0;
|
||||
/*
|
||||
* Cascade entries have no accelerator but do show an arrow. Set
|
||||
* this field width to the width of the OBM_MNARROW system bitmap
|
||||
* used to display the arrow. I couldn't find how to query the
|
||||
* system for this value, therefore I resort to hardcoding.
|
||||
*/
|
||||
*widthPtr = CASCADE_ARROW_WIDTH;
|
||||
} else if ((menuPtr->menuType != MENUBAR) && (mePtr->accelPtr != NULL)) {
|
||||
const char *accel = Tcl_GetString(mePtr->accelPtr);
|
||||
|
||||
@@ -1666,7 +1686,10 @@ GetTearoffEntryGeometry(
|
||||
int *widthPtr, /* The resulting width */
|
||||
int *heightPtr) /* The resulting height */
|
||||
{
|
||||
if (menuPtr->menuType != MASTER_MENU) {
|
||||
(void)mePtr;
|
||||
(void)tkfont;
|
||||
|
||||
if (menuPtr->menuType != MAIN_MENU) {
|
||||
*heightPtr = 0;
|
||||
} else {
|
||||
*heightPtr = fmPtr->linespace;
|
||||
@@ -1699,6 +1722,10 @@ GetMenuSeparatorGeometry(
|
||||
int *widthPtr, /* The resulting width */
|
||||
int *heightPtr) /* The resulting height */
|
||||
{
|
||||
(void)menuPtr;
|
||||
(void)mePtr;
|
||||
(void)tkfont;
|
||||
|
||||
*widthPtr = 0;
|
||||
*heightPtr = fmPtr->linespace - (2 * fmPtr->descent);
|
||||
}
|
||||
@@ -1812,6 +1839,11 @@ DrawMenuEntryIndicator(
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
(void)tkfont;
|
||||
(void)fmPtr;
|
||||
(void)width;
|
||||
(void)height;
|
||||
|
||||
if ((mePtr->type == CHECK_BUTTON_ENTRY)
|
||||
|| (mePtr->type == RADIO_BUTTON_ENTRY)) {
|
||||
if (mePtr->indicatorOn && (mePtr->entryFlags & ENTRY_SELECTED)) {
|
||||
@@ -1892,6 +1924,9 @@ DrawMenuEntryAccelerator(
|
||||
int baseline;
|
||||
int leftEdge = x + mePtr->indicatorSpace + mePtr->labelWidth;
|
||||
const char *accel;
|
||||
(void)activeBorder;
|
||||
(void)width;
|
||||
(void)height;
|
||||
|
||||
if (menuPtr->menuType == MENUBAR) {
|
||||
return;
|
||||
@@ -1909,7 +1944,7 @@ DrawMenuEntryAccelerator(
|
||||
* Draw disabled 3D text highlight only with the Win95/98 look.
|
||||
*/
|
||||
|
||||
if (TkWinGetPlatformTheme() == TK_THEME_WIN_CLASSIC) {
|
||||
if (TkWinGetPlatformTheme() != TK_THEME_WIN_XP) {
|
||||
if ((mePtr->state == ENTRY_DISABLED)
|
||||
&& (menuPtr->disabledFgPtr != NULL) && (accel != NULL)) {
|
||||
COLORREF oldFgColor = gc->foreground;
|
||||
@@ -1935,8 +1970,9 @@ DrawMenuEntryAccelerator(
|
||||
* DrawMenuEntryArrow --
|
||||
*
|
||||
* This function draws the arrow bitmap on the right side of a menu
|
||||
* entry. This function is only used when drawing the arrow for a
|
||||
* disabled cascade menu.
|
||||
* entry. This function is only used when drawing the arrow for:
|
||||
* - a disabled cascade item
|
||||
* - a cascade item in any state in a torn-off menu
|
||||
*
|
||||
* Results:
|
||||
* None.
|
||||
@@ -1965,11 +2001,23 @@ DrawMenuEntryArrow(
|
||||
COLORREF oldFgColor;
|
||||
COLORREF oldBgColor;
|
||||
RECT rect;
|
||||
(void)gc;
|
||||
(void)activeBorder;
|
||||
|
||||
if (!drawArrow || (mePtr->type != CASCADE_ENTRY)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Don't draw the arrow if a submenu is not attached to this
|
||||
* cascade entry.
|
||||
*/
|
||||
|
||||
if ((mePtr->childMenuRefPtr == NULL)
|
||||
|| (mePtr->childMenuRefPtr->menuPtr == NULL)) {
|
||||
return;
|
||||
}
|
||||
|
||||
oldFgColor = gc->foreground;
|
||||
oldBgColor = gc->background;
|
||||
|
||||
@@ -2035,6 +2083,10 @@ DrawMenuSeparator(
|
||||
{
|
||||
XPoint points[2];
|
||||
Tk_3DBorder border;
|
||||
(void)mePtr;
|
||||
(void)gc;
|
||||
(void)tkfont;
|
||||
(void)fmPtr;
|
||||
|
||||
points[0].x = x;
|
||||
points[0].y = y + height / 2;
|
||||
@@ -2074,16 +2126,20 @@ DrawMenuUnderline(
|
||||
int width, /* Width of entry */
|
||||
int height) /* Height of entry */
|
||||
{
|
||||
(void)fmPtr;
|
||||
(void)width;
|
||||
|
||||
if ((mePtr->underline >= 0) && (mePtr->labelPtr != NULL)) {
|
||||
int len;
|
||||
|
||||
len = Tcl_GetCharLength(mePtr->labelPtr);
|
||||
if (mePtr->underline < len) {
|
||||
const char *label, *start, *end;
|
||||
int ch;
|
||||
|
||||
label = Tcl_GetString(mePtr->labelPtr);
|
||||
start = Tcl_UtfAtIndex(label, mePtr->underline);
|
||||
end = Tcl_UtfNext(start);
|
||||
start = TkUtfAtIndex(label, mePtr->underline);
|
||||
end = start + TkUtfToUniChar(start, &ch);
|
||||
Tk_UnderlineChars(menuPtr->display, d,
|
||||
gc, tkfont, label, x + mePtr->indicatorSpace,
|
||||
y + (height + fmPtr->ascent - fmPtr->descent) / 2,
|
||||
@@ -2113,7 +2169,7 @@ DrawMenuUnderline(
|
||||
|
||||
static int
|
||||
TkWinMenuKeyObjCmd(
|
||||
ClientData clientData, /* Unused. */
|
||||
ClientData dummy, /* Unused. */
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument objects. */
|
||||
@@ -2125,6 +2181,7 @@ TkWinMenuKeyObjCmd(
|
||||
TkWindow *winPtr;
|
||||
KeySym keySym;
|
||||
int i;
|
||||
(void)dummy;
|
||||
|
||||
if (objc != 3) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "window keySym");
|
||||
@@ -2174,17 +2231,16 @@ TkWinMenuKeyObjCmd(
|
||||
virtualKey = XKeysymToKeycode(winPtr->display, keySym);
|
||||
scanCode = MapVirtualKeyW(virtualKey, 0);
|
||||
if (0 != scanCode) {
|
||||
XKeyEvent xkey = eventPtr->xkey;
|
||||
TkKeyEvent xkey;
|
||||
memcpy(&xkey, eventPtr, sizeof(xkey));
|
||||
CallWindowProcW(DefWindowProcW, Tk_GetHWND(Tk_WindowId(tkwin)),
|
||||
WM_SYSKEYDOWN, virtualKey,
|
||||
(int) ((scanCode << 16) | (1 << 29)));
|
||||
if (xkey.nbytes > 0) {
|
||||
for (i = 0; i < xkey.nbytes; i++) {
|
||||
CallWindowProcW(DefWindowProcW,
|
||||
Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSCHAR,
|
||||
xkey.trans_chars[i],
|
||||
(int) ((scanCode << 16) | (1 << 29)));
|
||||
}
|
||||
for (i = 0; i < xkey.nbytes; i++) {
|
||||
CallWindowProcW(DefWindowProcW,
|
||||
Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSCHAR,
|
||||
xkey.trans_chars[i],
|
||||
(int) ((scanCode << 16) | (1 << 29)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2257,8 +2313,7 @@ TkpInitializeMenuBindings(
|
||||
*/
|
||||
|
||||
(void) Tcl_CreateObjCommand(interp, "tk::WinMenuKey",
|
||||
TkWinMenuKeyObjCmd,
|
||||
(ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL);
|
||||
TkWinMenuKeyObjCmd, Tk_MainWindow(interp), NULL);
|
||||
|
||||
(void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid,
|
||||
"<Alt_L>", "tk::WinMenuKey %W %N", 0);
|
||||
@@ -2441,7 +2496,7 @@ DrawMenuEntryLabel(
|
||||
int baseline = y + (height + fmPtr->ascent - fmPtr->descent) / 2;
|
||||
const char *label = Tcl_GetString(mePtr->labelPtr);
|
||||
|
||||
if (TkWinGetPlatformTheme() == TK_THEME_WIN_CLASSIC) {
|
||||
if (TkWinGetPlatformTheme() != TK_THEME_WIN_XP) {
|
||||
/*
|
||||
* Win 95/98 systems draw disabled menu text with a 3D
|
||||
* highlight, unless the menu item is highlighted,
|
||||
@@ -2537,8 +2592,12 @@ DrawTearoffEntry(
|
||||
XPoint points[2];
|
||||
int segmentWidth, maxX;
|
||||
Tk_3DBorder border;
|
||||
(void)mePtr;
|
||||
(void)gc;
|
||||
(void)tkfont;
|
||||
(void)fmPtr;
|
||||
|
||||
if (menuPtr->menuType != MASTER_MENU) {
|
||||
if (menuPtr->menuType != MAIN_MENU) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2580,7 +2639,7 @@ DrawTearoffEntry(
|
||||
|
||||
int
|
||||
TkpConfigureMenuEntry(
|
||||
register TkMenuEntry *mePtr)/* Information about menu entry; may or may
|
||||
TkMenuEntry *mePtr)/* Information about menu entry; may or may
|
||||
* not already have values for some fields. */
|
||||
{
|
||||
ScheduleMenuReconfigure(mePtr->menuPtr);
|
||||
@@ -2644,7 +2703,7 @@ TkpDrawMenuEntry(
|
||||
menuDc = TkWinGetDrawableDC(menuPtr->display, menuDrawable, &dcState);
|
||||
|
||||
memDc = CreateCompatibleDC(menuDc);
|
||||
oldBitmap = SelectObject(memDc,
|
||||
oldBitmap = (HBITMAP)SelectObject(memDc,
|
||||
CreateCompatibleBitmap(menuDc, width, height) );
|
||||
|
||||
memWinDraw.type = TWD_WINDC;
|
||||
@@ -3101,27 +3160,28 @@ static void
|
||||
MenuSelectEvent(
|
||||
TkMenu *menuPtr) /* the menu we have selected. */
|
||||
{
|
||||
XVirtualEvent event;
|
||||
union {XEvent general; XVirtualEvent virt;} event;
|
||||
union {DWORD msgpos; POINTS point;} root;
|
||||
|
||||
event.type = VirtualEvent;
|
||||
event.serial = menuPtr->display->request;
|
||||
event.send_event = 0;
|
||||
event.display = menuPtr->display;
|
||||
memset(&event, 0, sizeof(event));
|
||||
event.virt.type = VirtualEvent;
|
||||
event.virt.serial = menuPtr->display->request;
|
||||
event.virt.send_event = 0;
|
||||
event.virt.display = menuPtr->display;
|
||||
Tk_MakeWindowExist(menuPtr->tkwin);
|
||||
event.event = Tk_WindowId(menuPtr->tkwin);
|
||||
event.root = XRootWindow(menuPtr->display, 0);
|
||||
event.subwindow = None;
|
||||
event.time = TkpGetMS();
|
||||
event.virt.event = Tk_WindowId(menuPtr->tkwin);
|
||||
event.virt.root = XRootWindow(menuPtr->display, 0);
|
||||
event.virt.subwindow = None;
|
||||
event.virt.time = TkpGetMS();
|
||||
|
||||
root.msgpos = GetMessagePos();
|
||||
event.x_root = root.point.x;
|
||||
event.y_root = root.point.y;
|
||||
event.state = TkWinGetModifierState();
|
||||
event.same_screen = 1;
|
||||
event.name = Tk_GetUid("MenuSelect");
|
||||
event.user_data = NULL;
|
||||
Tk_QueueWindowEvent((XEvent *) &event, TCL_QUEUE_TAIL);
|
||||
event.virt.x_root = root.point.x;
|
||||
event.virt.y_root = root.point.y;
|
||||
event.virt.state = TkWinGetModifierState();
|
||||
event.virt.same_screen = 1;
|
||||
event.virt.name = Tk_GetUid("MenuSelect");
|
||||
event.virt.user_data = NULL;
|
||||
Tk_QueueWindowEvent(&event.general, TCL_QUEUE_TAIL);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3186,8 +3246,9 @@ HWND
|
||||
Tk_GetMenuHWND(
|
||||
Tk_Window tkwin)
|
||||
{
|
||||
ThreadSpecificData *tsdPtr =
|
||||
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
|
||||
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
|
||||
(void)tkwin;
|
||||
|
||||
TkMenuInit();
|
||||
return tsdPtr->embeddedMenuHWND;
|
||||
@@ -3211,8 +3272,10 @@ Tk_GetMenuHWND(
|
||||
|
||||
static void
|
||||
MenuExitHandler(
|
||||
ClientData clientData) /* Not used */
|
||||
ClientData dummy) /* Not used */
|
||||
{
|
||||
(void)dummy;
|
||||
|
||||
UnregisterClassW(MENU_CLASS_NAME, Tk_GetHINSTANCE());
|
||||
UnregisterClassW(EMBEDDED_MENU_CLASS_NAME, Tk_GetHINSTANCE());
|
||||
}
|
||||
@@ -3236,10 +3299,11 @@ MenuExitHandler(
|
||||
|
||||
static void
|
||||
MenuThreadExitHandler(
|
||||
ClientData clientData) /* Not used */
|
||||
ClientData dummy) /* Not used */
|
||||
{
|
||||
ThreadSpecificData *tsdPtr =
|
||||
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
|
||||
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
|
||||
(void)dummy;
|
||||
|
||||
DestroyWindow(tsdPtr->menuHWND);
|
||||
DestroyWindow(tsdPtr->embeddedMenuHWND);
|
||||
@@ -3276,6 +3340,8 @@ TkWinGetMenuSystemDefault(
|
||||
const char *className) /* The name of the option class. */
|
||||
{
|
||||
Tcl_Obj *valuePtr = NULL;
|
||||
(void)tkwin;
|
||||
(void)className;
|
||||
|
||||
if ((strcmp(dbName, "activeBorderWidth") == 0) ||
|
||||
(strcmp(dbName, "borderWidth") == 0)) {
|
||||
@@ -3324,7 +3390,6 @@ SetDefaults(
|
||||
int padding;
|
||||
#endif
|
||||
} nc;
|
||||
OSVERSIONINFOW os;
|
||||
|
||||
/*
|
||||
* Set all of the default options. The loop will terminate when we run out
|
||||
@@ -3344,9 +3409,7 @@ SetDefaults(
|
||||
|
||||
nc.metrics.cbSize = sizeof(nc);
|
||||
|
||||
os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
|
||||
GetVersionExW(&os);
|
||||
if (os.dwMajorVersion < 6) {
|
||||
if (TkWinGetPlatformTheme() != TK_THEME_WIN_VISTA) {
|
||||
nc.metrics.cbSize -= sizeof(int);
|
||||
}
|
||||
|
||||
@@ -3479,7 +3542,7 @@ TkpMenuInit(void)
|
||||
void
|
||||
TkpMenuThreadInit(void)
|
||||
{
|
||||
ThreadSpecificData *tsdPtr =
|
||||
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
|
||||
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
|
||||
|
||||
tsdPtr->menuHWND = CreateWindowW(MENU_CLASS_NAME, L"MenuWindow", WS_POPUP,
|
||||
|
||||
@@ -368,6 +368,19 @@ void TkSetCursorPos(
|
||||
input.type = INPUT_MOUSE;
|
||||
input.mi.dx = (x * 65535 + xscreen/2) / xscreen;
|
||||
input.mi.dy = (y * 65535 + yscreen/2) / yscreen;
|
||||
|
||||
/*
|
||||
* Horrible workaround here. There is a bug on Win 10: when warping to
|
||||
* pixel (x = 0, y = 0) the SendInput() below just does not move the
|
||||
* mouse pointer. However, as soon as dx or dy is non zero it moves as
|
||||
* expected. Given the scaling factor of 65535 (see above),
|
||||
* (dx = 1 , dy = 0) still means pixel (x = 0, y = 0).
|
||||
* See ticket [69b48f427e].
|
||||
*/
|
||||
if (input.mi.dx == 0 && input.mi.dy == 0) {
|
||||
input.mi.dx = 1;
|
||||
}
|
||||
|
||||
input.mi.mouseData = 0;
|
||||
input.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE;
|
||||
input.mi.time = 0;
|
||||
|
||||
@@ -91,11 +91,15 @@
|
||||
* See ticket [916c1095438eae56]: GetVersionExW triggers warnings
|
||||
*/
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(disable:4146)
|
||||
# pragma warning(disable:4267)
|
||||
# pragma warning(disable:4244)
|
||||
# pragma warning(disable:4311)
|
||||
# pragma warning(disable:4312)
|
||||
# pragma warning(disable:4996)
|
||||
#if !defined(_WIN64)
|
||||
# pragma warning(disable:4305)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -116,6 +120,12 @@
|
||||
#define TkpGetPixel(p) (((((p)->red >> 8) & 0xff) \
|
||||
| ((p)->green & 0xff00) | (((p)->blue << 8) & 0xff0000)) | 0x20000000)
|
||||
|
||||
/*
|
||||
* Used by tkWindow.c
|
||||
*/
|
||||
|
||||
#define TkpHandleMapOrUnmap(tkwin, event) Tk_HandleEvent(event)
|
||||
|
||||
/*
|
||||
* These calls implement native bitmaps which are not currently
|
||||
* supported under Windows. The macros eliminate the calls.
|
||||
|
||||
@@ -121,6 +121,8 @@ Tk_SetAppName(
|
||||
* be globally unique. */
|
||||
{
|
||||
#ifndef TK_SEND_ENABLED_ON_WINDOWS
|
||||
(void)tkwin;
|
||||
|
||||
/*
|
||||
* Temporarily disabled for bug #858822
|
||||
*/
|
||||
@@ -163,7 +165,7 @@ Tk_SetAppName(
|
||||
if (riPtr == NULL) {
|
||||
LPUNKNOWN *objPtr;
|
||||
|
||||
riPtr = ckalloc(sizeof(RegisteredInterp));
|
||||
riPtr = (RegisteredInterp *)ckalloc(sizeof(RegisteredInterp));
|
||||
memset(riPtr, 0, sizeof(RegisteredInterp));
|
||||
riPtr->interp = interp;
|
||||
|
||||
@@ -213,6 +215,8 @@ TkGetInterpNames(
|
||||
* lookup. */
|
||||
{
|
||||
#ifndef TK_SEND_ENABLED_ON_WINDOWS
|
||||
(void)interp;
|
||||
(void)tkwin;
|
||||
/*
|
||||
* Temporarily disabled for bug #858822
|
||||
*/
|
||||
@@ -254,7 +258,8 @@ TkGetInterpNames(
|
||||
if (*p) {
|
||||
Tcl_DString ds;
|
||||
|
||||
Tcl_WinTCharToUtf((LPCTSTR)(p + 1), -1, &ds);
|
||||
Tcl_DStringInit(&ds);
|
||||
Tcl_WCharToUtfDString(p + 1, wcslen(p + 1), &ds);
|
||||
result = Tcl_ListObjAppendElement(interp,
|
||||
objList,
|
||||
Tcl_NewStringObj(Tcl_DStringValue(&ds),
|
||||
@@ -619,7 +624,8 @@ BuildMoniker(
|
||||
LPMONIKER pmkItem = NULL;
|
||||
Tcl_DString dString;
|
||||
|
||||
Tcl_WinUtfToTChar(name, -1, &dString);
|
||||
Tcl_DStringInit(&dString);
|
||||
Tcl_UtfToWCharDString(name, -1, &dString);
|
||||
hr = CreateFileMoniker((LPOLESTR)Tcl_DStringValue(&dString), &pmkItem);
|
||||
Tcl_DStringFree(&dString);
|
||||
if (SUCCEEDED(hr)) {
|
||||
@@ -733,7 +739,7 @@ Send(
|
||||
* object. */
|
||||
Tcl_Interp *interp, /* The local interpreter. */
|
||||
int async, /* Flag for the calling style. */
|
||||
ClientData clientData, /* The RegisteredInterp structure for this
|
||||
ClientData dummy, /* The RegisteredInterp structure for this
|
||||
* interp. */
|
||||
int objc, /* Number of arguments to be sent. */
|
||||
Tcl_Obj *const objv[]) /* The arguments to be sent. */
|
||||
@@ -747,6 +753,7 @@ Send(
|
||||
DISPID dispid;
|
||||
Tcl_DString ds;
|
||||
const char *src;
|
||||
(void)dummy;
|
||||
|
||||
cmd = Tcl_ConcatObj(objc, objv);
|
||||
|
||||
@@ -761,8 +768,8 @@ Send(
|
||||
|
||||
vCmd.vt = VT_BSTR;
|
||||
src = Tcl_GetString(cmd);
|
||||
Tcl_WinUtfToTChar(src, cmd->length, &ds);
|
||||
vCmd.bstrVal = SysAllocString((WCHAR *) Tcl_DStringValue(&ds));
|
||||
Tcl_DStringInit(&ds);
|
||||
vCmd.bstrVal = SysAllocString(Tcl_UtfToWCharDString(src, cmd->length, &ds));
|
||||
Tcl_DStringFree(&ds);
|
||||
|
||||
dp.cArgs = 1;
|
||||
@@ -784,8 +791,8 @@ Send(
|
||||
|
||||
ehr = VariantChangeType(&vResult, &vResult, 0, VT_BSTR);
|
||||
if (SUCCEEDED(ehr)) {
|
||||
Tcl_WinTCharToUtf((LPCTSTR)vResult.bstrVal, SysStringLen(vResult.bstrVal) *
|
||||
sizeof (WCHAR), &ds);
|
||||
Tcl_DStringInit(&ds);
|
||||
Tcl_WCharToUtfDString(vResult.bstrVal, SysStringLen(vResult.bstrVal), &ds);
|
||||
Tcl_DStringResult(interp, &ds);
|
||||
}
|
||||
|
||||
@@ -797,8 +804,9 @@ Send(
|
||||
|
||||
if (hr == DISP_E_EXCEPTION && ei.bstrSource != NULL) {
|
||||
Tcl_Obj *opError, *opErrorCode, *opErrorInfo;
|
||||
Tcl_WinTCharToUtf((LPCTSTR)ei.bstrSource, SysStringLen(ei.bstrSource) *
|
||||
sizeof (WCHAR), &ds);
|
||||
|
||||
Tcl_DStringInit(&ds);
|
||||
Tcl_WCharToUtfDString(ei.bstrSource, SysStringLen(ei.bstrSource), &ds);
|
||||
opError = Tcl_NewStringObj(Tcl_DStringValue(&ds),
|
||||
Tcl_DStringLength(&ds));
|
||||
Tcl_DStringFree(&ds);
|
||||
@@ -869,14 +877,14 @@ TkWinSend_SetExcepInfo(
|
||||
/* TODO: Handle failure to append */
|
||||
|
||||
src = Tcl_GetString(opError);
|
||||
Tcl_WinUtfToTChar(src, opError->length, &ds);
|
||||
Tcl_DStringInit(&ds);
|
||||
pExcepInfo->bstrDescription =
|
||||
SysAllocString((WCHAR *) Tcl_DStringValue(&ds));
|
||||
SysAllocString(Tcl_UtfToWCharDString(src, opError->length, &ds));
|
||||
Tcl_DStringFree(&ds);
|
||||
src = Tcl_GetString(opErrorCode);
|
||||
Tcl_WinUtfToTChar(src, opErrorCode->length, &ds);
|
||||
Tcl_DStringInit(&ds);
|
||||
pExcepInfo->bstrSource =
|
||||
SysAllocString((WCHAR *) Tcl_DStringValue(&ds));
|
||||
SysAllocString(Tcl_UtfToWCharDString(src, opErrorCode->length, &ds));
|
||||
Tcl_DStringFree(&ds);
|
||||
Tcl_DecrRefCount(opErrorCode);
|
||||
pExcepInfo->scode = E_FAIL;
|
||||
@@ -923,7 +931,7 @@ TkWinSend_QueueCommand(
|
||||
|
||||
TRACE("SendQueueCommand()\n");
|
||||
|
||||
evPtr = ckalloc(sizeof(SendEvent));
|
||||
evPtr = (SendEvent *)ckalloc(sizeof(SendEvent));
|
||||
evPtr->header.proc = SendEventProc;
|
||||
evPtr->header.nextPtr = NULL;
|
||||
evPtr->interp = interp;
|
||||
@@ -965,6 +973,7 @@ SendEventProc(
|
||||
int flags)
|
||||
{
|
||||
SendEvent *evPtr = (SendEvent *)eventPtr;
|
||||
(void)flags;
|
||||
|
||||
TRACE("SendEventProc\n");
|
||||
|
||||
|
||||
@@ -166,17 +166,17 @@ WinSendCom_QueryInterface(
|
||||
void **ppvObject)
|
||||
{
|
||||
HRESULT hr = E_NOINTERFACE;
|
||||
TkWinSendCom *this = (TkWinSendCom *) This;
|
||||
TkWinSendCom *sendCom = (TkWinSendCom *) This;
|
||||
*ppvObject = NULL;
|
||||
|
||||
if (memcmp(riid, &IID_IUnknown, sizeof(IID)) == 0
|
||||
|| memcmp(riid, &IID_IDispatch, sizeof(IID)) == 0) {
|
||||
*ppvObject = (void **) this;
|
||||
this->lpVtbl->AddRef(This);
|
||||
*ppvObject = (void **) sendCom;
|
||||
sendCom->lpVtbl->AddRef(This);
|
||||
hr = S_OK;
|
||||
} else if (memcmp(riid, &IID_ISupportErrorInfo, sizeof(IID)) == 0) {
|
||||
*ppvObject = (void **) (this + 1);
|
||||
this->lpVtbl2->AddRef((ISupportErrorInfo *) (this + 1));
|
||||
*ppvObject = (void **) (sendCom + 1);
|
||||
sendCom->lpVtbl2->AddRef((ISupportErrorInfo *) (sendCom + 1));
|
||||
hr = S_OK;
|
||||
}
|
||||
return hr;
|
||||
@@ -186,9 +186,9 @@ static STDMETHODIMP_(ULONG)
|
||||
WinSendCom_AddRef(
|
||||
IDispatch *This)
|
||||
{
|
||||
TkWinSendCom *this = (TkWinSendCom*)This;
|
||||
TkWinSendCom *sendCom = (TkWinSendCom*)This;
|
||||
|
||||
return InterlockedIncrement(&this->refcount);
|
||||
return InterlockedIncrement(&sendCom->refcount);
|
||||
}
|
||||
|
||||
static STDMETHODIMP_(ULONG)
|
||||
@@ -196,9 +196,9 @@ WinSendCom_Release(
|
||||
IDispatch *This)
|
||||
{
|
||||
long r = 0;
|
||||
TkWinSendCom *this = (TkWinSendCom*)This;
|
||||
TkWinSendCom *sendCom = (TkWinSendCom*)This;
|
||||
|
||||
if ((r = InterlockedDecrement(&this->refcount)) == 0) {
|
||||
if ((r = InterlockedDecrement(&sendCom->refcount)) == 0) {
|
||||
TkWinSendCom_Destroy(This);
|
||||
}
|
||||
return r;
|
||||
@@ -210,6 +210,7 @@ WinSendCom_GetTypeInfoCount(
|
||||
UINT *pctinfo)
|
||||
{
|
||||
HRESULT hr = E_POINTER;
|
||||
(void)This;
|
||||
|
||||
if (pctinfo != NULL) {
|
||||
*pctinfo = 0;
|
||||
@@ -226,6 +227,9 @@ WinSendCom_GetTypeInfo(
|
||||
ITypeInfo **ppTI)
|
||||
{
|
||||
HRESULT hr = E_POINTER;
|
||||
(void)This;
|
||||
(void)iTInfo;
|
||||
(void)lcid;
|
||||
|
||||
if (ppTI) {
|
||||
*ppTI = NULL;
|
||||
@@ -244,6 +248,10 @@ WinSendCom_GetIDsOfNames(
|
||||
DISPID *rgDispId)
|
||||
{
|
||||
HRESULT hr = E_POINTER;
|
||||
(void)This;
|
||||
(void)riid;
|
||||
(void)cNames;
|
||||
(void)lcid;
|
||||
|
||||
if (rgDispId) {
|
||||
hr = DISP_E_UNKNOWNNAME;
|
||||
@@ -269,7 +277,9 @@ WinSendCom_Invoke(
|
||||
UINT *puArgErr)
|
||||
{
|
||||
HRESULT hr = DISP_E_MEMBERNOTFOUND;
|
||||
TkWinSendCom *this = (TkWinSendCom*)This;
|
||||
TkWinSendCom *sendCom = (TkWinSendCom*)This;
|
||||
(void)riid;
|
||||
(void)lcid;
|
||||
|
||||
switch (dispidMember) {
|
||||
case TKWINSENDCOM_DISPID_SEND:
|
||||
@@ -277,7 +287,7 @@ WinSendCom_Invoke(
|
||||
if (pDispParams->cArgs != 1) {
|
||||
hr = DISP_E_BADPARAMCOUNT;
|
||||
} else {
|
||||
hr = Send(this, pDispParams->rgvarg[0], pvarResult,
|
||||
hr = Send(sendCom, pDispParams->rgvarg[0], pvarResult,
|
||||
pExcepInfo, puArgErr);
|
||||
}
|
||||
}
|
||||
@@ -288,7 +298,7 @@ WinSendCom_Invoke(
|
||||
if (pDispParams->cArgs != 1) {
|
||||
hr = DISP_E_BADPARAMCOUNT;
|
||||
} else {
|
||||
hr = Async(this, pDispParams->rgvarg[0], pExcepInfo, puArgErr);
|
||||
hr = Async(sendCom, pDispParams->rgvarg[0], pExcepInfo, puArgErr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -313,27 +323,27 @@ ISupportErrorInfo_QueryInterface(
|
||||
REFIID riid,
|
||||
void **ppvObject)
|
||||
{
|
||||
TkWinSendCom *this = (TkWinSendCom *)(This - 1);
|
||||
TkWinSendCom *sendCom = (TkWinSendCom *)(This - 1);
|
||||
|
||||
return this->lpVtbl->QueryInterface((IDispatch *) this, riid, ppvObject);
|
||||
return sendCom->lpVtbl->QueryInterface((IDispatch *) sendCom, riid, ppvObject);
|
||||
}
|
||||
|
||||
static STDMETHODIMP_(ULONG)
|
||||
ISupportErrorInfo_AddRef(
|
||||
ISupportErrorInfo *This)
|
||||
{
|
||||
TkWinSendCom *this = (TkWinSendCom *)(This - 1);
|
||||
TkWinSendCom *sendCom = (TkWinSendCom *)(This - 1);
|
||||
|
||||
return InterlockedIncrement(&this->refcount);
|
||||
return InterlockedIncrement(&sendCom->refcount);
|
||||
}
|
||||
|
||||
static STDMETHODIMP_(ULONG)
|
||||
ISupportErrorInfo_Release(
|
||||
ISupportErrorInfo *This)
|
||||
{
|
||||
TkWinSendCom *this = (TkWinSendCom *)(This - 1);
|
||||
TkWinSendCom *sendCom = (TkWinSendCom *)(This - 1);
|
||||
|
||||
return this->lpVtbl->Release((IDispatch *) this);
|
||||
return sendCom->lpVtbl->Release((IDispatch *) sendCom);
|
||||
}
|
||||
|
||||
static STDMETHODIMP
|
||||
@@ -341,7 +351,10 @@ ISupportErrorInfo_InterfaceSupportsErrorInfo(
|
||||
ISupportErrorInfo *This,
|
||||
REFIID riid)
|
||||
{
|
||||
/*TkWinSendCom *this = (TkWinSendCom*)(This - 1);*/
|
||||
(void)This;
|
||||
(void)riid;
|
||||
|
||||
/*TkWinSendCom *sendCom = (TkWinSendCom*)(This - 1);*/
|
||||
return S_OK; /* or S_FALSE */
|
||||
}
|
||||
|
||||
@@ -371,6 +384,7 @@ Async(
|
||||
HRESULT hr = S_OK;
|
||||
VARIANT vCmd;
|
||||
Tcl_DString ds;
|
||||
(void)puArgErr;
|
||||
|
||||
VariantInit(&vCmd);
|
||||
|
||||
@@ -385,8 +399,8 @@ Async(
|
||||
if (SUCCEEDED(hr) && obj->interp) {
|
||||
Tcl_Obj *scriptPtr;
|
||||
|
||||
Tcl_WinTCharToUtf((LPCTSTR)vCmd.bstrVal, SysStringLen(vCmd.bstrVal) *
|
||||
sizeof (WCHAR), &ds);
|
||||
Tcl_DStringInit(&ds);
|
||||
Tcl_WCharToUtfDString(vCmd.bstrVal, SysStringLen(vCmd.bstrVal), &ds);
|
||||
scriptPtr =
|
||||
Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
|
||||
Tcl_DStringFree(&ds);
|
||||
@@ -427,9 +441,10 @@ Send(
|
||||
HRESULT hr = S_OK;
|
||||
int result = TCL_OK;
|
||||
VARIANT v;
|
||||
register Tcl_Interp *interp = obj->interp;
|
||||
Tcl_Interp *interp = obj->interp;
|
||||
Tcl_Obj *scriptPtr;
|
||||
Tcl_DString ds;
|
||||
(void)puArgErr;
|
||||
|
||||
if (interp == NULL) {
|
||||
return S_OK;
|
||||
@@ -440,8 +455,8 @@ Send(
|
||||
return hr;
|
||||
}
|
||||
|
||||
Tcl_WinTCharToUtf((LPCTSTR)v.bstrVal, SysStringLen(v.bstrVal) *
|
||||
sizeof(WCHAR), &ds);
|
||||
Tcl_DStringInit(&ds);
|
||||
Tcl_WCharToUtfDString(v.bstrVal, SysStringLen(v.bstrVal), &ds);
|
||||
scriptPtr = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
|
||||
Tcl_DStringFree(&ds);
|
||||
Tcl_Preserve(interp);
|
||||
@@ -457,8 +472,8 @@ Send(
|
||||
pvResult->vt = VT_BSTR;
|
||||
obj = Tcl_GetObjResult(interp);
|
||||
src = Tcl_GetString(obj);
|
||||
Tcl_WinUtfToTChar(src, obj->length, &ds);
|
||||
pvResult->bstrVal = SysAllocString((WCHAR *) Tcl_DStringValue(&ds));
|
||||
Tcl_DStringInit(&ds);
|
||||
pvResult->bstrVal = SysAllocString(Tcl_UtfToWCharDString(src, obj->length, &ds));
|
||||
Tcl_DStringFree(&ds);
|
||||
}
|
||||
if (result == TCL_ERROR) {
|
||||
|
||||
@@ -67,15 +67,15 @@ TkplatformtestInit(
|
||||
*/
|
||||
|
||||
Tcl_CreateObjCommand(interp, "testclipboard", TestclipboardObjCmd,
|
||||
(ClientData) Tk_MainWindow(interp), NULL);
|
||||
Tk_MainWindow(interp), NULL);
|
||||
Tcl_CreateObjCommand(interp, "testwinevent", TestwineventObjCmd,
|
||||
(ClientData) Tk_MainWindow(interp), NULL);
|
||||
Tk_MainWindow(interp), NULL);
|
||||
Tcl_CreateObjCommand(interp, "testfindwindow", TestfindwindowObjCmd,
|
||||
(ClientData) Tk_MainWindow(interp), NULL);
|
||||
Tk_MainWindow(interp), NULL);
|
||||
Tcl_CreateObjCommand(interp, "testgetwindowinfo", TestgetwindowinfoObjCmd,
|
||||
(ClientData) Tk_MainWindow(interp), NULL);
|
||||
Tk_MainWindow(interp), NULL);
|
||||
Tcl_CreateObjCommand(interp, "testwinlocale", TestwinlocaleObjCmd,
|
||||
(ClientData) Tk_MainWindow(interp), NULL);
|
||||
Tk_MainWindow(interp), NULL);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
@@ -177,7 +177,8 @@ AppendSystemError(
|
||||
} else {
|
||||
char *msgPtr;
|
||||
|
||||
Tcl_WinTCharToUtf((LPCTSTR)wMsgPtr, -1, &ds);
|
||||
Tcl_DStringInit(&ds);
|
||||
Tcl_WCharToUtfDString(wMsgPtr, wcslen(wMsgPtr), &ds);
|
||||
LocalFree(wMsgPtr);
|
||||
|
||||
msgPtr = Tcl_DStringValue(&ds);
|
||||
@@ -230,6 +231,8 @@ SetSelectionResult(
|
||||
Tcl_Interp *interp,
|
||||
const char *selection)
|
||||
{
|
||||
(void)dummy;
|
||||
|
||||
Tcl_AppendResult(interp, selection, NULL);
|
||||
return TCL_OK;
|
||||
}
|
||||
@@ -241,7 +244,7 @@ TestclipboardObjCmd(
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument values. */
|
||||
{
|
||||
Tk_Window tkwin = (Tk_Window) clientData;
|
||||
Tk_Window tkwin = (Tk_Window)clientData;
|
||||
|
||||
if (objc != 1) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, NULL);
|
||||
@@ -270,7 +273,7 @@ TestclipboardObjCmd(
|
||||
|
||||
static int
|
||||
TestwineventObjCmd(
|
||||
ClientData clientData, /* Main window for application. */
|
||||
ClientData dummy, /* Main window for application. */
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument strings. */
|
||||
@@ -293,6 +296,7 @@ TestwineventObjCmd(
|
||||
{WM_COMMAND, "WM_COMMAND"},
|
||||
{-1, NULL}
|
||||
};
|
||||
(void)dummy;
|
||||
|
||||
if ((objc == 3) && (strcmp(Tcl_GetString(objv[1]), "debug") == 0)) {
|
||||
int b;
|
||||
@@ -375,20 +379,20 @@ TestwineventObjCmd(
|
||||
case WM_SETTEXT: {
|
||||
Tcl_DString ds;
|
||||
|
||||
control = TestFindControl(hwnd, id);
|
||||
if (control == NULL) {
|
||||
Tcl_SetObjResult(interp,
|
||||
Tcl_ObjPrintf("Could not find control with id %d", id));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
control = TestFindControl(hwnd, id);
|
||||
if (control == NULL) {
|
||||
Tcl_SetObjResult(interp,
|
||||
Tcl_ObjPrintf("Could not find control with id %d", id));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_UtfToExternalDString(NULL, Tcl_GetString(objv[4]), -1, &ds);
|
||||
result = SendMessageA(control, WM_SETTEXT, 0,
|
||||
(LPARAM) Tcl_DStringValue(&ds));
|
||||
result = SendMessageA(control, WM_SETTEXT, 0,
|
||||
(LPARAM) Tcl_DStringValue(&ds));
|
||||
Tcl_DStringFree(&ds);
|
||||
if (result == 0) {
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to send text to dialog: ", -1));
|
||||
AppendSystemError(interp, GetLastError());
|
||||
return TCL_ERROR;
|
||||
Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to send text to dialog: ", -1));
|
||||
AppendSystemError(interp, GetLastError());
|
||||
return TCL_ERROR;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -427,7 +431,7 @@ TestwineventObjCmd(
|
||||
|
||||
static int
|
||||
TestfindwindowObjCmd(
|
||||
ClientData clientData, /* Main window for application. */
|
||||
ClientData dummy, /* Main window for application. */
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument values. */
|
||||
@@ -437,6 +441,7 @@ TestfindwindowObjCmd(
|
||||
HWND hwnd = NULL;
|
||||
int r = TCL_OK;
|
||||
DWORD myPid;
|
||||
(void)dummy;
|
||||
|
||||
Tcl_DStringInit(&classString);
|
||||
Tcl_DStringInit(&titleString);
|
||||
@@ -446,9 +451,11 @@ TestfindwindowObjCmd(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
title = (LPCWSTR)Tcl_WinUtfToTChar(Tcl_GetString(objv[1]), -1, &titleString);
|
||||
Tcl_DStringInit(&titleString);
|
||||
title = Tcl_UtfToWCharDString(Tcl_GetString(objv[1]), -1, &titleString);
|
||||
if (objc == 3) {
|
||||
windowClass = (LPCWSTR)Tcl_WinUtfToTChar(Tcl_GetString(objv[2]), -1, &classString);
|
||||
Tcl_DStringInit(&classString);
|
||||
windowClass = Tcl_UtfToWCharDString(Tcl_GetString(objv[2]), -1, &classString);
|
||||
}
|
||||
if (title[0] == 0)
|
||||
title = NULL;
|
||||
@@ -497,7 +504,7 @@ EnumChildrenProc(
|
||||
|
||||
static int
|
||||
TestgetwindowinfoObjCmd(
|
||||
ClientData clientData,
|
||||
ClientData dummy,
|
||||
Tcl_Interp *interp,
|
||||
int objc,
|
||||
Tcl_Obj *const objv[])
|
||||
@@ -508,6 +515,7 @@ TestgetwindowinfoObjCmd(
|
||||
WCHAR buf[512];
|
||||
int cch, cchBuf = 256;
|
||||
Tcl_DString ds;
|
||||
(void)dummy;
|
||||
|
||||
if (objc != 2) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, "hwnd");
|
||||
@@ -523,8 +531,8 @@ TestgetwindowinfoObjCmd(
|
||||
AppendSystemError(interp, GetLastError());
|
||||
return TCL_ERROR;
|
||||
} else {
|
||||
Tcl_DString ds;
|
||||
Tcl_WinTCharToUtf((LPCTSTR)buf, -1, &ds);
|
||||
Tcl_DStringInit(&ds);
|
||||
Tcl_WCharToUtfDString(buf, wcslen(buf), &ds);
|
||||
classObj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
|
||||
Tcl_DStringFree(&ds);
|
||||
}
|
||||
@@ -535,7 +543,8 @@ TestgetwindowinfoObjCmd(
|
||||
Tcl_NewWideIntObj(GetWindowLongPtrW(INT2PTR(hwnd), GWL_ID)));
|
||||
|
||||
cch = GetWindowTextW(INT2PTR(hwnd), buf, cchBuf);
|
||||
Tcl_WinTCharToUtf((LPCTSTR)buf, cch * sizeof (WCHAR), &ds);
|
||||
Tcl_DStringInit(&ds);
|
||||
Tcl_WCharToUtfDString(buf, cch, &ds);
|
||||
textObj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
|
||||
Tcl_DStringFree(&ds);
|
||||
|
||||
@@ -553,11 +562,13 @@ TestgetwindowinfoObjCmd(
|
||||
|
||||
static int
|
||||
TestwinlocaleObjCmd(
|
||||
ClientData clientData, /* Main window for application. */
|
||||
ClientData dummy, /* Main window for application. */
|
||||
Tcl_Interp *interp, /* Current interpreter. */
|
||||
int objc, /* Number of arguments. */
|
||||
Tcl_Obj *const objv[]) /* Argument values. */
|
||||
{
|
||||
(void)dummy;
|
||||
|
||||
if (objc != 1) {
|
||||
Tcl_WrongNumArgs(interp, 1, objv, NULL);
|
||||
return TCL_ERROR;
|
||||
|
||||
380
win/tkWinWm.c
380
win/tkWinWm.c
File diff suppressed because it is too large
Load Diff
291
win/tkWinX.c
291
win/tkWinX.c
@@ -70,7 +70,6 @@ static const char winScreenName[] = ":0"; /* Default name of windows display. */
|
||||
static HINSTANCE tkInstance = NULL; /* Application instance handle. */
|
||||
static int childClassInitialized; /* Registered child class? */
|
||||
static WNDCLASSW childClass; /* Window class for child windows. */
|
||||
static int tkPlatformId = 0; /* version of Windows platform */
|
||||
static int tkWinTheme = 0; /* See TkWinGetPlatformTheme */
|
||||
static Tcl_Encoding keyInputEncoding = NULL;
|
||||
/* The current character encoding for
|
||||
@@ -105,7 +104,7 @@ static Tcl_ThreadDataKey dataKey;
|
||||
static void GenerateXEvent(HWND hwnd, UINT message,
|
||||
WPARAM wParam, LPARAM lParam);
|
||||
static unsigned int GetState(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
static void GetTranslatedKey(XKeyEvent *xkey, UINT type);
|
||||
static void GetTranslatedKey(TkKeyEvent *xkey, UINT type);
|
||||
static void UpdateInputLanguage(int charset);
|
||||
static int HandleIMEComposition(HWND hwnd, LPARAM lParam);
|
||||
|
||||
@@ -139,8 +138,8 @@ TkGetServerInfo(
|
||||
|
||||
if (!buffer[0]) {
|
||||
HANDLE handle = GetModuleHandleW(L"NTDLL");
|
||||
int(__stdcall *getversion)(void *) =
|
||||
(int(__stdcall *)(void *))GetProcAddress(handle, "RtlGetVersion");
|
||||
int(__stdcall *getversion)(void *) = (int(__stdcall *)(void *))
|
||||
(void *)GetProcAddress(handle, "RtlGetVersion");
|
||||
os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
|
||||
if (!getversion || getversion(&os)) {
|
||||
GetVersionExW(&os);
|
||||
@@ -325,6 +324,69 @@ TkWinXCleanup(
|
||||
TkWinCleanupContainerList();
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* TkWinGetPlatformTheme --
|
||||
*
|
||||
* Return the Windows drawing style we should be using.
|
||||
*
|
||||
* Results:
|
||||
* The return value is one of:
|
||||
* TK_THEME_WIN_CLASSIC 95/98/NT or XP in classic mode
|
||||
* TK_THEME_WIN_XP XP not in classic mode
|
||||
* TK_THEME_WIN_VISTA Vista or higher
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int
|
||||
TkWinGetPlatformTheme(void)
|
||||
{
|
||||
if (tkWinTheme == 0) {
|
||||
OSVERSIONINFOW os;
|
||||
|
||||
os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
|
||||
GetVersionExW(&os);
|
||||
|
||||
if (os.dwPlatformId != VER_PLATFORM_WIN32_NT) {
|
||||
Tcl_Panic("Windows NT is the only supported platform");
|
||||
}
|
||||
|
||||
/*
|
||||
* Set tkWinTheme to be TK_THEME_WIN_(CLASSIC|XP|VISTA). The
|
||||
* TK_THEME_WIN_CLASSIC could be set even when running under XP if the
|
||||
* windows classic theme was selected.
|
||||
*/
|
||||
if (os.dwMajorVersion == 5 && os.dwMinorVersion >= 1) {
|
||||
HKEY hKey;
|
||||
LPCWSTR szSubKey = L"Control Panel\\Appearance";
|
||||
LPCWSTR szCurrent = L"Current";
|
||||
DWORD dwSize = 200;
|
||||
WCHAR pBuffer[200];
|
||||
|
||||
memset(pBuffer, 0, dwSize);
|
||||
if (RegOpenKeyExW(HKEY_CURRENT_USER, szSubKey, 0L,
|
||||
KEY_READ, &hKey) != ERROR_SUCCESS) {
|
||||
tkWinTheme = TK_THEME_WIN_XP;
|
||||
} else {
|
||||
RegQueryValueExW(hKey, szCurrent, NULL, NULL, (LPBYTE) pBuffer, &dwSize);
|
||||
RegCloseKey(hKey);
|
||||
if (wcscmp(pBuffer, L"Windows Standard") == 0) {
|
||||
tkWinTheme = TK_THEME_WIN_CLASSIC;
|
||||
} else {
|
||||
tkWinTheme = TK_THEME_WIN_XP;
|
||||
}
|
||||
}
|
||||
} else if (os.dwMajorVersion > 5) {
|
||||
tkWinTheme = TK_THEME_WIN_VISTA;
|
||||
} else {
|
||||
tkWinTheme = TK_THEME_WIN_CLASSIC;
|
||||
}
|
||||
}
|
||||
return tkWinTheme;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
@@ -334,11 +396,8 @@ TkWinXCleanup(
|
||||
* conditional code. Win32s is no longer supported.
|
||||
*
|
||||
* Results:
|
||||
* The return value is one of:
|
||||
* VER_PLATFORM_WIN32s Win32s on Windows 3.1 (not supported)
|
||||
* VER_PLATFORM_WIN32_WINDOWS Win32 on Windows 95, 98, ME (not supported)
|
||||
* The return value is always:
|
||||
* VER_PLATFORM_WIN32_NT Win32 on Windows XP, Vista, Windows 7, Windows 8
|
||||
* VER_PLATFORM_WIN32_CE Win32 on Windows CE
|
||||
*
|
||||
* Side effects:
|
||||
* None.
|
||||
@@ -349,74 +408,9 @@ TkWinXCleanup(
|
||||
int
|
||||
TkWinGetPlatformId(void)
|
||||
{
|
||||
if (tkPlatformId == 0) {
|
||||
OSVERSIONINFOW os;
|
||||
|
||||
os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
|
||||
GetVersionExW(&os);
|
||||
tkPlatformId = os.dwPlatformId;
|
||||
|
||||
/*
|
||||
* Set tkWinTheme to be TK_THEME_WIN_XP or TK_THEME_WIN_CLASSIC. The
|
||||
* TK_THEME_WIN_CLASSIC could be set even when running under XP if the
|
||||
* windows classic theme was selected.
|
||||
*/
|
||||
|
||||
if ((os.dwPlatformId == VER_PLATFORM_WIN32_NT) &&
|
||||
(os.dwMajorVersion == 5 && os.dwMinorVersion == 1)) {
|
||||
HKEY hKey;
|
||||
LPCWSTR szSubKey = L"Control Panel\\Appearance";
|
||||
LPCWSTR szCurrent = L"Current";
|
||||
DWORD dwSize = 200;
|
||||
char pBuffer[200];
|
||||
|
||||
memset(pBuffer, 0, dwSize);
|
||||
if (RegOpenKeyExW(HKEY_CURRENT_USER, szSubKey, 0L,
|
||||
KEY_READ, &hKey) != ERROR_SUCCESS) {
|
||||
tkWinTheme = TK_THEME_WIN_XP;
|
||||
} else {
|
||||
RegQueryValueExW(hKey, szCurrent, NULL, NULL, (LPBYTE) pBuffer, &dwSize);
|
||||
RegCloseKey(hKey);
|
||||
if (strcmp(pBuffer, "Windows Standard") == 0) {
|
||||
tkWinTheme = TK_THEME_WIN_CLASSIC;
|
||||
} else {
|
||||
tkWinTheme = TK_THEME_WIN_XP;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tkWinTheme = TK_THEME_WIN_CLASSIC;
|
||||
}
|
||||
}
|
||||
return tkPlatformId;
|
||||
return VER_PLATFORM_WIN32_NT;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* TkWinGetPlatformTheme --
|
||||
*
|
||||
* Return the Windows drawing style we should be using.
|
||||
*
|
||||
* Results:
|
||||
* The return value is one of:
|
||||
* TK_THEME_WIN_CLASSIC 95/98/NT or XP in classic mode
|
||||
* TK_THEME_WIN_XP XP not in classic mode
|
||||
*
|
||||
* Side effects:
|
||||
* Could invoke TkWinGetPlatformId.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int
|
||||
TkWinGetPlatformTheme(void)
|
||||
{
|
||||
if (tkPlatformId == 0) {
|
||||
TkWinGetPlatformId();
|
||||
}
|
||||
return tkWinTheme;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
@@ -1000,7 +994,7 @@ GenerateXEvent(
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
XEvent event;
|
||||
union {XEvent x; TkKeyEvent key;} event;
|
||||
TkWindow *winPtr;
|
||||
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
|
||||
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
|
||||
@@ -1026,33 +1020,33 @@ GenerateXEvent(
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&event, 0, sizeof(XEvent));
|
||||
event.xany.serial = winPtr->display->request++;
|
||||
event.xany.send_event = False;
|
||||
event.xany.display = winPtr->display;
|
||||
event.xany.window = winPtr->window;
|
||||
memset(&event.x, 0, sizeof(XEvent));
|
||||
event.x.xany.serial = winPtr->display->request++;
|
||||
event.x.xany.send_event = False;
|
||||
event.x.xany.display = winPtr->display;
|
||||
event.x.xany.window = winPtr->window;
|
||||
|
||||
switch (message) {
|
||||
case WM_PAINT: {
|
||||
PAINTSTRUCT ps;
|
||||
|
||||
event.type = Expose;
|
||||
event.x.type = Expose;
|
||||
BeginPaint(hwnd, &ps);
|
||||
event.xexpose.x = ps.rcPaint.left;
|
||||
event.xexpose.y = ps.rcPaint.top;
|
||||
event.xexpose.width = ps.rcPaint.right - ps.rcPaint.left;
|
||||
event.xexpose.height = ps.rcPaint.bottom - ps.rcPaint.top;
|
||||
event.x.xexpose.x = ps.rcPaint.left;
|
||||
event.x.xexpose.y = ps.rcPaint.top;
|
||||
event.x.xexpose.width = ps.rcPaint.right - ps.rcPaint.left;
|
||||
event.x.xexpose.height = ps.rcPaint.bottom - ps.rcPaint.top;
|
||||
EndPaint(hwnd, &ps);
|
||||
event.xexpose.count = 0;
|
||||
event.x.xexpose.count = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_CLOSE:
|
||||
event.type = ClientMessage;
|
||||
event.xclient.message_type =
|
||||
event.x.type = ClientMessage;
|
||||
event.x.xclient.message_type =
|
||||
Tk_InternAtom((Tk_Window) winPtr, "WM_PROTOCOLS");
|
||||
event.xclient.format = 32;
|
||||
event.xclient.data.l[0] =
|
||||
event.x.xclient.format = 32;
|
||||
event.x.xclient.data.l[0] =
|
||||
Tk_InternAtom((Tk_Window) winPtr, "WM_DELETE_WINDOW");
|
||||
break;
|
||||
|
||||
@@ -1088,10 +1082,10 @@ GenerateXEvent(
|
||||
return;
|
||||
}
|
||||
|
||||
event.xany.window = winPtr->window;
|
||||
event.type = (message == WM_SETFOCUS) ? FocusIn : FocusOut;
|
||||
event.xfocus.mode = NotifyNormal;
|
||||
event.xfocus.detail = NotifyNonlinear;
|
||||
event.x.xany.window = winPtr->window;
|
||||
event.x.type = (message == WM_SETFOCUS) ? FocusIn : FocusOut;
|
||||
event.x.xfocus.mode = NotifyNormal;
|
||||
event.x.xfocus.detail = NotifyNonlinear;
|
||||
|
||||
/*
|
||||
* Destroy the caret if we own it. If we are moving to another Tk
|
||||
@@ -1113,10 +1107,10 @@ GenerateXEvent(
|
||||
|
||||
return;
|
||||
}
|
||||
event.type = SelectionClear;
|
||||
event.xselectionclear.selection =
|
||||
event.x.type = SelectionClear;
|
||||
event.x.xselectionclear.selection =
|
||||
Tk_InternAtom((Tk_Window)winPtr, "CLIPBOARD");
|
||||
event.xselectionclear.time = TkpGetMS();
|
||||
event.x.xselectionclear.time = TkpGetMS();
|
||||
break;
|
||||
|
||||
case WM_MOUSEWHEEL:
|
||||
@@ -1145,15 +1139,15 @@ GenerateXEvent(
|
||||
* Set up the common event fields.
|
||||
*/
|
||||
|
||||
event.xbutton.root = RootWindow(winPtr->display, winPtr->screenNum);
|
||||
event.xbutton.subwindow = None;
|
||||
event.xbutton.x = clientPoint.x;
|
||||
event.xbutton.y = clientPoint.y;
|
||||
event.xbutton.x_root = root.point.x;
|
||||
event.xbutton.y_root = root.point.y;
|
||||
event.xbutton.state = state;
|
||||
event.xbutton.time = time;
|
||||
event.xbutton.same_screen = True;
|
||||
event.x.xbutton.root = RootWindow(winPtr->display, winPtr->screenNum);
|
||||
event.x.xbutton.subwindow = None;
|
||||
event.x.xbutton.x = clientPoint.x;
|
||||
event.x.xbutton.y = clientPoint.y;
|
||||
event.x.xbutton.x_root = root.point.x;
|
||||
event.x.xbutton.y_root = root.point.y;
|
||||
event.x.xbutton.state = state;
|
||||
event.x.xbutton.time = time;
|
||||
event.x.xbutton.same_screen = True;
|
||||
|
||||
/*
|
||||
* Now set up event specific fields.
|
||||
@@ -1185,10 +1179,10 @@ GenerateXEvent(
|
||||
* TkpGetString. [Bug 1118340].
|
||||
*/
|
||||
|
||||
event.type = MouseWheelEvent;
|
||||
event.xany.send_event = -1;
|
||||
event.xkey.nbytes = 0;
|
||||
event.xkey.keycode = tsdPtr->vWheelAcc / WHEEL_DELTA * WHEEL_DELTA;
|
||||
event.x.type = MouseWheelEvent;
|
||||
event.x.xany.send_event = -1;
|
||||
event.key.nbytes = 0;
|
||||
event.x.xkey.keycode = tsdPtr->vWheelAcc / WHEEL_DELTA * WHEEL_DELTA;
|
||||
tsdPtr->vWheelAcc = tsdPtr->vWheelAcc % WHEEL_DELTA;
|
||||
break;
|
||||
}
|
||||
@@ -1217,11 +1211,11 @@ GenerateXEvent(
|
||||
* TkpGetString. [Bug 1118340].
|
||||
*/
|
||||
|
||||
event.type = MouseWheelEvent;
|
||||
event.xany.send_event = -1;
|
||||
event.xkey.nbytes = 0;
|
||||
event.xkey.state |= ShiftMask;
|
||||
event.xkey.keycode = tsdPtr->hWheelAcc / WHEEL_DELTA * WHEEL_DELTA;
|
||||
event.x.type = MouseWheelEvent;
|
||||
event.x.xany.send_event = -1;
|
||||
event.key.nbytes = 0;
|
||||
event.x.xkey.state |= ShiftMask;
|
||||
event.x.xkey.keycode = tsdPtr->hWheelAcc / WHEEL_DELTA * WHEEL_DELTA;
|
||||
tsdPtr->hWheelAcc = tsdPtr->hWheelAcc % WHEEL_DELTA;
|
||||
break;
|
||||
}
|
||||
@@ -1235,10 +1229,10 @@ GenerateXEvent(
|
||||
* MBCS characters that came from the TranslateMessage call.
|
||||
*/
|
||||
|
||||
event.type = KeyPress;
|
||||
event.xany.send_event = -1;
|
||||
event.xkey.keycode = wParam;
|
||||
GetTranslatedKey(&event.xkey, (message == WM_KEYDOWN) ? WM_CHAR :
|
||||
event.x.type = KeyPress;
|
||||
event.x.xany.send_event = -1;
|
||||
event.x.xkey.keycode = wParam;
|
||||
GetTranslatedKey(&event.key, (message == WM_KEYDOWN) ? WM_CHAR :
|
||||
WM_SYSCHAR);
|
||||
break;
|
||||
|
||||
@@ -1250,9 +1244,9 @@ GenerateXEvent(
|
||||
* WM_CHAR messages which will follow.
|
||||
*/
|
||||
|
||||
event.type = KeyRelease;
|
||||
event.xkey.keycode = wParam;
|
||||
event.xkey.nbytes = 0;
|
||||
event.x.type = KeyRelease;
|
||||
event.x.xkey.keycode = wParam;
|
||||
event.key.nbytes = 0;
|
||||
break;
|
||||
|
||||
case WM_CHAR:
|
||||
@@ -1286,9 +1280,9 @@ GenerateXEvent(
|
||||
* character.
|
||||
*/
|
||||
|
||||
event.type = KeyPress;
|
||||
event.xany.send_event = -1;
|
||||
event.xkey.keycode = 0;
|
||||
event.x.type = KeyPress;
|
||||
event.x.xany.send_event = -1;
|
||||
event.x.xkey.keycode = 0;
|
||||
if ((int)wParam & 0xff00) {
|
||||
int ch1 = wParam & 0xffff;
|
||||
|
||||
@@ -1301,12 +1295,12 @@ GenerateXEvent(
|
||||
(ch1 & 0x3ff) | 0x10000;
|
||||
tsdPtr->surrogateBuffer = 0;
|
||||
}
|
||||
event.xany.send_event = -3;
|
||||
event.xkey.nbytes = 0;
|
||||
event.xkey.keycode = ch1;
|
||||
event.x.xany.send_event = -3;
|
||||
event.key.nbytes = 0;
|
||||
event.x.xkey.keycode = ch1;
|
||||
} else {
|
||||
event.xkey.nbytes = 1;
|
||||
event.xkey.trans_chars[0] = (char) wParam;
|
||||
event.key.nbytes = 1;
|
||||
event.key.trans_chars[0] = (char) wParam;
|
||||
|
||||
if (IsDBCSLeadByte((BYTE) wParam)) {
|
||||
MSG msg;
|
||||
@@ -1315,22 +1309,22 @@ GenerateXEvent(
|
||||
PM_NOREMOVE) != 0)
|
||||
&& (msg.message == WM_CHAR)) {
|
||||
GetMessageW(&msg, NULL, WM_CHAR, WM_CHAR);
|
||||
event.xkey.nbytes = 2;
|
||||
event.xkey.trans_chars[1] = (char) msg.wParam;
|
||||
event.key.nbytes = 2;
|
||||
event.key.trans_chars[1] = (char) msg.wParam;
|
||||
}
|
||||
}
|
||||
}
|
||||
Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
|
||||
event.type = KeyRelease;
|
||||
Tk_QueueWindowEvent(&event.x, TCL_QUEUE_TAIL);
|
||||
event.x.type = KeyRelease;
|
||||
break;
|
||||
|
||||
case WM_UNICHAR: {
|
||||
event.type = KeyPress;
|
||||
event.xany.send_event = -3;
|
||||
event.xkey.keycode = wParam;
|
||||
event.xkey.nbytes = 0;
|
||||
Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
|
||||
event.type = KeyRelease;
|
||||
event.x.type = KeyPress;
|
||||
event.x.xany.send_event = -3;
|
||||
event.x.xkey.keycode = wParam;
|
||||
event.key.nbytes = 0;
|
||||
Tk_QueueWindowEvent(&event.x, TCL_QUEUE_TAIL);
|
||||
event.x.type = KeyRelease;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1351,7 +1345,7 @@ GenerateXEvent(
|
||||
* Post the translated event to the main Tk event queue.
|
||||
*/
|
||||
|
||||
Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
|
||||
Tk_QueueWindowEvent(&event.x, TCL_QUEUE_TAIL);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1360,7 +1354,7 @@ GenerateXEvent(
|
||||
* GetState --
|
||||
*
|
||||
* This function constructs a state mask for the mouse buttons and
|
||||
* modifier keys as they were before the event occured.
|
||||
* modifier keys as they were before the event occurred.
|
||||
*
|
||||
* Results:
|
||||
* Returns a composite value of all the modifier and button state flags
|
||||
@@ -1453,7 +1447,7 @@ GetState(
|
||||
|
||||
static void
|
||||
GetTranslatedKey(
|
||||
XKeyEvent *xkey,
|
||||
TkKeyEvent *xkey,
|
||||
UINT type)
|
||||
{
|
||||
MSG msg;
|
||||
@@ -1476,10 +1470,9 @@ GetTranslatedKey(
|
||||
*/
|
||||
|
||||
if ((msg.message == WM_CHAR) && (msg.lParam & 0x20000000)) {
|
||||
xkey->state = 0;
|
||||
xkey->keyEvent.state = 0;
|
||||
}
|
||||
xkey->trans_chars[xkey->nbytes] = (char) msg.wParam;
|
||||
xkey->nbytes++;
|
||||
xkey->trans_chars[xkey->nbytes++] = (char) msg.wParam;
|
||||
|
||||
if (((unsigned short) msg.wParam) > ((unsigned short) 0xff)) {
|
||||
/*
|
||||
@@ -1536,7 +1529,11 @@ UpdateInputLanguage(
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf(codepage, "cp%d", charsetInfo.ciACP);
|
||||
if (charsetInfo.ciACP == CP_UTF8) {
|
||||
strcpy(codepage, "utf-8");
|
||||
} else {
|
||||
sprintf(codepage, "cp%d", charsetInfo.ciACP);
|
||||
}
|
||||
|
||||
if ((encoding = Tcl_GetEncoding(NULL, codepage)) == NULL) {
|
||||
/*
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include <tkWinInt.h>
|
||||
|
||||
#ifndef DFCS_HOT /* Windows 98/Me, Windows 200/XP only */
|
||||
#ifndef DFCS_HOT /* Windows 98/Me, Windows 2000/XP only */
|
||||
#define DFCS_HOT 0
|
||||
#endif
|
||||
|
||||
@@ -686,8 +686,8 @@ TTK_LAYOUT("TButton",
|
||||
TTK_LAYOUT("TCombobox",
|
||||
TTK_GROUP("Combobox.field", TTK_FILL_BOTH,
|
||||
TTK_NODE("Combobox.downarrow", TTK_PACK_RIGHT|TTK_FILL_Y)
|
||||
TTK_GROUP("Combobox.padding", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_BOTH,
|
||||
TTK_GROUP("Combobox.focus", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_BOTH,
|
||||
TTK_GROUP("Combobox.padding", TTK_FILL_BOTH,
|
||||
TTK_GROUP("Combobox.focus", TTK_FILL_BOTH,
|
||||
TTK_NODE("Combobox.textarea", TTK_FILL_BOTH)))))
|
||||
|
||||
TTK_END_LAYOUT_TABLE
|
||||
|
||||
@@ -15,14 +15,14 @@
|
||||
* shellcc/platform/commctls/userex/refentry.asp >
|
||||
*/
|
||||
|
||||
#define WINVER 0x0501 /* Requires Windows XP APIs */
|
||||
|
||||
#include <tkWinInt.h>
|
||||
#ifndef HAVE_UXTHEME_H
|
||||
/* Stub for platforms that lack the XP theme API headers: */
|
||||
#include <tkWinInt.h>
|
||||
int TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd) { return TCL_OK; }
|
||||
#else
|
||||
|
||||
#define WINVER 0x0501 /* Requires Windows XP APIs */
|
||||
|
||||
#include <windows.h>
|
||||
#include <uxtheme.h>
|
||||
#if defined(HAVE_VSSYM32_H) || _MSC_VER > 1500
|
||||
@@ -31,8 +31,6 @@ int TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd) { return TCL_OK; }
|
||||
# include <tmschema.h>
|
||||
#endif
|
||||
|
||||
#include <tkWinInt.h>
|
||||
|
||||
#include "ttk/ttkTheme.h"
|
||||
|
||||
typedef HTHEME (STDAPICALLTYPE OpenThemeDataProc)(HWND hwnd,
|
||||
@@ -106,9 +104,9 @@ LoadXPThemeProcs(HINSTANCE *phlib)
|
||||
* We have successfully loaded the library. Proceed in storing the
|
||||
* addresses of the functions we want to use.
|
||||
*/
|
||||
XPThemeProcs *procs = ckalloc(sizeof(XPThemeProcs));
|
||||
XPThemeProcs *procs = (XPThemeProcs *)ckalloc(sizeof(XPThemeProcs));
|
||||
#define LOADPROC(name) \
|
||||
(0 != (procs->name = (name ## Proc *)GetProcAddress(handle, #name) ))
|
||||
(0 != (procs->name = (name ## Proc *)(void *)GetProcAddress(handle, #name) ))
|
||||
|
||||
if ( LOADPROC(OpenThemeData)
|
||||
&& LOADPROC(CloseThemeData)
|
||||
@@ -138,7 +136,7 @@ LoadXPThemeProcs(HINSTANCE *phlib)
|
||||
static void
|
||||
XPThemeDeleteProc(void *clientData)
|
||||
{
|
||||
XPThemeData *themeData = clientData;
|
||||
XPThemeData *themeData = (XPThemeData *)clientData;
|
||||
FreeLibrary(themeData->hlibrary);
|
||||
ckfree(clientData);
|
||||
}
|
||||
@@ -146,9 +144,11 @@ XPThemeDeleteProc(void *clientData)
|
||||
static int
|
||||
XPThemeEnabled(Ttk_Theme theme, void *clientData)
|
||||
{
|
||||
XPThemeData *themeData = clientData;
|
||||
XPThemeData *themeData = (XPThemeData *)clientData;
|
||||
int active = themeData->procs->IsThemeActive();
|
||||
int themed = themeData->procs->IsAppThemed();
|
||||
(void)theme;
|
||||
|
||||
return (active && themed);
|
||||
}
|
||||
|
||||
@@ -382,12 +382,12 @@ typedef struct /* XP element specifications */
|
||||
int partId; /* BP_PUSHBUTTON, BP_CHECKBUTTON, etc. */
|
||||
Ttk_StateTable *statemap; /* Map Tk states to XP states */
|
||||
Ttk_Padding padding; /* See NOTE-GetThemeMargins */
|
||||
int flags;
|
||||
# define IGNORE_THEMESIZE 0x80000000 /* See NOTE-GetThemePartSize */
|
||||
# define PAD_MARGINS 0x40000000 /* See NOTE-GetThemeMargins */
|
||||
# define HEAP_ELEMENT 0x20000000 /* ElementInfo is on heap */
|
||||
# define HALF_HEIGHT 0x10000000 /* Used by GenericSizedElements */
|
||||
# define HALF_WIDTH 0x08000000 /* Used by GenericSizedElements */
|
||||
unsigned flags;
|
||||
# define IGNORE_THEMESIZE 0x80000000U /* See NOTE-GetThemePartSize */
|
||||
# define PAD_MARGINS 0x40000000U /* See NOTE-GetThemeMargins */
|
||||
# define HEAP_ELEMENT 0x20000000U /* ElementInfo is on heap */
|
||||
# define HALF_HEIGHT 0x10000000U /* Used by GenericSizedElements */
|
||||
# define HALF_WIDTH 0x08000000U /* Used by GenericSizedElements */
|
||||
} ElementInfo;
|
||||
|
||||
typedef struct
|
||||
@@ -395,7 +395,7 @@ typedef struct
|
||||
/*
|
||||
* Static data, initialized when element is registered:
|
||||
*/
|
||||
ElementInfo *info;
|
||||
const ElementInfo *info;
|
||||
XPThemeProcs *procs; /* Pointer to theme procedure table */
|
||||
|
||||
/*
|
||||
@@ -411,9 +411,9 @@ typedef struct
|
||||
} ElementData;
|
||||
|
||||
static ElementData *
|
||||
NewElementData(XPThemeProcs *procs, ElementInfo *info)
|
||||
NewElementData(XPThemeProcs *procs, const ElementInfo *info)
|
||||
{
|
||||
ElementData *elementData = ckalloc(sizeof(ElementData));
|
||||
ElementData *elementData = (ElementData *)ckalloc(sizeof(ElementData));
|
||||
|
||||
elementData->procs = procs;
|
||||
elementData->info = info;
|
||||
@@ -429,12 +429,12 @@ NewElementData(XPThemeProcs *procs, ElementInfo *info)
|
||||
*/
|
||||
static void DestroyElementData(void *clientData)
|
||||
{
|
||||
ElementData *elementData = clientData;
|
||||
ElementData *elementData = (ElementData *)clientData;
|
||||
if (elementData->info->flags & HEAP_ELEMENT) {
|
||||
ckfree(elementData->info->statemap);
|
||||
ckfree(elementData->info->className);
|
||||
ckfree(elementData->info->elementName);
|
||||
ckfree(elementData->info);
|
||||
ckfree((char *)elementData->info->statemap);
|
||||
ckfree((char *)elementData->info->className);
|
||||
ckfree((char *)elementData->info->elementName);
|
||||
ckfree((char *)elementData->info);
|
||||
}
|
||||
ckfree(clientData);
|
||||
}
|
||||
@@ -497,9 +497,10 @@ static void GenericElementSize(
|
||||
void *clientData, void *elementRecord, Tk_Window tkwin,
|
||||
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
|
||||
{
|
||||
ElementData *elementData = clientData;
|
||||
ElementData *elementData = (ElementData *)clientData;
|
||||
HRESULT result;
|
||||
SIZE size;
|
||||
(void)elementRecord;
|
||||
|
||||
if (!InitElementData(elementData, tkwin, 0))
|
||||
return;
|
||||
@@ -507,7 +508,7 @@ static void GenericElementSize(
|
||||
if (!(elementData->info->flags & IGNORE_THEMESIZE)) {
|
||||
result = elementData->procs->GetThemePartSize(
|
||||
elementData->hTheme,
|
||||
elementData->hDC,
|
||||
NULL,
|
||||
elementData->info->partId,
|
||||
Ttk_StateTableLookup(elementData->info->statemap, 0),
|
||||
NULL /*RECT *prc*/,
|
||||
@@ -533,8 +534,9 @@ static void GenericElementDraw(
|
||||
void *clientData, void *elementRecord, Tk_Window tkwin,
|
||||
Drawable d, Ttk_Box b, unsigned int state)
|
||||
{
|
||||
ElementData *elementData = clientData;
|
||||
ElementData *elementData = (ElementData *)clientData;
|
||||
RECT rc;
|
||||
(void)elementRecord;
|
||||
|
||||
if (!InitElementData(elementData, tkwin, d)) {
|
||||
return;
|
||||
@@ -578,7 +580,7 @@ GenericSizedElementSize(
|
||||
void *clientData, void *elementRecord, Tk_Window tkwin,
|
||||
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
|
||||
{
|
||||
ElementData *elementData = clientData;
|
||||
ElementData *elementData = (ElementData *)clientData;
|
||||
|
||||
if (!InitElementData(elementData, tkwin, 0))
|
||||
return;
|
||||
@@ -614,7 +616,7 @@ SpinboxArrowElementSize(
|
||||
void *clientData, void *elementRecord, Tk_Window tkwin,
|
||||
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
|
||||
{
|
||||
ElementData *elementData = clientData;
|
||||
ElementData *elementData = (ElementData *)clientData;
|
||||
|
||||
if (!InitElementData(elementData, tkwin, 0))
|
||||
return;
|
||||
@@ -643,9 +645,10 @@ static void ThumbElementDraw(
|
||||
void *clientData, void *elementRecord, Tk_Window tkwin,
|
||||
Drawable d, Ttk_Box b, unsigned int state)
|
||||
{
|
||||
ElementData *elementData = clientData;
|
||||
ElementData *elementData = (ElementData *)clientData;
|
||||
unsigned stateId = Ttk_StateTableLookup(elementData->info->statemap, state);
|
||||
RECT rc = BoxToRect(b);
|
||||
(void)elementRecord;
|
||||
|
||||
/*
|
||||
* Don't draw the thumb if we are disabled.
|
||||
@@ -682,7 +685,7 @@ static void PbarElementSize(
|
||||
void *clientData, void *elementRecord, Tk_Window tkwin,
|
||||
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
|
||||
{
|
||||
ElementData *elementData = clientData;
|
||||
ElementData *elementData = (ElementData *)clientData;
|
||||
int nBars = 3;
|
||||
|
||||
GenericElementSize(clientData, elementRecord, tkwin,
|
||||
@@ -722,9 +725,10 @@ static void TabElementDraw(
|
||||
void *clientData, void *elementRecord, Tk_Window tkwin,
|
||||
Drawable d, Ttk_Box b, unsigned int state)
|
||||
{
|
||||
ElementData *elementData = clientData;
|
||||
ElementData *elementData = (ElementData *)clientData;
|
||||
int partId = elementData->info->partId;
|
||||
RECT rc = BoxToRect(b);
|
||||
(void)elementRecord;
|
||||
|
||||
if (!InitElementData(elementData, tkwin, d))
|
||||
return;
|
||||
@@ -793,7 +797,7 @@ static Ttk_ElementSpec TreeIndicatorElementSpec =
|
||||
TreeIndicatorElementDraw
|
||||
};
|
||||
|
||||
#if BROKEN_TEXT_ELEMENT
|
||||
#ifdef BROKEN_TEXT_ELEMENT
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
@@ -812,7 +816,7 @@ typedef struct
|
||||
Tcl_Obj *fontObj;
|
||||
} TextElement;
|
||||
|
||||
static Ttk_ElementOptionSpec TextElementOptions[] =
|
||||
static const Ttk_ElementOptionSpec TextElementOptions[] =
|
||||
{
|
||||
{ "-text", TK_OPTION_STRING,
|
||||
Tk_Offset(TextElement,textObj), "" },
|
||||
@@ -837,15 +841,15 @@ static void TextElementSize(
|
||||
return;
|
||||
|
||||
src = Tcl_GetStringFromObj(element->textObj, &len);
|
||||
Tcl_WinUtfToTChar(src, len, &ds);
|
||||
Tcl_DStringInit(&ds);
|
||||
hr = elementData->procs->GetThemeTextExtent(
|
||||
elementData->hTheme,
|
||||
elementData->hDC,
|
||||
elementData->info->partId,
|
||||
Ttk_StateTableLookup(elementData->info->statemap, 0),
|
||||
(WCHAR *) Tcl_DStringValue(&ds),
|
||||
Tcl_UtfToWCharDString(src, len, &ds),
|
||||
-1,
|
||||
DT_LEFT,// | DT_BOTTOM | DT_NOPREFIX,
|
||||
DT_LEFT /* | DT_BOTTOM | DT_NOPREFIX */,
|
||||
NULL,
|
||||
&rc);
|
||||
|
||||
@@ -876,15 +880,15 @@ static void TextElementDraw(
|
||||
return;
|
||||
|
||||
src = Tcl_GetStringFromObj(element->textObj, &len);
|
||||
Tcl_WinUtfToTChar(src, len, &ds);
|
||||
Tcl_DStringInit(&ds);
|
||||
hr = elementData->procs->DrawThemeText(
|
||||
elementData->hTheme,
|
||||
elementData->hDC,
|
||||
elementData->info->partId,
|
||||
Ttk_StateTableLookup(elementData->info->statemap, state),
|
||||
(WCHAR *) Tcl_DStringValue(&ds),
|
||||
Tcl_UtfToWCharDString(src, len, &ds),
|
||||
-1,
|
||||
DT_LEFT,// | DT_BOTTOM | DT_NOPREFIX,
|
||||
DT_LEFT /* | DT_BOTTOM | DT_NOPREFIX */,
|
||||
(state & TTK_STATE_DISABLED) ? DTT_GRAYED : 0,
|
||||
&rc);
|
||||
|
||||
@@ -917,8 +921,8 @@ TTK_LAYOUT("TButton",
|
||||
|
||||
TTK_LAYOUT("TMenubutton",
|
||||
TTK_NODE("Menubutton.dropdown", TTK_PACK_RIGHT|TTK_FILL_Y)
|
||||
TTK_GROUP("Menubutton.button", TTK_PACK_RIGHT|TTK_EXPAND|TTK_FILL_BOTH,
|
||||
TTK_GROUP("Menubutton.padding", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_X,
|
||||
TTK_GROUP("Menubutton.button", TTK_FILL_BOTH,
|
||||
TTK_GROUP("Menubutton.padding", TTK_FILL_X,
|
||||
TTK_NODE("Menubutton.label", 0))))
|
||||
|
||||
TTK_LAYOUT("Horizontal.TScrollbar",
|
||||
@@ -936,14 +940,14 @@ TTK_LAYOUT("Vertical.TScrollbar",
|
||||
TTK_NODE("Vertical.Scrollbar.grip", 0))))
|
||||
|
||||
TTK_LAYOUT("Horizontal.TScale",
|
||||
TTK_GROUP("Scale.focus", TTK_EXPAND|TTK_FILL_BOTH,
|
||||
TTK_GROUP("Horizontal.Scale.trough", TTK_EXPAND|TTK_FILL_BOTH,
|
||||
TTK_GROUP("Scale.focus", TTK_FILL_BOTH,
|
||||
TTK_GROUP("Horizontal.Scale.trough", TTK_FILL_BOTH,
|
||||
TTK_NODE("Horizontal.Scale.track", TTK_FILL_X)
|
||||
TTK_NODE("Horizontal.Scale.slider", TTK_PACK_LEFT) )))
|
||||
|
||||
TTK_LAYOUT("Vertical.TScale",
|
||||
TTK_GROUP("Scale.focus", TTK_EXPAND|TTK_FILL_BOTH,
|
||||
TTK_GROUP("Vertical.Scale.trough", TTK_EXPAND|TTK_FILL_BOTH,
|
||||
TTK_GROUP("Scale.focus", TTK_FILL_BOTH,
|
||||
TTK_GROUP("Vertical.Scale.trough", TTK_FILL_BOTH,
|
||||
TTK_NODE("Vertical.Scale.track", TTK_FILL_Y)
|
||||
TTK_NODE("Vertical.Scale.slider", TTK_PACK_TOP) )))
|
||||
|
||||
@@ -1029,7 +1033,7 @@ static ElementInfo ElementInfoTable[] = {
|
||||
{ "Menubutton.dropdown", &GenericElementSpec, L"TOOLBAR",
|
||||
TP_SPLITBUTTONDROPDOWN,toolbutton_statemap, NOPAD,0 },
|
||||
{ "Treeview.field", &GenericElementSpec, L"TREEVIEW",
|
||||
TVP_TREEITEM, treeview_statemap, PAD(1, 1, 1, 1), 0 },
|
||||
TVP_TREEITEM, treeview_statemap, PAD(1, 1, 1, 1), IGNORE_THEMESIZE },
|
||||
{ "Treeitem.indicator", &TreeIndicatorElementSpec, L"TREEVIEW",
|
||||
TVP_GLYPH, tvpglyph_statemap, PAD(1,1,6,0), PAD_MARGINS },
|
||||
{ "Treeheading.border", &GenericElementSpec, L"HEADER",
|
||||
@@ -1044,12 +1048,10 @@ static ElementInfo ElementInfoTable[] = {
|
||||
{ "Spinbox.downarrow", &SpinboxArrowElementSpec, L"SPIN",
|
||||
SPNP_DOWN, spinbutton_statemap, NOPAD,
|
||||
PAD_MARGINS | ((SM_CXVSCROLL << 8) | SM_CYVSCROLL) },
|
||||
|
||||
#if BROKEN_TEXT_ELEMENT
|
||||
#ifdef BROKEN_TEXT_ELEMENT
|
||||
{ "Labelframe.text", &TextElementSpec, L"BUTTON",
|
||||
BP_GROUPBOX, groupbox_statemap, NOPAD,0 },
|
||||
#endif
|
||||
|
||||
{ 0,0,0,0,0,NOPAD,0 }
|
||||
};
|
||||
#undef PAD
|
||||
@@ -1058,7 +1060,7 @@ static ElementInfo ElementInfoTable[] = {
|
||||
static int
|
||||
GetSysFlagFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *resultPtr)
|
||||
{
|
||||
static const char *names[] = {
|
||||
static const char *const names[] = {
|
||||
"SM_CXBORDER", "SM_CYBORDER", "SM_CXVSCROLL", "SM_CYVSCROLL",
|
||||
"SM_CXHSCROLL", "SM_CYHSCROLL", "SM_CXMENUCHECK", "SM_CYMENUCHECK",
|
||||
"SM_CXMENUSIZE", "SM_CYMENUSIZE", "SM_CXSIZE", "SM_CYSIZE", "SM_CXSMSIZE",
|
||||
@@ -1112,7 +1114,7 @@ Ttk_CreateVsapiElement(
|
||||
int objc,
|
||||
Tcl_Obj *const objv[])
|
||||
{
|
||||
XPThemeData *themeData = clientData;
|
||||
XPThemeData *themeData = (XPThemeData *)clientData;
|
||||
ElementInfo *elementPtr = NULL;
|
||||
ClientData elementData;
|
||||
LPCWSTR className;
|
||||
@@ -1126,7 +1128,7 @@ Ttk_CreateVsapiElement(
|
||||
Ttk_ElementSpec *elementSpec = &GenericElementSpec;
|
||||
Tcl_DString classBuf;
|
||||
|
||||
static const char *optionStrings[] =
|
||||
static const char *const optionStrings[] =
|
||||
{ "-padding","-width","-height","-margins", "-syssize",
|
||||
"-halfheight", "-halfwidth", NULL };
|
||||
enum { O_PADDING, O_WIDTH, O_HEIGHT, O_MARGINS, O_SYSSIZE,
|
||||
@@ -1143,7 +1145,8 @@ Ttk_CreateVsapiElement(
|
||||
return TCL_ERROR;
|
||||
}
|
||||
name = Tcl_GetStringFromObj(objv[0], &length);
|
||||
className = (LPCWSTR) Tcl_WinUtfToTChar(name, length, &classBuf);
|
||||
Tcl_DStringInit(&classBuf);
|
||||
className = Tcl_UtfToWCharDString(name, length, &classBuf);
|
||||
|
||||
/* flags or padding */
|
||||
if (objc > 3) {
|
||||
@@ -1218,7 +1221,7 @@ Ttk_CreateVsapiElement(
|
||||
if (Tcl_ListObjGetElements(interp, objv[2], &count, &specs) != TCL_OK)
|
||||
goto retErr;
|
||||
/* we over-allocate to ensure there is a terminating entry */
|
||||
stateTable = ckalloc(sizeof(Ttk_StateTable) * (count + 1));
|
||||
stateTable = (Ttk_StateTable *)ckalloc(sizeof(Ttk_StateTable) * (count + 1));
|
||||
memset(stateTable, 0, sizeof(Ttk_StateTable) * (count + 1));
|
||||
for (n = 0, j = 0; status == TCL_OK && n < count; n += 2, ++j) {
|
||||
Ttk_StateSpec spec = {0,0};
|
||||
@@ -1236,11 +1239,11 @@ Ttk_CreateVsapiElement(
|
||||
return status;
|
||||
}
|
||||
} else {
|
||||
stateTable = ckalloc(sizeof(Ttk_StateTable));
|
||||
stateTable = (Ttk_StateTable *)ckalloc(sizeof(Ttk_StateTable));
|
||||
memset(stateTable, 0, sizeof(Ttk_StateTable));
|
||||
}
|
||||
|
||||
elementPtr = ckalloc(sizeof(ElementInfo));
|
||||
elementPtr = (ElementInfo *)ckalloc(sizeof(ElementInfo));
|
||||
elementPtr->elementSpec = elementSpec;
|
||||
elementPtr->partId = partId;
|
||||
elementPtr->statemap = stateTable;
|
||||
@@ -1248,12 +1251,12 @@ Ttk_CreateVsapiElement(
|
||||
elementPtr->flags = HEAP_ELEMENT | flags;
|
||||
|
||||
/* set the element name to an allocated copy */
|
||||
name = ckalloc(strlen(elementName) + 1);
|
||||
name = (char *)ckalloc(strlen(elementName) + 1);
|
||||
strcpy(name, elementName);
|
||||
elementPtr->elementName = name;
|
||||
|
||||
/* set the class name to an allocated copy */
|
||||
wname = ckalloc(Tcl_DStringLength(&classBuf) + sizeof(WCHAR));
|
||||
wname = (LPWSTR)ckalloc(Tcl_DStringLength(&classBuf) + sizeof(WCHAR));
|
||||
wcscpy(wname, className);
|
||||
elementPtr->className = wname;
|
||||
|
||||
@@ -1281,11 +1284,7 @@ MODULE_SCOPE int TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd)
|
||||
XPThemeProcs *procs;
|
||||
HINSTANCE hlibrary;
|
||||
Ttk_Theme themePtr, parentPtr, vistaPtr;
|
||||
ElementInfo *infoPtr;
|
||||
OSVERSIONINFOW os;
|
||||
|
||||
os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
|
||||
GetVersionExW(&os);
|
||||
const ElementInfo *infoPtr;
|
||||
|
||||
procs = LoadXPThemeProcs(&hlibrary);
|
||||
if (!procs)
|
||||
@@ -1305,7 +1304,7 @@ MODULE_SCOPE int TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd)
|
||||
* Set theme data and cleanup proc
|
||||
*/
|
||||
|
||||
themeData = ckalloc(sizeof(XPThemeData));
|
||||
themeData = (XPThemeData *)ckalloc(sizeof(XPThemeData));
|
||||
themeData->procs = procs;
|
||||
themeData->hlibrary = hlibrary;
|
||||
|
||||
@@ -1318,7 +1317,7 @@ MODULE_SCOPE int TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd)
|
||||
* enable function. The theme itself is defined in script.
|
||||
*/
|
||||
|
||||
if (os.dwPlatformId == VER_PLATFORM_WIN32_NT && os.dwMajorVersion > 5) {
|
||||
if (TkWinGetPlatformTheme() == TK_THEME_WIN_VISTA) {
|
||||
vistaPtr = Ttk_CreateTheme(interp, "vista", themePtr);
|
||||
if (vistaPtr) {
|
||||
Ttk_SetThemeEnabledProc(vistaPtr, XPThemeEnabled, themeData);
|
||||
|
||||
@@ -25,15 +25,29 @@ int _CRT_glob = 0;
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#ifdef TK_TEST
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern Tcl_PackageInitProc Tktest_Init;
|
||||
#endif /* TK_TEST */
|
||||
|
||||
#if !defined(TCL_USE_STATIC_PACKAGES)
|
||||
# if TCL_MAJOR_VERSION > 8 || TCL_MINOR_VERSION > 6
|
||||
# define TCL_USE_STATIC_PACKAGES 1
|
||||
# else
|
||||
# define TCL_USE_STATIC_PACKAGES 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(STATIC_BUILD) && TCL_USE_STATIC_PACKAGES
|
||||
extern Tcl_PackageInitProc Registry_Init;
|
||||
extern Tcl_PackageInitProc Dde_Init;
|
||||
extern Tcl_PackageInitProc Dde_SafeInit;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#ifdef TCL_BROKEN_MAINARGS
|
||||
static void setargv(int *argcPtr, TCHAR ***argvPtr);
|
||||
#endif
|
||||
@@ -54,7 +68,11 @@ static BOOL consoleRequired = TRUE;
|
||||
#define TK_LOCAL_APPINIT Tcl_AppInit
|
||||
#endif
|
||||
#ifndef MODULE_SCOPE
|
||||
# define MODULE_SCOPE extern
|
||||
# ifdef __cplusplus
|
||||
# define MODULE_SCOPE extern "C"
|
||||
# else
|
||||
# define MODULE_SCOPE extern
|
||||
# endif
|
||||
#endif
|
||||
MODULE_SCOPE int TK_LOCAL_APPINIT(Tcl_Interp *interp);
|
||||
|
||||
@@ -106,6 +124,10 @@ _tWinMain(
|
||||
TCHAR **argv;
|
||||
int argc;
|
||||
TCHAR *p;
|
||||
(void)hInstance;
|
||||
(void)hPrevInstance;
|
||||
(void)lpszCmdLine;
|
||||
(void)nCmdShow;
|
||||
|
||||
/*
|
||||
* Create the console channels and install them as the standard channels.
|
||||
@@ -196,12 +218,12 @@ Tcl_AppInit(
|
||||
if (Registry_Init(interp) == TCL_ERROR) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_StaticPackage(interp, "registry", Registry_Init, 0);
|
||||
Tcl_StaticPackage(interp, "Registry", Registry_Init, 0);
|
||||
|
||||
if (Dde_Init(interp) == TCL_ERROR) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_StaticPackage(interp, "dde", Dde_Init, Dde_SafeInit);
|
||||
Tcl_StaticPackage(interp, "Dde", Dde_Init, Dde_SafeInit);
|
||||
#endif
|
||||
|
||||
#ifdef TK_TEST
|
||||
@@ -265,6 +287,7 @@ main(
|
||||
char **dummy)
|
||||
{
|
||||
TCHAR **argv;
|
||||
(void)dummy;
|
||||
#else
|
||||
int
|
||||
_tmain(
|
||||
@@ -364,7 +387,7 @@ setargv(
|
||||
#undef Tcl_Alloc
|
||||
#undef Tcl_DbCkalloc
|
||||
|
||||
argSpace = ckalloc(size * sizeof(char *)
|
||||
argSpace = (TCHAR *)ckalloc(size * sizeof(char *)
|
||||
+ (_tcslen(cmdLine) * sizeof(TCHAR)) + sizeof(TCHAR));
|
||||
argv = (TCHAR **) argSpace;
|
||||
argSpace += size * (sizeof(char *)/sizeof(TCHAR));
|
||||
|
||||
Reference in New Issue
Block a user