Import Tk 8.6.8

This commit is contained in:
Cheryl Sabella
2018-02-22 14:31:15 -05:00
parent b1c28856bb
commit 8e57feeeb9
193 changed files with 6172 additions and 4033 deletions

View File

@@ -394,8 +394,8 @@ X11_OBJS = tkUnix.o tkUnix3d.o tkUnixButton.o tkUnixColor.o tkUnixConfig.o \
AQUA_OBJS = tkMacOSXBitmap.o tkMacOSXButton.o tkMacOSXClipboard.o \
tkMacOSXColor.o tkMacOSXConfig.o tkMacOSXCursor.o tkMacOSXDebug.o \
tkMacOSXDialog.o tkMacOSXDraw.o tkMacOSXEmbed.o tkMacOSXEntry.o \
tkMacOSXEvent.o tkMacOSXFont.o tkMacOSXHLEvents.o tkMacOSXInit.o \
tkMacOSXKeyboard.o tkMacOSXKeyEvent.o tkMacOSXMenu.o \
tkMacOSXEvent.o tkMacOSXFont.o tkMacOSXHLEvents.o tkMacOSXImage.o \
tkMacOSXInit.o tkMacOSXKeyboard.o tkMacOSXKeyEvent.o tkMacOSXMenu.o \
tkMacOSXMenubutton.o tkMacOSXMenus.o tkMacOSXMouseEvent.o \
tkMacOSXNotify.o tkMacOSXRegion.o tkMacOSXScrlbr.o tkMacOSXSend.o \
tkMacOSXSubwindows.o tkMacOSXWindowEvent.o \
@@ -519,6 +519,7 @@ AQUA_SRCS = \
$(MAC_OSX_DIR)/tkMacOSXDraw.c $(MAC_OSX_DIR)/tkMacOSXEmbed.c \
$(MAC_OSX_DIR)/tkMacOSXEntry.c $(MAC_OSX_DIR)/tkMacOSXEvent.c \
$(MAC_OSX_DIR)/tkMacOSXFont.c $(MAC_OSX_DIR)/tkMacOSXHLEvents.c \
$(MAC_OSX_DIR)/tkMacOSXImage.c \
$(MAC_OSX_DIR)/tkMacOSXInit.c $(MAC_OSX_DIR)/tkMacOSXKeyboard.c \
$(MAC_OSX_DIR)/tkMacOSXKeyEvent.c $(MAC_OSX_DIR)/tkMacOSXMenu.c \
$(MAC_OSX_DIR)/tkMacOSXMenubutton.c $(MAC_OSX_DIR)/tkMacOSXMenus.c \
@@ -1272,6 +1273,9 @@ tkMacOSXFont.o: $(MAC_OSX_DIR)/tkMacOSXFont.c
tkMacOSXHLEvents.o: $(MAC_OSX_DIR)/tkMacOSXHLEvents.c
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXHLEvents.c
tkMacOSXImage.o: $(MAC_OSX_DIR)/tkMacOSXImage.c
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXImage.c
tkMacOSXInit.o: $(MAC_OSX_DIR)/tkMacOSXInit.c tkConfig.sh
$(CC) -c $(CC_SWITCHES) -DTK_LIBRARY=\"${TK_LIBRARY}\" \
$(MAC_OSX_DIR)/tkMacOSXInit.c
@@ -1574,8 +1578,7 @@ dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(M
$(TOP_DIR)/win/aclocal.m4 $(TOP_DIR)/win/tcl.m4 \
$(DISTDIR)/win
cp -p $(TOP_DIR)/win/*.[ch] $(TOP_DIR)/win/*.bat $(DISTDIR)/win
cp -p $(TOP_DIR)/win/makefile.* $(DISTDIR)/win
cp -p $(TOP_DIR)/win/rules.vc $(DISTDIR)/win
cp -p $(TOP_DIR)/win/*.vc $(DISTDIR)/win
cp -p $(TOP_DIR)/win/README $(DISTDIR)/win
cp -p $(TOP_DIR)/license.terms $(DISTDIR)/win
mkdir $(DISTDIR)/win/rc
@@ -1649,7 +1652,7 @@ dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(M
$(TCLDIR)/doc/man.macros $(DISTDIR)/doc
mkdir $(DISTDIR)/tests
cp -p $(TOP_DIR)/license.terms $(TEST_DIR)/*.{test,tcl} \
$(TEST_DIR)/README $(TEST_DIR)/*.{gif,ppm,xbm} \
$(TEST_DIR)/README $(TEST_DIR)/*.{gif,png,ppm,xbm} \
$(TEST_DIR)/option.file* $(DISTDIR)/tests
mkdir $(DISTDIR)/tests/ttk
cp -p $(TEST_DIR)/ttk/*.{test,tcl} $(DISTDIR)/tests/ttk

64
unix/configure vendored Normal file → Executable file
View File

@@ -1338,7 +1338,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
TK_VERSION=8.6
TK_MAJOR_VERSION=8
TK_MINOR_VERSION=6
TK_PATCH_LEVEL=".6"
TK_PATCH_LEVEL=".8"
VERSION=${TK_VERSION}
LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv"
@@ -1429,8 +1429,9 @@ echo "$as_me: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >
for i in `ls -d ${libdir} 2>/dev/null` \
`ls -d ${exec_prefix}/lib 2>/dev/null` \
`ls -d ${prefix}/lib 2>/dev/null` \
`ls -d /usr/local/lib 2>/dev/null` \
`ls -d /usr/contrib/lib 2>/dev/null` \
`ls -d /usr/local/lib 2>/dev/null` \
`ls -d /usr/pkg/lib 2>/dev/null` \
`ls -d /usr/lib 2>/dev/null` \
`ls -d /usr/lib64 2>/dev/null` \
; do
@@ -4489,8 +4490,10 @@ fi
PLAT_OBJS=""
PLAT_SRCS=""
LDAIX_SRC=""
if test x"${SHLIB_VERSION}" = x; then
SHLIB_VERSION="1.0"
if test "x${SHLIB_VERSION}" = x; then
SHLIB_VERSION=".1.0"
else
SHLIB_VERSION=".${SHLIB_VERSION}"
fi
case $system in
@@ -5355,47 +5358,26 @@ fi
OpenBSD-*)
arch=`arch -s`
case "$arch" in
vax)
# Equivalent using configure option --disable-load
# Step 4 will set the necessary variables
DL_OBJS=""
SHLIB_LD_LIBS=""
LDFLAGS=""
alpha|sparc64)
SHLIB_CFLAGS="-fPIC"
;;
*)
case "$arch" in
alpha|sparc|sparc64)
SHLIB_CFLAGS="-fPIC"
;;
*)
SHLIB_CFLAGS="-fpic"
;;
esac
SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}'
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
if test $doRpath = yes; then
SHLIB_CFLAGS="-fpic"
;;
esac
SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}'
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
if test $doRpath = yes; then
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
fi
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
LDFLAGS="-Wl,-export-dynamic"
;;
esac
case "$arch" in
vax)
CFLAGS_OPTIMIZE="-O1"
;;
sh)
CFLAGS_OPTIMIZE="-O0"
;;
*)
CFLAGS_OPTIMIZE="-O2"
;;
esac
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}'
LDFLAGS="-Wl,-export-dynamic"
CFLAGS_OPTIMIZE="-O2"
if test "${TCL_THREADS}" = "1"; then
# On OpenBSD: Compile with -pthread
@@ -6134,7 +6116,7 @@ fi
# requires an extra version number at the end of .so file names.
# So, the library has to have a name like libtcl75.so.1.0
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}'
UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
TCL_LIB_VERSIONS_OK=nodots
;;

2
unix/configure.in Normal file → Executable file
View File

@@ -25,7 +25,7 @@ m4_ifdef([SC_USE_CONFIG_HEADERS], [
TK_VERSION=8.6
TK_MAJOR_VERSION=8
TK_MINOR_VERSION=6
TK_PATCH_LEVEL=".6"
TK_PATCH_LEVEL=".8"
VERSION=${TK_VERSION}
LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv"

0
unix/install-sh Normal file → Executable file
View File

0
unix/installManPage Normal file → Executable file
View File

View File

@@ -91,8 +91,9 @@ AC_DEFUN([SC_PATH_TCLCONFIG], [
for i in `ls -d ${libdir} 2>/dev/null` \
`ls -d ${exec_prefix}/lib 2>/dev/null` \
`ls -d ${prefix}/lib 2>/dev/null` \
`ls -d /usr/local/lib 2>/dev/null` \
`ls -d /usr/contrib/lib 2>/dev/null` \
`ls -d /usr/local/lib 2>/dev/null` \
`ls -d /usr/pkg/lib 2>/dev/null` \
`ls -d /usr/lib 2>/dev/null` \
`ls -d /usr/lib64 2>/dev/null` \
; do
@@ -611,7 +612,6 @@ AC_DEFUN([SC_ENABLE_FRAMEWORK], [
# TCL_THREADS
# _REENTRANT
# _THREAD_SAFE
#
#------------------------------------------------------------------------
AC_DEFUN([SC_ENABLE_THREADS], [
@@ -727,7 +727,6 @@ AC_DEFUN([SC_ENABLE_THREADS], [
# Sets to $(LDFLAGS_OPTIMIZE) if false
# DBGX Formerly used as debug library extension;
# always blank now.
#
#------------------------------------------------------------------------
AC_DEFUN([SC_ENABLE_SYMBOLS], [
@@ -977,7 +976,7 @@ AC_DEFUN([SC_CONFIG_SYSTEM], [
# SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
# creating shared libraries. This symbol typically
# goes at the end of the "ld" commands that build
# shared libraries. The value of the symbol is
# shared libraries. The value of the symbol defaults to
# "${LIBS}" if all of the dependent libraries should
# be specified when creating a shared library. If
# dependent libraries should not be specified (as on
@@ -1107,7 +1106,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
PLAT_OBJS=""
PLAT_SRCS=""
LDAIX_SRC=""
AS_IF([test x"${SHLIB_VERSION}" = x], [SHLIB_VERSION="1.0"])
AS_IF([test "x${SHLIB_VERSION}" = x],[SHLIB_VERSION=".1.0"],[SHLIB_VERSION=".${SHLIB_VERSION}"])
case $system in
AIX-*)
AS_IF([test "${TCL_THREADS}" = "1" -a "$GCC" != "yes"], [
@@ -1467,44 +1466,23 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
OpenBSD-*)
arch=`arch -s`
case "$arch" in
vax)
# Equivalent using configure option --disable-load
# Step 4 will set the necessary variables
DL_OBJS=""
SHLIB_LD_LIBS=""
LDFLAGS=""
alpha|sparc64)
SHLIB_CFLAGS="-fPIC"
;;
*)
case "$arch" in
alpha|sparc|sparc64)
SHLIB_CFLAGS="-fPIC"
;;
*)
SHLIB_CFLAGS="-fpic"
;;
esac
SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}'
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
AS_IF([test $doRpath = yes], [
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
LDFLAGS="-Wl,-export-dynamic"
;;
esac
case "$arch" in
vax)
CFLAGS_OPTIMIZE="-O1"
;;
sh)
CFLAGS_OPTIMIZE="-O0"
;;
*)
CFLAGS_OPTIMIZE="-O2"
SHLIB_CFLAGS="-fpic"
;;
esac
SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}'
SHLIB_SUFFIX=".so"
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
AS_IF([test $doRpath = yes], [
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}'
LDFLAGS="-Wl,-export-dynamic"
CFLAGS_OPTIMIZE="-O2"
AS_IF([test "${TCL_THREADS}" = "1"], [
# On OpenBSD: Compile with -pthread
# Don't link with -lpthread
@@ -1825,7 +1803,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
# requires an extra version number at the end of .so file names.
# So, the library has to have a name like libtcl75.so.1.0
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}'
UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
TCL_LIB_VERSIONS_OK=nodots
;;
@@ -2706,7 +2684,7 @@ AC_DEFUN([SC_TCL_CFG_ENCODING], [
# advancedTest - the advanced test to run if the function is present
#
# Results:
# Might cause compatability versions of the function to be used.
# Might cause compatibility versions of the function to be used.
# Might affect the following vars:
# USE_COMPAT (implicit)
#

View File

@@ -4,7 +4,7 @@
Name: tk
Summary: Tk graphical toolkit for the Tcl scripting language.
Version: 8.6.6
Version: 8.6.8
Release: 2
License: BSD
Group: Development/Languages

View File

@@ -351,6 +351,47 @@ TkpCreateButton(
*----------------------------------------------------------------------
*/
static void
ShiftByOffset(
TkButton *butPtr,
int relief,
int *x, /* shift this x coordinate */
int *y, /* shift this y coordinate */
int width, /* width of image/text */
int height) /* height of image/text */
{
if (relief != TK_RELIEF_RAISED
&& butPtr->type == TYPE_BUTTON
&& !Tk_StrictMotif(butPtr->tkwin)) {
int shiftX;
int shiftY;
/*
* This is an (unraised) button widget, so we offset the text to make
* the button appear to move up and down as the relief changes.
*/
shiftX = shiftY = (relief == TK_RELIEF_SUNKEN) ? 2 : 1;
if (relief != TK_RELIEF_RIDGE) {
/*
* Take back one pixel if the padding is even, otherwise the
* content will be displayed too far right/down.
*/
if ((Tk_Width(butPtr->tkwin) - width) % 2 == 0) {
shiftX -= 1;
}
if ((Tk_Height(butPtr->tkwin) - height) % 2 == 0) {
shiftY -= 1;
}
}
*x += shiftX;
*y += shiftY;
}
}
void
TkpDisplayButton(
ClientData clientData) /* Information about widget. */
@@ -366,10 +407,6 @@ TkpDisplayButton(
int width = 0, height = 0, fullWidth, fullHeight;
int textXOffset, textYOffset;
int haveImage = 0, haveText = 0;
int offset; /* 1 means this is a button widget, so we
* offset the text to make the button appear
* to move up and down as the relief
* changes. */
int imageWidth, imageHeight;
int imageXOffset = 0, imageYOffset = 0;
/* image information that will be used to
@@ -432,8 +469,6 @@ TkpDisplayButton(
}
}
offset = (butPtr->type == TYPE_BUTTON) && !Tk_StrictMotif(butPtr->tkwin);
/*
* In order to avoid screen flashes, this function redraws the button in a
* pixmap, then copies the pixmap to the screen in a single operation.
@@ -525,17 +560,7 @@ TkpDisplayButton(
butPtr->indicatorSpace + fullWidth, fullHeight, &x, &y);
x += butPtr->indicatorSpace;
x += offset;
y += offset;
if (relief == TK_RELIEF_RAISED) {
x -= offset;
y -= offset;
} else if (relief == TK_RELIEF_SUNKEN) {
x += offset;
y += offset;
}
ShiftByOffset(butPtr, relief, &x, &y, width, height);
imageXOffset += x;
imageYOffset += y;
@@ -593,16 +618,7 @@ TkpDisplayButton(
TkComputeAnchor(butPtr->anchor, tkwin, 0, 0,
butPtr->indicatorSpace + width, height, &x, &y);
x += butPtr->indicatorSpace;
x += offset;
y += offset;
if (relief == TK_RELIEF_RAISED) {
x -= offset;
y -= offset;
} else if (relief == TK_RELIEF_SUNKEN) {
x += offset;
y += offset;
}
ShiftByOffset(butPtr, relief, &x, &y, width, height);
imageXOffset += x;
imageYOffset += y;
if (butPtr->image != NULL) {
@@ -655,16 +671,7 @@ TkpDisplayButton(
butPtr->textHeight, &x, &y);
x += butPtr->indicatorSpace;
x += offset;
y += offset;
if (relief == TK_RELIEF_RAISED) {
x -= offset;
y -= offset;
} else if (relief == TK_RELIEF_SUNKEN) {
x += offset;
y += offset;
}
ShiftByOffset(butPtr, relief, &x, &y, width, height);
Tk_DrawTextLayout(butPtr->display, pixmap, gc, butPtr->textLayout,
x, y, 0, -1);
Tk_UnderlineTextLayout(butPtr->display, pixmap, gc,

View File

@@ -639,7 +639,6 @@ TkpFreeCursor(
TkUnixCursor *unixCursorPtr = (TkUnixCursor *) cursorPtr;
XFreeCursor(unixCursorPtr->display, (Cursor) unixCursorPtr->info.cursor);
Tk_FreeXId(unixCursorPtr->display, (XID) unixCursorPtr->info.cursor);
}
/*

View File

@@ -38,6 +38,8 @@ static void DisplayFileProc(ClientData clientData, int flags);
static void DisplaySetupProc(ClientData clientData, int flags);
static void TransferXEventsToTcl(Display *display);
#ifdef TK_USE_INPUT_METHODS
static void InstantiateIMCallback(Display *, XPointer client_data, XPointer call_data);
static void DestroyIMCallback(XIM im, XPointer client_data, XPointer call_data);
static void OpenIM(TkDisplay *dispPtr);
#endif
@@ -179,6 +181,8 @@ TkpOpenDisplay(
dispPtr->flags |= use_xkb;
#ifdef TK_USE_INPUT_METHODS
OpenIM(dispPtr);
XRegisterIMInstantiateCallback(dispPtr->display, NULL, NULL, NULL,
InstantiateIMCallback, (XPointer) dispPtr);
#endif
Tcl_CreateFileHandler(ConnectionNumber(display), TCL_READABLE,
DisplayFileProc, dispPtr);
@@ -664,6 +668,35 @@ TkpSync(
}
#ifdef TK_USE_INPUT_METHODS
static void
InstantiateIMCallback(
Display *display,
XPointer client_data,
XPointer call_data)
{
TkDisplay *dispPtr;
dispPtr = (TkDisplay *) client_data;
OpenIM(dispPtr);
XUnregisterIMInstantiateCallback(dispPtr->display, NULL, NULL, NULL,
InstantiateIMCallback, (XPointer) dispPtr);
}
static void
DestroyIMCallback(
XIM im,
XPointer client_data,
XPointer call_data)
{
TkDisplay *dispPtr;
dispPtr = (TkDisplay *) client_data;
dispPtr->inputMethod = NULL;
++dispPtr->ximGeneration;
XRegisterIMInstantiateCallback(dispPtr->display, NULL, NULL, NULL,
InstantiateIMCallback, (XPointer) dispPtr);
}
/*
*--------------------------------------------------------------
*
@@ -693,11 +726,23 @@ OpenIM(
return;
}
++dispPtr->ximGeneration;
dispPtr->inputMethod = XOpenIM(dispPtr->display, NULL, NULL, NULL);
if (dispPtr->inputMethod == NULL) {
return;
}
/* Require X11R6 */
{
XIMCallback destroy_cb;
destroy_cb.callback = DestroyIMCallback;
destroy_cb.client_data = (XPointer) dispPtr;
if (XSetIMValues(dispPtr->inputMethod, XNDestroyCallback,
&destroy_cb, NULL))
goto error;
}
if ((XGetIMValues(dispPtr->inputMethod, XNQueryInputStyle, &stylePtr,
NULL) != NULL) || (stylePtr == NULL)) {
goto error;
@@ -744,6 +789,7 @@ error:
if (dispPtr->inputMethod) {
XCloseIM(dispPtr->inputMethod);
dispPtr->inputMethod = NULL;
++dispPtr->ximGeneration;
}
}
#endif /* TK_USE_INPUT_METHODS */

View File

@@ -406,7 +406,7 @@ ControlUtfProc(
{
const char *srcStart, *srcEnd;
char *dstStart, *dstEnd;
Tcl_UniChar ch;
int ch;
int result;
static char hexChars[] = "0123456789abcdef";
static char mapChars[] = {
@@ -427,9 +427,9 @@ ControlUtfProc(
result = TCL_CONVERT_NOSPACE;
break;
}
src += Tcl_UtfToUniChar(src, &ch);
src += TkUtfToUniChar(src, &ch);
dst[0] = '\\';
if ((ch < sizeof(mapChars)) && (mapChars[ch] != 0)) {
if (((size_t) ch < sizeof(mapChars)) && (mapChars[ch] != 0)) {
dst[1] = mapChars[ch];
dst += 2;
} else if (ch < 256) {
@@ -437,13 +437,21 @@ ControlUtfProc(
dst[2] = hexChars[(ch >> 4) & 0xf];
dst[3] = hexChars[ch & 0xf];
dst += 4;
} else {
} else if (ch < 0x10000) {
dst[1] = 'u';
dst[2] = hexChars[(ch >> 12) & 0xf];
dst[3] = hexChars[(ch >> 8) & 0xf];
dst[4] = hexChars[(ch >> 4) & 0xf];
dst[5] = hexChars[ch & 0xf];
dst += 6;
} else {
/* TODO we can do better here */
dst[1] = 'u';
dst[2] = 'f';
dst[3] = 'f';
dst[4] = 'f';
dst[5] = 'd';
dst += 6;
}
}
*srcReadPtr = src - srcStart;
@@ -946,7 +954,7 @@ void
TkpGetFontAttrsForChar(
Tk_Window tkwin, /* Window on the font's display */
Tk_Font tkfont, /* Font to query */
Tcl_UniChar c, /* Character of interest */
int c, /* Character of interest */
TkFontAttributes *faPtr) /* Output: Font attributes */
{
FontAttributes atts;
@@ -1028,7 +1036,7 @@ Tk_MeasureChars(
curByte = 0;
} else if (maxLength < 0) {
const char *p, *end, *next;
Tcl_UniChar ch;
int ch;
SubFont *thisSubFontPtr;
FontFamily *familyPtr;
Tcl_DString runString;
@@ -1044,7 +1052,7 @@ Tk_MeasureChars(
curX = 0;
end = source + numBytes;
for (p = source; p < end; ) {
next = p + Tcl_UtfToUniChar(p, &ch);
next = p + TkUtfToUniChar(p, &ch);
thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr);
if (thisSubFontPtr != lastSubFontPtr) {
familyPtr = lastSubFontPtr->familyPtr;
@@ -1406,10 +1414,13 @@ TkpDrawCharsInContext(
* whole (not just the range) string when
* drawing. */
{
int widthUntilStart;
(void) numBytes; /*unused*/
Tk_MeasureChars(tkfont, source, rangeStart, -1, 0, &widthUntilStart);
Tk_DrawChars(display, drawable, gc, tkfont, source + rangeStart,
rangeLength, x, y);
rangeLength, x+widthUntilStart, y);
}
/*
@@ -1524,7 +1535,7 @@ CreateClosestFont(
continue;
}
IdentifySymbolEncodings(&got);
scalable = (got.fa.size == 0);
scalable = (got.fa.size == 0.0);
score = RankAttributes(&want, &got);
if (score < bestScore[scalable]) {
bestIdx[scalable] = nameIdx;
@@ -1631,7 +1642,7 @@ InitFont(
fmPtr->fixed = fixed;
fontPtr->display = display;
fontPtr->pixelSize = TkFontGetPixels(tkwin, fa.fa.size);
fontPtr->pixelSize = (int)(TkFontGetPixels(tkwin, fa.fa.size) + 0.5);
fontPtr->xa = fa.xa;
fontPtr->numSubFonts = 1;
@@ -2442,7 +2453,7 @@ CanUseFallback(
want.xa = fontPtr->xa;
want.fa.family = Tk_GetUid(faceName);
want.fa.size = -fontPtr->pixelSize;
want.fa.size = (double)-fontPtr->pixelSize;
hateFoundry = NULL;
hateCharset = NULL;
@@ -2525,7 +2536,7 @@ CanUseFallback(
* D. Rank each name and pick the best match.
*/
scalable = (got.fa.size == 0);
scalable = (got.fa.size == 0.0);
score = RankAttributes(&want, &got);
if (score < bestScore[scalable]) {
bestIdx[scalable] = nameIdx;
@@ -2654,7 +2665,7 @@ RankAttributes(
penalty += 1000;
}
if (gotPtr->fa.size == 0) {
if (gotPtr->fa.size == 0.0) {
/*
* A scalable font is almost always acceptable, but the corresponding
* bitmapped font would be better.
@@ -2668,14 +2679,14 @@ RankAttributes(
* It's worse to be too large than to be too small.
*/
diff = (-gotPtr->fa.size - -wantPtr->fa.size);
diff = (int) (150 * (-gotPtr->fa.size - -wantPtr->fa.size));
if (diff > 0) {
penalty += 600;
} else if (diff < 0) {
penalty += 150;
diff = -diff;
}
penalty += 150 * diff;
penalty += diff;
}
if (gotPtr->xa.charset != wantPtr->xa.charset) {
int i;
@@ -2762,7 +2773,7 @@ GetScreenFont(
}
*str = '\0';
sprintf(buf, "%.200s-%d-*-*-*-*-*%s", nameList[bestIdx[1]],
-wantPtr->fa.size, rest);
(int)(-wantPtr->fa.size+0.5), rest);
*str = '-';
fontStructPtr = XLoadQueryFont(display, buf);
bestScore[1] = INT_MAX;

View File

@@ -170,18 +170,21 @@ GetTkFontAttributes(
{
const char *family = "Unknown";
const char *const *familyPtr = &family;
int weight, slant, size, pxsize;
double ptsize;
int weight, slant, pxsize;
double size, ptsize;
(void) XftPatternGetString(ftFont->pattern, XFT_FAMILY, 0, familyPtr);
if (XftPatternGetDouble(ftFont->pattern, XFT_SIZE, 0,
&ptsize) == XftResultMatch) {
size = (int) ptsize;
size = ptsize;
} else if (XftPatternGetDouble(ftFont->pattern, XFT_PIXEL_SIZE, 0,
&ptsize) == XftResultMatch) {
size = -ptsize;
} else if (XftPatternGetInteger(ftFont->pattern, XFT_PIXEL_SIZE, 0,
&pxsize) == XftResultMatch) {
size = -pxsize;
size = (double)-pxsize;
} else {
size = 12;
size = 12.0;
}
if (XftPatternGetInteger(ftFont->pattern, XFT_WEIGHT, 0,
&weight) != XftResultMatch) {
@@ -194,7 +197,7 @@ GetTkFontAttributes(
#if DEBUG_FONTSEL
printf("family %s size %d weight %d slant %d\n",
family, size, weight, slant);
family, (int)size, weight, slant);
#endif /* DEBUG_FONTSEL */
faPtr->family = Tk_GetUid(family);
@@ -441,10 +444,10 @@ TkpGetFontFromAttributes(
if (faPtr->family) {
XftPatternAddString(pattern, XFT_FAMILY, faPtr->family);
}
if (faPtr->size > 0) {
XftPatternAddDouble(pattern, XFT_SIZE, (double)faPtr->size);
} else if (faPtr->size < 0) {
XftPatternAddInteger(pattern, XFT_PIXEL_SIZE, -faPtr->size);
if (faPtr->size > 0.0) {
XftPatternAddDouble(pattern, XFT_SIZE, faPtr->size);
} else if (faPtr->size < 0.0) {
XftPatternAddDouble(pattern, XFT_SIZE, TkFontGetPoints(tkwin, faPtr->size));
} else {
XftPatternAddDouble(pattern, XFT_SIZE, 12.0);
}
@@ -615,7 +618,7 @@ void
TkpGetFontAttrsForChar(
Tk_Window tkwin, /* Window on the font's display */
Tk_Font tkfont, /* Font to query */
Tcl_UniChar c, /* Character of interest */
int c, /* Character of interest */
TkFontAttributes *faPtr) /* Output: Font attributes */
{
UnixFtFont *fontPtr = (UnixFtFont *) tkfont;
@@ -668,9 +671,9 @@ Tk_MeasureChars(
curByte = 0;
sawNonSpace = 0;
while (numBytes > 0) {
Tcl_UniChar unichar;
int unichar;
clen = Tcl_UtfToUniChar(source, &unichar);
clen = TkUtfToUniChar(source, &unichar);
c = (FcChar32) unichar;
if (clen <= 0) {
@@ -778,7 +781,7 @@ LookUpColor(Display *display, /* Display to lookup colors on */
i >= 0; last2 = last, last = i, i = fontPtr->colors[i].next) {
if (pixel == fontPtr->colors[i].color.pixel) {
/*
/*
* Color found in cache. Move it to the front of the list and return it.
*/
if (last >= 0) {
@@ -802,7 +805,7 @@ LookUpColor(Display *display, /* Display to lookup colors on */
last = fontPtr->ncolors++;
}
/*
/*
* Translate the pixel value to a color. Needs a server round-trip.
*/
xcolor.pixel = pixel;
@@ -856,6 +859,10 @@ Tk_DrawChars(
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (maxCoord <= y) {
return; /* nothing to draw */
}
if (fontPtr->ftDraw == 0) {
#if DEBUG_FONTSEL
printf("Switch to drawable 0x%x\n", drawable);
@@ -876,7 +883,7 @@ Tk_DrawChars(
XftDrawSetClip(fontPtr->ftDraw, tsdPtr->clipRegion);
}
nspec = 0;
while (numBytes > 0 && x <= maxCoord && y <= maxCoord) {
while (numBytes > 0) {
XftFont *ftFont;
FcChar32 c;
@@ -893,19 +900,25 @@ Tk_DrawChars(
ftFont = GetFont(fontPtr, c, 0.0);
if (ftFont) {
specs[nspec].font = ftFont;
int cx = x;
int cy = y;
specs[nspec].glyph = XftCharIndex(fontPtr->display, ftFont, c);
specs[nspec].x = x;
specs[nspec].y = y;
XftGlyphExtents(fontPtr->display, ftFont, &specs[nspec].glyph, 1,
&metrics);
x += metrics.xOff;
y += metrics.yOff;
nspec++;
if (nspec == NUM_SPEC) {
XftDrawGlyphFontSpec(fontPtr->ftDraw, xftcolor,
specs, nspec);
nspec = 0;
if ((x += metrics.xOff) >= maxCoord
|| (y += metrics.yOff) >= maxCoord) {
break;
}
if (metrics.xOff > 0 && cx >= 0 && cy >= 0) {
specs[nspec].font = ftFont;
specs[nspec].x = cx;
specs[nspec].y = cy;
if (++nspec == NUM_SPEC) {
XftDrawGlyphFontSpec(fontPtr->ftDraw, xftcolor,
specs, nspec);
nspec = 0;
}
}
}
}
@@ -1008,8 +1021,7 @@ TkDrawAngledChars(
currentFtFont = NULL;
originX = originY = 0; /* lint */
while (numBytes > 0 && x <= maxCoord && x >= minCoord && y <= maxCoord
&& y >= minCoord) {
while (numBytes > 0 && x >= minCoord && y >= minCoord) {
XftFont *ftFont;
FcChar32 c;
@@ -1047,8 +1059,17 @@ TkDrawAngledChars(
XftGlyphExtents(fontPtr->display, currentFtFont, glyphs,
nglyph, &metrics);
nglyph = 0;
x += metrics.xOff;
y += metrics.yOff;
/*
* Breaking at this place is sub-optimal, but the whole algorithm
* has a design problem, the choice of NUM_SPEC is arbitrary, and so
* the inter-glyph spacing will look arbitrary. This algorithm
* has to draw the whole string at once (or whole blocks with same
* font), this requires a dynamic 'glyphs' array. In case of overflow
* the array has to be divided until the maximal string will fit. (GC)
*/
if ((x += metrics.xOff) >= maxCoord || (y += metrics.yOff) >= maxCoord) {
break;
}
}
currentFtFont = ftFont;
}
@@ -1084,8 +1105,7 @@ TkDrawAngledChars(
XftDrawSetClip(fontPtr->ftDraw, tsdPtr->clipRegion);
}
nspec = 0;
while (numBytes > 0 && x <= maxCoord && x >= minCoord
&& y <= maxCoord && y >= minCoord) {
while (numBytes > 0 && x >= minCoord && y >= minCoord) {
XftFont *ftFont, *ft0Font;
FcChar32 c;
@@ -1109,10 +1129,11 @@ TkDrawAngledChars(
specs[nspec].y = ROUND16(y);
XftGlyphExtents(fontPtr->display, ft0Font, &specs[nspec].glyph, 1,
&metrics);
x += metrics.xOff*cosA + metrics.yOff*sinA;
y += metrics.yOff*cosA - metrics.xOff*sinA;
nspec++;
if (nspec == NUM_SPEC) {
if ((x += metrics.xOff*cosA + metrics.yOff*sinA) > maxCoord
|| (y += metrics.yOff*cosA - metrics.xOff*sinA) > maxCoord) {
break;
}
if (++nspec == NUM_SPEC) {
XftDrawGlyphFontSpec(fontPtr->ftDraw, xftcolor,
specs, nspec);
nspec = 0;

View File

@@ -13,6 +13,10 @@
#include "tkInt.h"
#include "tkScale.h"
#if defined(_WIN32)
#define snprintf _snprintf
#endif
/*
* Forward declarations for functions defined later in this file:
*/
@@ -267,7 +271,9 @@ DisplayVerticalValue(
Tk_GetFontMetrics(scalePtr->tkfont, &fm);
y = TkScaleValueToPixel(scalePtr, value) + fm.ascent/2;
sprintf(valueString, scalePtr->format, value);
if (snprintf(valueString, TCL_DOUBLE_SPACE, scalePtr->format, value) < 0) {
valueString[TCL_DOUBLE_SPACE - 1] = '\0';
}
length = (int) strlen(valueString);
width = Tk_TextWidth(scalePtr->tkfont, valueString, length);
@@ -352,7 +358,10 @@ DisplayHorizontalScale(
ticks = fabs((scalePtr->toValue - scalePtr->fromValue)
/ tickInterval);
sprintf(valueString, scalePtr->format, scalePtr->fromValue);
if (snprintf(valueString, TCL_DOUBLE_SPACE, scalePtr->format,
scalePtr->fromValue) < 0) {
valueString[TCL_DOUBLE_SPACE - 1] = '\0';
}
maxTicks = (double) Tk_Width(tkwin)
/ (double) Tk_TextWidth(scalePtr->tkfont, valueString, -1);
if (ticks > maxTicks) {
@@ -484,7 +493,9 @@ DisplayHorizontalValue(
x = TkScaleValueToPixel(scalePtr, value);
Tk_GetFontMetrics(scalePtr->tkfont, &fm);
y = top + fm.ascent;
sprintf(valueString, scalePtr->format, value);
if (snprintf(valueString, TCL_DOUBLE_SPACE, scalePtr->format, value) < 0) {
valueString[TCL_DOUBLE_SPACE - 1] = '\0';
}
length = (int) strlen(valueString);
width = Tk_TextWidth(scalePtr->tkfont, valueString, length);
@@ -551,7 +562,10 @@ TkpDisplayScale(
Tcl_Preserve(scalePtr);
if ((scalePtr->flags & INVOKE_COMMAND) && (scalePtr->command != NULL)) {
Tcl_Preserve(interp);
sprintf(string, scalePtr->format, scalePtr->value);
if (snprintf(string, TCL_DOUBLE_SPACE, scalePtr->format,
scalePtr->value) < 0) {
string[TCL_DOUBLE_SPACE - 1] = '\0';
}
Tcl_DStringInit(&buf);
Tcl_DStringAppend(&buf, scalePtr->command, -1);
Tcl_DStringAppend(&buf, " ", -1);

View File

@@ -165,6 +165,13 @@ TkSelGetSelection(
Tcl_DStringInit(&retr.buf);
pendingRetrievals = &retr;
/*
* Delete the property to indicate that no parameters are supplied for
* the conversion request.
*/
XDeleteProperty(winPtr->display, retr.winPtr->window, retr.property);
/*
* Initiate the request for the selection. Note: can't use TkCurrentTime
* for the time. If we do, and this application hasn't received any X
@@ -865,8 +872,9 @@ ConvertSelection(
goto refuse;
}
result = XGetWindowProperty(eventPtr->display, eventPtr->requestor,
eventPtr->property, 0, MAX_PROP_WORDS, False, XA_ATOM,
&type, &format, &incr.numConversions, &bytesAfter,
eventPtr->property, 0, MAX_PROP_WORDS, False,
winPtr->dispPtr->atomPairAtom, &type, &format,
&incr.numConversions, &bytesAfter,
(unsigned char **) multAtomsPtr);
if ((result != Success) || (bytesAfter != 0) || (format != 32)
|| (type == None)) {
@@ -1028,8 +1036,8 @@ ConvertSelection(
}
if (multiple) {
XChangeProperty(reply.xsel.display, reply.xsel.requestor,
reply.xsel.property, XA_ATOM, 32, PropModeReplace,
(unsigned char *) incr.multAtoms,
reply.xsel.property, winPtr->dispPtr->atomPairAtom,
32, PropModeReplace, (unsigned char *) incr.multAtoms,
(int) incr.numConversions*2);
} else {
/*

View File

@@ -96,7 +96,6 @@ Tk_FreePixmap(
Pixmap pixmap) /* Identifier for pixmap. */
{
XFreePixmap(display, pixmap);
Tk_FreeXId(display, (XID) pixmap);
}