summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2017-03-06 18:24:38 (GMT)
committerfvogel <fvogelnew1@free.fr>2017-03-06 18:24:38 (GMT)
commite98430e7e070536bd9d5ccb44afa4976b735ff65 (patch)
tree15779675471fdc625c17330f72e4c676f065d928
parentee16a52044d53a25664ecc7f02b042e3fb638baf (diff)
parent05fb5c3c424e8c68a0cf14a68d2f32570b2d5d69 (diff)
downloadtk-e98430e7e070536bd9d5ccb44afa4976b735ff65.zip
tk-e98430e7e070536bd9d5ccb44afa4976b735ff65.tar.gz
tk-e98430e7e070536bd9d5ccb44afa4976b735ff65.tar.bz2
merge trunk
-rw-r--r--.fossil-settings/crlf-glob4
-rw-r--r--.fossil-settings/crnl-glob2
-rw-r--r--.fossil-settings/encoding-glob2
-rw-r--r--.fossil-settings/ignore-glob3
-rw-r--r--changes2
-rw-r--r--doc/menu.n2
-rw-r--r--doc/spinbox.n14
-rw-r--r--doc/text.n20
-rw-r--r--doc/ttk_vsapi.n2
-rw-r--r--generic/tk.decls2
-rw-r--r--generic/tk.h14
-rw-r--r--generic/tkBind.c12
-rw-r--r--generic/tkCanvUtil.c8
-rw-r--r--generic/tkCmds.c7
-rw-r--r--generic/tkConfig.c21
-rw-r--r--generic/tkConsole.c14
-rw-r--r--generic/tkDecls.h8
-rw-r--r--generic/tkEntry.c19
-rw-r--r--generic/tkEvent.c13
-rw-r--r--generic/tkFont.c31
-rw-r--r--generic/tkGC.c5
-rw-r--r--generic/tkGrid.c3
-rw-r--r--generic/tkImgBmap.c5
-rw-r--r--generic/tkImgPNG.c4
-rw-r--r--generic/tkImgPhInstance.c3
-rw-r--r--generic/tkImgPhoto.c50
-rw-r--r--generic/tkImgPhoto.h2
-rw-r--r--generic/tkInt.decls70
-rw-r--r--generic/tkInt.h18
-rw-r--r--generic/tkIntXlibDecls.h139
-rw-r--r--generic/tkMain.c2
-rw-r--r--generic/tkObj.c15
-rw-r--r--generic/tkPack.c15
-rw-r--r--generic/tkPanedWindow.c22
-rw-r--r--generic/tkScrollbar.c13
-rw-r--r--generic/tkScrollbar.h6
-rw-r--r--generic/tkSelect.c2
-rw-r--r--generic/tkStubInit.c31
-rw-r--r--generic/tkTest.c4
-rw-r--r--generic/tkText.c108
-rw-r--r--generic/tkText.h2
-rw-r--r--generic/tkTextDisp.c42
-rw-r--r--generic/tkTextIndex.c10
-rw-r--r--generic/tkTextTag.c7
-rw-r--r--generic/tkUtil.c80
-rw-r--r--generic/tkVisual.c13
-rw-r--r--generic/tkWindow.c16
-rw-r--r--generic/ttk/ttkButton.c13
-rw-r--r--generic/ttk/ttkEntry.c17
-rw-r--r--generic/ttk/ttkGenStubs.tcl963
-rw-r--r--generic/ttk/ttkImage.c34
-rw-r--r--generic/ttk/ttkTheme.h2
-rw-r--r--library/demos/en.msg2
-rw-r--r--library/demos/nl.msg4
-rw-r--r--library/menu.tcl4
-rw-r--r--library/tclIndex1
-rw-r--r--library/text.tcl96
-rw-r--r--library/tkfbox.tcl5
-rw-r--r--library/ttk/altTheme.tcl12
-rw-r--r--library/ttk/clamTheme.tcl34
-rw-r--r--library/ttk/classicTheme.tcl13
-rw-r--r--library/ttk/combobox.tcl3
-rw-r--r--library/ttk/defaults.tcl42
-rw-r--r--library/ttk/vistaTheme.tcl2
-rw-r--r--library/xmfbox.tcl16
-rw-r--r--macosx/Tk.xcode/project.pbxproj3
-rw-r--r--macosx/Tk.xcodeproj/project.pbxproj4
-rw-r--r--macosx/tkMacOSXDraw.c18
-rw-r--r--macosx/tkMacOSXFont.c2
-rw-r--r--macosx/tkMacOSXPort.h1
-rw-r--r--macosx/tkMacOSXWindowEvent.c8
-rw-r--r--macosx/tkMacOSXXStubs.c4
-rw-r--r--tests/bitmap.test9
-rw-r--r--tests/border.test9
-rw-r--r--tests/button.test48
-rw-r--r--tests/color.test16
-rw-r--r--tests/constraints.tcl4
-rw-r--r--tests/cursor.test9
-rw-r--r--tests/entry.test18
-rw-r--r--tests/event.test35
-rw-r--r--tests/filebox.test4
-rw-r--r--tests/focusTcl.test8
-rw-r--r--tests/font.test16
-rw-r--r--tests/grid.test19
-rw-r--r--tests/imgPhoto.test17
-rw-r--r--tests/listbox.test3
-rw-r--r--tests/menu.test29
-rw-r--r--tests/pack.test4
-rw-r--r--tests/scrollbar.test4
-rw-r--r--tests/spinbox.test23
-rw-r--r--tests/text.test158
-rw-r--r--tests/textDisp.test100
-rw-r--r--tests/textIndex.test6
-rw-r--r--tests/textMark.test2
-rw-r--r--tests/textTag.test70
-rw-r--r--tests/textWind.test6
-rw-r--r--tests/ttk/combobox.test9
-rw-r--r--tests/ttk/spinbox.test21
-rw-r--r--tests/winFont.test6
-rw-r--r--unix/Makefile.in4
-rwxr-xr-xunix/configure2
-rw-r--r--unix/tcl.m42
-rw-r--r--unix/tkUnixEvent.c46
-rw-r--r--unix/tkUnixFont.c58
-rw-r--r--unix/tkUnixRFont.c6
-rw-r--r--unix/tkUnixSelect.c4
-rw-r--r--unix/tkUnixWm.c28
-rw-r--r--win/Makefile.in6
-rwxr-xr-xwin/configure2
-rw-r--r--win/makefile.vc2
-rw-r--r--win/mkd.bat12
-rw-r--r--win/rmd.bat20
-rw-r--r--win/rules.vc27
-rw-r--r--win/tcl.m42
-rw-r--r--win/tkWin.h12
-rw-r--r--win/tkWinClipboard.c11
-rw-r--r--win/tkWinDraw.c132
-rw-r--r--win/tkWinFont.c93
-rw-r--r--win/tkWinKey.c97
-rw-r--r--win/tkWinMenu.c63
-rw-r--r--win/tkWinTest.c18
-rw-r--r--win/tkWinWindow.c41
-rw-r--r--win/tkWinX.c120
-rw-r--r--win/ttkWinXPTheme.c8
-rw-r--r--xlib/xgc.c20
-rw-r--r--xlib/xutil.c1
126 files changed, 1939 insertions, 1741 deletions
diff --git a/.fossil-settings/crlf-glob b/.fossil-settings/crlf-glob
new file mode 100644
index 0000000..ad7795f
--- /dev/null
+++ b/.fossil-settings/crlf-glob
@@ -0,0 +1,4 @@
+win/buildall.vc.bat
+win/makefile.bc
+win/makefile.vc
+win/rules.vc
diff --git a/.fossil-settings/crnl-glob b/.fossil-settings/crnl-glob
index 7175730..ad7795f 100644
--- a/.fossil-settings/crnl-glob
+++ b/.fossil-settings/crnl-glob
@@ -1,6 +1,4 @@
win/buildall.vc.bat
win/makefile.bc
win/makefile.vc
-win/mkd.bat
-win/rmd.bat
win/rules.vc
diff --git a/.fossil-settings/encoding-glob b/.fossil-settings/encoding-glob
index 7175730..ad7795f 100644
--- a/.fossil-settings/encoding-glob
+++ b/.fossil-settings/encoding-glob
@@ -1,6 +1,4 @@
win/buildall.vc.bat
win/makefile.bc
win/makefile.vc
-win/mkd.bat
-win/rmd.bat
win/rules.vc
diff --git a/.fossil-settings/ignore-glob b/.fossil-settings/ignore-glob
index e404f52..e8f5bbb 100644
--- a/.fossil-settings/ignore-glob
+++ b/.fossil-settings/ignore-glob
@@ -6,6 +6,7 @@
*.lib
*.o
*.obj
+*.pdb
*.res
*.sl
*.so
@@ -18,4 +19,6 @@
*/tktest*
*/versions.vc
doc/man.macros
+win/Debug_VC*
+win/Release_VC*
unix/tk.pc
diff --git a/changes b/changes
index bf3e62e..3f1b43d 100644
--- a/changes
+++ b/changes
@@ -1315,7 +1315,7 @@ ISO Latin-1 character set.
result across the execution of binding scripts. Otherwise if an event
triggers in the middle of some other script (e.g. a destroy event during
window creation, because there was an error in the creation command),
-the intepreter's result gets lost.
+the interpreter's result gets lost.
2/19/94 (bug fix) Fixed bug in dealing with results of sent command
that could cause them to get lost in some situations.
diff --git a/doc/menu.n b/doc/menu.n
index 9dd7ef4..5742e23 100644
--- a/doc/menu.n
+++ b/doc/menu.n
@@ -101,7 +101,7 @@ textual field is displayed to the right of the label. The accelerator
typically describes a keystroke sequence that may be used in the
application to cause the same result as invoking the menu entry.
This is a display option, it does not actually set the corresponding
-binding (which can be achieved using the \fBbind\fR command).
+binding (which can be achieved using the \fBbind\fR command).
The third field is an \fIindicator\fR. The indicator is present only for
checkbutton or radiobutton entries. It indicates whether the entry
is selected or not, and is displayed to the left of the entry's
diff --git a/doc/spinbox.n b/doc/spinbox.n
index 2f7e6bd..638b726 100644
--- a/doc/spinbox.n
+++ b/doc/spinbox.n
@@ -219,15 +219,19 @@ were editing the spinbox widget from). It is also recommended to not set an
associated \fB\-textvariable\fR during validation, as that can cause the
spinbox widget to become out of sync with the \fB\-textvariable\fR.
.PP
-Also, the \fBvalidate\fR option will set itself to \fBnone\fR when the
-spinbox value gets changed because of adjustment of \fBfrom\fR or \fBto\fR
-and the \fBvalidateCommand\fR returns false. For instance
+Also, the \fB-validate\fR option will set itself to \fBnone\fR when the
+spinbox value gets changed because of adjustment of \fB-from\fR or \fB-to\fR
+and the \fB-validatecommand\fR returns false. For instance
.CS
\fIspinbox pathName \-from 1 \-to 10 \-validate all \-vcmd {return 0}\fR
.CE
-will in fact set the \fBvalidate\fR option to \fBnone\fR because the default
-value for the spinbox gets changed (due to the \fBfrom\fR and \fBto\fR
+will in fact set the \fB-validate\fR option to \fBnone\fR because the default
+value for the spinbox gets changed (due to the \fB-from\fR and \fB-to\fR
options) to a value not accepted by the validation script.
+.PP
+Moreover, forced validation is performed when invoking any spinbutton of
+the spinbox. If the validation script returns false in this situation,
+then the \fB-validate\fR option will be automatically set to \fBnone\fR.
.SH "WIDGET COMMAND"
.PP
The \fBspinbox\fR command creates a new Tcl command whose
diff --git a/doc/text.n b/doc/text.n
index 9bbe8bc..ae84f5d 100644
--- a/doc/text.n
+++ b/doc/text.n
@@ -609,9 +609,11 @@ specified by the \fB\-foreground\fR tag option is used.
\fB\-wrap \fImode\fR
.
\fIMode\fR specifies how to handle lines that are wider than the text's
-window. It has the same legal values as the \fB\-wrap\fR option for the text
-widget: \fBnone\fR, \fBchar\fR, or \fBword\fR. If this tag option is
-specified, it overrides the \fB\-wrap\fR option for the text widget.
+window. This option only applies to a display line if it applies to the
+first non-elided character on that display line. It has the same legal
+values as the \fB\-wrap\fR option for the text widget: \fBnone\fR,
+\fBchar\fR, or \fBword\fR. If this tag option is specified, it
+overrides the \fB\-wrap\fR option for the text widget.
.PP
If a character has several tags associated with it, and if their display
options conflict, then the options of the highest priority tag are used. If a
@@ -1307,8 +1309,9 @@ of the widget to \fIboolean\fR.
\fIpathName \fBedit redo\fR
.
When the \fB\-undo\fR option is true, reapplies the last undone edits provided
-no other edits were done since then. Generates an error when the redo stack is
-empty. Does nothing when the \fB\-undo\fR option is false.
+no other edits were done since then, and returns a list of indices indicating
+what ranges were changed by the redo operation. Generates an error when the
+redo stack is empty. Does nothing when the \fB\-undo\fR option is false.
.TP
\fIpathName \fBedit reset\fR
.
@@ -1321,9 +1324,10 @@ Inserts a separator (boundary) on the undo stack. Does nothing when the
.TP
\fIpathName \fBedit undo\fR
.
-Undoes the last edit action when the \fB\-undo\fR option is true. An edit
-action is defined as all the insert and delete commands that are recorded on
-the undo stack in between two separators. Generates an error when the undo
+Undoes the last edit action when the \fB\-undo\fR option is true, and returns a
+list of indices indicating what ranges were changed by the undo operation. An
+edit action is defined as all the insert and delete commands that are recorded
+on the undo stack in between two separators. Generates an error when the undo
stack is empty. Does nothing when the \fB\-undo\fR option is false.
.RE
.TP
diff --git a/doc/ttk_vsapi.n b/doc/ttk_vsapi.n
index 334836c..4d5c3eb 100644
--- a/doc/ttk_vsapi.n
+++ b/doc/ttk_vsapi.n
@@ -61,7 +61,7 @@ corresponding Visual Styles API state value.
This permits the element appearance to respond to changes in the
widget state such as becoming active or being pressed. The list should
be as described for the \fBttk::style map\fR command but note that the
-last pair in the list should be the default state and is typically and
+last pair in the list should be the default state and is typically an
empty list and 1. Unfortunately all the Visual Styles parts have
different state values and these must be looked up either in the
Microsoft documentation or more likely in the header files. The
diff --git a/generic/tk.decls b/generic/tk.decls
index 9ceb3af..eaaa063 100644
--- a/generic/tk.decls
+++ b/generic/tk.decls
@@ -326,7 +326,7 @@ declare 75 {
declare 76 {
void Tk_FreeTextLayout(Tk_TextLayout textLayout)
}
-declare 77 {
+declare 77 deprecated {
void Tk_FreeXId(Display *display, XID xid)
}
declare 78 {
diff --git a/generic/tk.h b/generic/tk.h
index 9403f31..1cb10e2 100644
--- a/generic/tk.h
+++ b/generic/tk.h
@@ -105,6 +105,10 @@ extern "C" {
#ifdef BUILD_tk
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLEXPORT
+#else
+# ifndef TCL_STORAGE_CLASS
+# define TCL_STORAGE_CLASS DLLIMPORT
+# endif
#endif
/*
@@ -414,7 +418,9 @@ typedef enum {
#define TK_CONFIG_COLOR_ONLY (1 << 1)
#define TK_CONFIG_MONO_ONLY (1 << 2)
#define TK_CONFIG_DONT_SET_DEFAULT (1 << 3)
-#define TK_CONFIG_OPTION_SPECIFIED (1 << 4)
+#if !defined(TK_NO_DEPRECATED) || defined(BUILD_tk)
+# define TK_CONFIG_OPTION_SPECIFIED (1 << 4)
+#endif
#define TK_CONFIG_USER_BIT 0x100
#endif /* __NO_OLD_CONFIG */
@@ -746,9 +752,10 @@ typedef XActivateDeactivateEvent XDeactivateEvent;
(((Tk_FakeWin *) (tkwin))->flags & TK_WM_MANAGEABLE)
#define Tk_ReqWidth(tkwin) (((Tk_FakeWin *) (tkwin))->reqWidth)
#define Tk_ReqHeight(tkwin) (((Tk_FakeWin *) (tkwin))->reqHeight)
-/* Tk_InternalBorderWidth is deprecated */
+#ifndef TK_NO_DEPRECATED
#define Tk_InternalBorderWidth(tkwin) \
(((Tk_FakeWin *) (tkwin))->internalBorderLeft)
+#endif /* !TK_NO_DEPRECATED */
#define Tk_InternalBorderLeft(tkwin) \
(((Tk_FakeWin *) (tkwin))->internalBorderLeft)
#define Tk_InternalBorderRight(tkwin) \
@@ -814,6 +821,9 @@ typedef struct Tk_FakeWin {
int minReqWidth;
int minReqHeight;
char *dummy20; /* geometryMaster */
+#ifdef TK_USE_INPUT_METHODS
+ int dummy21;
+#endif /* TK_USE_INPUT_METHODS */
} Tk_FakeWin;
/*
diff --git a/generic/tkBind.c b/generic/tkBind.c
index acc4e43..8a6fc56 100644
--- a/generic/tkBind.c
+++ b/generic/tkBind.c
@@ -1260,6 +1260,16 @@ Tk_BindEvent(
}
}
+ /*
+ * Ignore event types which are not in flagArray and all zeroes there.
+ * Most notably, NoExpose events can fill the ring buffer and disturb
+ * (thus masking out) event sequences of interest.
+ */
+
+ if ((eventPtr->type >= TK_LASTEVENT) || !flagArray[eventPtr->type]) {
+ return;
+ }
+
dispPtr = ((TkWindow *) tkwin)->dispPtr;
bindInfoPtr = winPtr->mainPtr->bindInfo;
@@ -3460,7 +3470,7 @@ HandleEventGenerate(
Tcl_DoWhenIdle(DoWarp, dispPtr);
dispPtr->flags |= TK_DISPLAY_IN_WARP;
}
- dispPtr->warpWindow = Tk_IdToWindow(Tk_Display(mainWin),
+ dispPtr->warpWindow = Tk_IdToWindow(dispPtr->display,
event.general.xmotion.window);
dispPtr->warpMainwin = mainWin;
dispPtr->warpX = event.general.xmotion.x;
diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c
index cbbc2b4..09ce98c 100644
--- a/generic/tkCanvUtil.c
+++ b/generic/tkCanvUtil.c
@@ -1136,7 +1136,9 @@ Tk_ConfigOutlineGC(
if (mask && (dash->number != 0)) {
gcValues->line_style = LineOnOffDash;
gcValues->dash_offset = outline->offset;
- if (dash->number > 0) {
+ if ((unsigned int)ABS(dash->number) > sizeof(char *)) {
+ gcValues->dashes = dash->pattern.pt[0];
+ } else if (dash->number != 0) {
gcValues->dashes = dash->pattern.array[0];
} else {
gcValues->dashes = (char) (4 * width + 0.5);
@@ -1340,7 +1342,9 @@ Tk_ResetOutlineGC(
if ((dash->number > 2) || (dash->number < -1) || (dash->number==2 &&
(dash->pattern.array[0] != dash->pattern.array[1])) ||
((dash->number == -1) && (dash->pattern.array[0] != ','))) {
- if (dash->number > 0) {
+ if ((unsigned int)ABS(dash->number) > sizeof(char *)) {
+ dashList = dash->pattern.pt[0];
+ } else if (dash->number != 0) {
dashList = dash->pattern.array[0];
} else {
dashList = (char) (4 * width + 0.5);
diff --git a/generic/tkCmds.c b/generic/tkCmds.c
index 6196b17..93c1fb0 100644
--- a/generic/tkCmds.c
+++ b/generic/tkCmds.c
@@ -2068,14 +2068,13 @@ TkGetDisplayOf(
* present. */
{
const char *string;
- int length;
if (objc < 1) {
return 0;
}
- string = Tcl_GetStringFromObj(objv[0], &length);
- if ((length >= 2) &&
- (strncmp(string, "-displayof", (unsigned) length) == 0)) {
+ string = Tcl_GetString(objv[0]);
+ if ((objv[0]->length >= 2) &&
+ (strncmp(string, "-displayof", objv[0]->length) == 0)) {
if (objc < 2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"value for \"-displayof\" missing", -1));
diff --git a/generic/tkConfig.c b/generic/tkConfig.c
index 9c159e6..093bd35 100644
--- a/generic/tkConfig.c
+++ b/generic/tkConfig.c
@@ -91,7 +91,7 @@ typedef struct TkOption {
*/
typedef struct OptionTable {
- int refCount; /* Counts the number of uses of this table
+ size_t refCount; /* Counts the number of uses of this table
* (the number of times Tk_CreateOptionTable
* has returned it). This can be greater than
* 1 if it is shared along several option
@@ -103,7 +103,7 @@ typedef struct OptionTable {
* templates, this points to the table
* corresponding to the next template in the
* chain. */
- int numOptions; /* The number of items in the options array
+ size_t numOptions; /* The number of items in the options array
* below. */
Option options[1]; /* Information about the individual options in
* the table. This must be the last field in
@@ -177,7 +177,7 @@ Tk_CreateOptionTable(
OptionTable *tablePtr;
const Tk_OptionSpec *specPtr, *specPtr2;
Option *optionPtr;
- int numOptions, i;
+ size_t numOptions, i;
ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
@@ -330,10 +330,9 @@ Tk_DeleteOptionTable(
{
OptionTable *tablePtr = (OptionTable *) optionTable;
Option *optionPtr;
- int count;
+ size_t count;
- tablePtr->refCount--;
- if (tablePtr->refCount > 0) {
+ if (tablePtr->refCount-- > 1) {
return;
}
@@ -978,7 +977,7 @@ GetOption(
Option *bestPtr, *optionPtr;
OptionTable *tablePtr2;
const char *p1, *p2;
- int count;
+ size_t count;
/*
* Search through all of the option tables in the chain to find the best
@@ -1539,7 +1538,7 @@ Tk_FreeConfigOptions(
{
OptionTable *tablePtr;
Option *optionPtr;
- int count;
+ size_t count;
Tcl_Obj **oldPtrPtr, *oldPtr;
char *oldInternalPtr;
const Tk_OptionSpec *specPtr;
@@ -1733,7 +1732,7 @@ Tk_GetOptionInfo(
Tcl_Obj *resultPtr;
OptionTable *tablePtr = (OptionTable *) optionTable;
Option *optionPtr;
- int count;
+ size_t count;
/*
* If information is only wanted for a single configuration spec, then
@@ -2096,9 +2095,9 @@ TkDebugConfig(
if (tablePtr == (OptionTable *) Tcl_GetHashValue(hashEntryPtr)) {
for ( ; tablePtr != NULL; tablePtr = tablePtr->nextPtr) {
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewIntObj(tablePtr->refCount));
+ Tcl_NewWideIntObj(tablePtr->refCount));
Tcl_ListObjAppendElement(NULL, objPtr,
- Tcl_NewIntObj(tablePtr->numOptions));
+ Tcl_NewWideIntObj(tablePtr->numOptions));
Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewStringObj(
tablePtr->options[0].specPtr->optionName, -1));
}
diff --git a/generic/tkConsole.c b/generic/tkConsole.c
index 8bfbe9b..57e8364 100644
--- a/generic/tkConsole.c
+++ b/generic/tkConsole.c
@@ -24,7 +24,7 @@
typedef struct ConsoleInfo {
Tcl_Interp *consoleInterp; /* Interpreter displaying the console. */
Tcl_Interp *interp; /* Interpreter controlled by console. */
- int refCount;
+ size_t refCount;
} ConsoleInfo;
/*
@@ -223,7 +223,7 @@ Tk_InitConsoleChannels(
* Ensure that we are getting a compatible version of Tcl.
*/
- if (Tcl_InitStubs(interp, "8.6", 0) == NULL) {
+ if (Tcl_InitStubs(interp, "8.6-", 0) == NULL) {
return;
}
@@ -452,7 +452,7 @@ Tk_CreateConsoleWindow(
if (mainWindow) {
Tk_DeleteEventHandler(mainWindow, StructureNotifyMask,
ConsoleEventProc, info);
- if (--info->refCount <= 0) {
+ if (info->refCount-- <= 1) {
ckfree(info);
}
}
@@ -592,7 +592,7 @@ ConsoleClose(
ConsoleInfo *info = data->info;
if (info) {
- if (--info->refCount <= 0) {
+ if (info->refCount-- <= 1) {
/*
* Assuming the Tcl_Interp * fields must already be NULL.
*/
@@ -881,7 +881,7 @@ InterpDeleteProc(
Tcl_DeleteThreadExitHandler(DeleteConsoleInterp, info->consoleInterp);
info->consoleInterp = NULL;
}
- if (--info->refCount <= 0) {
+ if (info->refCount-- <= 1) {
ckfree(info);
}
}
@@ -912,7 +912,7 @@ ConsoleDeleteProc(
if (info->consoleInterp) {
Tcl_DeleteInterp(info->consoleInterp);
}
- if (--info->refCount <= 0) {
+ if (info->refCount-- <= 1) {
ckfree(info);
}
}
@@ -949,7 +949,7 @@ ConsoleEventProc(
Tcl_EvalEx(consoleInterp, "tk::ConsoleExit", -1, TCL_EVAL_GLOBAL);
}
- if (--info->refCount <= 0) {
+ if (info->refCount-- <= 1) {
ckfree(info);
}
}
diff --git a/generic/tkDecls.h b/generic/tkDecls.h
index eaaaf6c..3b72706 100644
--- a/generic/tkDecls.h
+++ b/generic/tkDecls.h
@@ -17,6 +17,12 @@
#define TCL_STORAGE_CLASS DLLEXPORT
#endif
+#if defined(TK_NO_DEPRECATED) && defined(BUILD_tk)
+# define TK_DEPRECATED MODULE_SCOPE
+#else
+# define TK_DEPRECATED EXTERN
+#endif
+
/*
* WARNING: This file is automatically generated by the tools/genStubs.tcl
* script. Any modifications to the function declarations below should be made
@@ -281,7 +287,7 @@ EXTERN void Tk_FreePixmap(Display *display, Pixmap pixmap);
/* 76 */
EXTERN void Tk_FreeTextLayout(Tk_TextLayout textLayout);
/* 77 */
-EXTERN void Tk_FreeXId(Display *display, XID xid);
+TK_DEPRECATED void Tk_FreeXId(Display *display, XID xid);
/* 78 */
EXTERN GC Tk_GCForColor(XColor *colorPtr, Drawable drawable);
/* 79 */
diff --git a/generic/tkEntry.c b/generic/tkEntry.c
index 5681e47..acfdd31 100644
--- a/generic/tkEntry.c
+++ b/generic/tkEntry.c
@@ -1926,8 +1926,8 @@ EntryComputeGeometry(
*/
if (entryPtr->showChar != NULL) {
- Tcl_UniChar ch;
- char buf[TCL_UTF_MAX];
+ int ch;
+ char buf[6];
int size;
/*
@@ -1937,15 +1937,16 @@ EntryComputeGeometry(
* resulting string.
*/
- Tcl_UtfToUniChar(entryPtr->showChar, &ch);
- size = Tcl_UniCharToUtf(ch, buf);
+ TkUtfToUniChar(entryPtr->showChar, &ch);
+ size = TkUniCharToUtf(ch, buf);
entryPtr->numDisplayBytes = entryPtr->numChars * size;
p = ckalloc(entryPtr->numDisplayBytes + 1);
entryPtr->displayString = p;
for (i = entryPtr->numChars; --i >= 0; ) {
- p += Tcl_UniCharToUtf(ch, p);
+ memcpy(p, buf, size);
+ p += size;
}
*p = '\0';
}
@@ -3413,7 +3414,7 @@ ExpandPercents(
* list element. */
int number, length;
register const char *string;
- Tcl_UniChar ch;
+ int ch;
char numStorage[2*TCL_INTEGER_SPACE];
while (1) {
@@ -3446,7 +3447,7 @@ ExpandPercents(
before++; /* skip over % */
if (*before != '\0') {
- before += Tcl_UtfToUniChar(before, &ch);
+ before += TkUtfToUniChar(before, &ch);
} else {
ch = '%';
}
@@ -3466,7 +3467,7 @@ ExpandPercents(
string = Tk_PathName(entryPtr->tkwin);
break;
default:
- length = Tcl_UniCharToUtf(ch, numStorage);
+ length = TkUniCharToUtf(ch, numStorage);
numStorage[length] = '\0';
string = numStorage;
break;
@@ -3526,7 +3527,7 @@ ExpandPercents(
string = Tk_PathName(entryPtr->tkwin);
break;
default:
- length = Tcl_UniCharToUtf(ch, numStorage);
+ length = TkUniCharToUtf(ch, numStorage);
numStorage[length] = '\0';
string = numStorage;
break;
diff --git a/generic/tkEvent.c b/generic/tkEvent.c
index 95aeda1..d058e7c 100644
--- a/generic/tkEvent.c
+++ b/generic/tkEvent.c
@@ -356,6 +356,7 @@ CreateXIC(
/* XCreateIC failed. */
return;
}
+ winPtr->ximGeneration = dispPtr->ximGeneration;
/*
* Adjust the window's event mask if the IM requires it.
@@ -1288,6 +1289,14 @@ Tk_HandleEvent(
*/
#ifdef TK_USE_INPUT_METHODS
+ /*
+ * If the XIC has been invalidated, it must be recreated.
+ */
+ if (winPtr->dispPtr->ximGeneration != winPtr->ximGeneration) {
+ winPtr->flags &= ~TK_CHECKED_IC;
+ winPtr->inputContext = NULL;
+ }
+
if ((winPtr->dispPtr->flags & TK_DISPLAY_USE_IM)) {
if (!(winPtr->flags & (TK_CHECKED_IC|TK_ALREADY_DEAD))) {
winPtr->flags |= TK_CHECKED_IC;
@@ -1295,7 +1304,9 @@ Tk_HandleEvent(
CreateXIC(winPtr);
}
}
- if (eventPtr->type == FocusIn && winPtr->inputContext != NULL) {
+ if ((eventPtr->type == FocusIn) &&
+ (winPtr->dispPtr->inputMethod != NULL) &&
+ (winPtr->inputContext != NULL)) {
XSetICFocus(winPtr->inputContext);
}
}
diff --git a/generic/tkFont.c b/generic/tkFont.c
index 1ffac16..a00c627 100644
--- a/generic/tkFont.c
+++ b/generic/tkFont.c
@@ -41,7 +41,7 @@ typedef struct TkFontInfo {
*/
typedef struct NamedFont {
- int refCount; /* Number of users of named font. */
+ size_t refCount; /* Number of users of named font. */
int deletePending; /* Non-zero if font should be deleted when
* last reference goes away. */
TkFontAttributes fa; /* Desired attributes for named font. */
@@ -562,17 +562,19 @@ Tk_FontObjCmd(
*/
if (charPtr != NULL) {
- if (Tcl_GetCharLength(charPtr) != 1) {
+ const char *string = Tcl_GetString(charPtr);
+ int len = TkUtfToUniChar(string, &uniChar);
+
+ if (len != charPtr->length) {
resultPtr = Tcl_NewStringObj(
"expected a single character but got \"", -1);
- Tcl_AppendLimitedToObj(resultPtr, Tcl_GetString(charPtr),
+ Tcl_AppendLimitedToObj(resultPtr, string,
-1, 40, "...");
Tcl_AppendToObj(resultPtr, "\"", -1);
Tcl_SetObjResult(interp, resultPtr);
Tcl_SetErrorCode(interp, "TK", "VALUE", "FONT_SAMPLE", NULL);
return TCL_ERROR;
}
- uniChar = Tcl_GetUniChar(charPtr, 0);
}
/*
@@ -1432,8 +1434,7 @@ Tk_FreeFont(
*/
nfPtr = Tcl_GetHashValue(fontPtr->namedHashPtr);
- nfPtr->refCount--;
- if ((nfPtr->refCount == 0) && nfPtr->deletePending) {
+ if ((nfPtr->refCount-- <= 1) && nfPtr->deletePending) {
Tcl_DeleteHashEntry(fontPtr->namedHashPtr);
ckfree(nfPtr);
}
@@ -1694,7 +1695,7 @@ Tk_PostscriptFontName(
} else if (strcasecmp(family, "ZapfDingbats") == 0) {
family = "ZapfDingbats";
} else {
- Tcl_UniChar ch;
+ int ch;
/*
* Inline, capitalize the first letter of each word, lowercase the
@@ -1712,14 +1713,14 @@ Tk_PostscriptFontName(
src++;
upper = 1;
}
- src += Tcl_UtfToUniChar(src, &ch);
+ src += TkUtfToUniChar(src, &ch);
if (upper) {
- ch = (Tcl_UniChar) Tcl_UniCharToUpper(ch);
+ ch = Tcl_UniCharToUpper(ch);
upper = 0;
} else {
- ch = (Tcl_UniChar) Tcl_UniCharToLower(ch);
+ ch = Tcl_UniCharToLower(ch);
}
- dest += Tcl_UniCharToUtf(ch, dest);
+ dest += TkUniCharToUtf(ch, dest);
}
*dest = '\0';
Tcl_DStringSetLength(dsPtr, dest - Tcl_DStringValue(dsPtr));
@@ -3249,7 +3250,7 @@ Tk_TextLayoutToPostscript(
int i, j, len;
const char *p, *glyphname;
char uindex[5], c, *ps;
- Tcl_UniChar ch;
+ int ch;
Tcl_AppendToObj(psObj, "[(", -1);
for (i = 0; i < layoutPtr->numChunks; i++, chunkPtr++) {
@@ -3272,7 +3273,7 @@ Tk_TextLayoutToPostscript(
* international postscript fonts.
*/
- p += Tcl_UtfToUniChar(p, &ch);
+ p += TkUtfToUniChar(p, &ch);
if ((ch == '(') || (ch == ')') || (ch == '\\') || (ch < 0x20)) {
/*
* Tricky point: the "03" is necessary in the sprintf below,
@@ -3298,6 +3299,9 @@ Tk_TextLayoutToPostscript(
* use the full glyph name.
*/
+ if (ch > 0xffff) {
+ goto noMapping;
+ }
sprintf(uindex, "%04X", ch); /* endianness? */
glyphname = Tcl_GetVar2(interp, "::tk::psglyphs", uindex, 0);
if (glyphname) {
@@ -3318,6 +3322,7 @@ Tk_TextLayoutToPostscript(
* No known mapping for the character into the space of
* PostScript glyphs. Ignore it. :-(
*/
+noMapping: ;
#ifdef TK_DEBUG_POSTSCRIPT_OUTPUT
fprintf(stderr, "Warning: no mapping to PostScript "
diff --git a/generic/tkGC.c b/generic/tkGC.c
index c424e30..55e5774 100644
--- a/generic/tkGC.c
+++ b/generic/tkGC.c
@@ -23,7 +23,7 @@
typedef struct {
GC gc; /* Graphics context. */
Display *display; /* Display to which gc belongs. */
- int refCount; /* Number of active uses of gc. */
+ size_t refCount; /* Number of active uses of gc. */
Tcl_HashEntry *valueHashPtr;/* Entry in valueTable (needed when deleting
* this structure). */
} TkGC;
@@ -312,8 +312,7 @@ Tk_FreeGC(
Tcl_Panic("Tk_FreeGC received unknown gc argument");
}
gcPtr = Tcl_GetHashValue(idHashPtr);
- gcPtr->refCount--;
- if (gcPtr->refCount == 0) {
+ if (gcPtr->refCount-- <= 1) {
XFreeGC(gcPtr->display, gcPtr->gc);
Tcl_DeleteHashEntry(gcPtr->valueHashPtr);
Tcl_DeleteHashEntry(idHashPtr);
diff --git a/generic/tkGrid.c b/generic/tkGrid.c
index 2a88b76..62c9c59 100644
--- a/generic/tkGrid.c
+++ b/generic/tkGrid.c
@@ -3314,6 +3314,9 @@ ConfigureSlaves(
}
if (slavePtr->masterPtr != NULL && slavePtr->masterPtr != masterPtr) {
+ if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
+ Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin);
+ }
Unlink(slavePtr);
slavePtr->masterPtr = NULL;
}
diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c
index 0906673..1a9a86e 100644
--- a/generic/tkImgBmap.c
+++ b/generic/tkImgBmap.c
@@ -49,7 +49,7 @@ typedef struct BitmapMaster {
*/
typedef struct BitmapInstance {
- int refCount; /* Number of instances that share this data
+ size_t refCount; /* Number of instances that share this data
* structure. */
BitmapMaster *masterPtr; /* Pointer to master for image. */
Tk_Window tkwin; /* Window in which the instances will be
@@ -951,8 +951,7 @@ ImgBmapFree(
BitmapInstance *instancePtr = clientData;
BitmapInstance *prevPtr;
- instancePtr->refCount--;
- if (instancePtr->refCount > 0) {
+ if (instancePtr->refCount-- > 1) {
return;
}
diff --git a/generic/tkImgPNG.c b/generic/tkImgPNG.c
index c6e3029..6e64afa 100644
--- a/generic/tkImgPNG.c
+++ b/generic/tkImgPNG.c
@@ -2245,10 +2245,10 @@ ApplyAlpha(
p += offset;
if (16 == pngPtr->bitDepth) {
- register int channel;
+ register unsigned int channel;
while (p < endPtr) {
- channel = (unsigned char)
+ channel = (unsigned int)
(((p[0] << 8) | p[1]) * pngPtr->alpha);
*p++ = (unsigned char) (channel >> 8);
diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c
index bd152f2..98aaeab 100644
--- a/generic/tkImgPhInstance.c
+++ b/generic/tkImgPhInstance.c
@@ -721,8 +721,7 @@ TkImgPhotoFree(
PhotoInstance *instancePtr = clientData;
ColorTable *colorPtr;
- instancePtr->refCount -= 1;
- if (instancePtr->refCount > 0) {
+ if (instancePtr->refCount-- > 1) {
return;
}
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index 3e03f3d..1bd0142 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -409,7 +409,8 @@ ImgPhotoCmd(
Tk_PhotoImageBlock block;
Tk_Window tkwin;
Tk_PhotoImageFormat *imageFormat;
- int imageWidth, imageHeight, matched, length, oldformat = 0;
+ size_t length;
+ int imageWidth, imageHeight, matched, oldformat = 0;
Tcl_Channel chan;
Tk_PhotoHandle srcHandle;
ThreadSpecificData *tsdPtr =
@@ -446,12 +447,13 @@ ImgPhotoCmd(
Tcl_WrongNumArgs(interp, 2, objv, "option");
return TCL_ERROR;
}
- arg = Tcl_GetStringFromObj(objv[2], &length);
- if (strncmp(arg,"-data", (unsigned) length) == 0) {
+ arg = Tcl_GetString(objv[2]);
+ length = objv[2]->length;
+ if (strncmp(arg,"-data", length) == 0) {
if (masterPtr->dataString) {
Tcl_SetObjResult(interp, masterPtr->dataString);
}
- } else if (strncmp(arg,"-format", (unsigned) length) == 0) {
+ } else if (strncmp(arg,"-format", length) == 0) {
if (masterPtr->format) {
Tcl_SetObjResult(interp, masterPtr->format);
}
@@ -495,9 +497,10 @@ ImgPhotoCmd(
return TCL_OK;
} else if (objc == 3) {
- const char *arg = Tcl_GetStringFromObj(objv[2], &length);
+ const char *arg = Tcl_GetString(objv[2]);
- if (length > 1 && !strncmp(arg, "-data", (unsigned) length)) {
+ length = objv[2]->length;
+ if (length > 1 && !strncmp(arg, "-data", length)) {
Tcl_AppendResult(interp, "-data {} {} {}", NULL);
if (masterPtr->dataString) {
/*
@@ -511,7 +514,7 @@ ImgPhotoCmd(
}
return TCL_OK;
} else if (length > 1 &&
- !strncmp(arg, "-format", (unsigned) length)) {
+ !strncmp(arg, "-format", length)) {
Tcl_AppendResult(interp, "-format {} {} {}", NULL);
if (masterPtr->format) {
/*
@@ -1489,7 +1492,8 @@ ParseSubcommandOptions(
* TK_PHOTO_COMPOSITE_* constants. */
NULL
};
- int index, c, bit, currentBit, length;
+ size_t length;
+ int index, c, bit, currentBit;
int values[4], numValues, maxValues, argIndex;
const char *option, *expandedOption, *needed;
const char *const *listPtr;
@@ -1501,7 +1505,8 @@ ParseSubcommandOptions(
* optPtr->name.
*/
- expandedOption = option = Tcl_GetStringFromObj(objv[index], &length);
+ expandedOption = option = Tcl_GetString(objv[index]);
+ length = objv[index]->length;
if (option[0] != '-') {
if (optPtr->name == NULL) {
optPtr->name = objv[index];
@@ -1519,7 +1524,7 @@ ParseSubcommandOptions(
currentBit = 1;
for (listPtr = optionNames; *listPtr != NULL; ++listPtr) {
if ((c == *listPtr[0])
- && (strncmp(option, *listPtr, (size_t) length) == 0)) {
+ && (strncmp(option, *listPtr, length) == 0)) {
expandedOption = *listPtr;
if (bit != 0) {
goto unknownOrAmbiguousOption;
@@ -1535,7 +1540,11 @@ ParseSubcommandOptions(
*/
if (!(allowedOptions & bit)) {
- goto unknownOrAmbiguousOption;
+ if (optPtr->name != NULL) {
+ goto unknownOrAmbiguousOption;
+ }
+ optPtr->name = objv[index];
+ continue;
}
/*
@@ -1765,7 +1774,8 @@ ImgPhotoConfigureMaster(
const char *oldFileString, *oldPaletteString;
Tcl_Obj *oldData, *data = NULL, *oldFormat, *format = NULL;
Tcl_Obj *tempdata, *tempformat;
- int length, i, j, result, imageWidth, imageHeight, oldformat;
+ size_t length;
+ int i, j, result, imageWidth, imageHeight, oldformat;
double oldGamma;
Tcl_Channel chan;
Tk_PhotoImageFormat *imageFormat;
@@ -1773,10 +1783,11 @@ ImgPhotoConfigureMaster(
args = ckalloc((objc + 1) * sizeof(char *));
for (i = 0, j = 0; i < objc; i++,j++) {
- args[j] = Tcl_GetStringFromObj(objv[i], &length);
+ args[j] = Tcl_GetString(objv[i]);
+ length = objv[i]->length;
if ((length > 1) && (args[j][0] == '-')) {
if ((args[j][1] == 'd') &&
- !strncmp(args[j], "-data", (size_t) length)) {
+ !strncmp(args[j], "-data", length)) {
if (++i < objc) {
data = objv[i];
j--;
@@ -1789,7 +1800,7 @@ ImgPhotoConfigureMaster(
return TCL_ERROR;
}
} else if ((args[j][1] == 'f') &&
- !strncmp(args[j], "-format", (size_t) length)) {
+ !strncmp(args[j], "-format", length)) {
if (++i < objc) {
format = objv[i];
j--;
@@ -1852,9 +1863,10 @@ ImgPhotoConfigureMaster(
* Force into ByteArray format, which most (all) image handlers will
* use anyway. Empty length means ignore the -data option.
*/
+ int bytesize;
- (void) Tcl_GetByteArrayFromObj(data, &length);
- if (length) {
+ (void) Tcl_GetByteArrayFromObj(data, &bytesize);
+ if (bytesize) {
Tcl_IncrRefCount(data);
} else {
data = NULL;
@@ -1870,8 +1882,8 @@ ImgPhotoConfigureMaster(
* object.
*/
- (void) Tcl_GetStringFromObj(format, &length);
- if (length) {
+ (void) Tcl_GetString(format);
+ if (format->length) {
Tcl_IncrRefCount(format);
} else {
format = NULL;
diff --git a/generic/tkImgPhoto.h b/generic/tkImgPhoto.h
index 36bc6cb..45fac88 100644
--- a/generic/tkImgPhoto.h
+++ b/generic/tkImgPhoto.h
@@ -201,7 +201,7 @@ struct PhotoInstance {
* this particular colormap. */
PhotoInstance *nextPtr; /* Pointer to the next instance in the list of
* instances associated with this master. */
- int refCount; /* Number of instances using this structure. */
+ size_t refCount; /* Number of instances using this structure. */
Tk_Uid palette; /* Palette for these particular instances. */
double gamma; /* Gamma value for these instances. */
Tk_Uid defaultPalette; /* Default palette to use if a palette is not
diff --git a/generic/tkInt.decls b/generic/tkInt.decls
index 586b407..a13d8d7 100644
--- a/generic/tkInt.decls
+++ b/generic/tkInt.decls
@@ -1422,28 +1422,76 @@ declare 106 win {
# New in Tk 8.6
declare 107 win {
- int XFlush(Display *display)
+ int XFlush(Display *display)
}
declare 108 win {
- int XGrabServer(Display *display)
+ int XGrabServer(Display *display)
}
declare 109 win {
- int XUngrabServer(Display *display)
+ int XUngrabServer(Display *display)
}
declare 110 win {
- int XFree(void *data)
+ int XFree(void *data)
}
declare 111 win {
- int XNoOp(Display *display)
+ int XNoOp(Display *display)
}
declare 112 win {
- XAfterFunction XSynchronize(Display *display, Bool onoff)
+ XAfterFunction XSynchronize(Display *display, Bool onoff)
}
declare 113 win {
- int XSync(Display *display, Bool discard)
+ int XSync(Display *display, Bool discard)
}
declare 114 win {
- VisualID XVisualIDFromVisual(Visual *visual)
+ VisualID XVisualIDFromVisual(Visual *visual)
+}
+
+# For tktreectrl
+declare 120 win {
+ int XOffsetRegion(Region rgn, int dx, int dy)
+}
+declare 121 win {
+ int XUnionRegion(Region srca, Region srcb, Region dr_return)
+}
+
+# For 3dcanvas
+declare 122 win {
+ Window XCreateWindow(Display *display, Window parent, int x, int y,
+ unsigned int width, unsigned int height,
+ unsigned int border_width, int depth, unsigned int clazz,
+ Visual *visual, unsigned long value_mask,
+ XSetWindowAttributes *attributes)
+}
+
+# Various, e.g. for stub-enabled BLT
+declare 129 win {
+ int XLowerWindow(Display *d, Window w)
+}
+declare 130 win {
+ int XFillArcs(Display *d, Drawable dr, GC gc, XArc *a, int n)
+}
+declare 131 win {
+ int XDrawArcs(Display *d, Drawable dr, GC gc, XArc *a, int n)
+}
+declare 132 win {
+ int XDrawRectangles(Display *d, Drawable dr, GC gc, XRectangle *r, int n)
+}
+declare 133 win {
+ int XDrawSegments(Display *d, Drawable dr, GC gc, XSegment *s, int n)
+}
+declare 134 win {
+ int XDrawPoint(Display *d, Drawable dr, GC gc, int x, int y)
+}
+declare 135 win {
+ int XDrawPoints(Display *d, Drawable dr, GC gc, XPoint *p, int n, int m)
+}
+declare 136 win {
+ int XReparentWindow(Display *d, Window w, Window p, int x, int y)
+}
+declare 137 win {
+ int XPutImage(Display *d, Drawable dr, GC gc, XImage *im,
+ int sx, int sy, int dx, int dy,
+ unsigned int w, unsigned int h)
}
################################
@@ -1725,7 +1773,7 @@ declare 79 aqua {
XTextProperty *text_prop_return)
}
declare 80 aqua {
- void XDrawSegments(Display *display, Drawable d, GC gc,
+ int XDrawSegments(Display *display, Drawable d, GC gc,
XSegment *segments, int nsegments)
}
declare 81 aqua {
@@ -1743,10 +1791,10 @@ declare 84 aqua {
void XClearWindow(Display *d, Window w)
}
declare 85 aqua {
- void XDrawPoint(Display *display, Drawable d, GC gc, int x, int y)
+ int XDrawPoint(Display *display, Drawable d, GC gc, int x, int y)
}
declare 86 aqua {
- void XDrawPoints(Display *display, Drawable d, GC gc, XPoint *points,
+ int XDrawPoints(Display *display, Drawable d, GC gc, XPoint *points,
int npoints, int mode)
}
declare 87 aqua {
diff --git a/generic/tkInt.h b/generic/tkInt.h
index 0b502e4..3138ffc 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -478,7 +478,7 @@ typedef struct TkDisplay {
#endif /* TK_USE_INPUT_METHODS */
Tcl_HashTable winTable; /* Maps from X window ids to TkWindow ptrs. */
- int refCount; /* Reference count of how many Tk applications
+ size_t refCount; /* Reference count of how many Tk applications
* are using this display. Used to clean up
* the display when we no longer have any Tk
* applications using it. */
@@ -508,6 +508,9 @@ typedef struct TkDisplay {
int iconDataSize; /* Size of default iconphoto image data. */
unsigned char *iconDataPtr; /* Default iconphoto image data, if set. */
+#ifdef TK_USE_INPUT_METHODS
+ int ximGeneration; /* Used to invalidate XIC */
+#endif /* TK_USE_INPUT_METHODS */
} TkDisplay;
/*
@@ -579,7 +582,7 @@ typedef struct TkEventHandler {
*/
typedef struct TkMainInfo {
- int refCount; /* Number of windows whose "mainPtr" fields
+ size_t refCount; /* Number of windows whose "mainPtr" fields
* point here. When this becomes zero, can
* free up the structure (the reference count
* is zero because windows can get deleted in
@@ -809,6 +812,9 @@ typedef struct TkWindow {
int minReqWidth; /* Minimum requested width. */
int minReqHeight; /* Minimum requested height. */
char *geometryMaster;
+#ifdef TK_USE_INPUT_METHODS
+ int ximGeneration; /* Used to invalidate XIC */
+#endif /* TK_USE_INPUT_METHODS */
} TkWindow;
/*
@@ -1232,6 +1238,14 @@ MODULE_SCOPE Status TkParseColor (Display * display,
MODULE_SCOPE void TkUnixSetXftClipRegion(TkRegion clipRegion);
#endif
+#if TCL_UTF_MAX > 4
+# define TkUtfToUniChar Tcl_UtfToUniChar
+# define TkUniCharToUtf Tcl_UniCharToUtf
+#else
+ MODULE_SCOPE int TkUtfToUniChar(const char *, int *);
+ MODULE_SCOPE int TkUniCharToUtf(int, char *);
+#endif
+
/*
* Unsupported commands.
*/
diff --git a/generic/tkIntXlibDecls.h b/generic/tkIntXlibDecls.h
index 6ac7ccb..67b7c39 100644
--- a/generic/tkIntXlibDecls.h
+++ b/generic/tkIntXlibDecls.h
@@ -23,11 +23,25 @@
# include <tcl.h>
#endif
+#ifndef EXTERN
+# define EXTERN extern TCL_STORAGE_CLASS
+#endif
+
+/* Some (older) versions of X11/Xutil.h have a wrong signature of those
+ two functions, so move them out of the way temporarly. */
+#define XOffsetRegion _XOffsetRegion
+#define XUnionRegion _XUnionRegion
#include "X11/Xutil.h"
+#undef XOffsetRegion
+#undef XUnionRegion
#ifdef BUILD_tk
-#undef TCL_STORAGE_CLASS
-#define TCL_STORAGE_CLASS DLLEXPORT
+# undef TCL_STORAGE_CLASS
+# define TCL_STORAGE_CLASS DLLEXPORT
+#else
+# ifndef TCL_STORAGE_CLASS
+# define TCL_STORAGE_CLASS DLLIMPORT
+# endif
#endif
typedef int (*XAfterFunction) ( /* WARNING, this type not in Xlib spec */
@@ -356,6 +370,57 @@ EXTERN XAfterFunction XSynchronize(Display *display, Bool onoff);
EXTERN int XSync(Display *display, Bool discard);
/* 114 */
EXTERN VisualID XVisualIDFromVisual(Visual *visual);
+/* Slot 115 is reserved */
+/* Slot 116 is reserved */
+/* Slot 117 is reserved */
+/* Slot 118 is reserved */
+/* Slot 119 is reserved */
+/* 120 */
+EXTERN int XOffsetRegion(Region rgn, int dx, int dy);
+/* 121 */
+EXTERN int XUnionRegion(Region srca, Region srcb,
+ Region dr_return);
+/* 122 */
+EXTERN Window XCreateWindow(Display *display, Window parent, int x,
+ int y, unsigned int width,
+ unsigned int height,
+ unsigned int border_width, int depth,
+ unsigned int clazz, Visual *visual,
+ unsigned long value_mask,
+ XSetWindowAttributes *attributes);
+/* Slot 123 is reserved */
+/* Slot 124 is reserved */
+/* Slot 125 is reserved */
+/* Slot 126 is reserved */
+/* Slot 127 is reserved */
+/* Slot 128 is reserved */
+/* 129 */
+EXTERN int XLowerWindow(Display *d, Window w);
+/* 130 */
+EXTERN int XFillArcs(Display *d, Drawable dr, GC gc, XArc *a,
+ int n);
+/* 131 */
+EXTERN int XDrawArcs(Display *d, Drawable dr, GC gc, XArc *a,
+ int n);
+/* 132 */
+EXTERN int XDrawRectangles(Display *d, Drawable dr, GC gc,
+ XRectangle *r, int n);
+/* 133 */
+EXTERN int XDrawSegments(Display *d, Drawable dr, GC gc,
+ XSegment *s, int n);
+/* 134 */
+EXTERN int XDrawPoint(Display *d, Drawable dr, GC gc, int x,
+ int y);
+/* 135 */
+EXTERN int XDrawPoints(Display *d, Drawable dr, GC gc,
+ XPoint *p, int n, int m);
+/* 136 */
+EXTERN int XReparentWindow(Display *d, Window w, Window p,
+ int x, int y);
+/* 137 */
+EXTERN int XPutImage(Display *d, Drawable dr, GC gc, XImage *im,
+ int sx, int sy, int dx, int dy,
+ unsigned int w, unsigned int h);
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
/* 0 */
@@ -584,7 +649,7 @@ EXTERN void XSetWMClientMachine(Display *display, Window w,
EXTERN Status XStringListToTextProperty(char **list, int count,
XTextProperty *text_prop_return);
/* 80 */
-EXTERN void XDrawSegments(Display *display, Drawable d, GC gc,
+EXTERN int XDrawSegments(Display *display, Drawable d, GC gc,
XSegment *segments, int nsegments);
/* 81 */
EXTERN void XForceScreenSaver(Display *display, int mode);
@@ -598,10 +663,10 @@ EXTERN int XFillRectangle(Display *display, Drawable d, GC gc,
/* 84 */
EXTERN void XClearWindow(Display *d, Window w);
/* 85 */
-EXTERN void XDrawPoint(Display *display, Drawable d, GC gc,
+EXTERN int XDrawPoint(Display *display, Drawable d, GC gc,
int x, int y);
/* 86 */
-EXTERN void XDrawPoints(Display *display, Drawable d, GC gc,
+EXTERN int XDrawPoints(Display *display, Drawable d, GC gc,
XPoint *points, int npoints, int mode);
/* 87 */
EXTERN int XWarpPointer(Display *display, Window src_w,
@@ -742,6 +807,29 @@ typedef struct TkIntXlibStubs {
XAfterFunction (*xSynchronize) (Display *display, Bool onoff); /* 112 */
int (*xSync) (Display *display, Bool discard); /* 113 */
VisualID (*xVisualIDFromVisual) (Visual *visual); /* 114 */
+ void (*reserved115)(void);
+ void (*reserved116)(void);
+ void (*reserved117)(void);
+ void (*reserved118)(void);
+ void (*reserved119)(void);
+ int (*xOffsetRegion) (Region rgn, int dx, int dy); /* 120 */
+ int (*xUnionRegion) (Region srca, Region srcb, Region dr_return); /* 121 */
+ Window (*xCreateWindow) (Display *display, Window parent, int x, int y, unsigned int width, unsigned int height, unsigned int border_width, int depth, unsigned int clazz, Visual *visual, unsigned long value_mask, XSetWindowAttributes *attributes); /* 122 */
+ void (*reserved123)(void);
+ void (*reserved124)(void);
+ void (*reserved125)(void);
+ void (*reserved126)(void);
+ void (*reserved127)(void);
+ void (*reserved128)(void);
+ int (*xLowerWindow) (Display *d, Window w); /* 129 */
+ int (*xFillArcs) (Display *d, Drawable dr, GC gc, XArc *a, int n); /* 130 */
+ int (*xDrawArcs) (Display *d, Drawable dr, GC gc, XArc *a, int n); /* 131 */
+ int (*xDrawRectangles) (Display *d, Drawable dr, GC gc, XRectangle *r, int n); /* 132 */
+ int (*xDrawSegments) (Display *d, Drawable dr, GC gc, XSegment *s, int n); /* 133 */
+ int (*xDrawPoint) (Display *d, Drawable dr, GC gc, int x, int y); /* 134 */
+ int (*xDrawPoints) (Display *d, Drawable dr, GC gc, XPoint *p, int n, int m); /* 135 */
+ int (*xReparentWindow) (Display *d, Window w, Window p, int x, int y); /* 136 */
+ int (*xPutImage) (Display *d, Drawable dr, GC gc, XImage *im, int sx, int sy, int dx, int dy, unsigned int w, unsigned int h); /* 137 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
int (*xSetDashes) (Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n); /* 0 */
@@ -824,13 +912,13 @@ typedef struct TkIntXlibStubs {
XVisualInfo * (*xGetVisualInfo) (Display *display, long vinfo_mask, XVisualInfo *vinfo_template, int *nitems_return); /* 77 */
void (*xSetWMClientMachine) (Display *display, Window w, XTextProperty *text_prop); /* 78 */
Status (*xStringListToTextProperty) (char **list, int count, XTextProperty *text_prop_return); /* 79 */
- void (*xDrawSegments) (Display *display, Drawable d, GC gc, XSegment *segments, int nsegments); /* 80 */
+ int (*xDrawSegments) (Display *display, Drawable d, GC gc, XSegment *segments, int nsegments); /* 80 */
void (*xForceScreenSaver) (Display *display, int mode); /* 81 */
int (*xDrawLine) (Display *d, Drawable dr, GC g, int x1, int y1, int x2, int y2); /* 82 */
int (*xFillRectangle) (Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height); /* 83 */
void (*xClearWindow) (Display *d, Window w); /* 84 */
- void (*xDrawPoint) (Display *display, Drawable d, GC gc, int x, int y); /* 85 */
- void (*xDrawPoints) (Display *display, Drawable d, GC gc, XPoint *points, int npoints, int mode); /* 86 */
+ int (*xDrawPoint) (Display *display, Drawable d, GC gc, int x, int y); /* 85 */
+ int (*xDrawPoints) (Display *display, Drawable d, GC gc, XPoint *points, int npoints, int mode); /* 86 */
int (*xWarpPointer) (Display *display, Window src_w, Window dest_w, int src_x, int src_y, unsigned int src_width, unsigned int src_height, int dest_x, int dest_y); /* 87 */
void (*xQueryColor) (Display *display, Colormap colormap, XColor *def_in_out); /* 88 */
void (*xQueryColors) (Display *display, Colormap colormap, XColor *defs_in_out, int ncolors); /* 89 */
@@ -1081,6 +1169,41 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr;
(tkIntXlibStubsPtr->xSync) /* 113 */
#define XVisualIDFromVisual \
(tkIntXlibStubsPtr->xVisualIDFromVisual) /* 114 */
+/* Slot 115 is reserved */
+/* Slot 116 is reserved */
+/* Slot 117 is reserved */
+/* Slot 118 is reserved */
+/* Slot 119 is reserved */
+#define XOffsetRegion \
+ (tkIntXlibStubsPtr->xOffsetRegion) /* 120 */
+#define XUnionRegion \
+ (tkIntXlibStubsPtr->xUnionRegion) /* 121 */
+#define XCreateWindow \
+ (tkIntXlibStubsPtr->xCreateWindow) /* 122 */
+/* Slot 123 is reserved */
+/* Slot 124 is reserved */
+/* Slot 125 is reserved */
+/* Slot 126 is reserved */
+/* Slot 127 is reserved */
+/* Slot 128 is reserved */
+#define XLowerWindow \
+ (tkIntXlibStubsPtr->xLowerWindow) /* 129 */
+#define XFillArcs \
+ (tkIntXlibStubsPtr->xFillArcs) /* 130 */
+#define XDrawArcs \
+ (tkIntXlibStubsPtr->xDrawArcs) /* 131 */
+#define XDrawRectangles \
+ (tkIntXlibStubsPtr->xDrawRectangles) /* 132 */
+#define XDrawSegments \
+ (tkIntXlibStubsPtr->xDrawSegments) /* 133 */
+#define XDrawPoint \
+ (tkIntXlibStubsPtr->xDrawPoint) /* 134 */
+#define XDrawPoints \
+ (tkIntXlibStubsPtr->xDrawPoints) /* 135 */
+#define XReparentWindow \
+ (tkIntXlibStubsPtr->xReparentWindow) /* 136 */
+#define XPutImage \
+ (tkIntXlibStubsPtr->xPutImage) /* 137 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
#define XSetDashes \
diff --git a/generic/tkMain.c b/generic/tkMain.c
index 1b21223..87a3cf7 100644
--- a/generic/tkMain.c
+++ b/generic/tkMain.c
@@ -196,7 +196,7 @@ Tk_MainEx(
* Ensure that we are getting a compatible version of Tcl.
*/
- if (Tcl_InitStubs(interp, "8.6", 0) == NULL) {
+ if (Tcl_InitStubs(interp, "8.6-", 0) == NULL) {
if (Tcl_InitStubs(interp, "8.1", 0) == NULL) {
abort();
} else {
diff --git a/generic/tkObj.c b/generic/tkObj.c
index 7c09656..90fedbc 100644
--- a/generic/tkObj.c
+++ b/generic/tkObj.c
@@ -153,8 +153,19 @@ GetTypeCache(void)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (tsdPtr->doubleTypePtr == NULL) {
- tsdPtr->doubleTypePtr = Tcl_GetObjType("double");
- tsdPtr->intTypePtr = Tcl_GetObjType("int");
+ /* Smart initialization of doubleTypePtr/intTypePtr without
+ * hash-table lookup or creating complete Tcl_Obj's */
+ Tcl_Obj obj;
+ obj.length = 3;
+ obj.bytes = (char *)"0.0";
+ obj.typePtr = NULL;
+ Tcl_GetDoubleFromObj(NULL, &obj, &obj.internalRep.doubleValue);
+ tsdPtr->doubleTypePtr = obj.typePtr;
+ obj.bytes += 2;
+ obj.length = 1;
+ obj.typePtr = NULL;
+ Tcl_GetLongFromObj(NULL, &obj, &obj.internalRep.longValue);
+ tsdPtr->intTypePtr = obj.typePtr;
}
return tsdPtr;
}
diff --git a/generic/tkPack.c b/generic/tkPack.c
index 88a4b2d..8257b43 100644
--- a/generic/tkPack.c
+++ b/generic/tkPack.c
@@ -122,8 +122,10 @@ static int ConfigureSlaves(Tcl_Interp *interp, Tk_Window tkwin,
int objc, Tcl_Obj *const objv[]);
static void DestroyPacker(void *memPtr);
static Packer * GetPacker(Tk_Window tkwin);
+#ifndef TK_NO_DEPRECATED
static int PackAfter(Tcl_Interp *interp, Packer *prevPtr,
Packer *masterPtr, int objc,Tcl_Obj *const objv[]);
+#endif /* !TK_NO_DEPRECATED */
static void PackStructureProc(ClientData clientData,
XEvent *eventPtr);
static void Unlink(Packer *packPtr);
@@ -197,11 +199,14 @@ Tk_PackObjCmd(
Tk_Window tkwin = clientData;
const char *argv2;
static const char *const optionStrings[] = {
- /* after, append, before and unpack are deprecated */
+#ifndef TK_NO_DEPRECATED
"after", "append", "before", "unpack",
+#endif /* !TK_NO_DEPRECATED */
"configure", "forget", "info", "propagate", "slaves", NULL };
enum options {
+#ifndef TK_NO_DEPRECATED
PACK_AFTER, PACK_APPEND, PACK_BEFORE, PACK_UNPACK,
+#endif /* !TK_NO_DEPRECATED */
PACK_CONFIGURE, PACK_FORGET, PACK_INFO, PACK_PROPAGATE, PACK_SLAVES };
int index;
@@ -219,6 +224,7 @@ Tk_PackObjCmd(
if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings,
sizeof(char *), "option", 0, &index) != TCL_OK) {
+#ifndef TK_NO_DEPRECATED
/*
* Call it again without the deprecated ones to get a proper error
* message. This works well since there can't be any ambiguity between
@@ -228,11 +234,13 @@ Tk_PackObjCmd(
Tcl_ResetResult(interp);
Tcl_GetIndexFromObjStruct(interp, objv[1], &optionStrings[4],
sizeof(char *), "option", 0, &index);
+#endif /* TK_NO_DEPRECATED */
return TCL_ERROR;
}
argv2 = Tcl_GetString(objv[2]);
switch ((enum options) index) {
+#ifndef TK_NO_DEPRECATED
case PACK_AFTER: {
Packer *prevPtr;
Tk_Window tkwin2;
@@ -297,6 +305,7 @@ Tk_PackObjCmd(
}
return PackAfter(interp, prevPtr, masterPtr, objc-3, objv+3);
}
+#endif /* !TK_NO_DEPRECATED */
case PACK_CONFIGURE:
if (argv2[0] != '.') {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -458,6 +467,7 @@ Tk_PackObjCmd(
Tcl_SetObjResult(interp, resultObj);
break;
}
+#ifndef TK_NO_DEPRECATED
case PACK_UNPACK: {
Tk_Window tkwin2;
Packer *packPtr;
@@ -481,6 +491,7 @@ Tk_PackObjCmd(
}
break;
}
+#endif /* !TK_NO_DEPRECATED */
}
return TCL_OK;
@@ -1087,6 +1098,7 @@ GetPacker(
*------------------------------------------------------------------------
*/
+#ifndef TK_NO_DEPRECATED
static int
PackAfter(
Tcl_Interp *interp, /* Interpreter for error reporting. */
@@ -1307,6 +1319,7 @@ PackAfter(
}
return TCL_OK;
}
+#endif /* !TK_NO_DEPRECATED */
/*
*----------------------------------------------------------------------
diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c
index f350d0a..4bfc695 100644
--- a/generic/tkPanedWindow.c
+++ b/generic/tkPanedWindow.c
@@ -1484,10 +1484,10 @@ DisplayPanedWindow(
*/
if (horizontal) {
- sashHeight = Tk_Height(tkwin) - (2 * Tk_InternalBorderWidth(tkwin));
+ sashHeight = Tk_Height(tkwin) - (2 * Tk_InternalBorderLeft(tkwin));
sashWidth = pwPtr->sashWidth;
} else {
- sashWidth = Tk_Width(tkwin) - (2 * Tk_InternalBorderWidth(tkwin));
+ sashWidth = Tk_Width(tkwin) - (2 * Tk_InternalBorderLeft(tkwin));
sashHeight = pwPtr->sashWidth;
}
@@ -1754,7 +1754,7 @@ ArrangePanes(
*/
paneDynSize = paneDynMinSize = 0;
- internalBW = Tk_InternalBorderWidth(pwPtr->tkwin);
+ internalBW = Tk_InternalBorderLeft(pwPtr->tkwin);
pwHeight = Tk_Height(pwPtr->tkwin) - (2 * internalBW);
pwWidth = Tk_Width(pwPtr->tkwin) - (2 * internalBW);
x = y = internalBW;
@@ -2184,7 +2184,7 @@ ComputeGeometry(
pwPtr->flags |= REQUESTED_RELAYOUT;
- x = y = internalBw = Tk_InternalBorderWidth(pwPtr->tkwin);
+ x = y = internalBw = Tk_InternalBorderLeft(pwPtr->tkwin);
reqWidth = reqHeight = 0;
/*
@@ -2890,7 +2890,7 @@ PanedWindowProxyCommand(
return TCL_ERROR;
}
- internalBW = Tk_InternalBorderWidth(pwPtr->tkwin);
+ internalBW = Tk_InternalBorderLeft(pwPtr->tkwin);
if (pwPtr->orient == ORIENT_HORIZONTAL) {
if (x < 0) {
x = 0;
@@ -2899,10 +2899,10 @@ PanedWindowProxyCommand(
if (x > pwWidth) {
x = pwWidth;
}
- y = Tk_InternalBorderWidth(pwPtr->tkwin);
+ y = Tk_InternalBorderLeft(pwPtr->tkwin);
sashWidth = pwPtr->sashWidth;
sashHeight = Tk_Height(pwPtr->tkwin) -
- (2 * Tk_InternalBorderWidth(pwPtr->tkwin));
+ (2 * Tk_InternalBorderLeft(pwPtr->tkwin));
} else {
if (y < 0) {
y = 0;
@@ -2911,10 +2911,10 @@ PanedWindowProxyCommand(
if (y > pwHeight) {
y = pwHeight;
}
- x = Tk_InternalBorderWidth(pwPtr->tkwin);
+ x = Tk_InternalBorderLeft(pwPtr->tkwin);
sashHeight = pwPtr->sashWidth;
sashWidth = Tk_Width(pwPtr->tkwin) -
- (2 * Tk_InternalBorderWidth(pwPtr->tkwin));
+ (2 * Tk_InternalBorderLeft(pwPtr->tkwin));
}
if (sashWidth < 1) {
@@ -3053,7 +3053,7 @@ PanedWindowIdentifyCoords(
} else {
sashHeight = Tk_ReqHeight(pwPtr->tkwin);
}
- sashHeight -= 2 * Tk_InternalBorderWidth(pwPtr->tkwin);
+ sashHeight -= 2 * Tk_InternalBorderLeft(pwPtr->tkwin);
if (pwPtr->showHandle && pwPtr->handleSize > pwPtr->sashWidth) {
sashWidth = pwPtr->handleSize;
lpad = (pwPtr->handleSize - pwPtr->sashWidth) / 2;
@@ -3081,7 +3081,7 @@ PanedWindowIdentifyCoords(
} else {
sashWidth = Tk_ReqWidth(pwPtr->tkwin);
}
- sashWidth -= 2 * Tk_InternalBorderWidth(pwPtr->tkwin);
+ sashWidth -= 2 * Tk_InternalBorderLeft(pwPtr->tkwin);
lpad = rpad = 0;
}
diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c
index 5017d30..9c1ceb8 100644
--- a/generic/tkScrollbar.c
+++ b/generic/tkScrollbar.c
@@ -179,10 +179,12 @@ Tk_ScrollbarObjCmd(
scrollPtr->sliderLast = 0;
scrollPtr->activeField = 0;
scrollPtr->activeRelief = TK_RELIEF_RAISED;
+#ifndef TK_NO_DEPRECATED
scrollPtr->totalUnits = 0;
scrollPtr->windowUnits = 0;
scrollPtr->firstUnit = 0;
scrollPtr->lastUnit = 0;
+#endif /* TK_NO_DEPRECATED */
scrollPtr->firstFraction = 0.0;
scrollPtr->lastFraction = 0.0;
scrollPtr->cursor = None;
@@ -377,10 +379,13 @@ ScrollbarWidgetObjCmd(
Tcl_WrongNumArgs(interp, 1, objv, "get");
goto error;
}
+#ifndef TK_NO_DEPRECATED
if (scrollPtr->flags & NEW_STYLE_COMMANDS) {
+#endif /* TK_NO_DEPRECATED */
resObjs[0] = Tcl_NewDoubleObj(scrollPtr->firstFraction);
resObjs[1] = Tcl_NewDoubleObj(scrollPtr->lastFraction);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, resObjs));
+#ifndef TK_NO_DEPRECATED
} else {
resObjs[0] = Tcl_NewIntObj(scrollPtr->totalUnits);
resObjs[1] = Tcl_NewIntObj(scrollPtr->windowUnits);
@@ -388,6 +393,7 @@ ScrollbarWidgetObjCmd(
resObjs[3] = Tcl_NewIntObj(scrollPtr->lastUnit);
Tcl_SetObjResult(interp, Tcl_NewListObj(4, resObjs));
}
+#endif /* TK_NO_DEPRECATED */
break;
}
case COMMAND_IDENTIFY: {
@@ -413,8 +419,6 @@ ScrollbarWidgetObjCmd(
break;
}
case COMMAND_SET: {
- int totalUnits, windowUnits, firstUnit, lastUnit;
-
if (objc == 4) {
double first, last;
@@ -438,8 +442,10 @@ ScrollbarWidgetObjCmd(
} else {
scrollPtr->lastFraction = last;
}
+#ifndef TK_NO_DEPRECATED
scrollPtr->flags |= NEW_STYLE_COMMANDS;
} else if (objc == 6) {
+ int totalUnits, windowUnits, firstUnit, lastUnit;
if (Tcl_GetIntFromObj(interp, objv[2], &totalUnits) != TCL_OK) {
goto error;
}
@@ -477,10 +483,9 @@ ScrollbarWidgetObjCmd(
scrollPtr->lastFraction = ((double) (lastUnit+1))/totalUnits;
}
scrollPtr->flags &= ~NEW_STYLE_COMMANDS;
+#endif /* !TK_NO_DEPRECATED */
} else {
Tcl_WrongNumArgs(interp, 1, objv, "set firstFraction lastFraction");
- Tcl_AppendResult(interp, " or \"", Tcl_GetString(objv[0]),
- " set totalUnits windowUnits firstUnit lastUnit\"", NULL);
goto error;
}
TkpComputeScrollbarGeometry(scrollPtr);
diff --git a/generic/tkScrollbar.h b/generic/tkScrollbar.h
index b0cd085..66b12b8 100644
--- a/generic/tkScrollbar.h
+++ b/generic/tkScrollbar.h
@@ -96,6 +96,7 @@ typedef struct TkScrollbar {
* the NEW_STYLE_COMMANDS flag is 0.
*/
+#ifndef TK_NO_DEPRECATED
int totalUnits; /* Total dimension of application, in units.
* Valid only if the NEW_STYLE_COMMANDS flag
* isn't set. */
@@ -108,6 +109,9 @@ typedef struct TkScrollbar {
int lastUnit; /* Index of last unit visible in window.
* Valid only if the NEW_STYLE_COMMANDS flag
* isn't set. */
+#else
+ int dummy1,dummy2,dummy3,dummy4; /* sizeof(TkScrollbar) should not depend on TK_NO_DEPRECATED */
+#endif /* TK_NO_DEPRECATED */
double firstFraction; /* Position of first visible thing in window,
* specified as a fraction between 0 and
* 1.0. */
@@ -153,7 +157,9 @@ typedef struct TkScrollbar {
*/
#define REDRAW_PENDING 1
+#ifndef TK_NO_DEPRECATED
#define NEW_STYLE_COMMANDS 2
+#endif /* TK_NO_DEPRECATED */
#define GOT_FOCUS 4
/*
diff --git a/generic/tkSelect.c b/generic/tkSelect.c
index ab9018a..74b3964 100644
--- a/generic/tkSelect.c
+++ b/generic/tkSelect.c
@@ -26,7 +26,7 @@ typedef struct {
int charOffset; /* The offset of the next char to retrieve. */
int byteOffset; /* The expected byte offset of the next
* chunk. */
- char buffer[TCL_UTF_MAX]; /* A buffer to hold part of a UTF character
+ char buffer[4]; /* A buffer to hold part of a UTF character
* that is split across chunks. */
char command[1]; /* Command to invoke. Actual space is
* allocated as large as necessary. This must
diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c
index 21e6a68..7f5b3be 100644
--- a/generic/tkStubInit.c
+++ b/generic/tkStubInit.c
@@ -40,6 +40,10 @@ MODULE_SCOPE const TkStubs tkStubs;
#undef Tk_MainEx
#undef Tk_FreeXId
+
+#ifdef TK_NO_DEPRECATED
+#define Tk_FreeXId 0
+#else
static void
doNothing(void)
{
@@ -47,6 +51,7 @@ doNothing(void)
}
#define Tk_FreeXId ((void (*)(Display *, XID)) doNothing)
+#endif
#ifdef _WIN32
@@ -71,6 +76,9 @@ TkCreateXEventSource(void)
# define TkUnixContainerId 0
# define TkUnixDoOneXEvent 0
# define TkUnixSetMenubar 0
+# define XCreateWindow 0
+# define XOffsetRegion 0
+# define XUnionRegion 0
# define TkWmCleanup (void (*)(TkDisplay *)) TkpSync
# define TkSendCleanup (void (*)(TkDisplay *)) TkpSync
# define TkpTestsendCmd 0
@@ -707,6 +715,29 @@ static const TkIntXlibStubs tkIntXlibStubs = {
XSynchronize, /* 112 */
XSync, /* 113 */
XVisualIDFromVisual, /* 114 */
+ 0, /* 115 */
+ 0, /* 116 */
+ 0, /* 117 */
+ 0, /* 118 */
+ 0, /* 119 */
+ XOffsetRegion, /* 120 */
+ XUnionRegion, /* 121 */
+ XCreateWindow, /* 122 */
+ 0, /* 123 */
+ 0, /* 124 */
+ 0, /* 125 */
+ 0, /* 126 */
+ 0, /* 127 */
+ 0, /* 128 */
+ XLowerWindow, /* 129 */
+ XFillArcs, /* 130 */
+ XDrawArcs, /* 131 */
+ XDrawRectangles, /* 132 */
+ XDrawSegments, /* 133 */
+ XDrawPoint, /* 134 */
+ XDrawPoints, /* 135 */
+ XReparentWindow, /* 136 */
+ XPutImage, /* 137 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
XSetDashes, /* 0 */
diff --git a/generic/tkTest.c b/generic/tkTest.c
index faba89d..1f801be 100644
--- a/generic/tkTest.c
+++ b/generic/tkTest.c
@@ -227,7 +227,7 @@ Tktest_Init(
{
static int initialized = 0;
- if (Tcl_InitStubs(interp, "8.6", 0) == NULL) {
+ if (Tcl_InitStubs(interp, "8.6-", 0) == NULL) {
return TCL_ERROR;
}
if (Tk_InitStubs(interp, TK_VERSION, 0) == NULL) {
@@ -452,7 +452,7 @@ TestcursorObjCmd(
* A standard Tcl result.
*
* Side effects:
- * All the intepreters created by previous calls to "testnewapp" get
+ * All the interpreters created by previous calls to "testnewapp" get
* deleted.
*
*----------------------------------------------------------------------
diff --git a/generic/tkText.c b/generic/tkText.c
index bea4c62..4f25222 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -547,7 +547,7 @@ CreateWidget(
Tcl_InitHashTable(&sharedPtr->windowTable, TCL_STRING_KEYS);
Tcl_InitHashTable(&sharedPtr->imageTable, TCL_STRING_KEYS);
sharedPtr->undoStack = TkUndoInitStack(interp,0);
- sharedPtr->undo = 1;
+ sharedPtr->undo = 0;
sharedPtr->isDirty = 0;
sharedPtr->dirtyMode = TK_TEXT_DIRTY_NORMAL;
sharedPtr->autoSeparators = 1;
@@ -1570,8 +1570,7 @@ TextWidgetObjCmd(
}
done:
- textPtr->refCount--;
- if (textPtr->refCount == 0) {
+ if (textPtr->refCount-- <= 1) {
ckfree(textPtr);
}
return result;
@@ -1964,9 +1963,7 @@ DestroyText(
* portion of the text widget.
*/
- sharedTextPtr->refCount--;
-
- if (sharedTextPtr->refCount > 0) {
+ if (sharedTextPtr->refCount-- > 1) {
TkBTreeRemoveClient(sharedTextPtr->tree, textPtr);
/*
@@ -2042,13 +2039,12 @@ DestroyText(
}
textPtr->tkwin = NULL;
- textPtr->refCount--;
Tcl_DeleteCommandFromToken(textPtr->interp, textPtr->widgetCmd);
if (textPtr->afterSyncCmd){
Tcl_DecrRefCount(textPtr->afterSyncCmd);
textPtr->afterSyncCmd = NULL;
}
- if (textPtr->refCount == 0) {
+ if (textPtr->refCount-- <= 1) {
ckfree(textPtr);
}
}
@@ -2774,6 +2770,9 @@ TextPushUndoAction(
{
TkUndoSubAtom *iAtom, *dAtom;
int canUndo, canRedo;
+ char lMarkName[20] = "tk::undoMarkL";
+ char rMarkName[20] = "tk::undoMarkR";
+ char stringUndoMarkId[7] = "";
/*
* Create the helpers.
@@ -2784,6 +2783,10 @@ TextPushUndoAction(
Tcl_Obj *markSet2InsertObj = NULL;
Tcl_Obj *insertCmdObj = Tcl_NewObj();
Tcl_Obj *deleteCmdObj = Tcl_NewObj();
+ Tcl_Obj *markSetLUndoMarkCmdObj = Tcl_NewObj();
+ Tcl_Obj *markSetRUndoMarkCmdObj = NULL;
+ Tcl_Obj *markGravityLUndoMarkCmdObj = Tcl_NewObj();
+ Tcl_Obj *markGravityRUndoMarkCmdObj = NULL;
/*
* Get the index positions.
@@ -2833,6 +2836,40 @@ TextPushUndoAction(
Tcl_ListObjAppendElement(NULL, deleteCmdObj, index1Obj);
Tcl_ListObjAppendElement(NULL, deleteCmdObj, index2Obj);
+ Tcl_ListObjAppendElement(NULL, markSetLUndoMarkCmdObj,
+ Tcl_NewStringObj(Tk_PathName(textPtr->tkwin), -1));
+ Tcl_ListObjAppendElement(NULL, markSetLUndoMarkCmdObj,
+ Tcl_NewStringObj("mark", 4));
+ Tcl_ListObjAppendElement(NULL, markSetLUndoMarkCmdObj,
+ Tcl_NewStringObj("set", 3));
+ markSetRUndoMarkCmdObj = Tcl_DuplicateObj(markSetLUndoMarkCmdObj);
+ textPtr->sharedTextPtr->undoMarkId++;
+ sprintf(stringUndoMarkId, "%d", textPtr->sharedTextPtr->undoMarkId);
+ strcat(lMarkName, stringUndoMarkId);
+ strcat(rMarkName, stringUndoMarkId);
+ Tcl_ListObjAppendElement(NULL, markSetLUndoMarkCmdObj,
+ Tcl_NewStringObj(lMarkName, -1));
+ Tcl_ListObjAppendElement(NULL, markSetRUndoMarkCmdObj,
+ Tcl_NewStringObj(rMarkName, -1));
+ Tcl_ListObjAppendElement(NULL, markSetLUndoMarkCmdObj, index1Obj);
+ Tcl_ListObjAppendElement(NULL, markSetRUndoMarkCmdObj, index2Obj);
+
+ Tcl_ListObjAppendElement(NULL, markGravityLUndoMarkCmdObj,
+ Tcl_NewStringObj(Tk_PathName(textPtr->tkwin), -1));
+ Tcl_ListObjAppendElement(NULL, markGravityLUndoMarkCmdObj,
+ Tcl_NewStringObj("mark", 4));
+ Tcl_ListObjAppendElement(NULL, markGravityLUndoMarkCmdObj,
+ Tcl_NewStringObj("gravity", 7));
+ markGravityRUndoMarkCmdObj = Tcl_DuplicateObj(markGravityLUndoMarkCmdObj);
+ Tcl_ListObjAppendElement(NULL, markGravityLUndoMarkCmdObj,
+ Tcl_NewStringObj(lMarkName, -1));
+ Tcl_ListObjAppendElement(NULL, markGravityRUndoMarkCmdObj,
+ Tcl_NewStringObj(rMarkName, -1));
+ Tcl_ListObjAppendElement(NULL, markGravityLUndoMarkCmdObj,
+ Tcl_NewStringObj("left", 4));
+ Tcl_ListObjAppendElement(NULL, markGravityRUndoMarkCmdObj,
+ Tcl_NewStringObj("right", 5));
+
/*
* Note: we don't wish to use textPtr->widgetCmd in these callbacks
* because if we delete the textPtr, but peers still exist, we will then
@@ -2850,11 +2887,19 @@ TextPushUndoAction(
insertCmdObj, NULL);
TkUndoMakeCmdSubAtom(NULL, markSet2InsertObj, iAtom);
TkUndoMakeCmdSubAtom(NULL, seeInsertObj, iAtom);
+ TkUndoMakeCmdSubAtom(NULL, markSetLUndoMarkCmdObj, iAtom);
+ TkUndoMakeCmdSubAtom(NULL, markSetRUndoMarkCmdObj, iAtom);
+ TkUndoMakeCmdSubAtom(NULL, markGravityLUndoMarkCmdObj, iAtom);
+ TkUndoMakeCmdSubAtom(NULL, markGravityRUndoMarkCmdObj, iAtom);
dAtom = TkUndoMakeSubAtom(&TextUndoRedoCallback, textPtr->sharedTextPtr,
deleteCmdObj, NULL);
TkUndoMakeCmdSubAtom(NULL, markSet1InsertObj, dAtom);
TkUndoMakeCmdSubAtom(NULL, seeInsertObj, dAtom);
+ TkUndoMakeCmdSubAtom(NULL, markSetLUndoMarkCmdObj, dAtom);
+ TkUndoMakeCmdSubAtom(NULL, markSetRUndoMarkCmdObj, dAtom);
+ TkUndoMakeCmdSubAtom(NULL, markGravityLUndoMarkCmdObj, dAtom);
+ TkUndoMakeCmdSubAtom(NULL, markGravityRUndoMarkCmdObj, dAtom);
Tcl_DecrRefCount(seeInsertObj);
Tcl_DecrRefCount(index1Obj);
@@ -4459,7 +4504,7 @@ TkTextGetTabs(
Tcl_Obj **objv;
TkTextTabArray *tabArrayPtr;
TkTextTab *tabPtr;
- Tcl_UniChar ch;
+ int ch;
double prevStop, lastStop;
/*
* Map these strings to TkTextTabAlign values.
@@ -4566,7 +4611,7 @@ TkTextGetTabs(
* There may be a more efficient way of getting this.
*/
- Tcl_UtfToUniChar(Tcl_GetString(objv[i+1]), &ch);
+ TkUtfToUniChar(Tcl_GetString(objv[i+1]), &ch);
if (!Tcl_UniCharIsAlpha(ch)) {
continue;
}
@@ -5069,6 +5114,8 @@ TextEditUndo(
TkText *textPtr) /* Overall information about text widget. */
{
int status;
+ Tcl_Obj *cmdObj;
+ int code;
if (!textPtr->sharedTextPtr->undo) {
return TCL_OK;
@@ -5092,6 +5139,22 @@ TextEditUndo(
}
textPtr->sharedTextPtr->undo = 1;
+ /*
+ * Convert undo/redo temporary marks set by TkUndoRevert() into
+ * indices left in the interp result.
+ */
+
+ cmdObj = Tcl_ObjPrintf("::tk::TextUndoRedoProcessMarks %s",
+ Tk_PathName(textPtr->tkwin));
+ Tcl_IncrRefCount(cmdObj);
+ code = Tcl_EvalObjEx(textPtr->interp, cmdObj, TCL_EVAL_GLOBAL);
+ if (code != TCL_OK) {
+ Tcl_AddErrorInfo(textPtr->interp,
+ "\n (on undoing)");
+ Tcl_BackgroundException(textPtr->interp, code);
+ }
+ Tcl_DecrRefCount(cmdObj);
+
return status;
}
@@ -5117,6 +5180,8 @@ TextEditRedo(
TkText *textPtr) /* Overall information about text widget. */
{
int status;
+ Tcl_Obj *cmdObj;
+ int code;
if (!textPtr->sharedTextPtr->undo) {
return TCL_OK;
@@ -5139,6 +5204,23 @@ TextEditRedo(
textPtr->sharedTextPtr->dirtyMode = TK_TEXT_DIRTY_NORMAL;
}
textPtr->sharedTextPtr->undo = 1;
+
+ /*
+ * Convert undo/redo temporary marks set by TkUndoApply() into
+ * indices left in the interp result.
+ */
+
+ cmdObj = Tcl_ObjPrintf("::tk::TextUndoRedoProcessMarks %s",
+ Tk_PathName(textPtr->tkwin));
+ Tcl_IncrRefCount(cmdObj);
+ code = Tcl_EvalObjEx(textPtr->interp, cmdObj, TCL_EVAL_GLOBAL);
+ if (code != TCL_OK) {
+ Tcl_AddErrorInfo(textPtr->interp,
+ "\n (on undoing)");
+ Tcl_BackgroundException(textPtr->interp, code);
+ }
+ Tcl_DecrRefCount(cmdObj);
+
return status;
}
@@ -5526,7 +5608,7 @@ RunAfterSyncCmd(
* The widget has been deleted. Don't do anything.
*/
- if (--textPtr->refCount == 0) {
+ if (textPtr->refCount-- <= 1) {
ckfree((char *) textPtr);
}
return;
@@ -5880,7 +5962,7 @@ SearchCore(
CLANG_ASSERT(pattern);
do {
- Tcl_UniChar ch;
+ int ch;
const char *p;
int lastFullLine = lastOffset;
@@ -6110,7 +6192,7 @@ SearchCore(
}
} else {
firstOffset = p - startOfLine +
- Tcl_UtfToUniChar(startOfLine+matchOffset,&ch);
+ TkUtfToUniChar(startOfLine+matchOffset,&ch);
}
}
} while (searchSpecPtr->all);
diff --git a/generic/tkText.h b/generic/tkText.h
index 5d88784..430c96b 100644
--- a/generic/tkText.h
+++ b/generic/tkText.h
@@ -580,6 +580,8 @@ typedef struct TkSharedText {
* statements. */
int autoSeparators; /* Non-zero means the separators will be
* inserted automatically. */
+ int undoMarkId; /* Counts undo marks temporarily used during
+ undo and redo operations. */
int isDirty; /* Flag indicating the 'dirtyness' of the
* text widget. If the flag is not zero,
* unsaved modifications have been applied to
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 5faab36..0958986 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -3005,7 +3005,7 @@ AsyncUpdateLineMetrics(
* The widget has been deleted, or is not mapped. Don't do anything.
*/
- if (--textPtr->refCount == 0) {
+ if (textPtr->refCount-- <= 1) {
ckfree(textPtr);
}
return;
@@ -3080,8 +3080,7 @@ AsyncUpdateLineMetrics(
GenerateWidgetViewSyncEvent(textPtr, 1);
- textPtr->refCount--;
- if (textPtr->refCount == 0) {
+ if (textPtr->refCount-- <= 1) {
ckfree(textPtr);
}
return;
@@ -4163,7 +4162,7 @@ DisplayText(
textPtr->refCount++;
dInfoPtr->flags &= ~REPICK_NEEDED;
TkTextPickCurrent(textPtr, &textPtr->pickEvent);
- if (--textPtr->refCount == 0) {
+ if (textPtr->refCount-- <= 1) {
ckfree(textPtr);
goto end;
}
@@ -4299,8 +4298,9 @@ DisplayText(
if (TkScrollWindow(textPtr->tkwin, dInfoPtr->scrollGC, dInfoPtr->x,
oldY, dInfoPtr->maxX-dInfoPtr->x, height, 0, y-oldY,
damageRgn)) {
+#ifndef MAC_OSX_TK
TextInvalidateRegion(textPtr, damageRgn);
-
+#endif
}
numCopies++;
TkDestroyRegion(damageRgn);
@@ -6752,7 +6752,7 @@ AsyncUpdateYScrollbar(
GetYView(textPtr->interp, textPtr, 1);
}
- if (--textPtr->refCount == 0) {
+ if (textPtr->refCount-- <= 1) {
ckfree(textPtr);
}
}
@@ -7542,6 +7542,9 @@ TkTextCharLayoutProc(
* (b) at least one pixel of the character is visible, we have not
* already exceeded the character limit, and the next character is a
* white space character.
+ * In the specific case of 'word' wrapping mode however, include all space
+ * characters following the characters that fit in the space we've got,
+ * even if no pixel of them is visible.
*/
p = segPtr->body.chars + byteOffset;
@@ -7581,8 +7584,8 @@ TkTextCharLayoutProc(
if (bytesThatFit < maxBytes) {
if ((bytesThatFit == 0) && noCharsYet) {
- Tcl_UniChar ch;
- int chLen = Tcl_UtfToUniChar(p, &ch);
+ int ch;
+ int chLen = TkUtfToUniChar(p, &ch);
#if TK_LAYOUT_WITH_BASE_CHUNKS
bytesThatFit = CharChunkMeasureChars(chunkPtr, line,
@@ -7604,6 +7607,21 @@ TkTextCharLayoutProc(
nextX = maxX;
bytesThatFit++;
}
+ if (wrapMode == TEXT_WRAPMODE_WORD) {
+ while (p[bytesThatFit] == ' ') {
+ /*
+ * Space characters that would go at the beginning of the
+ * next line are allocated to the current line. This gives
+ * the effect of trimming white spaces that would otherwise
+ * be seen at the beginning of wrapped lines.
+ * Note that testing for '\t' is useless here because the
+ * chunk always includes at most one trailing \t, see
+ * LayoutDLine.
+ */
+
+ bytesThatFit++;
+ }
+ }
if (p[bytesThatFit] == '\n') {
/*
* A newline character takes up no space, so if the previous
@@ -7801,7 +7819,7 @@ CharChunkMeasureChars(
MeasureChars(tkfont, chars, charsLen, 0, bstart,
0, -1, 0, &widthUntilStart);
- xDisplacement = startX - widthUntilStart - chunkPtr->x;
+ xDisplacement = startX - widthUntilStart - ciPtr->baseChunkPtr->x;
}
fit = MeasureChars(tkfont, chars, charsLen, 0, bend,
@@ -8775,7 +8793,7 @@ FinalizeBaseChunk(
#if TK_DRAW_IN_CONTEXT
newwidth = 0;
CharChunkMeasureChars(chunkPtr, NULL, 0, 0, -1, 0, -1, 0, &newwidth);
- if (newwidth != chunkPtr->width) {
+ if (newwidth < chunkPtr->width) {
widthAdjust += newwidth - chunkPtr->width;
chunkPtr->width = newwidth;
}
@@ -8963,13 +8981,13 @@ RemoveFromBaseChunk(
bciPtr = baseCharChunkPtr->clientData;
+#ifdef DEBUG_LAYOUT_WITH_BASE_CHUNKS
if ((ciPtr->baseOffset + ciPtr->numBytes)
!= Tcl_DStringLength(&bciPtr->baseChars)) {
-#ifdef DEBUG_LAYOUT_WITH_BASE_CHUNKS
fprintf(stderr,"RemoveFromBaseChunk called with wrong chunk "
"(not last)\n");
-#endif
}
+#endif
Tcl_DStringSetLength(&bciPtr->baseChars, ciPtr->baseOffset);
diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c
index 92ca03b..cfe230c 100644
--- a/generic/tkTextIndex.c
+++ b/generic/tkTextIndex.c
@@ -87,7 +87,7 @@ FreeTextIndexInternalRep(
TkTextIndex *indexPtr = GET_TEXTINDEX(indexObjPtr);
if (indexPtr->textPtr != NULL) {
- if (--indexPtr->textPtr->refCount == 0) {
+ if (indexPtr->textPtr->refCount-- <= 1) {
/*
* The text widget has been deleted and we need to free it now.
*/
@@ -2298,9 +2298,9 @@ StartEnd(
int chSize = 1;
if (segPtr->typePtr == &tkTextCharType) {
- Tcl_UniChar ch;
+ int ch;
- chSize = Tcl_UtfToUniChar(segPtr->body.chars + offset, &ch);
+ chSize = TkUtfToUniChar(segPtr->body.chars + offset, &ch);
if (!Tcl_UniCharIsWordChar(ch)) {
break;
}
@@ -2343,9 +2343,9 @@ StartEnd(
int chSize = 1;
if (segPtr->typePtr == &tkTextCharType) {
- Tcl_UniChar ch;
- Tcl_UtfToUniChar(segPtr->body.chars + offset, &ch);
+ int ch;
+ TkUtfToUniChar(segPtr->body.chars + offset, &ch);
if (!Tcl_UniCharIsWordChar(ch)) {
break;
}
diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c
index a212615..d9329f5 100644
--- a/generic/tkTextTag.c
+++ b/generic/tkTextTag.c
@@ -30,7 +30,7 @@ static const char *const wrapStrings[] = {
/*
* The 'TkTextTabStyle' enum in tkText.h is used to define a type for the
* -tabstyle option of the Text widget. These values are used as indices into
- * the string table below. Tags are allowed an empty wrap value, but the
+ * the string table below. Tags are allowed an empty tabstyle value, but the
* widget as a whole is not.
*/
@@ -1258,8 +1258,7 @@ TkTextFreeTag(
if (textPtr != tagPtr->textPtr) {
Tcl_Panic("Tag being deleted from wrong widget");
}
- textPtr->refCount--;
- if (textPtr->refCount == 0) {
+ if (textPtr->refCount-- <= 1) {
ckfree(textPtr);
}
tagPtr->textPtr = NULL;
@@ -1522,7 +1521,7 @@ TkTextBindProc(
}
done:
- if (--textPtr->refCount == 0) {
+ if (textPtr->refCount-- <= 1) {
ckfree(textPtr);
}
}
diff --git a/generic/tkUtil.c b/generic/tkUtil.c
index d4c4d2d..d89282f 100644
--- a/generic/tkUtil.c
+++ b/generic/tkUtil.c
@@ -1192,6 +1192,86 @@ TkSendVirtualEvent(
Tk_QueueWindowEvent(&event.general, TCL_QUEUE_TAIL);
}
+
+#if TCL_UTF_MAX <= 4
+/*
+ *---------------------------------------------------------------------------
+ *
+ * TkUtfToUniChar --
+ *
+ * Almost the same as Tcl_UtfToUniChar but using int instead of Tcl_UniChar.
+ * This function is capable of collapsing a upper/lower surrogate pair to a
+ * single unicode character. So, up to 6 bytes might be consumed.
+ *
+ * Results:
+ * *chPtr is filled with the Tcl_UniChar, and the return value is the
+ * number of bytes from the UTF-8 string that were consumed.
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+int
+TkUtfToUniChar(
+ const char *src, /* The UTF-8 string. */
+ int *chPtr) /* Filled with the Tcl_UniChar represented by
+ * the UTF-8 string. */
+{
+ Tcl_UniChar uniChar = 0;
+
+ int len = Tcl_UtfToUniChar(src, &uniChar);
+ if ((uniChar & 0xfc00) == 0xd800) {
+ Tcl_UniChar high = uniChar;
+ /* This can only happen if Tcl is compiled with TCL_UTF_MAX=4,
+ * or when a high surrogate character is detected in UTF-8 form */
+ int len2 = Tcl_UtfToUniChar(src+len, &uniChar);
+ if ((uniChar & 0xfc00) == 0xdc00) {
+ *chPtr = (((high & 0x3ff) << 10) | (uniChar & 0x3ff)) + 0x10000;
+ len += len2;
+ } else {
+ *chPtr = high;
+ }
+ } else {
+ *chPtr = uniChar;
+ }
+ return len;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * TkUniCharToUtf --
+ *
+ * Almost the same as Tcl_UniCharToUtf but producing surrogates if
+ * TCL_UTF_MAX==3. So, up to 6 bytes might be produced.
+ *
+ * Results:
+ * *buf is filled with the UTF-8 string, and the return value is the
+ * number of bytes produced.
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+int TkUniCharToUtf(int ch, char *buf)
+{
+ int size = Tcl_UniCharToUtf(ch, buf);
+ if ((ch > 0xffff) && (ch <= 0x10ffff) && (size < 4)) {
+ /* Hey, this is wrong, we must be running TCL_UTF_MAX==3
+ * The best thing we can do is spit out 2 surrogates */
+ ch -= 0x10000;
+ size = Tcl_UniCharToUtf(((ch >> 10) | 0xd800), buf);
+ size += Tcl_UniCharToUtf(((ch & 0x3ff) | 0xdc00), buf+size);
+ }
+ return size;
+}
+
+
+#endif
/*
* Local Variables:
* mode: c
diff --git a/generic/tkVisual.c b/generic/tkVisual.c
index 8b0c155..6f6816d 100644
--- a/generic/tkVisual.c
+++ b/generic/tkVisual.c
@@ -46,7 +46,7 @@ static const VisualDictionary visualNames[] = {
struct TkColormap {
Colormap colormap; /* X's identifier for the colormap. */
Visual *visual; /* Visual for which colormap was allocated. */
- int refCount; /* How many uses of the colormap are still
+ size_t refCount; /* How many uses of the colormap are still
* outstanding (calls to Tk_GetColormap minus
* calls to Tk_FreeColormap). */
int shareable; /* 0 means this colormap was allocated by a
@@ -137,7 +137,7 @@ Tk_GetVisual(
for (cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL;
cmapPtr = cmapPtr->nextPtr) {
if (cmapPtr->colormap == *colormapPtr) {
- cmapPtr->refCount += 1;
+ cmapPtr->refCount++;
break;
}
}
@@ -324,7 +324,7 @@ Tk_GetVisual(
cmapPtr = cmapPtr->nextPtr) {
if (cmapPtr->shareable && (cmapPtr->visual == visual)) {
*colormapPtr = cmapPtr->colormap;
- cmapPtr->refCount += 1;
+ cmapPtr->refCount++;
goto done;
}
}
@@ -427,7 +427,7 @@ Tk_GetColormap(
for (cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL;
cmapPtr = cmapPtr->nextPtr) {
if (cmapPtr->colormap == colormap) {
- cmapPtr->refCount += 1;
+ cmapPtr->refCount++;
}
}
return colormap;
@@ -476,8 +476,7 @@ Tk_FreeColormap(
for (prevPtr = NULL, cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL;
prevPtr = cmapPtr, cmapPtr = cmapPtr->nextPtr) {
if (cmapPtr->colormap == colormap) {
- cmapPtr->refCount -= 1;
- if (cmapPtr->refCount == 0) {
+ if (cmapPtr->refCount-- <= 1) {
XFreeColormap(display, colormap);
if (prevPtr == NULL) {
dispPtr->cmapPtr = cmapPtr->nextPtr;
@@ -534,7 +533,7 @@ Tk_PreserveColormap(
for (cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL;
cmapPtr = cmapPtr->nextPtr) {
if (cmapPtr->colormap == colormap) {
- cmapPtr->refCount += 1;
+ cmapPtr->refCount++;
return;
}
}
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index 5855b7c..ed57280 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -355,6 +355,9 @@ CreateTopLevelWindow(
* Set the flags specified in the call.
*/
+#ifdef TK_USE_INPUT_METHODS
+ winPtr->ximGeneration = 0;
+#endif /*TK_USE_INPUT_METHODS*/
winPtr->flags |= flags;
/*
@@ -650,6 +653,7 @@ TkAllocWindow(
winPtr->flags = 0;
winPtr->handlerList = NULL;
#ifdef TK_USE_INPUT_METHODS
+ winPtr->ximGeneration = 0;
winPtr->inputContext = NULL;
#endif /* TK_USE_INPUT_METHODS */
winPtr->tagPtr = NULL;
@@ -943,7 +947,7 @@ TkCreateMainWindow(
}
/*
- * Set variables for the intepreter.
+ * Set variables for the interpreter.
*/
Tcl_SetVar2(interp, "tk_patchLevel", NULL, TK_PATCH_LEVEL, TCL_GLOBAL_ONLY);
@@ -1442,10 +1446,11 @@ Tk_DestroyWindow(
UnlinkWindow(winPtr);
TkEventDeadWindow(winPtr);
#ifdef TK_USE_INPUT_METHODS
- if (winPtr->inputContext != NULL) {
+ if (winPtr->inputContext != NULL &&
+ winPtr->ximGeneration == winPtr->dispPtr->ximGeneration) {
XDestroyIC(winPtr->inputContext);
- winPtr->inputContext = NULL;
}
+ winPtr->inputContext = NULL;
#endif /* TK_USE_INPUT_METHODS */
if (winPtr->tagPtr != NULL) {
TkFreeBindingTags(winPtr);
@@ -1479,8 +1484,7 @@ Tk_DestroyWindow(
winPtr->mainPtr->deletionEpoch++;
}
- winPtr->mainPtr->refCount--;
- if (winPtr->mainPtr->refCount == 0) {
+ if (winPtr->mainPtr->refCount-- <= 1) {
register const TkCmd *cmdPtr;
/*
@@ -3041,7 +3045,7 @@ Initialize(
* Ensure that we are getting a compatible version of Tcl.
*/
- if (Tcl_InitStubs(interp, "8.6", 0) == NULL) {
+ if (Tcl_InitStubs(interp, "8.6-", 0) == NULL) {
return TCL_ERROR;
}
diff --git a/generic/ttk/ttkButton.c b/generic/ttk/ttkButton.c
index bc44f25..c00754b 100644
--- a/generic/ttk/ttkButton.c
+++ b/generic/ttk/ttkButton.c
@@ -136,6 +136,15 @@ BaseCleanup(void *recordPtr)
TtkFreeImageSpec(basePtr->base.imageSpec);
}
+static void
+BaseImageChanged(
+ ClientData clientData, int x, int y, int width, int height,
+ int imageWidth, int imageHeight)
+{
+ Base *basePtr = (Base *)clientData;
+ TtkResizeWidget(&basePtr->core);
+}
+
static int BaseConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
{
Base *basePtr = recordPtr;
@@ -149,8 +158,8 @@ static int BaseConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
}
if (basePtr->base.imageObj) {
- imageSpec = TtkGetImageSpec(
- interp, basePtr->core.tkwin, basePtr->base.imageObj);
+ imageSpec = TtkGetImageSpecEx(
+ interp, basePtr->core.tkwin, basePtr->base.imageObj, BaseImageChanged, basePtr);
if (!imageSpec) {
goto error;
}
diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c
index f395649..a25574a 100644
--- a/generic/ttk/ttkEntry.c
+++ b/generic/ttk/ttkEntry.c
@@ -282,15 +282,16 @@ static char *EntryDisplayString(const char *showChar, int numChars)
{
char *displayString, *p;
int size;
- Tcl_UniChar ch;
- char buf[TCL_UTF_MAX];
+ int ch;
+ char buf[6];
- Tcl_UtfToUniChar(showChar, &ch);
- size = Tcl_UniCharToUtf(ch, buf);
+ TkUtfToUniChar(showChar, &ch);
+ size = TkUniCharToUtf(ch, buf);
p = displayString = ckalloc(numChars * size + 1);
while (numChars--) {
- p += Tcl_UniCharToUtf(ch, p);
+ memcpy(p, buf, size);
+ p += size;
}
*p = '\0';
@@ -405,7 +406,7 @@ ExpandPercents(
int number, length;
const char *string;
int stringLength;
- Tcl_UniChar ch;
+ int ch;
char numStorage[2*TCL_INTEGER_SPACE];
while (*template) {
@@ -429,7 +430,7 @@ ExpandPercents(
*/
++template; /* skip over % */
if (*template != '\0') {
- template += Tcl_UtfToUniChar(template, &ch);
+ template += TkUtfToUniChar(template, &ch);
} else {
ch = '%';
}
@@ -479,7 +480,7 @@ ExpandPercents(
string = Tk_PathName(entryPtr->core.tkwin);
break;
default:
- length = Tcl_UniCharToUtf(ch, numStorage);
+ length = TkUniCharToUtf(ch, numStorage);
numStorage[length] = '\0';
string = numStorage;
break;
diff --git a/generic/ttk/ttkGenStubs.tcl b/generic/ttk/ttkGenStubs.tcl
deleted file mode 100644
index 8047e3f..0000000
--- a/generic/ttk/ttkGenStubs.tcl
+++ /dev/null
@@ -1,963 +0,0 @@
-# ttkGenStubs.tcl --
-#
-# This script generates a set of stub files for a given
-# interface.
-#
-#
-# Copyright (c) 1998-1999 by Scriptics Corporation.
-# Copyright (c) 2007 Daniel A. Steffen <das@users.sourceforge.net>
-#
-# See the file "license.terms" for information on usage and redistribution
-# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-#
-# SOURCE: tcl/tools/genStubs.tcl, revision 1.44
-#
-# CHANGES:
-# + Second argument to "declare" is used as a status guard
-# instead of a platform guard.
-# + Allow trailing semicolon in function declarations
-#
-
-namespace eval genStubs {
- # libraryName --
- #
- # The name of the entire library. This value is used to compute
- # the USE_*_STUBS macro and the name of the init file.
-
- variable libraryName "UNKNOWN"
-
- # interfaces --
- #
- # An array indexed by interface name that is used to maintain
- # the set of valid interfaces. The value is empty.
-
- array set interfaces {}
-
- # curName --
- #
- # The name of the interface currently being defined.
-
- variable curName "UNKNOWN"
-
- # scspec --
- #
- # Storage class specifier for external function declarations.
- # Normally "EXTERN", may be set to something like XYZAPI
- #
- variable scspec "EXTERN"
-
- # epoch, revision --
- #
- # The epoch and revision numbers of the interface currently being defined.
- # (@@@TODO: should be an array mapping interface names -> numbers)
- #
-
- variable epoch {}
- variable revision 0
-
- # hooks --
- #
- # An array indexed by interface name that contains the set of
- # subinterfaces that should be defined for a given interface.
-
- array set hooks {}
-
- # stubs --
- #
- # This three dimensional array is indexed first by interface name,
- # second by field name, and third by a numeric offset or the
- # constant "lastNum". The lastNum entry contains the largest
- # numeric offset used for a given interface.
- #
- # Field "decl,$i" contains the C function specification that
- # should be used for the given entry in the stub table. The spec
- # consists of a list in the form returned by parseDecl.
- # Other fields TBD later.
-
- array set stubs {}
-
- # outDir --
- #
- # The directory where the generated files should be placed.
-
- variable outDir .
-}
-
-# genStubs::library --
-#
-# This function is used in the declarations file to set the name
-# of the library that the interfaces are associated with (e.g. "tcl").
-# This value will be used to define the inline conditional macro.
-#
-# Arguments:
-# name The library name.
-#
-# Results:
-# None.
-
-proc genStubs::library {name} {
- variable libraryName $name
-}
-
-# genStubs::interface --
-#
-# This function is used in the declarations file to set the name
-# of the interface currently being defined.
-#
-# Arguments:
-# name The name of the interface.
-#
-# Results:
-# None.
-
-proc genStubs::interface {name} {
- variable curName $name
- variable interfaces
- variable stubs
-
- set interfaces($name) {}
- set stubs($name,lastNum) 0
- return
-}
-
-# genStubs::scspec --
-#
-# Define the storage class macro used for external function declarations.
-# Typically, this will be a macro like XYZAPI or EXTERN that
-# expands to either DLLIMPORT or DLLEXPORT, depending on whether
-# -DBUILD_XYZ has been set.
-#
-proc genStubs::scspec {value} {
- variable scspec $value
-}
-
-# genStubs::epoch --
-#
-# Define the epoch number for this library. The epoch
-# should be incrememented when a release is made that
-# contains incompatible changes to the public API.
-#
-proc genStubs::epoch {value} {
- variable epoch $value
-}
-
-# genStubs::hooks --
-#
-# This function defines the subinterface hooks for the current
-# interface.
-#
-# Arguments:
-# names The ordered list of interfaces that are reachable through the
-# hook vector.
-#
-# Results:
-# None.
-
-proc genStubs::hooks {names} {
- variable curName
- variable hooks
-
- set hooks($curName) $names
- return
-}
-
-# genStubs::declare --
-#
-# This function is used in the declarations file to declare a new
-# interface entry.
-#
-# Arguments:
-# index The index number of the interface.
-# status Status of the interface: one of "current",
-# "deprecated", or "obsolete".
-# decl The C function declaration, or {} for an undefined
-# entry.
-#
-# Results:
-# None.
-
-proc genStubs::declare {args} {
- variable stubs
- variable curName
- variable revision
-
- incr revision
- if {[llength $args] == 2} {
- lassign $args index decl
- set status current
- } elseif {[llength $args] == 3} {
- lassign $args index status decl
- } else {
- puts stderr "wrong # args: declare $args"
- return
- }
-
- # Check for duplicate declarations, then add the declaration and
- # bump the lastNum counter if necessary.
-
- if {[info exists stubs($curName,decl,$index)]} {
- puts stderr "Duplicate entry: $index"
- }
- regsub -all "\[ \t\n\]+" [string trim $decl] " " decl
- set decl [parseDecl $decl]
-
- set stubs($curName,status,$index) $status
- set stubs($curName,decl,$index) $decl
-
- if {$index > $stubs($curName,lastNum)} {
- set stubs($curName,lastNum) $index
- }
- return
-}
-
-# genStubs::export --
-#
-# This function is used in the declarations file to declare a symbol
-# that is exported from the library but is not in the stubs table.
-#
-# Arguments:
-# decl The C function declaration, or {} for an undefined
-# entry.
-#
-# Results:
-# None.
-
-proc genStubs::export {args} {
- if {[llength $args] != 1} {
- puts stderr "wrong # args: export $args"
- }
- return
-}
-
-# genStubs::rewriteFile --
-#
-# This function replaces the machine generated portion of the
-# specified file with new contents. It looks for the !BEGIN! and
-# !END! comments to determine where to place the new text.
-#
-# Arguments:
-# file The name of the file to modify.
-# text The new text to place in the file.
-#
-# Results:
-# None.
-
-proc genStubs::rewriteFile {file text} {
- if {![file exists $file]} {
- puts stderr "Cannot find file: $file"
- return
- }
- set in [open ${file} r]
- set out [open ${file}.new w]
- fconfigure $out -translation lf
-
- while {![eof $in]} {
- set line [gets $in]
- if {[string match "*!BEGIN!*" $line]} {
- break
- }
- puts $out $line
- }
- puts $out "/* !BEGIN!: Do not edit below this line. */"
- puts $out $text
- while {![eof $in]} {
- set line [gets $in]
- if {[string match "*!END!*" $line]} {
- break
- }
- }
- puts $out "/* !END!: Do not edit above this line. */"
- puts -nonewline $out [read $in]
- close $in
- close $out
- file rename -force ${file}.new ${file}
- return
-}
-
-# genStubs::addPlatformGuard --
-#
-# Wrap a string inside a platform #ifdef.
-#
-# Arguments:
-# plat Platform to test.
-#
-# Results:
-# Returns the original text inside an appropriate #ifdef.
-
-proc genStubs::addPlatformGuard {plat iftxt {eltxt {}}} {
- set text ""
- switch $plat {
- win {
- append text "#ifdef _WIN32 /* WIN */\n${iftxt}"
- if {$eltxt ne ""} {
- append text "#else /* WIN */\n${eltxt}"
- }
- append text "#endif /* WIN */\n"
- }
- unix {
- append text "#if !defined(_WIN32) && !defined(MAC_OSX_TCL)\
- /* UNIX */\n${iftxt}"
- if {$eltxt ne ""} {
- append text "#else /* UNIX */\n${eltxt}"
- }
- append text "#endif /* UNIX */\n"
- }
- macosx {
- append text "#ifdef MAC_OSX_TCL /* MACOSX */\n${iftxt}"
- if {$eltxt ne ""} {
- append text "#else /* MACOSX */\n${eltxt}"
- }
- append text "#endif /* MACOSX */\n"
- }
- aqua {
- append text "#ifdef MAC_OSX_TK /* AQUA */\n${iftxt}"
- if {$eltxt ne ""} {
- append text "#else /* AQUA */\n${eltxt}"
- }
- append text "#endif /* AQUA */\n"
- }
- x11 {
- append text "#if !(defined(_WIN32) || defined(MAC_OSX_TK))\
- /* X11 */\n${iftxt}"
- if {$eltxt ne ""} {
- append text "#else /* X11 */\n${eltxt}"
- }
- append text "#endif /* X11 */\n"
- }
- default {
- append text "${iftxt}${eltxt}"
- }
- }
- return $text
-}
-
-# genStubs::emitSlots --
-#
-# Generate the stub table slots for the given interface. If there
-# are no generic slots, then one table is generated for each
-# platform, otherwise one table is generated for all platforms.
-#
-# Arguments:
-# name The name of the interface being emitted.
-# textVar The variable to use for output.
-#
-# Results:
-# None.
-
-proc genStubs::emitSlots {name textVar} {
- upvar $textVar text
-
- forAllStubs $name makeSlot noGuard text {" void (*reserved$i)(void);\n"}
- return
-}
-
-# genStubs::parseDecl --
-#
-# Parse a C function declaration into its component parts.
-#
-# Arguments:
-# decl The function declaration.
-#
-# Results:
-# Returns a list of the form {returnType name args}. The args
-# element consists of a list of type/name pairs, or a single
-# element "void". If the function declaration is malformed
-# then an error is displayed and the return value is {}.
-
-proc genStubs::parseDecl {decl} {
- if {![regexp {^(.*)\((.*)\);?$} $decl all prefix args]} {
- set prefix $decl
- set args {}
- }
- set prefix [string trim $prefix]
- if {![regexp {^(.+[ ][*]*)([^ *]+)$} $prefix all rtype fname]} {
- puts stderr "Bad return type: $decl"
- return
- }
- set rtype [string trim $rtype]
- if {$args eq ""} {
- return [list $rtype $fname {}]
- }
- foreach arg [split $args ,] {
- lappend argList [string trim $arg]
- }
- if {![string compare [lindex $argList end] "..."]} {
- set args TCL_VARARGS
- foreach arg [lrange $argList 0 end-1] {
- set argInfo [parseArg $arg]
- if {[llength $argInfo] == 2 || [llength $argInfo] == 3} {
- lappend args $argInfo
- } else {
- puts stderr "Bad argument: '$arg' in '$decl'"
- return
- }
- }
- } else {
- set args {}
- foreach arg $argList {
- set argInfo [parseArg $arg]
- if {![string compare $argInfo "void"]} {
- lappend args "void"
- break
- } elseif {[llength $argInfo] == 2 || [llength $argInfo] == 3} {
- lappend args $argInfo
- } else {
- puts stderr "Bad argument: '$arg' in '$decl'"
- return
- }
- }
- }
- return [list $rtype $fname $args]
-}
-
-# genStubs::parseArg --
-#
-# This function parses a function argument into a type and name.
-#
-# Arguments:
-# arg The argument to parse.
-#
-# Results:
-# Returns a list of type and name with an optional third array
-# indicator. If the argument is malformed, returns "".
-
-proc genStubs::parseArg {arg} {
- if {![regexp {^(.+[ ][*]*)([^][ *]+)(\[\])?$} $arg all type name array]} {
- if {$arg eq "void"} {
- return $arg
- } else {
- return
- }
- }
- set result [list [string trim $type] $name]
- if {$array ne ""} {
- lappend result $array
- }
- return $result
-}
-
-# genStubs::makeDecl --
-#
-# Generate the prototype for a function.
-#
-# Arguments:
-# name The interface name.
-# decl The function declaration.
-# index The slot index for this function.
-#
-# Results:
-# Returns the formatted declaration string.
-
-proc genStubs::makeDecl {name decl index} {
- variable scspec
- lassign $decl rtype fname args
-
- append text "/* $index */\n"
- set line "$scspec $rtype"
- set count [expr {2 - ([string length $line] / 8)}]
- append line [string range "\t\t\t" 0 $count]
- set pad [expr {24 - [string length $line]}]
- if {$pad <= 0} {
- append line " "
- set pad 0
- }
- if {$args eq ""} {
- append line $fname
- append text $line
- append text ";\n"
- return $text
- }
- append line $fname
-
- set arg1 [lindex $args 0]
- switch -exact $arg1 {
- void {
- append line "(void)"
- }
- TCL_VARARGS {
- set sep "("
- foreach arg [lrange $args 1 end] {
- append line $sep
- set next {}
- append next [lindex $arg 0]
- if {[string index $next end] ne "*"} {
- append next " "
- }
- append next [lindex $arg 1] [lindex $arg 2]
- if {[string length $line] + [string length $next] \
- + $pad > 76} {
- append text [string trimright $line] \n
- set line "\t\t\t\t"
- set pad 28
- }
- append line $next
- set sep ", "
- }
- append line ", ...)"
- }
- default {
- set sep "("
- foreach arg $args {
- append line $sep
- set next {}
- append next [lindex $arg 0]
- if {[string index $next end] ne "*"} {
- append next " "
- }
- append next [lindex $arg 1] [lindex $arg 2]
- if {[string length $line] + [string length $next] \
- + $pad > 76} {
- append text [string trimright $line] \n
- set line "\t\t\t\t"
- set pad 28
- }
- append line $next
- set sep ", "
- }
- append line ")"
- }
- }
- return "$text$line;\n"
-}
-
-# genStubs::makeMacro --
-#
-# Generate the inline macro for a function.
-#
-# Arguments:
-# name The interface name.
-# decl The function declaration.
-# index The slot index for this function.
-#
-# Results:
-# Returns the formatted macro definition.
-
-proc genStubs::makeMacro {name decl index} {
- lassign $decl rtype fname args
-
- set lfname [string tolower [string index $fname 0]]
- append lfname [string range $fname 1 end]
-
- set text "#define $fname \\\n\t("
- if {$args eq ""} {
- append text "*"
- }
- append text "${name}StubsPtr->$lfname)"
- append text " /* $index */\n"
- return $text
-}
-
-# genStubs::makeSlot --
-#
-# Generate the stub table entry for a function.
-#
-# Arguments:
-# name The interface name.
-# decl The function declaration.
-# index The slot index for this function.
-#
-# Results:
-# Returns the formatted table entry.
-
-proc genStubs::makeSlot {name decl index} {
- lassign $decl rtype fname args
-
- set lfname [string tolower [string index $fname 0]]
- append lfname [string range $fname 1 end]
-
- set text " "
- if {$args eq ""} {
- append text $rtype " *" $lfname "; /* $index */\n"
- return $text
- }
- if {[string range $rtype end-8 end] eq "__stdcall"} {
- append text [string trim [string range $rtype 0 end-9]] " (__stdcall *" $lfname ") "
- } else {
- append text $rtype " (*" $lfname ") "
- }
- set arg1 [lindex $args 0]
- switch -exact $arg1 {
- void {
- append text "(void)"
- }
- TCL_VARARGS {
- set sep "("
- foreach arg [lrange $args 1 end] {
- append text $sep [lindex $arg 0]
- if {[string index $text end] ne "*"} {
- append text " "
- }
- append text [lindex $arg 1] [lindex $arg 2]
- set sep ", "
- }
- append text ", ...)"
- }
- default {
- set sep "("
- foreach arg $args {
- append text $sep [lindex $arg 0]
- if {[string index $text end] ne "*"} {
- append text " "
- }
- append text [lindex $arg 1] [lindex $arg 2]
- set sep ", "
- }
- append text ")"
- }
- }
-
- append text "; /* $index */\n"
- return $text
-}
-
-# genStubs::makeInit --
-#
-# Generate the prototype for a function.
-#
-# Arguments:
-# name The interface name.
-# decl The function declaration.
-# index The slot index for this function.
-#
-# Results:
-# Returns the formatted declaration string.
-
-proc genStubs::makeInit {name decl index} {
- if {[lindex $decl 2] eq ""} {
- append text " &" [lindex $decl 1] ", /* " $index " */\n"
- } else {
- append text " " [lindex $decl 1] ", /* " $index " */\n"
- }
- return $text
-}
-
-# genStubs::forAllStubs --
-#
-# This function iterates over all of the slots and invokes
-# a callback for each slot. The result of the callback is then
-# placed inside appropriate guards.
-#
-# Arguments:
-# name The interface name.
-# slotProc The proc to invoke to handle the slot. It will
-# have the interface name, the declaration, and
-# the index appended.
-# guardProc The proc to invoke to add guards. It will have
-# the slot status and text appended.
-# textVar The variable to use for output.
-# skipString The string to emit if a slot is skipped. This
-# string will be subst'ed in the loop so "$i" can
-# be used to substitute the index value.
-#
-# Results:
-# None.
-
-proc genStubs::forAllStubs {name slotProc guardProc textVar
- {skipString {"/* Slot $i is reserved */\n"}}} {
- variable stubs
- upvar $textVar text
-
- set lastNum $stubs($name,lastNum)
-
- for {set i 0} {$i <= $lastNum} {incr i} {
- if {[info exists stubs($name,decl,$i)]} {
- append text [$guardProc $stubs($name,status,$i) \
- [$slotProc $name $stubs($name,decl,$i) $i]]
- } else {
- eval {append text} $skipString
- }
- }
-}
-
-proc genStubs::noGuard {status text} { return $text }
-
-proc genStubs::addGuard {status text} {
- variable libraryName
- set upName [string toupper $libraryName]
-
- switch -- $status {
- current {
- # No change
- }
- deprecated {
- set text [ifdeffed "${upName}_DEPRECATED" $text]
- }
- obsolete {
- set text ""
- }
- default {
- puts stderr "Unrecognized status code $status"
- }
- }
- return $text
-}
-
-proc genStubs::ifdeffed {macro text} {
- join [list "#ifdef $macro" $text "#endif" ""] \n
-}
-
-# genStubs::emitDeclarations --
-#
-# This function emits the function declarations for this interface.
-#
-# Arguments:
-# name The interface name.
-# textVar The variable to use for output.
-#
-# Results:
-# None.
-
-proc genStubs::emitDeclarations {name textVar} {
- upvar $textVar text
-
- append text "\n/*\n * Exported function declarations:\n */\n\n"
- forAllStubs $name makeDecl noGuard text
- return
-}
-
-# genStubs::emitMacros --
-#
-# This function emits the inline macros for an interface.
-#
-# Arguments:
-# name The name of the interface being emitted.
-# textVar The variable to use for output.
-#
-# Results:
-# None.
-
-proc genStubs::emitMacros {name textVar} {
- variable libraryName
- upvar $textVar text
-
- set upName [string toupper $libraryName]
- append text "\n#if defined(USE_${upName}_STUBS)\n"
- append text "\n/*\n * Inline function declarations:\n */\n\n"
-
- forAllStubs $name makeMacro addGuard text
-
- append text "\n#endif /* defined(USE_${upName}_STUBS) */\n"
- return
-}
-
-# genStubs::emitHeader --
-#
-# This function emits the body of the <name>Decls.h file for
-# the specified interface.
-#
-# Arguments:
-# name The name of the interface being emitted.
-#
-# Results:
-# None.
-
-proc genStubs::emitHeader {name} {
- variable outDir
- variable hooks
- variable epoch
- variable revision
-
- set capName [string toupper [string index $name 0]]
- append capName [string range $name 1 end]
-
- if {$epoch ne ""} {
- set CAPName [string toupper $name]
- append text "\n"
- append text "#define ${CAPName}_STUBS_EPOCH $epoch\n"
- append text "#define ${CAPName}_STUBS_REVISION $revision\n"
- }
-
- append text "\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n"
-
- emitDeclarations $name text
-
- if {[info exists hooks($name)]} {
- append text "\ntypedef struct {\n"
- foreach hook $hooks($name) {
- set capHook [string toupper [string index $hook 0]]
- append capHook [string range $hook 1 end]
- append text " const struct ${capHook}Stubs *${hook}Stubs;\n"
- }
- append text "} ${capName}StubHooks;\n"
- }
- append text "\ntypedef struct ${capName}Stubs {\n"
- append text " int magic;\n"
- if {$epoch ne ""} {
- append text " int epoch;\n"
- append text " int revision;\n"
- }
- if {[info exists hooks($name)]} {
- append text " const ${capName}StubHooks *hooks;\n\n"
- } else {
- append text " void *hooks;\n\n"
- }
-
- emitSlots $name text
-
- append text "} ${capName}Stubs;\n\n"
-
- append text "extern const ${capName}Stubs *${name}StubsPtr;\n\n"
- append text "#ifdef __cplusplus\n}\n#endif\n"
-
- emitMacros $name text
-
- rewriteFile [file join $outDir ${name}Decls.h] $text
- return
-}
-
-# genStubs::emitInit --
-#
-# Generate the table initializers for an interface.
-#
-# Arguments:
-# name The name of the interface to initialize.
-# textVar The variable to use for output.
-#
-# Results:
-# Returns the formatted output.
-
-proc genStubs::emitInit {name textVar} {
- variable hooks
- variable interfaces
- variable epoch
- upvar $textVar text
- set root 1
-
- set capName [string toupper [string index $name 0]]
- append capName [string range $name 1 end]
-
- if {[info exists hooks($name)]} {
- append text "\nstatic const ${capName}StubHooks ${name}StubHooks = \{\n"
- set sep " "
- foreach sub $hooks($name) {
- append text $sep "&${sub}Stubs"
- set sep ",\n "
- }
- append text "\n\};\n"
- }
- foreach intf [array names interfaces] {
- if {[info exists hooks($intf)]} {
- if {[lsearch -exact $hooks($intf) $name] >= 0} {
- set root 0
- break
- }
- }
- }
-
- append text "\n"
- if {!$root} {
- append text "static "
- }
- append text "const ${capName}Stubs ${name}Stubs = \{\n TCL_STUB_MAGIC,\n"
- if {$epoch ne ""} {
- set CAPName [string toupper $name]
- append text " ${CAPName}_STUBS_EPOCH,\n"
- append text " ${CAPName}_STUBS_REVISION,\n"
- }
- if {[info exists hooks($name)]} {
- append text " &${name}StubHooks,\n"
- } else {
- append text " 0,\n"
- }
-
- forAllStubs $name makeInit noGuard text {" 0, /* $i */\n"}
-
- append text "\};\n"
- return
-}
-
-# genStubs::emitInits --
-#
-# This function emits the body of the <name>StubInit.c file for
-# the specified interface.
-#
-# Arguments:
-# name The name of the interface being emitted.
-#
-# Results:
-# None.
-
-proc genStubs::emitInits {} {
- variable hooks
- variable outDir
- variable libraryName
- variable interfaces
-
- # Assuming that dependencies only go one level deep, we need to emit
- # all of the leaves first to avoid needing forward declarations.
-
- set leaves {}
- set roots {}
- foreach name [lsort [array names interfaces]] {
- if {[info exists hooks($name)]} {
- lappend roots $name
- } else {
- lappend leaves $name
- }
- }
- foreach name $leaves {
- emitInit $name text
- }
- foreach name $roots {
- emitInit $name text
- }
-
- rewriteFile [file join $outDir ${libraryName}StubInit.c] $text
-}
-
-# genStubs::init --
-#
-# This is the main entry point.
-#
-# Arguments:
-# None.
-#
-# Results:
-# None.
-
-proc genStubs::init {} {
- global argv argv0
- variable outDir
- variable interfaces
-
- if {[llength $argv] < 2} {
- puts stderr "usage: $argv0 outDir declFile ?declFile...?"
- exit 1
- }
-
- set outDir [lindex $argv 0]
-
- foreach file [lrange $argv 1 end] {
- source $file
- }
-
- foreach name [lsort [array names interfaces]] {
- puts "Emitting $name"
- emitHeader $name
- }
-
- emitInits
-}
-
-# lassign --
-#
-# This function emulates the TclX lassign command.
-#
-# Arguments:
-# valueList A list containing the values to be assigned.
-# args The list of variables to be assigned.
-#
-# Results:
-# Returns any values that were not assigned to variables.
-
-if {[string length [namespace which lassign]] == 0} {
- proc lassign {valueList args} {
- if {[llength $args] == 0} {
- error "wrong # args: should be \"lassign list varName ?varName ...?\""
- }
- uplevel [list foreach $args $valueList {break}]
- return [lrange $valueList [llength $args] end]
- }
-}
-
-genStubs::init
diff --git a/generic/ttk/ttkImage.c b/generic/ttk/ttkImage.c
index a5a3a52..e403e2d 100644
--- a/generic/ttk/ttkImage.c
+++ b/generic/ttk/ttkImage.c
@@ -25,6 +25,8 @@ struct TtkImageSpec {
int mapCount; /* #state-specific overrides */
Ttk_StateSpec *states; /* array[mapCount] of states ... */
Tk_Image *images; /* ... per-state images to use */
+ Tk_ImageChangedProc *imageChanged;
+ ClientData imageChangedClientData;
};
/* NullImageChanged --
@@ -34,15 +36,41 @@ static void NullImageChanged(ClientData clientData,
int x, int y, int width, int height, int imageWidth, int imageHeight)
{ /* No-op */ }
+/* ImageSpecImageChanged --
+ * Image changes should trigger a repaint.
+ */
+static void ImageSpecImageChanged(ClientData clientData,
+ int x, int y, int width, int height, int imageWidth, int imageHeight)
+{
+ Ttk_ImageSpec *imageSpec = (Ttk_ImageSpec *)clientData;
+ if (imageSpec->imageChanged != NULL) {
+ imageSpec->imageChanged(imageSpec->imageChangedClientData,
+ x, y, width, height,
+ imageWidth, imageHeight);
+ }
+}
+
/* TtkGetImageSpec --
* Constructs a Ttk_ImageSpec * from a Tcl_Obj *.
* Result must be released using TtkFreeImageSpec.
*
- * TODO: Need a variant of this that takes a user-specified ImageChanged proc
*/
Ttk_ImageSpec *
TtkGetImageSpec(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr)
{
+ return TtkGetImageSpecEx(interp, tkwin, objPtr, NULL, NULL);
+}
+
+/* TtkGetImageSpecEx --
+ * Constructs a Ttk_ImageSpec * from a Tcl_Obj *.
+ * Result must be released using TtkFreeImageSpec.
+ * imageChangedProc will be called when not NULL when
+ * the image changes to allow widgets to repaint.
+ */
+Ttk_ImageSpec *
+TtkGetImageSpecEx(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr,
+ Tk_ImageChangedProc *imageChangedProc, ClientData imageChangedClientData)
+{
Ttk_ImageSpec *imageSpec = 0;
int i = 0, n = 0, objc;
Tcl_Obj **objv;
@@ -52,6 +80,8 @@ TtkGetImageSpec(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr)
imageSpec->mapCount = 0;
imageSpec->states = 0;
imageSpec->images = 0;
+ imageSpec->imageChanged = imageChangedProc;
+ imageSpec->imageChangedClientData = imageChangedClientData;
if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) {
goto error;
@@ -74,7 +104,7 @@ TtkGetImageSpec(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr)
/* Get base image:
*/
imageSpec->baseImage = Tk_GetImage(
- interp, tkwin, Tcl_GetString(objv[0]), NullImageChanged, NULL);
+ interp, tkwin, Tcl_GetString(objv[0]), ImageSpecImageChanged, imageSpec);
if (!imageSpec->baseImage) {
goto error;
}
diff --git a/generic/ttk/ttkTheme.h b/generic/ttk/ttkTheme.h
index 7bf2a7f..9251dea 100644
--- a/generic/ttk/ttkTheme.h
+++ b/generic/ttk/ttkTheme.h
@@ -372,6 +372,8 @@ MODULE_SCOPE void Ttk_RegisterNamedColor(Ttk_ResourceCache, const char *, XColor
typedef struct TtkImageSpec Ttk_ImageSpec;
TTKAPI Ttk_ImageSpec *TtkGetImageSpec(Tcl_Interp *, Tk_Window, Tcl_Obj *);
+TTKAPI Ttk_ImageSpec *TtkGetImageSpecEx(Tcl_Interp *, Tk_Window, Tcl_Obj *,
+ Tk_ImageChangedProc *, ClientData);
TTKAPI void TtkFreeImageSpec(Ttk_ImageSpec *);
TTKAPI Tk_Image TtkSelectImage(Ttk_ImageSpec *, Ttk_State);
diff --git a/library/demos/en.msg b/library/demos/en.msg
index e364c81..05d4a64 100644
--- a/library/demos/en.msg
+++ b/library/demos/en.msg
@@ -18,7 +18,7 @@
::msgcat::mcset en "Demo code: %s"
::msgcat::mcset en "About Widget Demo"
::msgcat::mcset en "Tk widget demonstration application"
-::msgcat::mcset en "Copyright \u00a9 %s"
+::msgcat::mcset en "Copyright © %s"
::msgcat::mcset en "
@@title
Tk Widget Demonstrations
diff --git a/library/demos/nl.msg b/library/demos/nl.msg
index 61832d8..cd52630 100644
--- a/library/demos/nl.msg
+++ b/library/demos/nl.msg
@@ -18,9 +18,9 @@
::msgcat::mcset nl "Demo code: %s" "Code van Demo %s"
::msgcat::mcset nl "About Widget Demo" "Over deze demonstratie"
::msgcat::mcset nl "Tk widget demonstration" "Demonstratie van Tk widgets"
-::msgcat::mcset nl "Copyright \u00a9 %s"
+::msgcat::mcset nl "Copyright © %s"
-::msgcat::mcset nl "Tk Widget Demonstrations" "Demostratie van Tk widgets"
+::msgcat::mcset nl "Tk Widget Demonstrations" "Demonstratie van Tk widgets"
::msgcat::mcset nl "This application provides a front end for several short scripts" \
"Dit programma is een schil rond enkele korte scripts waarmee"
::msgcat::mcset nl "that demonstrate what you can do with Tk widgets. Each of the" \
diff --git a/library/menu.tcl b/library/menu.tcl
index a7aaa3f..b5dd88e 100644
--- a/library/menu.tcl
+++ b/library/menu.tcl
@@ -607,6 +607,10 @@ proc ::tk::MenuButtonDown menu {
if {![winfo viewable $menu]} {
return
}
+ if {[$menu index active] eq "none"} {
+ set Priv(window) {}
+ return
+ }
$menu postcascade active
if {$Priv(postedMb) ne "" && [winfo viewable $Priv(postedMb)]} {
grab -global $Priv(postedMb)
diff --git a/library/tclIndex b/library/tclIndex
index b3f37fa..919fa8a 100644
--- a/library/tclIndex
+++ b/library/tclIndex
@@ -247,7 +247,6 @@ set auto_index(::tk::ListBoxKeyAccel_Unset) [list source [file join $dir xmfbox.
set auto_index(::tk::ListBoxKeyAccel_Key) [list source [file join $dir xmfbox.tcl]]
set auto_index(::tk::ListBoxKeyAccel_Goto) [list source [file join $dir xmfbox.tcl]]
set auto_index(::tk::ListBoxKeyAccel_Reset) [list source [file join $dir xmfbox.tcl]]
-set auto_index(tk_getFileType) [list source [file join $dir xmfbox.tcl]]
set auto_index(::tk::unsupported::ExposePrivateCommand) [list source [file join $dir unsupported.tcl]]
set auto_index(::tk::unsupported::ExposePrivateVariable) [list source [file join $dir unsupported.tcl]]
set auto_index(::tk::fontchooser) [list source [file join $dir fontchooser.tcl]]
diff --git a/library/text.tcl b/library/text.tcl
index 2bf1b2b..59e395c 100644
--- a/library/text.tcl
+++ b/library/text.tcl
@@ -1202,3 +1202,99 @@ proc ::tk::TextScanDrag {w x y} {
$w scan dragto $x $y
}
}
+
+# ::tk::TextUndoRedoProcessMarks --
+#
+# This proc is executed after an undo or redo action.
+# It processes the list of undo/redo marks temporarily set in the
+# text widget to positions delimiting where changes happened, and
+# returns a flat list of ranges. The temporary marks are removed
+# from the text widget.
+#
+# Arguments:
+# w - The text widget
+
+proc ::tk::TextUndoRedoProcessMarks {w} {
+ set indices {}
+ set undoMarks {}
+
+ # only consider the temporary marks set by an undo/redo action
+ foreach mark [$w mark names] {
+ if {[string range $mark 0 11] eq "tk::undoMark"} {
+ lappend undoMarks $mark
+ }
+ }
+
+ # transform marks into indices
+ # the number of undo/redo marks is always even, each right mark
+ # completes a left mark to give a range
+ # this is true because:
+ # - undo/redo only deals with insertions and deletions of text
+ # - insertions may move marks but not delete them
+ # - when deleting text, marks located inside the deleted range
+ # are not erased but moved to the start of the deletion range
+ # . this is done in TkBTreeDeleteIndexRange ("This segment
+ # refuses to die...")
+ # . because MarkDeleteProc does nothing else than returning
+ # a value indicating that marks are not deleted by this
+ # deleteProc
+ # . mark deletion rather happen through [.text mark unset xxx]
+ # which was not used _up to this point of the code_ (it
+ # is a bit later just before exiting the present proc)
+ set nUndoMarks [llength $undoMarks]
+ set n [expr {$nUndoMarks / 2}]
+ set undoMarks [lsort -dictionary $undoMarks]
+ set Lmarks [lrange $undoMarks 0 [expr {$n - 1}]]
+ set Rmarks [lrange $undoMarks $n [llength $undoMarks]]
+ foreach Lmark $Lmarks Rmark $Rmarks {
+ lappend indices [$w index $Lmark] [$w index $Rmark]
+ $w mark unset $Lmark $Rmark
+ }
+
+ # process ranges to:
+ # - remove those already fully included in another range
+ # - merge overlapping ranges
+ set ind [lsort -dictionary -stride 2 $indices]
+ set indices {}
+
+ for {set i 0} {$i < $nUndoMarks} {incr i 2} {
+ set il1 [lindex $ind $i]
+ set ir1 [lindex $ind [expr {$i + 1}]]
+ lappend indices $il1 $ir1
+
+ for {set j [expr {$i + 2}]} {$j < $nUndoMarks} {incr j 2} {
+ set il2 [lindex $ind $j]
+ set ir2 [lindex $ind [expr {$j + 1}]]
+
+ if {[$w compare $il2 > $ir1]} {
+ # second range starts after the end of first range
+ # -> further second ranges do not need to be considered
+ # because ranges were sorted by increasing first index
+ set j $nUndoMarks
+
+ } else {
+ if {[$w compare $ir2 > $ir1]} {
+ # second range overlaps first range
+ # -> merge them into a single range
+ set indices [lreplace $indices end-1 end]
+ lappend indices $il1 $ir2
+
+ } else {
+ # second range is fully included in first range
+ # -> ignore it
+
+ }
+ # in both cases above, the second range shall be
+ # trimmed out from the list of ranges
+ set ind [lreplace $ind $j [expr {$j + 1}]]
+ incr j -2
+ incr nUndoMarks -2
+
+ }
+
+ }
+
+ }
+
+ return $indices
+}
diff --git a/library/tkfbox.tcl b/library/tkfbox.tcl
index a52465a..f73fdc5 100644
--- a/library/tkfbox.tcl
+++ b/library/tkfbox.tcl
@@ -310,6 +310,7 @@ proc ::tk::dialog::file::Config {dataName type argList} {
# 5. Parse the -filetypes option
#
+ set data(origfiletypes) $data(-filetypes)
set data(-filetypes) [::tk::FDGetFileTypes $data(-filetypes)]
if {![winfo exists $data(-parent)]} {
@@ -1119,7 +1120,9 @@ proc ::tk::dialog::file::Done {w {selectFilePath ""}} {
&& [info exists data(filterType)] && $data(filterType) ne ""
} then {
upvar #0 $data(-typevariable) typeVariable
- set typeVariable [lindex $data(filterType) 0]
+ set typeVariable [lindex $data(origfiletypes) \
+ [lsearch -exact $data(-filetypes) $data(filterType)] 0]
+
}
}
bind $data(okBtn) <Destroy> {}
diff --git a/library/ttk/altTheme.tcl b/library/ttk/altTheme.tcl
index d57227c..5630e6c 100644
--- a/library/ttk/altTheme.tcl
+++ b/library/ttk/altTheme.tcl
@@ -14,6 +14,7 @@ namespace eval ttk::theme::alt {
-disabledfg "#a3a3a3"
-selectbg "#4a6984"
-selectfg "#ffffff"
+ -altindicator "#aaaaaa"
}
ttk::style theme settings alt {
@@ -46,9 +47,13 @@ namespace eval ttk::theme::alt {
ttk::style configure TCheckbutton -indicatorcolor "#ffffff" -padding 2
ttk::style configure TRadiobutton -indicatorcolor "#ffffff" -padding 2
ttk::style map TCheckbutton -indicatorcolor \
- [list disabled $colors(-frame) pressed $colors(-frame)]
+ [list pressed $colors(-frame) \
+ alternate $colors(-altindicator) \
+ disabled $colors(-frame)]
ttk::style map TRadiobutton -indicatorcolor \
- [list disabled $colors(-frame) pressed $colors(-frame)]
+ [list pressed $colors(-frame) \
+ alternate $colors(-altindicator) \
+ disabled $colors(-frame)]
ttk::style configure TMenubutton \
-width -11 -padding "3 3" -relief raised
@@ -58,7 +63,8 @@ namespace eval ttk::theme::alt {
[list readonly $colors(-frame) disabled $colors(-frame)]
ttk::style configure TCombobox -padding 1
ttk::style map TCombobox -fieldbackground \
- [list readonly $colors(-frame) disabled $colors(-frame)]
+ [list readonly $colors(-frame) disabled $colors(-frame)] \
+ -arrowcolor [list disabled $colors(-disabledfg)]
ttk::style configure ComboboxPopdownFrame \
-relief solid -borderwidth 1
diff --git a/library/ttk/clamTheme.tcl b/library/ttk/clamTheme.tcl
index 1789b8a..98f0036 100644
--- a/library/ttk/clamTheme.tcl
+++ b/library/ttk/clamTheme.tcl
@@ -7,16 +7,18 @@
namespace eval ttk::theme::clam {
variable colors
array set colors {
- -disabledfg "#999999"
- -frame "#dcdad5"
- -window "#ffffff"
- -dark "#cfcdc8"
- -darker "#bab5ab"
- -darkest "#9e9a91"
- -lighter "#eeebe7"
- -lightest "#ffffff"
- -selectbg "#4a6984"
- -selectfg "#ffffff"
+ -disabledfg "#999999"
+ -frame "#dcdad5"
+ -window "#ffffff"
+ -dark "#cfcdc8"
+ -darker "#bab5ab"
+ -darkest "#9e9a91"
+ -lighter "#eeebe7"
+ -lightest "#ffffff"
+ -selectbg "#4a6984"
+ -selectfg "#ffffff"
+ -altindicator "#5895bc"
+ -disabledaltindicator "#a0a0a0"
}
ttk::style theme settings clam {
@@ -80,9 +82,15 @@ namespace eval ttk::theme::clam {
-indicatormargin {1 1 4 1} \
-padding 2 ;
ttk::style map TCheckbutton -indicatorbackground \
- [list disabled $colors(-frame) pressed $colors(-frame)]
+ [list pressed $colors(-frame) \
+ {!disabled alternate} $colors(-altindicator) \
+ {disabled alternate} $colors(-disabledaltindicator) \
+ disabled $colors(-frame)]
ttk::style map TRadiobutton -indicatorbackground \
- [list disabled $colors(-frame) pressed $colors(-frame)]
+ [list pressed $colors(-frame) \
+ {!disabled alternate} $colors(-altindicator) \
+ {disabled alternate} $colors(-disabledaltindicator) \
+ disabled $colors(-frame)]
ttk::style configure TMenubutton \
-width -11 -padding 5 -relief raised
@@ -102,7 +110,7 @@ namespace eval ttk::theme::clam {
-fieldbackground [list {readonly focus} $colors(-selectbg) \
readonly $colors(-frame)] \
-foreground [list {readonly focus} $colors(-selectfg)] \
- ;
+ -arrowcolor [list disabled $colors(-disabledfg)]
ttk::style configure ComboboxPopdownFrame \
-relief solid -borderwidth 1
diff --git a/library/ttk/classicTheme.tcl b/library/ttk/classicTheme.tcl
index 7e3eff5..3cb2b18 100644
--- a/library/ttk/classicTheme.tcl
+++ b/library/ttk/classicTheme.tcl
@@ -15,6 +15,7 @@ namespace eval ttk::theme::classic {
-selectfg "#000000"
-disabledfg "#a3a3a3"
-indicator "#b03060"
+ -altindicator "#b05e5e"
}
ttk::style theme settings classic {
@@ -49,15 +50,19 @@ namespace eval ttk::theme::classic {
ttk::style configure TCheckbutton -indicatorrelief raised
ttk::style map TCheckbutton \
-indicatorcolor [list \
- pressed $colors(-frame) selected $colors(-indicator)] \
- -indicatorrelief {selected sunken pressed sunken} \
+ pressed $colors(-frame) \
+ alternate $colors(-altindicator) \
+ selected $colors(-indicator)] \
+ -indicatorrelief {alternate raised selected sunken pressed sunken} \
;
ttk::style configure TRadiobutton -indicatorrelief raised
ttk::style map TRadiobutton \
-indicatorcolor [list \
- pressed $colors(-frame) selected $colors(-indicator)] \
- -indicatorrelief {selected sunken pressed sunken} \
+ pressed $colors(-frame) \
+ alternate $colors(-altindicator) \
+ selected $colors(-indicator)] \
+ -indicatorrelief {alternate raised selected sunken pressed sunken} \
;
ttk::style configure TMenubutton -relief raised -padding "3m 1m"
diff --git a/library/ttk/combobox.tcl b/library/ttk/combobox.tcl
index 03821a2..6ceccef 100644
--- a/library/ttk/combobox.tcl
+++ b/library/ttk/combobox.tcl
@@ -368,7 +368,8 @@ proc ttk::combobox::PlacePopdown {cb popdown} {
set y [winfo rooty $cb]
set w [winfo width $cb]
set h [winfo height $cb]
- set postoffset [ttk::style lookup TCombobox -postoffset {} {0 0 0 0}]
+ set style [$cb cget -style]
+ set postoffset [ttk::style lookup $style -postoffset {} {0 0 0 0}]
foreach var {x y w h} delta $postoffset {
incr $var $delta
}
diff --git a/library/ttk/defaults.tcl b/library/ttk/defaults.tcl
index 4551966..9cc5880 100644
--- a/library/ttk/defaults.tcl
+++ b/library/ttk/defaults.tcl
@@ -5,16 +5,19 @@
namespace eval ttk::theme::default {
variable colors
array set colors {
- -frame "#d9d9d9"
- -foreground "#000000"
- -window "#ffffff"
- -text "#000000"
- -activebg "#ececec"
- -selectbg "#4a6984"
- -selectfg "#ffffff"
- -darker "#c3c3c3"
- -disabledfg "#a3a3a3"
- -indicator "#4a6984"
+ -frame "#d9d9d9"
+ -foreground "#000000"
+ -window "#ffffff"
+ -text "#000000"
+ -activebg "#ececec"
+ -selectbg "#4a6984"
+ -selectfg "#ffffff"
+ -darker "#c3c3c3"
+ -disabledfg "#a3a3a3"
+ -indicator "#4a6984"
+ -disabledindicator "#a3a3a3"
+ -altindicator "#9fbdd8"
+ -disabledaltindicator "#c0c0c0"
}
ttk::style theme settings default {
@@ -45,12 +48,24 @@ namespace eval ttk::theme::default {
ttk::style configure TCheckbutton \
-indicatorcolor "#ffffff" -indicatorrelief sunken -padding 1
ttk::style map TCheckbutton -indicatorcolor \
- [list pressed $colors(-activebg) selected $colors(-indicator)]
+ [list pressed $colors(-activebg) \
+ {!disabled alternate} $colors(-altindicator) \
+ {disabled alternate} $colors(-disabledaltindicator) \
+ {!disabled selected} $colors(-indicator) \
+ {disabled selected} $colors(-disabledindicator)]
+ ttk::style map TCheckbutton -indicatorrelief \
+ [list alternate raised]
ttk::style configure TRadiobutton \
-indicatorcolor "#ffffff" -indicatorrelief sunken -padding 1
ttk::style map TRadiobutton -indicatorcolor \
- [list pressed $colors(-activebg) selected $colors(-indicator)]
+ [list pressed $colors(-activebg) \
+ {!disabled alternate} $colors(-altindicator) \
+ {disabled alternate} $colors(-disabledaltindicator) \
+ {!disabled selected} $colors(-indicator) \
+ {disabled selected} $colors(-disabledindicator)]
+ ttk::style map TRadiobutton -indicatorrelief \
+ [list alternate raised]
ttk::style configure TMenubutton \
-relief raised -padding "10 3"
@@ -62,7 +77,8 @@ namespace eval ttk::theme::default {
ttk::style configure TCombobox -arrowsize 12 -padding 1
ttk::style map TCombobox -fieldbackground \
- [list readonly $colors(-frame) disabled $colors(-frame)]
+ [list readonly $colors(-frame) disabled $colors(-frame)] \
+ -arrowcolor [list disabled $colors(-disabledfg)]
ttk::style configure TSpinbox -arrowsize 10 -padding {2 0 10 0}
ttk::style map TSpinbox -fieldbackground \
diff --git a/library/ttk/vistaTheme.tcl b/library/ttk/vistaTheme.tcl
index c284a52..c6c380d 100644
--- a/library/ttk/vistaTheme.tcl
+++ b/library/ttk/vistaTheme.tcl
@@ -133,7 +133,7 @@ namespace eval ttk::theme::vista {
Spinbox.background -sticky news -children {
Spinbox.padding -sticky news -children {
Spinbox.innerbg -sticky news -children {
- Spinbox.textarea -expand 1 -sticky {}
+ Spinbox.textarea -expand 1
}
}
Spinbox.uparrow -side top -sticky ens
diff --git a/library/xmfbox.tcl b/library/xmfbox.tcl
index aa66f7f..f1daea0 100644
--- a/library/xmfbox.tcl
+++ b/library/xmfbox.tcl
@@ -156,7 +156,7 @@ proc ::tk::MotifFDialog_FileTypes {w} {
# The filetypes radiobuttons
# set data(fileType) $data(-defaulttype)
# Default type to first entry
- set initialTypeName [lindex $data(-filetypes) 0 0]
+ set initialTypeName [lindex $data(origfiletypes) 0 0]
if {$data(-typevariable) ne ""} {
upvar #0 $data(-typevariable) typeVariable
if {[info exists typeVariable]} {
@@ -165,7 +165,7 @@ proc ::tk::MotifFDialog_FileTypes {w} {
}
set ix 0
set data(fileType) 0
- foreach fltr $data(-filetypes) {
+ foreach fltr $data(origfiletypes) {
set fname [lindex $fltr 0]
if {[string first $initialTypeName $fname] == 0} {
set data(fileType) $ix
@@ -185,7 +185,7 @@ proc ::tk::MotifFDialog_FileTypes {w} {
set cnt 0
if {$data(-filetypes) ne {}} {
foreach type $data(-filetypes) {
- set title [lindex [lindex $type 0] 0]
+ set title [lindex $type 0]
set filter [lindex $type 1]
radiobutton $f.b$cnt \
-text $title \
@@ -210,7 +210,6 @@ proc ::tk::MotifFDialog_SetFilter {w type} {
variable ::tk::Priv
set data(filter) [lindex $type 1]
- set Priv(selectFileType) [lindex [lindex $type 0] 0]
MotifFDialog_Update $w
}
@@ -299,6 +298,7 @@ proc ::tk::MotifFDialog_Config {dataName type argList} {
# file dialog, but we check for validity of the value to make sure
# the application code also runs fine with the TK file dialog.
#
+ set data(origfiletypes) $data(-filetypes)
set data(-filetypes) [::tk::FDGetFileTypes $data(-filetypes)]
if {![info exists data(filter)]} {
@@ -870,7 +870,7 @@ proc ::tk::MotifFDialog_ActivateSEnt {w} {
if {[info exists data(-typevariable)] && $data(-typevariable) ne ""
&& [info exists data(-filetypes)] && $data(-filetypes) ne ""} {
upvar #0 $data(-typevariable) typeVariable
- set typeVariable [lindex $data(-filetypes) $data(fileType) 0]
+ set typeVariable [lindex $data(origfiletypes) $data(fileType) 0]
}
if {$data(-multiple) != 0} {
@@ -980,9 +980,3 @@ proc ::tk::ListBoxKeyAccel_Reset {w} {
unset -nocomplain Priv(lbAccel,$w)
}
-proc ::tk_getFileType {} {
- variable ::tk::Priv
-
- return $Priv(selectFileType)
-}
-
diff --git a/macosx/Tk.xcode/project.pbxproj b/macosx/Tk.xcode/project.pbxproj
index eee37a2..f919a71 100644
--- a/macosx/Tk.xcode/project.pbxproj
+++ b/macosx/Tk.xcode/project.pbxproj
@@ -1215,13 +1215,11 @@
F966BC9808F27A3E005CB29B /* makefile.bc */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = makefile.bc; sourceTree = "<group>"; };
F966BC9908F27A3E005CB29B /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; };
F966BC9A08F27A3E005CB29B /* makefile.vc */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = makefile.vc; sourceTree = "<group>"; };
- F966BC9B08F27A3E005CB29B /* mkd.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mkd.bat; sourceTree = "<group>"; };
F966BC9C08F27A3E005CB29B /* nmakehlp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nmakehlp.c; sourceTree = "<group>"; };
F966BCEE08F27A3E005CB29B /* tk.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tk.rc; sourceTree = "<group>"; };
F966BCEF08F27A3E005CB29B /* tk_base.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tk_base.rc; sourceTree = "<group>"; };
F966BCF208F27A3E005CB29B /* wish.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = wish.rc; sourceTree = "<group>"; };
F966BCF308F27A3E005CB29B /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
- F966BCF408F27A3E005CB29B /* rmd.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rmd.bat; sourceTree = "<group>"; };
F966BCF508F27A3F005CB29B /* rules.vc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rules.vc; sourceTree = "<group>"; };
F966BCF608F27A3F005CB29B /* stubs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stubs.c; sourceTree = "<group>"; };
F966BCF708F27A3F005CB29B /* tcl.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = tcl.m4; sourceTree = "<group>"; };
@@ -2794,7 +2792,6 @@
F966BC9808F27A3E005CB29B /* makefile.bc */,
F966BC9908F27A3E005CB29B /* Makefile.in */,
F966BC9A08F27A3E005CB29B /* makefile.vc */,
- F966BC9B08F27A3E005CB29B /* mkd.bat */,
F966BC9C08F27A3E005CB29B /* nmakehlp.c */,
F966BC9D08F27A3E005CB29B /* rc */,
F966BCF308F27A3E005CB29B /* README */,
diff --git a/macosx/Tk.xcodeproj/project.pbxproj b/macosx/Tk.xcodeproj/project.pbxproj
index 2f7edba..a873432 100644
--- a/macosx/Tk.xcodeproj/project.pbxproj
+++ b/macosx/Tk.xcodeproj/project.pbxproj
@@ -1215,13 +1215,11 @@
F966BC9808F27A3E005CB29B /* makefile.bc */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = makefile.bc; sourceTree = "<group>"; };
F966BC9908F27A3E005CB29B /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; };
F966BC9A08F27A3E005CB29B /* makefile.vc */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = makefile.vc; sourceTree = "<group>"; };
- F966BC9B08F27A3E005CB29B /* mkd.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mkd.bat; sourceTree = "<group>"; };
F966BC9C08F27A3E005CB29B /* nmakehlp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nmakehlp.c; sourceTree = "<group>"; };
F966BCEE08F27A3E005CB29B /* tk.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tk.rc; sourceTree = "<group>"; };
F966BCEF08F27A3E005CB29B /* tk_base.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tk_base.rc; sourceTree = "<group>"; };
F966BCF208F27A3E005CB29B /* wish.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = wish.rc; sourceTree = "<group>"; };
F966BCF308F27A3E005CB29B /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
- F966BCF408F27A3E005CB29B /* rmd.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rmd.bat; sourceTree = "<group>"; };
F966BCF508F27A3F005CB29B /* rules.vc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rules.vc; sourceTree = "<group>"; };
F966BCF608F27A3F005CB29B /* stubs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stubs.c; sourceTree = "<group>"; };
F966BCF708F27A3F005CB29B /* tcl.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = tcl.m4; sourceTree = "<group>"; };
@@ -2794,11 +2792,9 @@
F966BC9808F27A3E005CB29B /* makefile.bc */,
F966BC9908F27A3E005CB29B /* Makefile.in */,
F966BC9A08F27A3E005CB29B /* makefile.vc */,
- F966BC9B08F27A3E005CB29B /* mkd.bat */,
F966BC9C08F27A3E005CB29B /* nmakehlp.c */,
F966BC9D08F27A3E005CB29B /* rc */,
F966BCF308F27A3E005CB29B /* README */,
- F966BCF408F27A3E005CB29B /* rmd.bat */,
F966BCF508F27A3F005CB29B /* rules.vc */,
F966BCF608F27A3F005CB29B /* stubs.c */,
F966BCF708F27A3F005CB29B /* tcl.m4 */,
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index f48538d..5ca8bfe 100644
--- a/macosx/tkMacOSXDraw.c
+++ b/macosx/tkMacOSXDraw.c
@@ -880,7 +880,7 @@ XDrawLines(
*----------------------------------------------------------------------
*/
-void
+int
XDrawSegments(
Display *display,
Drawable d,
@@ -894,7 +894,7 @@ XDrawSegments(
display->request++;
if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) {
- return;
+ return BadDrawable;
}
if (dc.context) {
double o = (lw % 2) ? .5 : 0;
@@ -911,6 +911,7 @@ XDrawSegments(
}
}
TkMacOSXRestoreDrawingContext(&dc);
+ return Success;
}
/*
@@ -1526,12 +1527,6 @@ TkScrollWindow(
srcRect = CGRectMake(x, y, width, height);
dstRect = CGRectOffset(srcRect, dx, dy);
- /* Expand the rectangles slightly to avoid degeneracies. */
- srcRect.origin.y -= 1;
- srcRect.size.height += 2;
- dstRect.origin.y += 1;
- dstRect.size.height -= 2;
-
/* Compute the damage. */
dmgRgn = HIShapeCreateMutableWithRect(&srcRect);
extraRgn = HIShapeCreateWithRect(&dstRect);
@@ -1570,9 +1565,6 @@ TkScrollWindow(
int oldMode = Tcl_SetServiceMode(TCL_SERVICE_NONE);
[view generateExposeEvents:dmgRgn childrenOnly:1];
Tcl_SetServiceMode(oldMode);
-
- /* Belt and suspenders: make the AppKit request a redraw
- when it gets control again. */
}
} else {
dmgRgn = HIShapeCreateEmpty();
@@ -1694,13 +1686,13 @@ TkMacOSXSetupDrawingContext(
CGContextSetTextDrawingMode(dc.context, kCGTextFill);
CGContextConcatCTM(dc.context, t);
if (dc.clipRgn) {
- #ifdef TK_MAC_DEBUG_DRAWING
+#ifdef TK_MAC_DEBUG_DRAWING
CGContextSaveGState(dc.context);
ChkErr(HIShapeReplacePathInCGContext, dc.clipRgn, dc.context);
CGContextSetRGBFillColor(dc.context, 1.0, 0.0, 0.0, 0.1);
CGContextEOFillPath(dc.context);
CGContextRestoreGState(dc.context);
- #endif /* TK_MAC_DEBUG_DRAWING */
+#endif /* TK_MAC_DEBUG_DRAWING */
CGRect r;
if (!HIShapeIsRectangular(dc.clipRgn) || !CGRectContainsRect(
*HIShapeGetBounds(dc.clipRgn, &r),
diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c
index d3e0e41..b5ae1a3 100644
--- a/macosx/tkMacOSXFont.c
+++ b/macosx/tkMacOSXFont.c
@@ -870,7 +870,7 @@ TkpMeasureCharsInContext(
if (index <= start && !(flags & TK_WHOLE_WORDS)) {
index = CTTypesetterSuggestClusterBreak(typesetter, start, maxWidth);
}
- cs = (index < len || (flags & TK_WHOLE_WORDS)) ?
+ cs = (index <= len && (flags & TK_WHOLE_WORDS)) ?
whitespaceCharacterSet : lineendingCharacterSet;
while (index > start &&
[cs characterIsMember:[string characterAtIndex:(index - 1)]]) {
diff --git a/macosx/tkMacOSXPort.h b/macosx/tkMacOSXPort.h
index 0c3b347..bd48bd5 100644
--- a/macosx/tkMacOSXPort.h
+++ b/macosx/tkMacOSXPort.h
@@ -53,7 +53,6 @@
#include <X11/Xatom.h>
#include <X11/Xfuncproto.h>
#include <X11/Xutil.h>
-#include "tkIntXlibDecls.h"
/*
* The following macro defines the type of the mask arguments to
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index 461a94c..4672586 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -357,17 +357,17 @@ GenerateUpdates(
event.xany.window = Tk_WindowId(winPtr);
event.xany.display = Tk_Display(winPtr);
event.type = Expose;
- event.xexpose.x = damageBounds.origin.x - bounds.origin.x;
- event.xexpose.y = damageBounds.origin.y - bounds.origin.y;
+ event.xexpose.x = damageBounds.origin.x;
+ event.xexpose.y = damageBounds.origin.y;
event.xexpose.width = damageBounds.size.width;
event.xexpose.height = damageBounds.size.height;
event.xexpose.count = 0;
Tk_HandleEvent(&event);
- #ifdef TK_MAC_DEBUG_DRAWING
+#ifdef TK_MAC_DEBUG_DRAWING
NSLog(@"Expose %p {{%d, %d}, {%d, %d}}", event.xany.window, event.xexpose.x,
event.xexpose.y, event.xexpose.width, event.xexpose.height);
- #endif
+#endif
/*
* Generate updates for the children of this window
diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c
index 1313c9f..2251b8f 100644
--- a/macosx/tkMacOSXXStubs.c
+++ b/macosx/tkMacOSXXStubs.c
@@ -528,7 +528,7 @@ XClearWindow(
}
/*
-void
+int
XDrawPoint(
Display* display,
Drawable d,
@@ -538,7 +538,7 @@ XDrawPoint(
{
}
-void
+int
XDrawPoints(
Display* display,
Drawable d,
diff --git a/tests/bitmap.test b/tests/bitmap.test
index bd9c47f..6996f88 100644
--- a/tests/bitmap.test
+++ b/tests/bitmap.test
@@ -84,12 +84,14 @@ test bitmap-3.1 {Tk_FreeBitmapFromObj - reference counts} -constraints {
test bitmap-4.1 {FreeBitmapObjProc} -constraints {
testbitmap
+} -setup {
+ proc copy {s} {return [string index $s 0][string range $s 1 end]}
} -body {
- set x [join questhead]
+ set x [copy questhead]
button .b -bitmap $x
- set y [join questhead]
+ set y [copy questhead]
.b configure -bitmap $y
- set z [join questhead]
+ set z [copy questhead]
.b configure -bitmap $z
set result {}
lappend result [testbitmap questhead]
@@ -102,6 +104,7 @@ test bitmap-4.1 {FreeBitmapObjProc} -constraints {
set y bogus
return $result
} -cleanup {
+ rename copy {}
destroy .b
} -result {{{1 3}} {{1 2}} {{1 1}} {}}
diff --git a/tests/border.test b/tests/border.test
index 2ca64c1..d6ff5c7 100644
--- a/tests/border.test
+++ b/tests/border.test
@@ -127,16 +127,18 @@ test border-2.2 {Tk_Free3DBorder - unlinking from list} -constraints {
destroy .b .t2 .t3 .t
} -result {{{4 1} {3 0} {2 0} {1 0}} {{4 1} {2 0} {1 0}} {{4 1} {2 0}} {{2 0}} {}}
+
test border-3.1 {FreeBorderObjProc} -constraints {
testborder
} -setup {
set result {}
+ proc copy {s} {return [string index $s 0][string range $s 1 end]}
} -body {
- set x [join purple]
+ set x [copy purple]
button .b -bg $x -text .b1
- set y [join purple]
+ set y [copy purple]
.b configure -bg $y
- set z [join purple]
+ set z [copy purple]
.b configure -bg $z
lappend result [testborder purple]
set x red
@@ -148,6 +150,7 @@ test border-3.1 {FreeBorderObjProc} -constraints {
set y bogus
return $result
} -cleanup {
+ rename copy {}
destroy .b
} -result {{{1 3}} {{1 2}} {{1 1}} {}}
diff --git a/tests/button.test b/tests/button.test
index d7fb06d..47d4296 100644
--- a/tests/button.test
+++ b/tests/button.test
@@ -3435,15 +3435,47 @@ test button-5.23 {ConfigureButton - -height option} -constraints {
test button-5.24 {ConfigureButton - computing geometry} -constraints {
fonts
} -body {
- button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
- .b configure -text "Sample text" -width 10 -height 2
+ button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
+ -padx 30 -pady 20
+ # 1. button with text
+ .b configure -text "Sample text"
pack .b
- set result "[winfo reqwidth .b] [winfo reqheight .b]"
- .b configure -bitmap questhead
- lappend result [winfo reqwidth .b] [winfo reqheight .b]
-} -cleanup {
- destroy .b
-} -result {104 46 20 12}
+ set textwidth [font measure [.b cget -font] -displayof .b [.b cget -text]]
+ set expectedwidth [expr {$textwidth + 2*[.b cget -borderwidth] \
+ + 2*[.b cget -highlightthickness] + 2*[.b cget -padx]}]
+ incr expectedwidth 2 ; # added (hardcoded) in tkUnixButton.c
+ set result [expr $expectedwidth == [winfo reqwidth .b]]
+ set linespace [lindex [font metrics [.b cget -font] -displayof .b] 5]
+ set expectedheight [expr {$linespace + 2*[.b cget -borderwidth] \
+ + 2*[.b cget -highlightthickness] + 2*[.b cget -pady]}]
+ incr expectedheight 2 ; # added (hardcoded) in tkUnixButton.c
+ lappend result [expr $expectedheight == [winfo reqheight .b]]
+ # 2. button with a bitmap image
+ # there is no access to characteristics the predefined bitmaps,
+ # so define one as an image (copied from questhead.xbm)
+ set myquesthead [image create bitmap -data {
+ #define myquesthead_width 20
+ #define myquesthead_height 22
+ static unsigned char myquesthead_bits[] = {
+ 0xf8, 0x1f, 0x00, 0xac, 0x2a, 0x00, 0x56, 0x55, 0x00, 0xeb, 0xaf, 0x00,
+ 0xf5, 0x5f, 0x01, 0xfb, 0xbf, 0x00, 0x75, 0x5d, 0x01, 0xfb, 0xbe, 0x02,
+ 0x75, 0x5d, 0x05, 0xab, 0xbe, 0x0a, 0x55, 0x5f, 0x07, 0xab, 0xaf, 0x00,
+ 0xd6, 0x57, 0x01, 0xac, 0xab, 0x00, 0xd8, 0x57, 0x00, 0xb0, 0xaa, 0x00,
+ 0x50, 0x55, 0x00, 0xb0, 0x0b, 0x00, 0xd0, 0x17, 0x00, 0xb0, 0x0b, 0x00,
+ 0x58, 0x15, 0x00, 0xa8, 0x2a, 0x00};
+ }]
+ .b configure -image $myquesthead
+ set expectedwidth [expr {[image width $myquesthead] + 2*[.b cget -borderwidth] \
+ + 2*[.b cget -highlightthickness]}]
+ incr expectedwidth 2 ; # added (hardcoded) in tkUnixButton.c
+ lappend result [expr $expectedwidth == [winfo reqwidth .b]]
+ set expectedheight [expr {[image height $myquesthead] + 2*[.b cget -borderwidth] \
+ + 2*[.b cget -highlightthickness]}]
+ incr expectedheight 2 ; # added (hardcoded) in tkUnixButton.c
+ lappend result [expr $expectedheight == [winfo reqheight .b]]
+} -cleanup {
+ destroy .b
+} -result {1 1 1 1}
test button-5.25 {ConfigureButton - computing geometry} -setup {
button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
diff --git a/tests/color.test b/tests/color.test
index 237ec01..0b328cf 100644
--- a/tests/color.test
+++ b/tests/color.test
@@ -255,13 +255,17 @@ test color-3.4 {Tk_FreeColorFromObj - unlinking from list} colorsFree {
lappend result [testcolor purple]
} {{{4 1} {3 0} {2 0} {1 0}} {{4 1} {2 0} {1 0}} {{4 1} {2 0}} {{2 0}} {}}
-test color-4.1 {FreeColorObjProc} colorsFree {
+test color-4.1 {FreeColorObjProc} -constraints {
+ colorsFree
+} -setup {
+ proc copy {s} {return [string index $s 0][string range $s 1 end]}
+} -body {
destroy .b
- set x [format purple]
+ set x [copy purple]
button .b -foreground $x -text .b1
- set y [format purple]
+ set y [copy purple]
.b configure -foreground $y
- set z [format purple]
+ set z [copy purple]
.b configure -foreground $z
set result {}
lappend result [testcolor purple]
@@ -273,7 +277,9 @@ test color-4.1 {FreeColorObjProc} colorsFree {
lappend result [testcolor purple]
set y bogus
set result
-} {{{1 3}} {{1 2}} {{1 1}} {}}
+} -cleanup {
+ rename copy {}
+} -result {{{1 3}} {{1 2}} {{1 1}} {}}
destroy .t
diff --git a/tests/constraints.tcl b/tests/constraints.tcl
index e0486ff..a87499d 100644
--- a/tests/constraints.tcl
+++ b/tests/constraints.tcl
@@ -180,7 +180,11 @@ namespace import -force tk::test::*
namespace import -force tcltest::testConstraint
testConstraint notAqua [expr {[tk windowingsystem] ne "aqua"}]
testConstraint aqua [expr {[tk windowingsystem] eq "aqua"}]
+testConstraint x11 [expr {[tk windowingsystem] eq "x11"}]
testConstraint nonwin [expr {[tk windowingsystem] ne "win32"}]
+testConstraint aquaOrWin32 [expr {
+ ([tk windowingsystem] eq "win32") || [testConstraint aqua]
+}]
testConstraint userInteraction 0
testConstraint nonUnixUserInteraction [expr {
[testConstraint userInteraction] ||
diff --git a/tests/cursor.test b/tests/cursor.test
index 95c7b99..8d7ebb0 100644
--- a/tests/cursor.test
+++ b/tests/cursor.test
@@ -144,12 +144,14 @@ test cursor-3.1 {Tk_FreeCursorFromObj - reference counts} -constraints {
test cursor-4.1 {FreeCursorObjProc} -constraints {
testcursor
+} -setup {
+ proc copy {s} {return [string index $s 0][string range $s 1 end]}
} -body {
- set x [join heart]
+ set x [copy heart]
button .b -cursor $x
- set y [join heart]
+ set y [copy heart]
.b configure -cursor $y
- set z [join heart]
+ set z [copy heart]
.b configure -cursor $z
set result {}
lappend result [testcursor heart]
@@ -162,6 +164,7 @@ test cursor-4.1 {FreeCursorObjProc} -constraints {
set y bogus
set result
} -cleanup {
+ rename copy {}
destroy .b
} -result {{{1 3}} {{1 2}} {{1 1}} {}}
diff --git a/tests/entry.test b/tests/entry.test
index eeebe5d..785dd0b 100644
--- a/tests/entry.test
+++ b/tests/entry.test
@@ -2305,10 +2305,20 @@ test entry-8.18 {DeleteChars procedure} -setup {
.e insert 0 "xyzzy"
update
.e delete 2 4
- winfo reqwidth .e
-} -cleanup {
- destroy .e
-} -result {31}
+ # To check that deletion actually happened we measure the new width
+ # of the widget, based on the measuring width of the remaining text ("xyy")
+ # in the widget. For that purpose we have to mirror the code in tkEntry.c
+ # for computation of the reqwidth
+ # note: XPAD corresponds to the hardcoded #define XPAD 1
+ set XPAD 1
+ set expected [expr { [font measure [.e cget -font] "xyy"] \
+ + 2 * ( [.e cget -borderwidth] + \
+ [.e cget -highlightthickness] + $XPAD ) } ]
+ expr {[winfo reqwidth .e] == $expected}
+} -cleanup {
+ destroy .e
+ unset XPAD expected
+} -result {1}
test entry-9.1 {EntryValueChanged procedure} -setup {
unset -nocomplain x
diff --git a/tests/event.test b/tests/event.test
index 1691868..f874065 100644
--- a/tests/event.test
+++ b/tests/event.test
@@ -822,6 +822,41 @@ test event-7.2(double-click) {A double click on a lone character
deleteWindows
} -result {4 A 4 A}
+test event-8 {event generate with keysyms corresponding to
+ multi-byte virtual keycodes - bug
+ e36963bfe8df9f5e528134707a91b9c0051de723} -constraints nonPortable -setup {
+ deleteWindows
+ set res [list ]
+} -body {
+ set t [toplevel .t]
+ set e [entry $t.e]
+ pack $e
+ tkwait visibility $e
+ bind $e <KeyPress> {lappend res keycode: %k keysym: %K}
+ focus -force $e
+ update
+ event generate $e <diaeresis>
+ # The value now contained in $res depends on the actual
+ # physical keyboard layout and keycode generated, from
+ # the hardware on which the test suite happens to run.
+ # We don't need (and we can't really) check correctness
+ # of the (system-dependent) keycode received, however
+ # Tk should be able to associate this keycode to a
+ # (system-independent) known keysym, unless the system
+ # running the test does not have a keyboard with a
+ # diaeresis key.
+ if {[expr {[lindex $res 3] ne "??"}]} {
+ # keyboard has a physical diaeresis key and bug is fixed
+ return "OK"
+ } else {
+ return "Test failed, unless the keyboard tied to the system \
+ on which this test is run does NOT have a diaeresis \
+ physical key - in this case, test is actually void."
+ }
+} -cleanup {
+ deleteWindows
+} -result {OK}
+
# cleanup
unset -nocomplain keypress_lookup
rename _init_keypress_lookup {}
diff --git a/tests/filebox.test b/tests/filebox.test
index 864d215..85cb8a5 100644
--- a/tests/filebox.test
+++ b/tests/filebox.test
@@ -281,7 +281,7 @@ foreach mode $modes {
-initialfile $fileName -initialdir $fileDir \
-typevariable tv]
if {[info exists tv]} {
- regexp {^(.*) \(.*\)$} $tv dummy typeName
+ set typeName $tv
} else {
set typeName "-unset-"
}
@@ -463,7 +463,7 @@ foreach mode $modes {
}
# The rest of the tests need to be executed on Unix only.
- # The test whether the dialog box widgets were implemented correctly.
+ # They test whether the dialog box widgets were implemented correctly.
# These tests are not
# needed on the other platforms because they use native file dialogs.
}
diff --git a/tests/focusTcl.test b/tests/focusTcl.test
index ef848bb..0e457a6 100644
--- a/tests/focusTcl.test
+++ b/tests/focusTcl.test
@@ -402,7 +402,7 @@ test focusTcl-5.4 {tkFocusOK procedure, -takefocus ""} -body {
test focusTcl-5.5 {tkFocusOK procedure, -takefocus "", not mapped} -body {
setup1 .
.b.x configure -takefocus ""
- pack unpack .b.x
+ pack forget .b.x
update
tk_focusNext .b
} -cleanup {
@@ -413,7 +413,7 @@ test focusTcl-5.6 {tkFocusOK procedure, -takefocus "", not mapped} -body {
foreach w {.b.x .b.y .b.z} {
$w configure -takefocus ""
}
- pack unpack .b
+ pack forget .b
update
tk_focusNext .b
} -cleanup {
@@ -422,7 +422,7 @@ test focusTcl-5.6 {tkFocusOK procedure, -takefocus "", not mapped} -body {
test focusTcl-5.7 {tkFocusOK procedure, -takefocus "", not mapped} -body {
setup1 .
.b.y configure -takefocus 1
- pack unpack .b.y
+ pack forget .b.y
update
tk_focusNext .b.x
} -cleanup {
@@ -432,7 +432,7 @@ test focusTcl-5.8 {tkFocusOK procedure, -takefocus "", not mapped} -body {
proc always args {return 1}
setup1 .
.b.y configure -takefocus always
- pack unpack .b.y
+ pack forget .b.y
update
tk_focusNext .b.x
} -cleanup {
diff --git a/tests/font.test b/tests/font.test
index 70cd779..b8c0144 100644
--- a/tests/font.test
+++ b/tests/font.test
@@ -141,10 +141,22 @@ test font-4.9 {font command: actual} -constraints {unix noExceed} -body {
test font-4.10 {font command: actual} -constraints win -body {
# (objc > 3) so objPtr = objv[3 + skip]
font actual {-family times} -family
-} -result {Times New Roman}
+} -result {times}
test font-4.11 {font command: bad option} -body {
font actual xyz -style
} -returnCodes error -result {bad option "-style": must be -family, -size, -weight, -slant, -underline, or -overstrike}
+test font-4.12 {font command: actual} -body {
+ font actual {-family times} -- \ud800
+} -match glob -result {*}
+test font-4.13 {font command: actual} -body {
+ font actual {-family times} -- \udc00
+} -match glob -result {*}
+test font-4.14 {font command: actual} -constraints win -body {
+ font actual {-family times} -family -- \ud800\udc00
+} -result {times}
+test font-4.15 {font command: actual} -body {
+ font actual {-family times} -- \udc00\ud800
+} -returnCodes 1 -match glob -result {expected a single character but got "*"}
test font-5.1 {font command: configure} -body {
@@ -2333,7 +2345,7 @@ test font-45.1 {TkFontGetAliasList: no match} -body {
} -result [font actual {-size 10} -family]
test font-45.2 {TkFontGetAliasList: match} -constraints win -body {
font actual {times 10} -family
-} -result {Times New Roman}
+} -result {times}
test font-45.3 {TkFontGetAliasList: match} -constraints {unix noExceed} -body {
# can fail on Unix systems that have a real "times new roman" font
font actual {{times new roman} 10} -family
diff --git a/tests/grid.test b/tests/grid.test
index c1d9d06..cba69db 100644
--- a/tests/grid.test
+++ b/tests/grid.test
@@ -1998,6 +1998,25 @@ test grid-22.5 {remove} {
grid info .c
} {-in . -column 0 -row 0 -columnspan 2 -rowspan 2 -ipadx 0 -ipady 0 -padx {3 5} -pady {4 7} -sticky ns}
grid_reset 22.5
+
+test grid-23 {grid configure -in leaked from previous master - bug
+ 6aea69fccbb266b7f0437686379fbe5b55442958} {
+ frame .f
+ frame .g
+ pack .f .g
+ text .t
+ grid .t -in .f
+ pack forget .f
+ update
+ grid .t -in .g
+ # .t is now managed by .g; following lines must have no effect on .t
+ pack .f
+ update
+ pack forget .f
+ update
+ winfo ismapped .t ; # must return 1
+} {1}
+grid_reset 23
# cleanup
cleanupTests
diff --git a/tests/imgPhoto.test b/tests/imgPhoto.test
index e566176..f9ffa94 100644
--- a/tests/imgPhoto.test
+++ b/tests/imgPhoto.test
@@ -797,6 +797,23 @@ test imgPhoto-4.73 {ImgPhotoCmd procedure: copy with -compositingrule} -setup {
} -cleanup {
image delete photo1 photo2
} -result {0,2 1,1 2,0}
+test imgPhoto-4.74 {ImgPhotoCmd procedure: put option error handling} -setup {
+ image create photo photo1
+} -body {
+ photo1 put {{white}} -to 10 10 20 20 {{white}}
+} -cleanup {
+ image delete photo1
+} -returnCodes 1 -result {wrong # args: should be "photo1 put data ?-option value ...?"}
+test imgPhoto-4.75 {<photo> read command: filename starting with '-'} -constraints {
+ hasTeapotPhoto
+} -body {
+ file copy -force $teapotPhotoFile -teapotPhotoFile
+ image create photo photo1
+ photo1 read -teapotPhotoFile
+} -cleanup {
+ image delete photo1
+ file delete ./-teapotPhotoFile
+} -result {}
test imgPhoto-5.1 {ImgPhotoGet/Free procedures, shared instances} -constraints {
hasTeapotPhoto
diff --git a/tests/listbox.test b/tests/listbox.test
index fc243f1..92029de 100644
--- a/tests/listbox.test
+++ b/tests/listbox.test
@@ -1222,6 +1222,7 @@ test listbox-4.1 {ConfigureListbox procedure} -constraints {
pack .l
update
} -body {
+ update
set x [getsize .]
.l configure -setgrid 0
update
@@ -2306,7 +2307,7 @@ test listbox-13.3 {ListboxScanTo procedure} -constraints {
.l scan dragto [expr 5+$width] [expr 10+$height]
update
lappend x [format {%.6g %.6g} {*}[.l xview]] [format {%.6g %.6g} {*}[.l yview]]
-} -result {{0.8 1} {0.75 1} {0.64 0.84} {0.25 0.5}}
+} -result {{0.8 1} {0.75 1} {0.6 0.8} {0.25 0.5}}
test listbox-14.1 {NearestListboxElement procedure, partial last line} -body {
diff --git a/tests/menu.test b/tests/menu.test
index 7931c66..479978e 100644
--- a/tests/menu.test
+++ b/tests/menu.test
@@ -3878,6 +3878,35 @@ test menu-37.1 {menubar menues cannot be posted - bug 2160206} -setup {
destroy .m
} -result {1 {a menubar menu cannot be posted}}
+test menu-38.1 {Can't dismiss ttk::menubutton menu until mouse has hovered over it - bug fa32290898} -setup {
+} -constraints {macOrUnix} -body {
+ toplevel .top
+ ttk::menubutton .top.mb -text "Some menu";
+ menu .top.mb.m;
+ .top.mb.m add command -label "Item 1";
+ .top.mb.m add command -label "Item 2";
+ .top.mb configure -menu .top.mb.m;
+ pack .top.mb
+ update
+ # simulate mouse click on the menubutton, which posts its menu
+ event generate .top.mb <ButtonPress-1> -warp 1
+ update
+ after 50
+ event generate .top.mb <ButtonRelease-1>
+ update
+ # simulate mouse click on the menu again, i.e. without
+ # entering/leaving the posted menu
+ event generate .top.mb <ButtonPress-1>
+ update
+ after 50
+ event generate .top.mb <ButtonRelease-1>
+ update
+ # the menu shall have been unposted by the second click
+ winfo ismapped .top.mb.m
+} -cleanup {
+ destroy .top.mb.m .top.m .top
+} -result {0}
+
# cleanup
imageFinish
diff --git a/tests/pack.test b/tests/pack.test
index cf62f7b..279db8b 100644
--- a/tests/pack.test
+++ b/tests/pack.test
@@ -1403,7 +1403,7 @@ test pack-15.1 {managing geometry with -in option} -setup {
pack .pack.b -in .pack.f.f2
update
set result [winfo geom .pack.b]
- pack unpack .pack.a
+ pack forget .pack.a
update
lappend result [winfo geom .pack.b]
} -cleanup {
@@ -1441,7 +1441,7 @@ test pack-15.3 {managing geometry with -in option} -setup {
pack .pack.b -in .pack.f.f2
update
set result [winfo ismapped .pack.b]
- pack unpack .pack.f
+ pack forget .pack.f
update
lappend result [winfo ismapped .pack.b]
} -cleanup {
diff --git a/tests/scrollbar.test b/tests/scrollbar.test
index 6d811dc..b7cdbc0 100644
--- a/tests/scrollbar.test
+++ b/tests/scrollbar.test
@@ -396,10 +396,10 @@ test scrollbar-3.70 {ScrollbarWidgetCmd procedure, "set" option} {
} {100 50 30 30}
test scrollbar-3.71 {ScrollbarWidgetCmd procedure, "set" option} {
list [catch {.s set 1 2 3} msg] $msg
-} {1 {wrong # args: should be ".s set firstFraction lastFraction" or ".s set totalUnits windowUnits firstUnit lastUnit"}}
+} {1 {wrong # args: should be ".s set firstFraction lastFraction"}}
test scrollbar-3.72 {ScrollbarWidgetCmd procedure, "set" option} {
list [catch {.s set 1 2 3 4 5} msg] $msg
-} {1 {wrong # args: should be ".s set firstFraction lastFraction" or ".s set totalUnits windowUnits firstUnit lastUnit"}}
+} {1 {wrong # args: should be ".s set firstFraction lastFraction"}}
test scrollbar-3.73 {ScrollbarWidgetCmd procedure} {
list [catch {.s bogus} msg] $msg
} {1 {bad option "bogus": must be activate, cget, configure, delta, fraction, get, identify, or set}}
diff --git a/tests/spinbox.test b/tests/spinbox.test
index 206a61d..1f2bdac 100644
--- a/tests/spinbox.test
+++ b/tests/spinbox.test
@@ -2607,10 +2607,25 @@ test spinbox-8.18 {DeleteChars procedure} -setup {
.e insert 0 "xyzzy"
update
.e delete 2 4
- winfo reqwidth .e
-} -cleanup {
- destroy .e
-} -result {42}
+ # To check that deletion actually happened we measure the new width
+ # of the widget, based on the measuring width of the remaining text ("xyy")
+ # in the widget. For that purpose we have to mirror the code in tkEntry.c
+ # for computation of the reqwidth
+ # note: XPAD corresponds to the hardcoded #define XPAD 1
+ set XPAD 1
+ set buttonWidth [expr { [font measure [.e cget -font] "0"] + 2 * (1 + $XPAD) }]
+ if {$buttonWidth < 11} {
+ set buttonWidth 11
+ }
+ set expected [expr { [font measure [.e cget -font] "xyy"] \
+ + 2 * ( [.e cget -borderwidth] + \
+ [.e cget -highlightthickness] + $XPAD ) \
+ + $buttonWidth } ]
+ expr {[winfo reqwidth .e] == $expected}
+} -cleanup {
+ destroy .e
+ unset XPAD buttonWidth expected
+} -result {1}
test spinbox-9.1 {SpinboxValueChanged procedure} -setup {
unset -nocomplain x
diff --git a/tests/text.test b/tests/text.test
index 8723d3d..84ed50e 100644
--- a/tests/text.test
+++ b/tests/text.test
@@ -29,6 +29,15 @@ test text-1.1 {configuration option: "autoseparators"} -setup {
} -cleanup {
destroy .t
} -result {1}
+test text-1.1b {configuration option: "autoseparators", default} -setup {
+ text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
+ pack .t
+ update
+} -body {
+ .t cget -autoseparators
+} -cleanup {
+ destroy .t
+} -result {1}
test text-1.2 {configuration option: "autoseparators"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -428,6 +437,15 @@ test text-1.43 {configuration option: "maxundo"} -setup {
} -cleanup {
destroy .t
} -result {5}
+test text-1.43b {configuration option: "maxundo", default} -setup {
+ text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
+ pack .t
+ update
+} -body {
+ .t cget -maxundo
+} -cleanup {
+ destroy .t
+} -result {0}
test text-1.44 {configuration option: "maxundo"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -732,6 +750,15 @@ test text-1.75 {configuration option: "undo"} -setup {
} -cleanup {
destroy .t
} -result {1}
+test text-1.75b {configuration option: "undo", default} -setup {
+ text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
+ pack .t
+ update
+} -body {
+ .t cget -undo
+} -cleanup {
+ destroy .t
+} -result {0}
test text-1.76 {configuration option: "undo"} -setup {
text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
pack .t
@@ -895,9 +922,9 @@ test text-2.8 {Tk_TextCmd procedure} -constraints {
.t tag cget sel -relief
} -cleanup {
destroy .t
-} -result {solid}
+} -result {flat}
test text-2.9 {Tk_TextCmd procedure} -constraints {
- unix
+ unix notAqua
} -body {
catch {destroy .t}
text .t
@@ -1458,7 +1485,19 @@ Line 7"
rename .t {}
rename test.t .t
destroy .t
-} -result {{edit undo} {delete 2.1 2.4} {mark set insert 2.1} {see insert} {insert 2.1 ef} {mark set insert 2.3} {see insert}}
+} -result [list {edit undo} {delete 2.1 2.4} {mark set insert 2.1} {see insert} \
+ {mark set tk::undoMarkL2 2.1} {mark set tk::undoMarkR2 2.4} \
+ {mark gravity tk::undoMarkL2 left} {mark gravity tk::undoMarkR2 right} \
+ {insert 2.1 ef} {mark set insert 2.3} {see insert} \
+ {mark set tk::undoMarkL1 2.1} {mark set tk::undoMarkR1 2.3} \
+ {mark gravity tk::undoMarkL1 left} {mark gravity tk::undoMarkR1 right} \
+ {mark names} \
+ {index tk::undoMarkL1} {index tk::undoMarkR1} \
+ {mark unset tk::undoMarkL1 tk::undoMarkR1} \
+ {index tk::undoMarkL2} {index tk::undoMarkR2} \
+ {mark unset tk::undoMarkL2 tk::undoMarkR2} \
+ {compare 2.1 > 2.3} {compare 2.6 > 2.3} ]
+
test text-8.23 {TextWidgetCmd procedure, "replace" option with undo} -setup {
text .t
} -body {
@@ -2604,7 +2643,7 @@ test text-10.37 {TextWidgetCmd procedure, "count" option} -setup {
} -result {3}
test text-10.38 {TextWidgetCmd procedure, "count" option} -setup {
text .t -font {Courier -12} -borderwidth 2 -highlightthickness 2
- pack append . .t {top expand fill}
+ pack .t -expand 1 -fill both
} -body {
.t configure -width 20 -height 10
update
@@ -2700,7 +2739,7 @@ test text-9.2.47 {TextWidgetCmd procedure, "count" option} -setup {
test text-11.1 {counting with tag priority eliding} -setup {
text .t -font {Courier -12} -borderwidth 2 -highlightthickness 2
- pack append . .t {top expand fill}
+ pack .t -expand 1 -fill both
} -body {
.t insert end "hello"
.t configure -wrap none
@@ -2717,7 +2756,7 @@ test text-11.1 {counting with tag priority eliding} -setup {
} -result {0 1 2 3 4 5 5 6}
test text-11.2 {counting with tag priority eliding} -setup {
text .t -font {Courier -12} -borderwidth 2 -highlightthickness 2
- pack append . .t {top expand fill}
+ pack .t -expand 1 -fill both
} -body {
.t insert end "hello"
.t tag configure elide1 -elide 0
@@ -2829,7 +2868,7 @@ test text-11.7 {counting with tag priority eliding} -setup {
} -result {5 5}
test text-11.8 {counting with tag priority eliding} -setup {
text .t -font {Courier -12} -borderwidth 2 -highlightthickness 2
- pack append . .t {top expand fill}
+ pack .t -expand 1 -fill both
set res {}
} -body {
.t insert end "hello"
@@ -2855,7 +2894,7 @@ test text-11.8 {counting with tag priority eliding} -setup {
} -result {0 0 0 0 3 2 1 1}
test text-11.9 {counting with tag priority eliding} -setup {
text .t -font {Courier -12} -borderwidth 2 -highlightthickness 2
- pack append . .t {top expand fill}
+ pack .t -expand 1 -fill both
set res {}
} -body {
.t tag configure WELCOME -elide 1
@@ -3405,7 +3444,7 @@ test text-14.18 {ConfigureText procedure} -constraints fonts -setup {
text .top.t -font {Courier -12} -borderwidth 2 -highlightthickness 2
} -body {
.top.t configure -width 20 -height 10
- pack append .top .top.t top
+ pack .top.t
update
set geom [wm geometry .top]
set x [string range $geom 0 [string first + $geom]]
@@ -3422,7 +3461,7 @@ test text-14.19 {ConfigureText procedure} -setup {
} -body {
.top.t configure -width 20 -height 10 -setgrid 1
wm overrideredirect .top 1
- pack append .top .top.t top
+ pack .top.t
wm geometry .top +0+0
update
wm geometry .top
@@ -3439,7 +3478,7 @@ test text-14.20 {ConfigureText procedure} -setup {
} -body {
.top.t configure -width 20 -height 10 -setgrid 1
wm overrideredirect .top 1
- pack append .top .top.t top
+ pack .top.t
wm geometry .top +0+0
update
set result [wm geometry .top]
@@ -3729,7 +3768,7 @@ Line 4
test text-19.11 {DeleteChars procedure} -body {
toplevel .top
text .top.t -width 20 -height 5
- pack append .top .top.t top
+ pack .top.t
wm geometry .top +0+0
.top.t insert 1.0 "abc\n123\nx\ny\nz\nq\nr\ns"
update
@@ -3741,7 +3780,7 @@ test text-19.11 {DeleteChars procedure} -body {
test text-19.12 {DeleteChars procedure} -body {
toplevel .top
text .top.t -width 20 -height 5
- pack append .top .top.t top
+ pack .top.t
wm geometry .top +0+0
.top.t insert 1.0 "abc\n123\nx\ny\nz\nq\nr\ns"
.top.t yview 3.0
@@ -3801,7 +3840,7 @@ test text-19.16 {DeleteChars procedure, updates affecting topIndex} -setup {
wm geometry .top +0+0
update
} -body {
- .top.t insert end "abc def\n01 2345 678 9101112\nLine 3\nLine 4\nLine 5\n6\n7\n8\n"
+ .top.t insert end "abc def\n01 2a345 678 9101112\nLine 3\nLine 4\nLine 5\n6\n7\n8\n"
.top.t yview 2.4
.top.t delete 2.5
set x [.top.t index @0,0]
@@ -3814,7 +3853,7 @@ test text-19.16 {DeleteChars procedure, updates affecting topIndex} -setup {
test text-20.1 {TextFetchSelection procedure} -setup {
text .t -width 20 -height 10
- pack append . .t {top expand fill}
+ pack .t -expand 1 -fill both
update
} -body {
foreach i {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
@@ -3829,7 +3868,7 @@ b.0b.1b.2b.3b.4
c.0c}
test text-20.2 {TextFetchSelection procedure} -setup {
text .t -width 20 -height 10
- pack append . .t {top expand fill}
+ pack .t -expand 1 -fill both
update
} -body {
foreach i {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
@@ -3849,7 +3888,7 @@ b.0b.1b.2b.3b.4
c.0c}
test text-20.3 {TextFetchSelection procedure} -setup {
text .t -width 20 -height 10
- pack append . .t {top expand fill}
+ pack .t -expand 1 -fill both
update
} -body {
foreach i {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
@@ -3863,7 +3902,7 @@ test text-20.3 {TextFetchSelection procedure} -setup {
} -result {m}
test text-20.4 {TextFetchSelection procedure} -setup {
text .t -width 20 -height 10
- pack append . .t {top expand fill}
+ pack .t -expand 1 -fill both
update
} -body {
foreach i {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
@@ -3883,7 +3922,7 @@ test text-20.4 {TextFetchSelection procedure} -setup {
cj.0j.1j.2j.3j.4m}
test text-20.5 {TextFetchSelection procedure, long selections} -setup {
text .t -width 20 -height 10
- pack append . .t {top expand fill}
+ pack .t -expand 1 -fill both
update
set x ""
} -body {
@@ -3898,7 +3937,7 @@ test text-20.5 {TextFetchSelection procedure, long selections} -setup {
} -result {1}
-test text-21.1 {TkTextLostSelection procedure} -constraints unix -setup {
+test text-21.1 {TkTextLostSelection procedure} -constraints {x11} -setup {
text .t
.t insert 1.0 "Line 1"
entry .t.e
@@ -3913,7 +3952,7 @@ test text-21.1 {TkTextLostSelection procedure} -constraints unix -setup {
} -cleanup {
destroy .t .t2
} -result {}
-test text-21.2 {TkTextLostSelection procedure} -constraints win -setup {
+test text-21.2 {TkTextLostSelection procedure} -constraints aquaOrWin32 -setup {
text .t
.t insert 1.0 "Line 1"
entry .t.e
@@ -6396,8 +6435,23 @@ test text-27.16a {undo configuration options with peers} -body {
lappend res [.t edit canundo]
lappend res [.tt edit canundo]
} -cleanup {
- destroy .t
+ destroy .t .tt
} -result {1 1 0 0 100 100 1 1}
+test text-27.16b {undo configuration options with peers, defaults} -body {
+ text .t
+ .t peer create .tt
+ set res [.t cget -undo]
+ lappend res [.tt cget -undo]
+ lappend res [.t cget -autoseparators]
+ lappend res [.tt cget -autoseparators]
+ lappend res [.t cget -maxundo]
+ lappend res [.tt cget -maxundo]
+ .t insert end "The undo stack is common between peers"
+ lappend res [.t edit canundo]
+ lappend res [.tt edit canundo]
+} -cleanup {
+ destroy .t .tt
+} -result {0 0 1 1 0 0 0 0}
test text-27.17 {bug fix 1536735 - undo with empty text} -body {
text .t -undo 1
set r [.t edit modified]
@@ -6577,6 +6631,66 @@ test text-27.25 {<<UndoStack>> virtual event} -setup {
} -cleanup {
destroy .t
} -result {0 0 1 2 3 4 4 5 6 6 7 8 8 9}
+test text-27.26 {edit undo and edit redo return ranges} -setup {
+ destroy .t
+ set res {}
+} -body {
+ text .t -undo true -autoseparators false
+ .t insert end "Hello "
+ .t edit separator
+ .t insert end "World!\n"
+ .t insert 1.6 "GREAT "
+ .t insert end "Another edit here!!"
+ lappend res [.t edit undo]
+ lappend res [.t edit redo]
+ .t edit separator
+ .t delete 1.6
+ .t delete 1.9 1.10
+ .t insert 1.9 L
+ lappend res [.t edit undo]
+ lappend res [.t edit redo]
+ .t replace 1.6 1.10 Tcl/Tk
+ .t replace 2.8 2.12 "one bites the dust"
+ lappend res [.t edit undo]
+ lappend res [.t edit redo]
+} -cleanup {
+ destroy .t
+} -result [list {1.6 2.0} \
+ {1.6 2.19} \
+ {1.6 1.7 1.10 1.12} \
+ {1.6 1.7 1.9 1.11} \
+ {1.6 1.16 2.8 2.19} \
+ {1.6 1.16 2.8 2.30} ]
+test text-27.27 {edit undo and edit redo return ranges} -setup {
+ destroy .t
+ set res {}
+} -body {
+ text .t -undo true -autoseparators false
+ for {set i 3} {$i >= 1} {incr i -1} {
+ .t insert 1.0 "Line $i\n"
+ }
+ lappend res [.t edit undo]
+ lappend res [.t edit redo]
+} -cleanup {
+ destroy .t
+} -result [list {1.0 2.0} \
+ {1.0 4.0} ]
+test text-27.28 {edit undo and edit redo do not leave \
+ spurious temporary marks behind them} -setup {
+ destroy .t
+ set res {}
+} -body {
+ pack [text .t -undo true -autoseparators false]
+ .t insert end "Hello World.\n"
+ .t edit separator
+ .t insert end "Again hello.\n"
+ .t edit undo
+ lappend res [lsearch [.t mark names] tk::undoMark*]
+ .t edit redo
+ lappend res [lsearch [.t mark names] tk::undoMark*]
+} -cleanup {
+ destroy .t
+} -result [list -1 -1]
test text-28.1 {bug fix - 624372, ControlUtfProc long lines} -body {
diff --git a/tests/textDisp.test b/tests/textDisp.test
index ebaa6d8..f2eb47d 100644
--- a/tests/textDisp.test
+++ b/tests/textDisp.test
@@ -39,9 +39,9 @@ option add *Text.highlightThickness $twht
catch {destroy .f .t}
frame .f -width 100 -height 20
-pack append . .f left
+pack .f -side left
-set fixedFont {Courier -12}
+set fixedFont {"Courier New" -12}
# 15 on XP, 13 on Solaris 8
set fixedHeight [font metrics $fixedFont -linespace]
# 7 on all platforms
@@ -65,7 +65,7 @@ set bigAscent [font metrics $bigFont -ascent]
set ascentDiff [expr {$bigAscent - $fixedAscent}]
text .t -font $fixedFont -width 20 -height 10 -yscrollcommand scroll
-pack append . .t {top expand fill}
+pack .t -expand 1 -fill both
.t tag configure big -font $bigFont
.t debug on
wm geometry . {}
@@ -253,8 +253,8 @@ test textDisp-2.5 {LayoutDLine, word wrap} {textfonts} {
.t configure -wrap word
.t delete 1.0 end
.t insert 1.0 "This isx some sample text for testing."
- list [.t bbox 1.13] [.t bbox 1.14] [.t bbox 1.19]
-} [list [list 96 5 49 $fixedHeight] [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 40 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
+ list [.t bbox 1.13] [.t bbox 1.19] [.t bbox 1.20] [.t bbox 1.21]
+} [list [list 96 5 $fixedWidth $fixedHeight] [list 138 5 $fixedWidth $fixedHeight] [list 145 5 0 $fixedHeight] [list 5 [expr {$fixedDiff + 18}] $fixedWidth $fixedHeight]]
test textDisp-2.6 {LayoutDLine, word wrap} {
.t configure -wrap word
.t delete 1.0 end
@@ -353,16 +353,16 @@ test textDisp-2.16 {LayoutDLine, justification} {textfonts} {
.t tag configure x -justify center
.t tag add x 1.1 1.20
.t tag add x 1.21 1.end
- list [.t bbox 1.0] [.t bbox 1.20] [.t bbox 1.36] [.t bbox 2.0]
-} [list [list 5 5 7 $fixedHeight] [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 43 [expr {2*$fixedDiff + 31}] 7 $fixedHeight] [list 5 [expr {3*$fixedDiff + 44}] 7 $fixedHeight]]
+ list [.t bbox 1.0] [.t bbox 1.20] [.t bbox 1.41] [.t bbox 2.0]
+} [list [list 5 5 7 $fixedHeight] [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 61 [expr {2*$fixedDiff + 31}] 7 $fixedHeight] [list 5 [expr {3*$fixedDiff + 44}] 7 $fixedHeight]]
test textDisp-2.17 {LayoutDLine, justification} {textfonts} {
.t configure -wrap word
.t delete 1.0 end
- .t insert 1.0 "Lots of long words, enough to force word wrap\nThen\nmore lines"
+ .t insert 1.0 "Lots of very long words, enough to force word wrap\nThen\nmore lines"
.t tag configure x -justify center
- .t tag add x 1.20
- list [.t bbox 1.0] [.t bbox 1.20] [.t bbox 1.36] [.t bbox 2.0]
-} [list [list 5 5 7 $fixedHeight] [list 19 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 5 [expr {2*$fixedDiff + 31}] 7 $fixedHeight] [list 5 [expr {3*$fixedDiff + 44}] 7 $fixedHeight]]
+ .t tag add x 1.18
+ list [.t bbox 1.0] [.t bbox 1.18] [.t bbox 1.35] [.t bbox 2.0]
+} [list [list 5 5 7 $fixedHeight] [list 15 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 5 [expr {2*$fixedDiff + 31}] 7 $fixedHeight] [list 5 [expr {3*$fixedDiff + 44}] 7 $fixedHeight]]
test textDisp-2.18 {LayoutDLine, justification} {textfonts} {
.t configure -wrap none
.t delete 1.0 end
@@ -599,7 +599,7 @@ test textDisp-4.6 {UpdateDisplayInfo, tiny window} {
wm overrideredirect . 1
}
frame .f2 -width 20 -height 100
- pack before .f .f2 top
+ pack .f2 -before .f
wm geom . 103x103
update
.t configure -wrap none -borderwidth 2
@@ -1952,13 +1952,15 @@ test textDisp-15.8 {Scrolling near end of window} {
.tf.f.t insert end "\nLine $i"
}
update ; after 1000 ; update
+ set refind [.tf.f.t index @0,[winfo height .tf.f.t]]
# Should scroll and should not crash!
.tf.f.t yview scroll 1 unit
# Check that it has scrolled
- set res [.tf.f.t index @0,[expr [winfo height .tf.f.t] - 15]]
+ set newind [.tf.f.t index @0,[winfo height .tf.f.t]]
+ set res [.tf.f.t compare $newind > $refind]
destroy .tf
set res
-} {12.0}
+} {1}
.t configure -wrap char
.t delete 1.0 end
@@ -2337,7 +2339,7 @@ test textDisp-17.10 {TkTextScanCmd procedure, word wrapping} {textfonts} {
set x [.t index @0,0]
.t scan dragto 0 [expr {70 + $fixedDiff}]
list $x [.t index @0,0]
-} {9.15 8.31}
+} {9.0 8.0}
.t configure -xscrollcommand scroll -yscrollcommand {}
test textDisp-18.1 {GetXView procedure} {
.t configure -wrap none
@@ -2563,7 +2565,7 @@ test textDisp-19.10.1 {Widget manipulation causes height miscount} {
.t insert end "\nLine $i"
}
.t insert end "\nThis last line wraps around four "
- .t insert end "times with a bit left on the last line."
+ .t insert end "times with a little bit left on the last line."
.t yview insert
update
.t count -update -ypixels 1.0 end
@@ -2577,7 +2579,7 @@ test textDisp-19.11 {GetYView procedure} {
.t insert end "\nLine $i"
}
.t insert end "\nThis last line wraps around four "
- .t insert end "times with a bit left on the last line."
+ .t insert end "times with a little bit left on the last line."
.t yview insert
update
.t count -update -ypixels 1.0 end
@@ -2599,7 +2601,7 @@ test textDisp-19.11.5.1 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 16.5
} {0}
test textDisp-19.11.6 {TextWidgetCmd procedure, "count -displaylines"} {
- .t count -displaylines 16.0 16.20
+ .t count -displaylines 16.0 16.24
} {1}
test textDisp-19.11.7 {TextWidgetCmd procedure, "count -displaylines"} {
.t count -displaylines 16.0 16.40
@@ -2652,14 +2654,14 @@ test textDisp-19.11.17 {TextWidgetCmd procedure, "index +displaylines"} {
[.t index "12.0 +2d lines"] [.t index "11.0 +2d lines"] \
[.t index "13.0 +2d lines"] [.t index "13.1 +3d lines"] \
[.t index "13.0 +4d lines"]
-} {15.5 16.0 15.0 16.0 16.15 16.33}
+} {15.5 16.0 15.0 16.0 16.21 16.39}
test textDisp-19.11.18 {TextWidgetCmd procedure, "index +displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "12.0" "14.0"
list [.t index "15.5 -2d lines"] \
[.t index "16.0 -2d lines"] [.t index "15.0 -2d lines"] \
- [.t index "16.0 -3d lines"] [.t index "16.17 -4d lines"] \
- [.t index "16.36 -5d lines"]
+ [.t index "16.0 -3d lines"] [.t index "16.23 -4d lines"] \
+ [.t index "16.42 -5d lines"]
} {11.5 14.0 11.0 11.0 11.2 11.3}
test textDisp-19.11.19 {TextWidgetCmd procedure, "count -displaylines"} {
.t tag remove elide 1.0 end
@@ -2673,14 +2675,14 @@ test textDisp-19.11.20 {TextWidgetCmd procedure, "index +displaylines"} {
[.t index "12.0 +2d lines"] [.t index "11.0 +2d lines"] \
[.t index "13.0 +2d lines"] [.t index "13.0 +3d lines"] \
[.t index "13.0 +4d lines"]
-} {16.38 16.50 16.33 16.50 16.67 17.0}
+} {16.44 16.57 16.39 16.57 16.74 17.0}
test textDisp-19.11.21 {TextWidgetCmd procedure, "index +displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "12.0" "16.0 +1displaylines"
- list [.t index "16.38 -2d lines"] \
- [.t index "16.50 -3d lines"] [.t index "16.33 -2d lines"] \
- [.t index "16.53 -4d lines"] [.t index "16.69 -4d lines"] \
- [.t index "17.1 -5d lines"]
+ list [.t index "16.44 -2d lines"] \
+ [.t index "16.57 -3d lines"] [.t index "16.39 -2d lines"] \
+ [.t index "16.60 -4d lines"] [.t index "16.76 -4d lines"] \
+ [.t index "17.0 -5d lines"]
} {11.5 11.0 11.0 10.3 11.2 11.0}
test textDisp-19.11.22 {TextWidgetCmd procedure, "index +displaylines"} {
.t tag remove elide 1.0 end
@@ -2688,7 +2690,7 @@ test textDisp-19.11.22 {TextWidgetCmd procedure, "index +displaylines"} {
[.t index "end -3d lines"] [.t index "1.0 -2d lines"] \
[.t index "1.0 +4d lines"] [.t index "1.0 +50d lines"] \
[.t index "end -50d lines"]
-} {17.0 16.33 1.0 5.0 17.0 1.0}
+} {17.0 16.39 1.0 5.0 17.0 1.0}
test textDisp-19.11.23 {TextWidgetCmd procedure, "index +displaylines"} {
.t tag remove elide 1.0 end
.t tag add elide "12.3" "16.0 +1displaylines"
@@ -2697,7 +2699,7 @@ test textDisp-19.11.23 {TextWidgetCmd procedure, "index +displaylines"} {
[.t index "12.0 +2d lines"] [.t index "11.0 +2d lines"] \
[.t index "13.0 +2d lines"] [.t index "13.0 +3d lines"] \
[.t index "13.0 +4d lines"]
-} {16.17 16.33 16.28 16.46 16.28 16.49 16.65 16.72}
+} {16.23 16.44 16.39 16.57 16.39 16.60 16.77 16.79}
.t tag remove elide 1.0 end
test textDisp-19.11.24 {TextWidgetCmd procedure, "index +/-displaylines"} {
list [.t index "11.5 + -1 display lines"] \
@@ -2746,7 +2748,7 @@ test textDisp-19.14 {GetYView procedure} {
.t insert end "\nLine $i"
}
.t insert end "\nThis last line wraps around four "
- .t insert end "times with a bit left on the last line."
+ .t insert end "times with a little bit left on the last line."
# Need to update so everything is calculated.
update ; .t count -update -ypixels 1.0 end
update ; after 10 ; update
@@ -2766,7 +2768,7 @@ test textDisp-19.15 {GetYView procedure} {
.t insert end "\nLine $i"
}
.t insert end "\nThis last line wraps around four "
- .t insert end "times with a bit left on the last line."
+ .t insert end "times with a bit little left on the last line."
update
.t configure -yscrollcommand scrollError
proc bgerror args {
@@ -2794,7 +2796,7 @@ test textDisp-19.16 {count -ypixels} {
.t insert end "\nLine $i"
}
.t insert end "\nThis last line wraps around four "
- .t insert end "times with a bit left on the last line."
+ .t insert end "times with a little bit left on the last line."
# Need to update so everything is calculated.
update ; .t count -update -ypixels 1.0 end ; update
set res {}
@@ -2871,28 +2873,28 @@ for {set i 2} {$i <= 200} {incr i} {
.t configure -wrap word
.t delete 50.0 51.0
.t insert 50.0 "This is a long line, one that will wrap around twice.\n"
-test textDisp-20.1 {FindDLine} {textfonts} {
+test textDisp-20.1 {FindDLine} {
.t yview 48.0
list [.t dlineinfo 46.0] [.t dlineinfo 47.0] [.t dlineinfo 49.0] \
[.t dlineinfo 58.0]
} [list {} {} [list 3 [expr {$fixedDiff + 16}] 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}]
-test textDisp-20.2 {FindDLine} {textfonts} {
+test textDisp-20.2 {FindDLine} {
.t yview 100.0
.t yview -pickplace 53.0
- list [.t dlineinfo 50.0] [.t dlineinfo 50.14] [.t dlineinfo 50.15]
-} [list [list 3 [expr {-1 - $fixedDiff/2}] 105 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {-1 - $fixedDiff/2}] 105 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {12 + $fixedDiff/2}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]]]
-test textDisp-20.3 {FindDLine} {textfonts} {
+ list [.t dlineinfo 50.0] [.t dlineinfo 50.14] [.t dlineinfo 50.21]
+} [list [list 3 [expr {-1 - $fixedDiff/2}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {-1 - $fixedDiff/2}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {12 + $fixedDiff/2}] 133 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]]]
+test textDisp-20.3 {FindDLine} {
.t yview 100.0
.t yview 49.0
- list [.t dlineinfo 50.0] [.t dlineinfo 50.20] [.t dlineinfo 57.0]
-} [list [list 3 [expr {$fixedDiff + 16}] 105 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {2*$fixedDiff + 29}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}]
-test textDisp-20.4 {FindDLine} {textfonts} {
+ list [.t dlineinfo 50.0] [.t dlineinfo 50.24] [.t dlineinfo 57.0]
+} [list [list 3 [expr {$fixedDiff + 16}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {2*$fixedDiff + 29}] 133 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}]
+test textDisp-20.4 {FindDLine} {
.t yview 100.0
.t yview 42.0
- list [.t dlineinfo 50.0] [.t dlineinfo 50.20] [.t dlineinfo 50.40]
-} [list [list 3 [expr {8*$fixedDiff + 107}] 105 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {9*$fixedDiff + 120}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}]
+ list [.t dlineinfo 50.0] [.t dlineinfo 50.24] [.t dlineinfo 50.40]
+} [list [list 3 [expr {8*$fixedDiff + 107}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {9*$fixedDiff + 120}] 133 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}]
.t config -wrap none
-test textDisp-20.5 {FindDLine} {textfonts} {
+test textDisp-20.5 {FindDLine} {
.t yview 100.0
.t yview 48.0
list [.t dlineinfo 50.0] [.t dlineinfo 50.20] [.t dlineinfo 50.40]
@@ -2903,7 +2905,7 @@ test textDisp-21.1 {TkTextPixelIndex} {textfonts} {
.t yview 48.0
list [.t index @-10,-10] [.t index @6,6] [.t index @22,6] \
[.t index @102,6] [.t index @38,[expr {$fixedHeight * 4 + 3}]] [.t index @44,67]
-} {48.0 48.0 48.2 48.7 50.40 50.40}
+} {48.0 48.0 48.2 48.7 50.45 50.45}
.t insert end \n
test textDisp-21.2 {TkTextPixelIndex} {textfonts} {
.t yview 195.0
@@ -2959,7 +2961,7 @@ test textDisp-22.1 {TkTextCharBbox} {textfonts} {
.t yview 48.0
list [.t bbox 47.2] [.t bbox 48.0] [.t bbox 50.5] [.t bbox 50.40] \
[.t bbox 58.0]
-} [list {} [list 3 3 7 $fixedHeight] [list 38 [expr {3+2*$fixedHeight}] 7 $fixedHeight] [list 38 [expr {3+4*$fixedHeight}] 7 $fixedHeight] {}]
+} [list {} [list 3 3 7 $fixedHeight] [list 38 [expr {3+2*$fixedHeight}] 7 $fixedHeight] [list 3 [expr {3+4*$fixedHeight}] 7 $fixedHeight] {}]
test textDisp-22.2 {TkTextCharBbox} {textfonts} {
.t config -wrap none
.t yview 48.0
@@ -3083,13 +3085,13 @@ test textDisp-23.1 {TkTextDLineInfo} {textfonts} {
.t yview 48.0
list [.t dlineinfo 47.3] [.t dlineinfo 48.0] [.t dlineinfo 50.40] \
[.t dlineinfo 56.0]
-} [list {} [list 3 3 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {4*$fixedDiff + 55}] 126 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}]
+} [list {} [list 3 3 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {4*$fixedDiff + 55}] 91 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}]
test textDisp-23.2 {TkTextDLineInfo} {textfonts} {
.t config -bd 4 -wrap word
update
.t yview 48.0
.t dlineinfo 50.40
-} [list 7 [expr {4*$fixedDiff + 59}] 126 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]]
+} [list 7 [expr {4*$fixedDiff + 59}] 91 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]]
.t config -bd 0
test textDisp-23.3 {TkTextDLineInfo} {textfonts} {
.t config -wrap none
@@ -3284,11 +3286,11 @@ test textDisp-24.17 {TkTextCharLayoutProc, -wrap word} {textfonts} {
test textDisp-24.18 {TkTextCharLayoutProc, -wrap word} {textfonts} {
.t configure -wrap word
.t delete 1.0 end
- .t insert 1.0 "xThis is a line that wraps around"
+ .t insert 1.0 "xxThis is a line that wraps around"
wm geom . {}
update
- list [.t bbox 1.14] [.t bbox 1.15] [.t bbox 1.16]
-} [list [list 101 3 7 $fixedHeight] [list 108 3 35 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
+ list [.t bbox 1.15] [.t bbox 1.16] [.t bbox 1.17]
+} [list [list 108 3 7 $fixedHeight] [list 115 3 28 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]]
test textDisp-24.19 {TkTextCharLayoutProc, -wrap word} {textfonts} {
.t configure -wrap word
.t delete 1.0 end
diff --git a/tests/textIndex.test b/tests/textIndex.test
index ce331b4..3f26af5 100644
--- a/tests/textIndex.test
+++ b/tests/textIndex.test
@@ -13,7 +13,7 @@ namespace import -force tcltest::test
catch {destroy .t}
text .t -font {Courier -12} -width 20 -height 10
-pack append . .t {top expand fill}
+pack .t -expand 1 -fill both
update
.t debug on
wm geometry . {}
@@ -714,7 +714,7 @@ test textIndex-18.1 {Object indices don't cache mark names} {
} {3.4 3.0 1.0}
frame .f -width 100 -height 20
-pack append . .f left
+pack .f -side left
set fixedFont {Courier -12}
set fixedHeight [font metrics $fixedFont -linespace]
@@ -724,7 +724,7 @@ set varFont {Times -14}
set bigFont {Helvetica -24}
destroy .t
text .t -font $fixedFont -width 20 -height 10 -wrap char
-pack append . .t {top expand fill}
+pack .t -expand 1 -fill both
.t tag configure big -font $bigFont
.t debug on
wm geometry . {}
diff --git a/tests/textMark.test b/tests/textMark.test
index 0fac8f7..043ff82 100644
--- a/tests/textMark.test
+++ b/tests/textMark.test
@@ -13,7 +13,7 @@ tcltest::loadTestedCommands
destroy .t
text .t -width 20 -height 10
-pack append . .t {top expand fill}
+pack .t -expand 1 -fill both
update
.t debug on
wm geometry . {}
diff --git a/tests/textTag.test b/tests/textTag.test
index 2df8c5a..ca3dc0f 100644
--- a/tests/textTag.test
+++ b/tests/textTag.test
@@ -11,15 +11,29 @@ namespace import ::tcltest::*
eval tcltest::configure $argv
tcltest::loadTestedCommands
+set textWidgetFont {Courier 12}
+set bigFont {Courier 24}
+
+# what is needed is a font that is both fixed-width and featuring a
+# specific size because in some tests (that will be constrained by
+# haveFontSizes), a tag applying the $bigFont will be set to some
+# characters, which action has the effect of changing what character
+# is under the mouse pointer, which is the purpose of the tests
+testConstraint haveFontSizes [expr {
+ [font metrics $textWidgetFont -fixed] &&
+ [font actual $textWidgetFont -size] == 12 &&
+ [font metrics $bigFont -fixed] &&
+ [font actual $bigFont -size] == 24 }
+]
+
destroy .t
text .t -width 20 -height 10
-pack append . .t {top expand fill}
+pack .t -expand 1 -fill both
update
.t debug on
wm geometry . {}
-set bigFont {Helvetica 24}
# The statements below reset the main window; it's needed if the window
# manager is mwm, to make mwm forget about a previous minimum size setting.
@@ -1196,7 +1210,8 @@ test textTag-14.4 {SortTags} -setup {
} -result {x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29}
-
+set curFont [.t cget -font]
+set curWrap [.t cget -wrap]
set c [.t bbox 2.1]
set x1 [expr [lindex $c 0] + [lindex $c 2]/2]
set y1 [expr [lindex $c 1] + [lindex $c 3]/2]
@@ -1206,6 +1221,15 @@ set y2 [expr [lindex $c 1] + [lindex $c 3]/2]
set c [.t bbox 4.3]
set x3 [expr [lindex $c 0] + [lindex $c 2]/2]
set y3 [expr [lindex $c 1] + [lindex $c 3]/2]
+.t configure -font $textWidgetFont -wrap none
+update
+set c [.t bbox 2.1]
+set x4 [expr [lindex $c 0] + [lindex $c 2]/2]
+set y4 [expr [lindex $c 1] + [lindex $c 3]/2]
+set c [.t bbox 3.2]
+set x5 [expr [lindex $c 0] + [lindex $c 2]/2]
+set y5 [expr [lindex $c 1] + [lindex $c 3]/2]
+.t configure -font $curFont -wrap $curWrap
test textTag-15.1 {TkTextBindProc} -setup {
.t tag delete x y
@@ -1313,19 +1337,23 @@ test textTag-16.1 {TkTextPickCurrent procedure} -setup {
lappend x [.t index current]
} -result {2.1 3.2 3.2 3.2 3.2 3.2 4.3}
-test textTag-16.2 {TkTextPickCurrent procedure} -setup {
+test textTag-16.2 {TkTextPickCurrent procedure} -constraints {
+ haveFontSizes
+} -setup {
.t tag delete {*}[.t tag names]
event generate {} <Motion> -warp 1 -x -1 -y -1; update
+ .t configure -font $textWidgetFont -wrap none
} -body {
.t tag configure big -font $bigFont
- event gen .t <ButtonRelease-1> -state 0x100 -x $x1 -y $y1
- event gen .t <Motion> -x $x2 -y $y2
+ event gen .t <ButtonRelease-1> -state 0x100 -x $x4 -y $y4
+ event gen .t <Motion> -x $x5 -y $y5
set x [.t index current]
.t tag add big 3.0
update
lappend x [.t index current]
} -cleanup {
.t tag delete big
+ .t configure -font $curFont -wrap $curWrap
} -result {3.2 3.1}
test textTag-16.3 {TkTextPickCurrent procedure} -setup {
@@ -1381,57 +1409,69 @@ test textTag-16.4 {TkTextPickCurrent procedure} -setup {
.t tag delete {*}[.t tag names]
} -result {enter-a enter-b enter-c | leave-c leave-b}
-test textTag-16.5 {TkTextPickCurrent procedure} -setup {
+test textTag-16.5 {TkTextPickCurrent procedure} -constraints {
+ haveFontSizes
+} -setup {
foreach i {big a b c d} {
.t tag remove $i 1.0 end
}
event generate {} <Motion> -warp 1 -x -1 -y -1; update
+ .t configure -font $textWidgetFont -wrap none
} -body {
.t tag configure big -font $bigFont
- event gen .t <Motion> -x $x1 -y $y1
+ event gen .t <Motion> -x $x4 -y $y4
.t tag bind a <Enter> {.t tag add big 3.0 3.2}
.t tag add a 3.2
- event gen .t <Motion> -x $x2 -y $y2
+ event gen .t <Motion> -x $x5 -y $y5
.t index current
} -cleanup {
.t tag delete a big
+ .t configure -font $curFont -wrap $curWrap
} -result {3.2}
-test textTag-16.6 {TkTextPickCurrent procedure} -setup {
+test textTag-16.6 {TkTextPickCurrent procedure} -constraints {
+ haveFontSizes
+} -setup {
foreach i {big a b c d} {
.t tag remove $i 1.0 end
}
event generate {} <Motion> -warp 1 -x -1 -y -1; update
+ .t configure -font $textWidgetFont -wrap none
} -body {
.t tag configure big -font $bigFont
- event gen .t <Motion> -x $x1 -y $y1
+ event gen .t <Motion> -x $x4 -y $y4
.t tag bind a <Enter> {.t tag add big 3.0 3.2}
.t tag add a 3.2
- event gen .t <Motion> -x $x2 -y $y2
+ event gen .t <Motion> -x $x5 -y $y5
update
.t index current
} -cleanup {
.t tag delete a big
+ .t configure -font $curFont -wrap $curWrap
} -result {3.1}
-test textTag-16.7 {TkTextPickCurrent procedure} -setup {
+test textTag-16.7 {TkTextPickCurrent procedure} -constraints {
+ haveFontSizes
+} -setup {
foreach i {big a b c d} {
.t tag remove $i 1.0 end
}
event generate {} <Motion> -warp 1 -x -1 -y -1; update
+ .t configure -font $textWidgetFont -wrap none
} -body {
.t tag configure big -font $bigFont
.t tag bind a <Enter> {.t tag add big 3.0 3.2}
.t tag add a 3.2
- event gen .t <Motion> -x $x1 -y $y1
+ event gen .t <Motion> -x $x4 -y $y4
.t tag bind a <Leave> {.t tag add big 3.0 3.2}
.t tag add a 2.1
- event gen .t <Motion> -x $x2 -y $y2
+ event gen .t <Motion> -x $x5 -y $y5
update
.t index current
} -cleanup {
.t tag delete a big
+ .t configure -font $curFont -wrap $curWrap
} -result {3.1}
diff --git a/tests/textWind.test b/tests/textWind.test
index b0359f9..d32bd8d 100644
--- a/tests/textWind.test
+++ b/tests/textWind.test
@@ -16,18 +16,18 @@ tcltest::loadTestedCommands
option add *Text.borderWidth 2
option add *Text.highlightThickness 2
-option add *Text.font {Courier -12}
+option add *Text.font {"Courier New" -12}
deleteWindows
# Widget used in tests 1.* - 16.*
text .t -width 30 -height 6 -bd 2 -highlightthickness 2
-pack append . .t {top expand fill}
+pack .t -expand 1 -fill both
update
.t debug on
# 15 on XP, 13 on Solaris 8
-set fixedHeight [font metrics {Courier -12} -linespace]
+set fixedHeight [font metrics {"Courier New" -12} -linespace]
set fixedDiff [expr {$fixedHeight - 13}] ;# 2 on XP
set color [expr {[winfo depth .t] > 1 ? "green" : "black"}]
diff --git a/tests/ttk/combobox.test b/tests/ttk/combobox.test
index a31b3bd..3868953 100644
--- a/tests/ttk/combobox.test
+++ b/tests/ttk/combobox.test
@@ -45,6 +45,15 @@ test combobox-2.4 "current -- value not in list" -body {
test combobox-2.end "Cleanup" -body { destroy .cb }
+test combobox-3 "Read postoffset value dynamically from current style" -body {
+ ttk::combobox .cb -values [list a b c] -style "DerivedStyle.TCombobox"
+ pack .cb -expand true -fill both
+ ttk::style configure DerivedStyle.TCombobox -postoffset [list 25 0 0 0]
+ ttk::combobox::Post .cb
+ expr {[winfo rootx .cb.popdown] - [winfo rootx .cb]}
+} -result 25 -cleanup {
+ destroy .cb
+}
test combobox-1890211 "ComboboxSelected event after listbox unposted" -body {
# whitebox test...
diff --git a/tests/ttk/spinbox.test b/tests/ttk/spinbox.test
index 6c328bb..38bae14 100644
--- a/tests/ttk/spinbox.test
+++ b/tests/ttk/spinbox.test
@@ -199,6 +199,27 @@ test spinbox-2.4 "current command -- value not in list" -constraints nyi -setup
destroy .sb
} -result -1
+test spinbox-3.0 "textarea should expand to fill widget" -setup {
+ set SBV 5
+ set ::spinbox_test {}
+ ttk::spinbox .sb -from 0 -to 10 -textvariable SBV
+} -body {
+ grid .sb -sticky ew
+ grid columnconfigure . 0 -weight 1
+ bind . <Map> {
+ after idle {
+ wm geometry . "210x80"
+ after 100 {set ::spinbox_test [.sb identify element 5 5]}
+ }
+ bind . <Map> {}
+ }
+ after 500 {set ::spinbox_wait 1} ; vwait ::spinbox_wait
+ set ::spinbox_test
+} -cleanup {
+ destroy .sb
+ unset -nocomplain ::spinbox_test SBV
+} -result {textarea}
+
# nostomp: NB intentional difference between ttk::spinbox and tk::spinbox;
# see also #1439266
#
diff --git a/tests/winFont.test b/tests/winFont.test
index 08a53ff..93aeca9 100644
--- a/tests/winFont.test
+++ b/tests/winFont.test
@@ -71,7 +71,7 @@ test winfont-2.7 {TkpGetFontFromAttributes procedure: Times fonts} -constraints
lappend x [font actual {-family "Times"} -family]
lappend x [font actual {-family "New York"} -family]
lappend x [font actual {-family "Times New Roman"} -family]
-} -result {{Times New Roman} {Times New Roman} {Times New Roman}}
+} -result {Times Times {Times New Roman}}
test winfont-2.8 {TkpGetFontFromAttributes procedure: Courier fonts} -constraints {
win
} -setup {
@@ -80,7 +80,7 @@ test winfont-2.8 {TkpGetFontFromAttributes procedure: Courier fonts} -constraint
lappend x [font actual {-family "Courier"} -family]
lappend x [font actual {-family "Monaco"} -family]
lappend x [font actual {-family "Courier New"} -family]
-} -result {{Courier New} {Courier New} {Courier New}}
+} -result {Courier Courier {Courier New}}
test winfont-2.9 {TkpGetFontFromAttributes procedure: Helvetica fonts} -constraints {
win
} -setup {
@@ -89,7 +89,7 @@ test winfont-2.9 {TkpGetFontFromAttributes procedure: Helvetica fonts} -constrai
lappend x [font actual {-family "Helvetica"} -family]
lappend x [font actual {-family "Geneva"} -family]
lappend x [font actual {-family "Arial"} -family]
-} -result {Arial Arial Arial}
+} -result {Helvetica Helvetica Arial}
test winfont-2.10 {TkpGetFontFromAttributes procedure: fallback} -constraints {
win
} -body {
diff --git a/unix/Makefile.in b/unix/Makefile.in
index a4bc2d4..1b8677e 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -723,7 +723,7 @@ install-binaries: $(TK_STUB_LIB_FILE) $(TK_LIB_FILE) ${WISH_EXE}
echo "Creating package index $(PKG_INDEX)"; \
rm -f "$(PKG_INDEX)"; \
(\
- echo "if {[catch {package present Tcl 8.6.0}]} return";\
+ echo "if {[catch {package present Tcl 8.6-}]} return";\
relative=`echo | awk '{ORS=" "; split("$(TK_PKG_DIR)",a,"/"); for (f in a) {print ".."}}'`;\
if test "x$(DLL_INSTALL_DIR)" != "x$(BIN_INSTALL_DIR)"; then \
echo "package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir $${relative}$(TK_LIB_FILE)]] Tk]";\
@@ -1465,7 +1465,7 @@ $(TTK_DIR)/ttkStubInit.c: $(TTK_DIR)/ttk.decls
genstubs:
$(TCL_EXE) $(TOOL_DIR)/genStubs.tcl $(GENERIC_DIR) \
$(GENERIC_DIR)/tk.decls $(GENERIC_DIR)/tkInt.decls
- $(TCL_EXE) $(TTK_DIR)/ttkGenStubs.tcl $(TTK_DIR) $(TTK_DIR)/ttk.decls
+ $(TCL_EXE) $(TOOL_DIR)/genStubs.tcl $(TTK_DIR) $(TTK_DIR)/ttk.decls
#
# Target to check that all exported functions have an entry in the stubs
diff --git a/unix/configure b/unix/configure
index 1ed0275..f76ae3b 100755
--- a/unix/configure
+++ b/unix/configure
@@ -4595,7 +4595,7 @@ fi
if test "$GCC" = yes; then :
CFLAGS_OPTIMIZE=-O2
- CFLAGS_WARNING="-Wall -Wsign-compare -Wdeclaration-after-statement"
+ CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wdeclaration-after-statement"
else
diff --git a/unix/tcl.m4 b/unix/tcl.m4
index a1d4021..2ab432c 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -1096,7 +1096,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
CFLAGS_DEBUG=-g
AS_IF([test "$GCC" = yes], [
CFLAGS_OPTIMIZE=-O2
- CFLAGS_WARNING="-Wall -Wsign-compare -Wdeclaration-after-statement"
+ CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wdeclaration-after-statement"
], [
CFLAGS_OPTIMIZE=-O
CFLAGS_WARNING=""
diff --git a/unix/tkUnixEvent.c b/unix/tkUnixEvent.c
index f3beb16..111d430 100644
--- a/unix/tkUnixEvent.c
+++ b/unix/tkUnixEvent.c
@@ -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 */
diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c
index 1f4a1d4..e5aceb1 100644
--- a/unix/tkUnixFont.c
+++ b/unix/tkUnixFont.c
@@ -19,8 +19,8 @@
* The preferred font encodings.
*/
-static const char *const encodingList[] = {
- "iso8859-1", "jis0208", "jis0212", NULL
+static const char encodingList[][10] = {
+ "iso8859-1", "jis0208", "jis0212"
};
/*
@@ -35,14 +35,14 @@ static const char *const encodingList[] = {
* family": the foundry, face name, and charset.
*/
-#define FONTMAP_SHIFT 10
+#define FONTMAP_SHIFT 12
-#define FONTMAP_PAGES (1 << (sizeof(Tcl_UniChar)*8 - FONTMAP_SHIFT))
+#define FONTMAP_PAGES (1 << (21 - FONTMAP_SHIFT))
#define FONTMAP_BITSPERPAGE (1 << FONTMAP_SHIFT)
typedef struct FontFamily {
struct FontFamily *nextPtr; /* Next in list of all known font families. */
- int refCount; /* How many SubFonts are referring to this
+ size_t refCount; /* How many SubFonts are referring to this
* FontFamily. When the refCount drops to
* zero, this FontFamily may be freed. */
/*
@@ -171,7 +171,7 @@ static Tcl_ThreadDataKey dataKey;
* encodings into the names expected by the Tcl encoding package.
*/
-static EncodingAlias encodingAliases[] = {
+static const EncodingAlias encodingAliases[] = {
{"gb2312-raw", "gb2312*"},
{"big5", "big5*"},
{"cns11643-1", "cns11643*-1"},
@@ -406,10 +406,10 @@ ControlUtfProc(
{
const char *srcStart, *srcEnd;
char *dstStart, *dstEnd;
- Tcl_UniChar ch;
+ int ch;
int result;
- static char hexChars[] = "0123456789abcdef";
- static char mapChars[] = {
+ static const char hexChars[] = "0123456789abcdef";
+ static const char mapChars[] = {
0, 0, 0, 0, 0, 0, 0,
'a', 'b', 't', 'n', 'v', 'f', 'r'
};
@@ -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;
@@ -513,7 +521,7 @@ Ucs2beToUtfProc(
srcEnd = src + srcLen;
dstStart = dst;
- dstEnd = dst + dstLen - TCL_UTF_MAX;
+ dstEnd = dst + dstLen - 4;
for (numChars = 0; src < srcEnd; numChars++) {
if (dst > dstEnd) {
@@ -588,7 +596,7 @@ UtfToUcs2beProc(
srcEnd = src + srcLen;
srcClose = srcEnd;
if (!(flags & TCL_ENCODING_END)) {
- srcClose -= TCL_UTF_MAX;
+ srcClose -= 4;
}
dstStart = dst;
@@ -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);
}
/*
@@ -1908,8 +1919,7 @@ FreeFontFamily(
if (familyPtr == NULL) {
return;
}
- familyPtr->refCount--;
- if (familyPtr->refCount > 0) {
+ if (familyPtr->refCount-- > 1) {
return;
}
Tcl_FreeEncoding(familyPtr->encoding);
@@ -2202,7 +2212,7 @@ FontMapLoadPage(
int row) /* Index of the page to be loaded into the
* cache. */
{
- char buf[16], src[TCL_UTF_MAX];
+ char buf[16], src[4];
int minHi, maxHi, minLo, maxLo, scale, checkLo;
int i, end, bitOffset, isTwoByteFont, n;
Tcl_Encoding encoding;
@@ -2406,7 +2416,7 @@ CanUseFallback(
unsigned bestScore[2];
char **nameList;
char **nameListOrig;
- char src[TCL_UTF_MAX];
+ char src[4];
FontAttributes want, got;
Display *display;
SubFont subFont;
@@ -2678,7 +2688,7 @@ RankAttributes(
penalty += 150 * diff;
}
if (gotPtr->xa.charset != wantPtr->xa.charset) {
- int i;
+ size_t i;
const char *gotAlias, *wantAlias;
penalty += 65000;
@@ -2686,7 +2696,7 @@ RankAttributes(
wantAlias = GetEncodingAlias(wantPtr->xa.charset);
if (strcmp(gotAlias, wantAlias) != 0) {
penalty += 30000;
- for (i = 0; encodingList[i] != NULL; i++) {
+ for (i = 0; i < sizeof(encodingList)/sizeof(encodingList[0]); i++) {
if (strcmp(gotAlias, encodingList[i]) == 0) {
penalty -= 30000;
break;
@@ -3004,7 +3014,7 @@ static const char *
GetEncodingAlias(
const char *name) /* The name to look up. */
{
- EncodingAlias *aliasPtr;
+ const EncodingAlias *aliasPtr;
for (aliasPtr = encodingAliases; aliasPtr->aliasPattern != NULL; ) {
if (Tcl_StringMatch(name, aliasPtr->aliasPattern)) {
diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c
index 01bbb30..36c4540 100644
--- a/unix/tkUnixRFont.c
+++ b/unix/tkUnixRFont.c
@@ -69,7 +69,7 @@ void
TkpFontPkgInit(
TkMainInfo *mainPtr) /* The application being created. */
{
- static Tcl_Config cfg[] = {
+ static const Tcl_Config cfg[] = {
{ "fontsystem", "xft" },
{ 0,0 }
};
@@ -668,9 +668,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) {
diff --git a/unix/tkUnixSelect.c b/unix/tkUnixSelect.c
index 4bb462e..53275d1 100644
--- a/unix/tkUnixSelect.c
+++ b/unix/tkUnixSelect.c
@@ -21,7 +21,7 @@ typedef struct ConvertInfo {
* offset of the next chunk of data to
* transfer. */
Tcl_EncodingState state; /* The encoding state needed across chunks. */
- char buffer[TCL_UTF_MAX]; /* A buffer to hold part of a UTF character
+ char buffer[4]; /* A buffer to hold part of a UTF character
* that is split across chunks.*/
} ConvertInfo;
@@ -439,7 +439,7 @@ TkSelPropProc(
* Preserve any left-over bytes.
*/
- if (srcLen > TCL_UTF_MAX) {
+ if (srcLen > 4) {
Tcl_Panic("selection conversion left too many bytes unconverted");
}
memcpy(incrPtr->converts[i].buffer, src, (size_t) srcLen+1);
diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c
index 19ac86c..68ab6d6 100644
--- a/unix/tkUnixWm.c
+++ b/unix/tkUnixWm.c
@@ -1033,7 +1033,7 @@ Tk_WmObjCmd(
WMOPT_MINSIZE, WMOPT_OVERRIDEREDIRECT, WMOPT_POSITIONFROM,
WMOPT_PROTOCOL, WMOPT_RESIZABLE, WMOPT_SIZEFROM, WMOPT_STACKORDER,
WMOPT_STATE, WMOPT_TITLE, WMOPT_TRANSIENT, WMOPT_WITHDRAW };
- int index, length;
+ int index;
const char *argv1;
TkWindow *winPtr;
Tk_Window targetWin;
@@ -1045,9 +1045,9 @@ Tk_WmObjCmd(
return TCL_ERROR;
}
- argv1 = Tcl_GetStringFromObj(objv[1], &length);
- if ((argv1[0] == 't') && (strncmp(argv1, "tracing", (size_t) length) == 0)
- && (length >= 3)) {
+ argv1 = Tcl_GetString(objv[1]);
+ if ((argv1[0] == 't') && (strncmp(argv1, "tracing", objv[1]->length) == 0)
+ && (objv[1]->length >= 3)) {
int wmTracing;
if ((objc != 2) && (objc != 3)) {
@@ -1457,7 +1457,6 @@ WmClientCmd(
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
const char *argv3;
- int length;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?name?");
@@ -1470,7 +1469,7 @@ WmClientCmd(
}
return TCL_OK;
}
- argv3 = Tcl_GetStringFromObj(objv[3], &length);
+ argv3 = Tcl_GetString(objv[3]);
if (argv3[0] == 0) {
if (wmPtr->clientMachine != NULL) {
ckfree(wmPtr->clientMachine);
@@ -1486,7 +1485,7 @@ WmClientCmd(
if (wmPtr->clientMachine != NULL) {
ckfree(wmPtr->clientMachine);
}
- wmPtr->clientMachine = ckalloc(length + 1);
+ wmPtr->clientMachine = ckalloc(objv[3]->length + 1);
strcpy(wmPtr->clientMachine, argv3);
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
XTextProperty textProp;
@@ -2072,7 +2071,6 @@ WmGroupCmd(
Tk_Window tkwin2;
WmInfo *wmPtr2;
const char *argv3;
- int length;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?pathName?");
@@ -2084,7 +2082,7 @@ WmGroupCmd(
}
return TCL_OK;
}
- argv3 = Tcl_GetStringFromObj(objv[3], &length);
+ argv3 = Tcl_GetString(objv[3]);
if (*argv3 == '\0') {
wmPtr->hints.flags &= ~WindowGroupHint;
if (wmPtr->leaderName != NULL) {
@@ -2112,7 +2110,7 @@ WmGroupCmd(
}
wmPtr->hints.window_group = Tk_WindowId(wmPtr2->wrapperPtr);
wmPtr->hints.flags |= WindowGroupHint;
- wmPtr->leaderName = ckalloc(length + 1);
+ wmPtr->leaderName = ckalloc(objv[3]->length + 1);
strcpy(wmPtr->leaderName, argv3);
}
UpdateHints(winPtr);
@@ -2334,7 +2332,6 @@ WmIconnameCmd(
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
const char *argv3;
- int length;
if (objc > 4) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?newName?");
@@ -2349,8 +2346,8 @@ WmIconnameCmd(
if (wmPtr->iconName != NULL) {
ckfree(wmPtr->iconName);
}
- argv3 = Tcl_GetStringFromObj(objv[3], &length);
- wmPtr->iconName = ckalloc(length + 1);
+ argv3 = Tcl_GetString(objv[3]);
+ wmPtr->iconName = ckalloc(objv[3]->length + 1);
strcpy(wmPtr->iconName, argv3);
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
UpdateTitle(winPtr);
@@ -3471,7 +3468,6 @@ WmTitleCmd(
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
const char *argv3;
- int length;
if (objc > 4) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?newTitle?");
@@ -3487,8 +3483,8 @@ WmTitleCmd(
if (wmPtr->title != NULL) {
ckfree(wmPtr->title);
}
- argv3 = Tcl_GetStringFromObj(objv[3], &length);
- wmPtr->title = ckalloc(length + 1);
+ argv3 = Tcl_GetString(objv[3]);
+ wmPtr->title = ckalloc(objv[3]->length + 1);
strcpy(wmPtr->title, argv3);
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
diff --git a/win/Makefile.in b/win/Makefile.in
index f1018eb..80d616b 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -170,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
+CFLAGS = @CFLAGS@ @CFLAGS_DEFAULT@ -DUNICODE -D_UNICODE -D_ATL_XP_TARGETING
# Special compiler flags to use when building man2tcl on Windows.
MAN2TCLFLAGS = @MAN2TCLFLAGS@
@@ -487,7 +487,7 @@ install-binaries: binaries
@echo "Creating package index $(PKG_INDEX)";
@$(RM) $(PKG_INDEX);
@(\
- echo "if {[catch {package present Tcl 8.6.0}]} return";\
+ echo "if {[catch {package present Tcl 8.6-}]} return";\
echo "if {(\$$::tcl_platform(platform) eq \"unix\") && ([info exists ::env(DISPLAY)]";\
echo " || ([info exists ::argv] && (\"-display\" in \$$::argv)))} {";\
echo " package ifneeded Tk $(VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir .. .. bin libtk$(VERSION).dll]] Tk]";\
@@ -730,7 +730,7 @@ genstubs:
"$(GENERIC_DIR_NATIVE)" \
"$(GENERIC_DIR_NATIVE)/tk.decls" \
"$(GENERIC_DIR_NATIVE)/tkInt.decls"
- $(TCL_EXE) "$(TTK_DIR)/ttkGenStubs.tcl" \
+ $(TCL_EXE) "$(TCL_TOOL_DIR)/genStubs.tcl" \
"$(TTK_DIR)" \
"$(TTK_DIR)/ttk.decls"
diff --git a/win/configure b/win/configure
index 0b80f22..0149709 100755
--- a/win/configure
+++ b/win/configure
@@ -4335,7 +4335,7 @@ $as_echo "using shared flags" >&6; }
CFLAGS_DEBUG=-g
CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
- CFLAGS_WARNING="-Wall -Wsign-compare -Wdeclaration-after-statement"
+ CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wdeclaration-after-statement"
LDFLAGS_DEBUG=
LDFLAGS_OPTIMIZE=
diff --git a/win/makefile.vc b/win/makefile.vc
index 6f61327..c8c42a2 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -961,7 +961,7 @@ install-binaries:
!if !$(STATIC_BUILD)
@echo creating package index
@type << > $(OUT_DIR)\pkgIndex.tcl
-if {[catch {package present Tcl 8.6.0}]} { return }
+if {[catch {package present Tcl 8.6-}]} { return }
if {($$::tcl_platform(platform) eq "unix") && ([info exists ::env(DISPLAY)]
|| ([info exists ::argv] && ("-display" in $$::argv)))} {
package ifneeded Tk $(TK_PATCH_LEVEL) [list load [file join $$dir .. .. bin libtk$(TK_DOTVERSION).dll] Tk]
diff --git a/win/mkd.bat b/win/mkd.bat
deleted file mode 100644
index 1bd5ccb..0000000
--- a/win/mkd.bat
+++ /dev/null
@@ -1,12 +0,0 @@
-@echo off
-
-if exist %1\nul goto end
-
-md %1
-if errorlevel 1 goto end
-
-echo Created directory %1
-
-:end
-
-
diff --git a/win/rmd.bat b/win/rmd.bat
deleted file mode 100644
index 820b76f..0000000
--- a/win/rmd.bat
+++ /dev/null
@@ -1,20 +0,0 @@
-@echo off
-
-if not exist %1\nul goto end
-
-echo Removing directory %1
-
-if "%OS%" == "Windows_NT" goto winnt
-
-deltree /y %1
-if errorlevel 1 goto end
-goto success
-
-:winnt
-rmdir /s /q %1
-if errorlevel 1 goto end
-
-:success
-echo Deleted directory %1
-
-:end
diff --git a/win/rules.vc b/win/rules.vc
index 0d8cd6b..fbbe705 100644
--- a/win/rules.vc
+++ b/win/rules.vc
@@ -33,7 +33,6 @@ _INSTALLDIR = $(INSTALLDIR:/=\)
# "delete all" method.
#----------------------------------------------------------
-!if "$(OS)" == "Windows_NT"
RMDIR = rmdir /S /Q
ERRNULL = 2>NUL
!if ![ver | find "4.0" > nul]
@@ -43,13 +42,6 @@ COPY = copy >NUL
CPY = xcopy /i /y >NUL
COPY = copy /y >NUL
!endif
-!else # "$(OS)" != "Windows_NT"
-CPY = xcopy /i >_JUNK.OUT # On Win98 NUL does not work here.
-COPY = copy >_JUNK.OUT # On Win98 NUL does not work here.
-RMDIR = deltree /Y
-NULL = \NUL # Used in testing directory existence
-ERRNULL = >NUL # Win9x shell cannot redirect stderr
-!endif
MKDIR = mkdir
#------------------------------------------------------------------------------
@@ -159,7 +151,7 @@ DEBUGFLAGS = $(DEBUGFLAGS) -RTC1
DEBUGFLAGS = $(DEBUGFLAGS) -GZ
!endif
-COMPILERFLAGS =-W3 -DUNICODE -D_UNICODE
+COMPILERFLAGS =-W3 /DUNICODE /D_UNICODE /D_ATL_XP_TARGETING
# In v13 -GL and -YX are incompatible.
!if [nmakehlp -c -YX]
@@ -230,6 +222,10 @@ STATIC_BUILD = 1
!else
STATIC_BUILD = 0
!endif
+!if [nmakehlp -f $(OPTS) "nomsvcrt"]
+!message *** Doing nomsvcrt
+MSVCRT = 0
+!else
!if [nmakehlp -f $(OPTS) "msvcrt"]
!message *** Doing msvcrt
MSVCRT = 1
@@ -240,6 +236,7 @@ MSVCRT = 1
MSVCRT = 0
!endif
!endif
+!endif
!if [nmakehlp -f $(OPTS) "staticpkg"] && $(STATIC_BUILD)
!message *** Doing staticpkg
TCL_USE_STATIC_PACKAGES = 1
@@ -400,14 +397,14 @@ TCL_COMPILE_DEBUG = 0
#----------------------------------------------------------
!if "$(CHECKS)" == "" || [nmakehlp -f "$(CHECKS)" "none"]
-TCL_NO_DEPRECATED = 0
+TK_NO_DEPRECATED = 0
WARNINGS = -W3
!else
!if [nmakehlp -f $(CHECKS) "nodep"]
!message *** Doing nodep check
-TCL_NO_DEPRECATED = 1
+TK_NO_DEPRECATED = 1
!else
-TCL_NO_DEPRECATED = 0
+TK_NO_DEPRECATED = 0
!endif
!if [nmakehlp -f $(CHECKS) "fullwarn"]
!message *** Doing full warnings check
@@ -446,7 +443,7 @@ This compiler does not support profile guided optimization.
# Set our defines now armed with our options.
#----------------------------------------------------------
-OPTDEFINES = -DTCL_CFGVAL_ENCODING=$(CFG_ENCODING) -DSTDC_HEADERS
+OPTDEFINES = -DTCL_CFGVAL_ENCODING=$(CFG_ENCODING) -DSTDC_HEADERS -DTCL_NO_DEPRECATED
!if $(TCL_MEM_DEBUG)
OPTDEFINES = $(OPTDEFINES) -DTCL_MEM_DEBUG
@@ -463,8 +460,8 @@ OPTDEFINES = $(OPTDEFINES) -DUSE_THREAD_ALLOC=1
!if $(STATIC_BUILD)
OPTDEFINES = $(OPTDEFINES) -DSTATIC_BUILD
!endif
-!if $(TCL_NO_DEPRECATED)
-OPTDEFINES = $(OPTDEFINES) -DTCL_NO_DEPRECATED
+!if $(TK_NO_DEPRECATED)
+OPTDEFINES = $(OPTDEFINES) -DTK_NO_DEPRECATED
!endif
!if !$(DEBUG)
diff --git a/win/tcl.m4 b/win/tcl.m4
index d1fb11c..4d28744 100644
--- a/win/tcl.m4
+++ b/win/tcl.m4
@@ -727,7 +727,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
CFLAGS_DEBUG=-g
CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
- CFLAGS_WARNING="-Wall -Wsign-compare -Wdeclaration-after-statement"
+ CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wdeclaration-after-statement"
LDFLAGS_DEBUG=
LDFLAGS_OPTIMIZE=
diff --git a/win/tkWin.h b/win/tkWin.h
index 4d278d7..86be2e9 100644
--- a/win/tkWin.h
+++ b/win/tkWin.h
@@ -18,14 +18,20 @@
* the SystemParametersInfo API doesn't like to receive structures that
* are larger than it expects which affects the font assignments.
*
- * WINVER = 0x0500 means Windows 2000 and above
+ * NTDDI_VERSION = 0x0600 means Windows Vista and above
*/
+#ifndef NTDDI_VERSION
+#define NTDDI_VERSION 0x06000000
+#endif
#ifndef WINVER
-#define WINVER 0x0500
+#define WINVER 0x0600
#endif
#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0500
+#define _WIN32_WINNT 0x0600
+#endif
+#ifndef _WIN32_IE
+#define _WIN32_IE 0x0600
#endif
#ifndef _TK
diff --git a/win/tkWinClipboard.c b/win/tkWinClipboard.c
index 200883f..929070b 100644
--- a/win/tkWinClipboard.c
+++ b/win/tkWinClipboard.c
@@ -414,16 +414,7 @@ UpdateClipboard(
OpenClipboard(hwnd);
EmptyClipboard();
- /*
- * CF_UNICODETEXT is only supported on NT, but it it is prefered when
- * possible.
- */
-
- if (TkWinGetPlatformId() != VER_PLATFORM_WIN32_WINDOWS) {
- SetClipboardData(CF_UNICODETEXT, NULL);
- } else {
- SetClipboardData(CF_TEXT, NULL);
- }
+ SetClipboardData(CF_UNICODETEXT, NULL);
CloseClipboard();
TkWinUpdatingClipboard(FALSE);
}
diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c
index ba4176c..1d17cc6 100644
--- a/win/tkWinDraw.c
+++ b/win/tkWinDraw.c
@@ -486,7 +486,7 @@ XCopyPlane(
/*
*----------------------------------------------------------------------
*
- * TkPutImage --
+ * TkPutImage, XPutImage --
*
* Copies a subimage from an in-memory image to a rectangle of of the
* specified drawable.
@@ -599,6 +599,21 @@ TkPutImage(
TkWinReleaseDrawableDC(d, dc, &state);
return Success;
}
+
+int
+XPutImage(
+ Display *display,
+ Drawable d, /* Destination drawable. */
+ GC gc,
+ XImage *image, /* Source image. */
+ int src_x, int src_y, /* Offset of subimage. */
+ int dest_x, int dest_y, /* Position of subimage origin in drawable. */
+ unsigned int width, unsigned int height)
+ /* Dimensions of subimage. */
+{
+ return TkPutImage(NULL, 0, display, d, gc, image,
+ src_x, src_y, dest_x, dest_y, width, height);
+}
/*
*----------------------------------------------------------------------
@@ -625,7 +640,6 @@ XFillRectangles(
int nrectangles)
{
HDC dc;
- int i;
RECT rect;
TkWinDCState state;
HBRUSH brush, oldBrush;
@@ -666,25 +680,26 @@ XFillRectangles(
* result with the stipple pattern.
*/
- for (i = 0; i < nrectangles; i++) {
- bitmap = CreateCompatibleBitmap(dc, rectangles[i].width,
- rectangles[i].height);
+ while (nrectangles-- > 0) {
+ bitmap = CreateCompatibleBitmap(dc, rectangles[0].width,
+ rectangles[0].height);
oldBitmap = SelectObject(dcMem, bitmap);
rect.left = 0;
rect.top = 0;
- rect.right = rectangles[i].width;
- rect.bottom = rectangles[i].height;
+ rect.right = rectangles[0].width;
+ rect.bottom = rectangles[0].height;
FillRect(dcMem, &rect, brush);
- BitBlt(dc, rectangles[i].x, rectangles[i].y, rectangles[i].width,
- rectangles[i].height, dcMem, 0, 0, COPYFG);
+ BitBlt(dc, rectangles[0].x, rectangles[0].y, rectangles[0].width,
+ rectangles[0].height, dcMem, 0, 0, COPYFG);
if (gc->fill_style == FillOpaqueStippled) {
FillRect(dcMem, &rect, bgBrush);
- BitBlt(dc, rectangles[i].x, rectangles[i].y,
- rectangles[i].width, rectangles[i].height, dcMem,
+ BitBlt(dc, rectangles[0].x, rectangles[0].y,
+ rectangles[0].width, rectangles[0].height, dcMem,
0, 0, COPYBG);
}
SelectObject(dcMem, oldBitmap);
DeleteObject(bitmap);
+ ++rectangles;
}
DeleteDC(dcMem);
@@ -693,22 +708,24 @@ XFillRectangles(
DeleteObject(bgBrush);
} else {
if (gc->function == GXcopy) {
- for (i = 0; i < nrectangles; i++) {
- rect.left = rectangles[i].x;
- rect.right = rect.left + rectangles[i].width;
- rect.top = rectangles[i].y;
- rect.bottom = rect.top + rectangles[i].height;
+ while (nrectangles-- > 0) {
+ rect.left = rectangles[0].x;
+ rect.right = rect.left + rectangles[0].width;
+ rect.top = rectangles[0].y;
+ rect.bottom = rect.top + rectangles[0].height;
FillRect(dc, &rect, brush);
+ ++rectangles;
}
} else {
HPEN newPen = CreatePen(PS_NULL, 0, gc->foreground);
HPEN oldPen = SelectObject(dc, newPen);
oldBrush = SelectObject(dc, brush);
- for (i = 0; i < nrectangles; i++) {
- Rectangle(dc, rectangles[i].x, rectangles[i].y,
- rectangles[i].x + rectangles[i].width + 1,
- rectangles[i].y + rectangles[i].height + 1);
+ while (nrectangles-- > 0) {
+ Rectangle(dc, rectangles[0].x, rectangles[0].y,
+ rectangles[0].x + rectangles[0].width + 1,
+ rectangles[0].y + rectangles[0].height + 1);
+ ++rectangles;
}
SelectObject(dc, oldBrush);
@@ -940,7 +957,7 @@ XFillPolygon(
/*
*----------------------------------------------------------------------
*
- * XDrawRectangle --
+ * XDrawRectangle, XDrawRectangles --
*
* Draws a rectangle.
*
@@ -985,11 +1002,32 @@ XDrawRectangle(
TkWinReleaseDrawableDC(d, dc, &state);
return Success;
}
+
+int
+XDrawRectangles(
+ Display *display,
+ Drawable d,
+ GC gc,
+ XRectangle rects[],
+ int nrects)
+{
+ int ret = Success;
+
+ while (nrects-- > 0) {
+ ret = XDrawRectangle(display, d, gc, rects[0].x, rects[0].y,
+ rects[0].width, rects[0].height);
+ if (ret != Success) {
+ break;
+ }
+ ++rects;
+ }
+ return ret;
+}
/*
*----------------------------------------------------------------------
*
- * XDrawArc --
+ * XDrawArc, XDrawArcs --
*
* Draw an arc.
*
@@ -1015,11 +1053,35 @@ XDrawArc(
return DrawOrFillArc(display, d, gc, x, y, width, height, start, extent, 0);
}
+
+int
+XDrawArcs(
+ Display *display,
+ Drawable d,
+ GC gc,
+ XArc *arcs,
+ int narcs)
+{
+ int ret = Success;
+
+ display->request++;
+
+ while (narcs-- > 0) {
+ ret = DrawOrFillArc(display, d, gc, arcs[0].x, arcs[0].y,
+ arcs[0].width, arcs[0].height,
+ arcs[0].angle1, arcs[0].angle2, 0);
+ if (ret != Success) {
+ break;
+ }
+ ++arcs;
+ }
+ return ret;
+}
/*
*----------------------------------------------------------------------
*
- * XFillArc --
+ * XFillArc, XFillArcs --
*
* Draw a filled arc.
*
@@ -1045,6 +1107,30 @@ XFillArc(
return DrawOrFillArc(display, d, gc, x, y, width, height, start, extent, 1);
}
+
+int
+XFillArcs(
+ Display *display,
+ Drawable d,
+ GC gc,
+ XArc *arcs,
+ int narcs)
+{
+ int ret = Success;
+
+ display->request++;
+
+ while (narcs-- > 0) {
+ ret = DrawOrFillArc(display, d, gc, arcs[0].x, arcs[0].y,
+ arcs[0].width, arcs[0].height,
+ arcs[0].angle1, arcs[0].angle2, 1);
+ if (ret != Success) {
+ break;
+ }
+ ++arcs;
+ }
+ return ret;
+}
/*
*----------------------------------------------------------------------
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index 7b5e4c9..c01dc3f 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -26,9 +26,9 @@
* Under Windows, a "font family" is uniquely identified by its face name.
*/
-#define FONTMAP_SHIFT 10
+#define FONTMAP_SHIFT 12
-#define FONTMAP_PAGES (1 << (sizeof(Tcl_UniChar)*8 - FONTMAP_SHIFT))
+#define FONTMAP_PAGES (1 << (21 - FONTMAP_SHIFT))
#define FONTMAP_BITSPERPAGE (1 << FONTMAP_SHIFT)
typedef struct FontFamily {
@@ -262,16 +262,7 @@ void
TkpFontPkgInit(
TkMainInfo *mainPtr) /* The application being created. */
{
- if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
- /*
- * If running NT, then we will be calling some Unicode functions
- * explictly. So, even if the Tcl system encoding isn't Unicode, make
- * sure we convert to/from the Unicode char set.
- */
-
- systemEncoding = TkWinGetUnicodeEncoding();
- }
-
+ systemEncoding = TkWinGetUnicodeEncoding();
TkWinSetupSystemFonts(mainPtr);
}
@@ -760,14 +751,14 @@ TkpGetFontAttrsForChar(
* character */
FontFamily *familyPtr = thisSubFontPtr->familyPtr;
HFONT oldfont; /* Saved font from the device context */
- TEXTMETRICA tm; /* Font metrics of the selected subfont */
+ TEXTMETRIC tm; /* Font metrics of the selected subfont */
/*
* Get the font attributes.
*/
oldfont = SelectObject(hdc, thisSubFontPtr->hFont0);
- GetTextMetricsA(hdc, &tm);
+ GetTextMetrics(hdc, &tm);
SelectObject(hdc, oldfont);
ReleaseDC(fontPtr->hwnd, hdc);
faPtr->family = familyPtr->faceName;
@@ -828,7 +819,7 @@ Tk_MeasureChars(
HFONT oldFont;
WinFont *fontPtr;
int curX, moretomeasure;
- Tcl_UniChar ch;
+ int ch;
SIZE size;
FontFamily *familyPtr;
Tcl_DString runString;
@@ -859,7 +850,7 @@ Tk_MeasureChars(
start = source;
end = start + numBytes;
for (p = start; p < end; ) {
- next = p + Tcl_UtfToUniChar(p, &ch);
+ next = p + TkUtfToUniChar(p, &ch);
thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr);
if (thisSubFontPtr != lastSubFontPtr) {
familyPtr = lastSubFontPtr->familyPtr;
@@ -921,7 +912,7 @@ Tk_MeasureChars(
familyPtr = lastSubFontPtr->familyPtr;
Tcl_DStringInit(&runString);
for (p = start; p < end; ) {
- next = p + Tcl_UtfToUniChar(p, &ch);
+ next = p + TkUtfToUniChar(p, &ch);
Tcl_UtfToExternal(NULL, familyPtr->encoding, p,
(int) (next - p), 0, NULL, buf, sizeof(buf), NULL,
&dstWrote, NULL);
@@ -970,13 +961,13 @@ Tk_MeasureChars(
*/
const char *lastWordBreak = NULL;
- Tcl_UniChar ch2;
+ int ch2;
end = p;
p = source;
ch = ' ';
while (p < end) {
- next = p + Tcl_UtfToUniChar(p, &ch2);
+ next = p + TkUtfToUniChar(p, &ch2);
if ((ch != ' ') && (ch2 == ' ')) {
lastWordBreak = p;
}
@@ -1118,7 +1109,7 @@ Tk_DrawChars(
HBRUSH oldBrush, stipple;
HBITMAP oldBitmap, bitmap;
HDC dcMem;
- TEXTMETRICA tm;
+ TEXTMETRIC tm;
SIZE size;
if (twdPtr->type != TWD_BITMAP) {
@@ -1145,7 +1136,7 @@ Tk_DrawChars(
*/
GetTextExtentPointA(dcMem, source, numBytes, &size);
- GetTextMetricsA(dcMem, &tm);
+ GetTextMetrics(dcMem, &tm);
size.cx -= tm.tmOverhang;
bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy);
oldBitmap = SelectObject(dcMem, bitmap);
@@ -1184,7 +1175,7 @@ Tk_DrawChars(
} else {
HBITMAP oldBitmap, bitmap;
HDC dcMem;
- TEXTMETRICA tm;
+ TEXTMETRIC tm;
SIZE size;
dcMem = CreateCompatibleDC(dc);
@@ -1199,7 +1190,7 @@ Tk_DrawChars(
*/
GetTextExtentPointA(dcMem, source, numBytes, &size);
- GetTextMetricsA(dcMem, &tm);
+ GetTextMetrics(dcMem, &tm);
size.cx -= tm.tmOverhang;
bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy);
oldBitmap = SelectObject(dcMem, bitmap);
@@ -1266,7 +1257,7 @@ TkDrawAngledChars(
HBRUSH oldBrush, stipple;
HBITMAP oldBitmap, bitmap;
HDC dcMem;
- TEXTMETRICA tm;
+ TEXTMETRIC tm;
SIZE size;
if (twdPtr->type != TWD_BITMAP) {
@@ -1293,7 +1284,7 @@ TkDrawAngledChars(
*/
GetTextExtentPointA(dcMem, source, numBytes, &size);
- GetTextMetricsA(dcMem, &tm);
+ GetTextMetrics(dcMem, &tm);
size.cx -= tm.tmOverhang;
bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy);
oldBitmap = SelectObject(dcMem, bitmap);
@@ -1332,7 +1323,7 @@ TkDrawAngledChars(
} else {
HBITMAP oldBitmap, bitmap;
HDC dcMem;
- TEXTMETRICA tm;
+ TEXTMETRIC tm;
SIZE size;
dcMem = CreateCompatibleDC(dc);
@@ -1347,7 +1338,7 @@ TkDrawAngledChars(
*/
GetTextExtentPointA(dcMem, source, numBytes, &size);
- GetTextMetricsA(dcMem, &tm);
+ GetTextMetrics(dcMem, &tm);
size.cx -= tm.tmOverhang;
bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy);
oldBitmap = SelectObject(dcMem, bitmap);
@@ -1407,9 +1398,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);
}
/*
@@ -1443,24 +1438,32 @@ MultiFontTextOut(
* string when drawing. */
double angle)
{
- Tcl_UniChar ch;
+ int ch;
SIZE size;
HFONT oldFont;
FontFamily *familyPtr;
Tcl_DString runString;
const char *p, *end, *next;
SubFont *lastSubFontPtr, *thisSubFontPtr;
- TEXTMETRICA tm;
+ TEXTMETRIC tm;
lastSubFontPtr = &fontPtr->subFontArray[0];
oldFont = SelectFont(hdc, fontPtr, lastSubFontPtr, angle);
- GetTextMetricsA(hdc, &tm);
+ GetTextMetrics(hdc, &tm);
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) {
+
+ /*
+ * The drawing API has a limit of 32767 pixels in one go.
+ * To avoid spending time on a rare case we do not measure each char,
+ * instead we limit to drawing chunks of 200 bytes since that works
+ * well in practice.
+ */
+
+ if ((thisSubFontPtr != lastSubFontPtr) || (p-source > 200)) {
if (p > source) {
familyPtr = lastSubFontPtr->familyPtr;
Tcl_UtfToExternalDString(familyPtr->encoding, source,
@@ -1478,7 +1481,7 @@ MultiFontTextOut(
lastSubFontPtr = thisSubFontPtr;
source = p;
SelectFont(hdc, fontPtr, lastSubFontPtr, angle);
- GetTextMetricsA(hdc, &tm);
+ GetTextMetrics(hdc, &tm);
}
p = next;
}
@@ -1556,7 +1559,7 @@ InitFont(
HDC hdc;
HWND hwnd;
HFONT oldFont;
- TEXTMETRICA tm;
+ TEXTMETRIC tm;
Window window;
TkFontMetrics *fmPtr;
Tcl_Encoding encoding;
@@ -1569,7 +1572,7 @@ InitFont(
hdc = GetDC(hwnd);
oldFont = SelectObject(hdc, hFont);
- GetTextMetricsA(hdc, &tm);
+ GetTextMetrics(hdc, &tm);
/*
* On any version NT, there may fonts with international names. Use the
@@ -2188,7 +2191,7 @@ FontMapLoadPage(
{
FontFamily *familyPtr;
Tcl_Encoding encoding;
- char src[TCL_UTF_MAX], buf[16];
+ char src[XMaxTransChars], buf[16];
USHORT *startCount, *endCount;
int i, j, bitOffset, end, segCount;
@@ -2525,22 +2528,6 @@ FamilyExists(
int result;
Tcl_DString faceString;
- /*
- * Just immediately rule out the following fonts, because they look so
- * ugly on windows. The caller's fallback mechanism will cause the
- * corresponding appropriate TrueType fonts to be selected.
- */
-
- if (strcasecmp(faceName, "Courier") == 0) {
- return 0;
- }
- if (strcasecmp(faceName, "Times") == 0) {
- return 0;
- }
- if (strcasecmp(faceName, "Helvetica") == 0) {
- return 0;
- }
-
Tcl_UtfToExternalDString(systemEncoding, faceName, -1, &faceString);
/*
diff --git a/win/tkWinKey.c b/win/tkWinKey.c
index ed546f7..1ebf312 100644
--- a/win/tkWinKey.c
+++ b/win/tkWinKey.c
@@ -88,6 +88,8 @@ TkpGetString(
* result. */
{
XKeyEvent *keyEv = &eventPtr->xkey;
+ char buf[6];
+ int len;
Tcl_DStringInit(dsPtr);
if (keyEv->send_event == -1) {
@@ -95,30 +97,14 @@ TkpGetString(
Tcl_ExternalToUtfDString(TkWinGetKeyInputEncoding(),
keyEv->trans_chars, keyEv->nbytes, dsPtr);
}
- } else if (keyEv->send_event == -2) {
- /*
- * Special case for win2000 multi-lingal IME input. xkey.trans_chars[]
- * already contains a UNICODE char.
- */
-
- int unichar;
- char buf[TCL_UTF_MAX];
- int len;
-
- unichar = keyEv->trans_chars[1] & 0xff;
- unichar <<= 8;
- unichar |= keyEv->trans_chars[0] & 0xff;
-
- len = Tcl_UniCharToUtf((Tcl_UniChar) unichar, buf);
-
- Tcl_DStringAppend(dsPtr, buf, len);
} else if (keyEv->send_event == -3) {
+
/*
- * Special case for WM_UNICHAR. xkey.trans_chars[] already contains a
- * UTF-8 char.
+ * Special case for WM_UNICHAR and win2000 multi-lingal IME input
*/
- Tcl_DStringAppend(dsPtr, keyEv->trans_chars, keyEv->nbytes);
+ len = TkUniCharToUtf(keyEv->keycode, buf);
+ Tcl_DStringAppend(dsPtr, buf, len);
} else {
/*
* This is an event generated from generic code. It has no nchars or
@@ -129,9 +115,6 @@ TkpGetString(
if (((keysym != NoSymbol) && (keysym > 0) && (keysym < 256))
|| (keysym == XK_Return) || (keysym == XK_Tab)) {
- char buf[TCL_UTF_MAX];
- int len;
-
len = Tcl_UniCharToUtf((Tcl_UniChar) (keysym & 255), buf);
Tcl_DStringAppend(dsPtr, buf, len);
}
@@ -196,18 +179,18 @@ KeycodeToKeysym(
{
BYTE keys[256];
int result, deadkey, shift;
- char buf[4];
+ TCHAR buf[4];
unsigned int scancode = MapVirtualKey(keycode, 0);
/*
- * Do not run keycodes of lock keys through ToAscii(). One of ToAscii()'s
+ * Do not run keycodes of lock keys through ToUnicode(). One of ToUnicode()'s
* side effects is to handle the lights on the keyboard, and we don't want
* to mess that up.
*/
if (noascii || keycode == VK_CAPITAL || keycode == VK_SCROLL ||
keycode == VK_NUMLOCK) {
- goto skipToAscii;
+ goto skipToUnicode;
}
/*
@@ -248,24 +231,24 @@ KeycodeToKeysym(
keys[VK_NUMLOCK] = 1;
}
- result = ToAscii(keycode, scancode, keys, (LPWORD) buf, 0);
+ result = ToUnicode(keycode, scancode, keys, buf, 4, 0);
if (result < 0) {
/*
* Win95/98: This was a dead char, which is now remembered by the
- * keyboard. Call ToAscii() again to forget it.
+ * keyboard. Call ToUnicode() again to forget it.
* WinNT: This was a dead char, overwriting any previously remembered
- * key. Calling ToAscii() again does not affect anything.
+ * key. Calling ToUnicode() again does not affect anything.
*/
- ToAscii(keycode, scancode, keys, (LPWORD) buf, 0);
+ ToUnicode(keycode, scancode, keys, buf, 4, 0);
return XK_Multi_key;
}
if (result == 2) {
/*
* This was a dead char, and there were one previously remembered by
- * the keyboard. Call ToAscii() again with proper parameters to
+ * the keyboard. Call ToUnicode() again with proper parameters to
* restore it.
*
* Get information about the old char
@@ -290,26 +273,26 @@ KeycodeToKeysym(
if (shift & 4) {
keys[VK_MENU] = 0x80;
}
- ToAscii(deadkey, scancode, keys, (LPWORD) buf, 0);
+ ToUnicode(deadkey, scancode, keys, buf, 4, 0);
return XK_Multi_key;
}
/*
- * Keycode mapped to a valid Latin-1 character. Since the keysyms for
- * alphanumeric characters map onto Latin-1, we just return it.
+ * Keycode mapped to a valid Unicode character. Since the keysyms for
+ * alphanumeric characters map onto Unicode, we just return it.
*
* We treat 0x7F as a special case mostly for backwards compatibility. In
* versions of Tk<=8.2, Control-Backspace returned "XK_BackSpace" as the X
* Keysym. This was due to the fact that we did not initialize the keys
- * array properly when we passed it to ToAscii, above. We had previously
+ * array properly when we passed it to ToUnicode, above. We had previously
* not been setting the state bit for the Control key. When we fixed that,
* we found that Control-Backspace on Windows is interpreted as ASCII-127
* (0x7F), which corresponds to the Delete key.
*
* Upon discovering this, we realized we had two choices: return XK_Delete
* or return XK_BackSpace. If we returned XK_Delete, that could be
- * considered "more correct" (although the correctness would be dependant
- * on whether you believe that ToAscii is doing the right thing in that
+ * considered "more correct" (although the correctness would be dependent
+ * on whether you believe that ToUnicode is doing the right thing in that
* case); however, this would break backwards compatibility, and worse, it
* would limit application programmers; they would effectively be unable
* to bind to <Control-Backspace> on Windows. We therefore chose instead
@@ -319,15 +302,15 @@ KeycodeToKeysym(
* XK_BackSpace).
*/
- if (result == 1 && UCHAR(buf[0]) >= 0x20 && UCHAR(buf[0]) != 0x7F) {
- return (KeySym) UCHAR(buf[0]);
+ if (result == 1 && buf[0] >= 0x20 && buf[0] != 0x7F) {
+ return (KeySym) buf[0];
}
/*
* Keycode is a non-alphanumeric key, so we have to do the lookup.
*/
- skipToAscii:
+ skipToUnicode:
if (keycode > MAX_KEYCODE) {
return NoSymbol;
}
@@ -335,18 +318,24 @@ KeycodeToKeysym(
/*
* Windows only gives us an undifferentiated VK_CONTROL code (for
* example) when either Control key is pressed. To distinguish between
- * left and right, we have to query the state of one of the two to
- * determine which was actually pressed. So if the keycode indicates
- * Control, Shift, or Menu (the key that everybody else calls Alt), do
- * this extra test. If the right-side key was pressed, return the
- * appropriate keycode. Otherwise, we fall through and rely on the
- * keymap table to hold the correct keysym value.
+ * left and right, we use the Extended flag. Indeed, the right Control
+ * and Alt (aka Menu) keys are such extended keys (which their left
+ * counterparts are not).
+ * Regarding the shift case, Windows does not set the Extended flag for
+ * the neither the left nor the right shift key. As a consequence another
+ * way to distinguish between the two keys is to query the state of one
+ * of the two to determine which was actually pressed. So if the keycode
+ * indicates Shift, do this extra test. If the right-side key was
+ * pressed, return the appropriate keycode. Otherwise, we fall through
+ * and rely on the keymap table to hold the correct keysym value.
+ * Note: this little trick only works for KeyPress, not for KeyRelease,
+ * for reasons stated in bug [2945130]
*/
case VK_CONTROL:
- if (GetKeyState(VK_RCONTROL) & 0x80) {
- return XK_Control_R;
- }
+ if (state & EXTENDED_MASK) {
+ return XK_Control_R;
+ }
break;
case VK_SHIFT:
if (GetKeyState(VK_RSHIFT) & 0x80) {
@@ -354,9 +343,9 @@ KeycodeToKeysym(
}
break;
case VK_MENU:
- if (GetKeyState(VK_RMENU) & 0x80) {
- return XK_Alt_R;
- }
+ if (state & EXTENDED_MASK) {
+ return XK_Alt_R;
+ }
break;
}
return keymap[keycode];
@@ -576,7 +565,7 @@ TkpSetKeycodeAndState(
}
}
if (keySym >= 0x20) {
- result = VkKeyScan((char) keySym);
+ result = VkKeyScan((TCHAR) keySym);
if (result != -1) {
shift = result >> 8;
if (shift & 1)
@@ -629,7 +618,7 @@ XKeysymToKeycode(
}
}
if (keysym >= 0x20) {
- result = VkKeyScan((char) keysym);
+ result = VkKeyScan((TCHAR) keysym);
if (result != -1) {
return (KeyCode) (result & 0xff);
}
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c
index 8e14669..5a686cc 100644
--- a/win/tkWinMenu.c
+++ b/win/tkWinMenu.c
@@ -900,7 +900,7 @@ TkWinMenuProc(
LRESULT lResult;
if (!TkWinHandleMenuEvent(&hwnd, &message, &wParam, &lParam, &lResult)) {
- lResult = DefWindowProcA(hwnd, message, wParam, lParam);
+ lResult = DefWindowProc(hwnd, message, wParam, lParam);
}
return lResult;
}
@@ -999,7 +999,7 @@ TkWinEmbeddedMenuProc(
}
default:
- lResult = DefWindowProcA(hwnd, message, wParam, lParam);
+ lResult = DefWindowProc(hwnd, message, wParam, lParam);
break;
}
return lResult;
@@ -2036,33 +2036,33 @@ TkWinMenuKeyObjCmd(
if (eventPtr->type == KeyPress) {
switch (keySym) {
case XK_Alt_L:
- scanCode = MapVirtualKeyA(VK_LMENU, 0);
- CallWindowProcA(DefWindowProcA, Tk_GetHWND(Tk_WindowId(tkwin)),
+ scanCode = MapVirtualKey(VK_LMENU, 0);
+ CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
WM_SYSKEYDOWN, VK_MENU,
(int) (scanCode << 16) | (1 << 29));
break;
case XK_Alt_R:
- scanCode = MapVirtualKeyA(VK_RMENU, 0);
- CallWindowProcA(DefWindowProcA, Tk_GetHWND(Tk_WindowId(tkwin)),
+ scanCode = MapVirtualKey(VK_RMENU, 0);
+ CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
WM_SYSKEYDOWN, VK_MENU,
(int) (scanCode << 16) | (1 << 29) | (1 << 24));
break;
case XK_F10:
- scanCode = MapVirtualKeyA(VK_F10, 0);
- CallWindowProcA(DefWindowProcA, Tk_GetHWND(Tk_WindowId(tkwin)),
+ scanCode = MapVirtualKey(VK_F10, 0);
+ CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
WM_SYSKEYDOWN, VK_F10, (int) (scanCode << 16));
break;
default:
virtualKey = XKeysymToKeycode(winPtr->display, keySym);
- scanCode = MapVirtualKeyA(virtualKey, 0);
+ scanCode = MapVirtualKey(virtualKey, 0);
if (0 != scanCode) {
XKeyEvent xkey = eventPtr->xkey;
- CallWindowProcA(DefWindowProcA, Tk_GetHWND(Tk_WindowId(tkwin)),
+ CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
WM_SYSKEYDOWN, virtualKey,
(int) ((scanCode << 16) | (1 << 29)));
if (xkey.nbytes > 0) {
for (i = 0; i < xkey.nbytes; i++) {
- CallWindowProcA(DefWindowProcA,
+ CallWindowProc(DefWindowProc,
Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSCHAR,
xkey.trans_chars[i],
(int) ((scanCode << 16) | (1 << 29)));
@@ -2073,28 +2073,28 @@ TkWinMenuKeyObjCmd(
} else if (eventPtr->type == KeyRelease) {
switch (keySym) {
case XK_Alt_L:
- scanCode = MapVirtualKeyA(VK_LMENU, 0);
- CallWindowProcA(DefWindowProcA, Tk_GetHWND(Tk_WindowId(tkwin)),
+ scanCode = MapVirtualKey(VK_LMENU, 0);
+ CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
WM_SYSKEYUP, VK_MENU, (int) (scanCode << 16)
| (1 << 29) | (1 << 30) | (1 << 31));
break;
case XK_Alt_R:
- scanCode = MapVirtualKeyA(VK_RMENU, 0);
- CallWindowProcA(DefWindowProcA, Tk_GetHWND(Tk_WindowId(tkwin)),
+ scanCode = MapVirtualKey(VK_RMENU, 0);
+ CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
WM_SYSKEYUP, VK_MENU, (int) (scanCode << 16) | (1 << 24)
| (0x111 << 29) | (1 << 30) | (1 << 31));
break;
case XK_F10:
- scanCode = MapVirtualKeyA(VK_F10, 0);
- CallWindowProcA(DefWindowProcA, Tk_GetHWND(Tk_WindowId(tkwin)),
+ scanCode = MapVirtualKey(VK_F10, 0);
+ CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
WM_SYSKEYUP, VK_F10,
(int) (scanCode << 16) | (1 << 30) | (1 << 31));
break;
default:
virtualKey = XKeysymToKeycode(winPtr->display, keySym);
- scanCode = MapVirtualKeyA(virtualKey, 0);
+ scanCode = MapVirtualKey(virtualKey, 0);
if (0 != scanCode) {
- CallWindowProcA(DefWindowProcA, Tk_GetHWND(Tk_WindowId(tkwin)),
+ CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
WM_SYSKEYUP, virtualKey, (int) ((scanCode << 16)
| (1 << 29) | (1 << 30) | (1 << 31)));
}
@@ -3199,16 +3199,11 @@ SetDefaults(
HDC scratchDC;
int bold = 0;
int italic = 0;
- TEXTMETRICA tm;
+ TEXTMETRIC tm;
int pointSize;
HFONT menuFont;
/* See: [Bug #3239768] tk8.4.19 (and later) WIN32 menu font support */
- struct {
- NONCLIENTMETRICS metrics;
-#if (WINVER < 0x0600)
- int padding;
-#endif
- } nc;
+ NONCLIENTMETRICS metrics;
OSVERSIONINFOW os;
/*
@@ -3227,19 +3222,19 @@ SetDefaults(
}
Tcl_DStringInit(&menuFontDString);
- nc.metrics.cbSize = sizeof(nc);
+ metrics.cbSize = sizeof(metrics);
os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
GetVersionExW(&os);
if (os.dwMajorVersion < 6) {
- nc.metrics.cbSize -= sizeof(int);
+ metrics.cbSize -= sizeof(int);
}
- SystemParametersInfo(SPI_GETNONCLIENTMETRICS, nc.metrics.cbSize,
- &nc.metrics, 0);
- menuFont = CreateFontIndirect(&nc.metrics.lfMenuFont);
+ SystemParametersInfo(SPI_GETNONCLIENTMETRICS, metrics.cbSize,
+ &metrics, 0);
+ menuFont = CreateFontIndirect(&metrics.lfMenuFont);
SelectObject(scratchDC, menuFont);
- GetTextMetricsA(scratchDC, &tm);
+ GetTextMetrics(scratchDC, &tm);
GetTextFaceA(scratchDC, LF_FACESIZE, faceName);
pointSize = MulDiv(tm.tmHeight - tm.tmInternalLeading,
72, GetDeviceCaps(scratchDC, LOGPIXELSY));
@@ -3295,9 +3290,7 @@ SetDefaults(
*/
showMenuAccelerators = TRUE;
- if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
- SystemParametersInfoA(SPI_GETKEYBOARDCUES, 0, &showMenuAccelerators, 0);
- }
+ SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &showMenuAccelerators, 0);
}
/*
diff --git a/win/tkWinTest.c b/win/tkWinTest.c
index d824ee4..095358d 100644
--- a/win/tkWinTest.c
+++ b/win/tkWinTest.c
@@ -483,7 +483,7 @@ TestfindwindowObjCmd(
AppendSystemError(interp, GetLastError());
r = TCL_ERROR;
} else {
- Tcl_SetObjResult(interp, Tcl_NewLongObj(PTR2INT(hwnd)));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj((size_t)hwnd));
}
Tcl_DStringFree(&titleString);
@@ -499,7 +499,7 @@ EnumChildrenProc(
{
Tcl_Obj *listObj = (Tcl_Obj *) lParam;
- Tcl_ListObjAppendElement(NULL, listObj, Tcl_NewLongObj(PTR2INT(hwnd)));
+ Tcl_ListObjAppendElement(NULL, listObj, Tcl_NewWideIntObj((size_t)hwnd));
return TRUE;
}
@@ -510,7 +510,7 @@ TestgetwindowinfoObjCmd(
int objc,
Tcl_Obj *const objv[])
{
- long hwnd;
+ Tcl_WideInt hwnd;
Tcl_Obj *dictObj = NULL, *classObj = NULL, *textObj = NULL;
Tcl_Obj *childrenObj = NULL;
TCHAR buf[512];
@@ -521,10 +521,10 @@ TestgetwindowinfoObjCmd(
return TCL_ERROR;
}
- if (Tcl_GetLongFromObj(interp, objv[1], &hwnd) != TCL_OK)
+ if (Tcl_GetWideIntFromObj(interp, objv[1], &hwnd) != TCL_OK)
return TCL_ERROR;
- cch = GetClassName(INT2PTR(hwnd), buf, cchBuf);
+ cch = GetClassName((HWND)(size_t)hwnd, buf, cchBuf);
if (cch == 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to get class name: ", -1));
AppendSystemError(interp, GetLastError());
@@ -539,17 +539,17 @@ TestgetwindowinfoObjCmd(
dictObj = Tcl_NewDictObj();
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("class", 5), classObj);
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("id", 2),
- Tcl_NewLongObj(GetWindowLongA(INT2PTR(hwnd), GWL_ID)));
+ Tcl_NewWideIntObj(GetWindowLongPtr((HWND)(size_t)hwnd, GWL_ID)));
- cch = GetWindowText(INT2PTR(hwnd), (LPTSTR)buf, cchBuf);
+ cch = GetWindowText((HWND)(size_t)hwnd, (LPTSTR)buf, cchBuf);
textObj = Tcl_NewUnicodeObj((LPCWSTR)buf, cch);
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("text", 4), textObj);
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("parent", 6),
- Tcl_NewLongObj(PTR2INT(GetParent((INT2PTR(hwnd))))));
+ Tcl_NewWideIntObj((size_t)(GetParent((HWND)(size_t)hwnd))));
childrenObj = Tcl_NewListObj(0, NULL);
- EnumChildWindows(INT2PTR(hwnd), EnumChildrenProc, (LPARAM)childrenObj);
+ EnumChildWindows((HWND)(size_t)hwnd, EnumChildrenProc, (LPARAM)childrenObj);
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("children", -1), childrenObj);
Tcl_SetObjResult(interp, dictObj);
diff --git a/win/tkWinWindow.c b/win/tkWinWindow.c
index ade15bc..385e72b 100644
--- a/win/tkWinWindow.c
+++ b/win/tkWinWindow.c
@@ -590,7 +590,7 @@ XResizeWindow(
/*
*----------------------------------------------------------------------
*
- * XRaiseWindow --
+ * XRaiseWindow, XLowerWindow --
*
* Change the stacking order of a window.
*
@@ -614,6 +614,18 @@ XRaiseWindow(
SetWindowPos(window, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
return Success;
}
+
+int
+XLowerWindow(
+ Display *display,
+ Window w)
+{
+ HWND window = Tk_GetHWND(w);
+
+ display->request++;
+ SetWindowPos(window, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+ return Success;
+}
/*
*----------------------------------------------------------------------
@@ -753,6 +765,33 @@ XChangeWindowAttributes(
/*
*----------------------------------------------------------------------
*
+ * XReparentWindow --
+ *
+ * TODO: currently placeholder to satisfy Xlib stubs.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * TODO.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+XReparentWindow(
+ Display *display,
+ Window w,
+ Window parent,
+ int x,
+ int y)
+{
+ return BadWindow;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TkWinSetWindowPos --
*
* Adjust the stacking order of a window relative to a second window (or
diff --git a/win/tkWinX.c b/win/tkWinX.c
index 7e25826..d41b6c1 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -13,16 +13,6 @@
#include "tkWinInt.h"
-/*
- * The w32api 1.1 package (included in Mingw 1.1) does not define _WIN32_IE by
- * default. Define it here to gain access to the InitCommonControlsEx API in
- * commctrl.h.
- */
-
-#ifndef _WIN32_IE
-#define _WIN32_IE 0x0550 /* IE 5.5 */
-#endif
-
#include <commctrl.h>
#ifdef _MSC_VER
# pragma comment (lib, "comctl32.lib")
@@ -81,6 +71,7 @@ typedef struct ThreadSpecificData {
TkDisplay *winDisplay; /* TkDisplay structure that represents Windows
* screen. */
int updatingClipboard; /* If 1, we are updating the clipboard. */
+ int surrogateBuffer; /* Buffer for first of surrogate pair. */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
@@ -91,7 +82,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);
+static void GetTranslatedKey(XKeyEvent *xkey, UINT type);
static void UpdateInputLanguage(int charset);
static int HandleIMEComposition(HWND hwnd, LPARAM lParam);
@@ -124,16 +115,13 @@ TkGetServerInfo(
OSVERSIONINFOW os;
if (!buffer[0]) {
- HANDLE handle = LoadLibraryW(L"NTDLL");
+ HANDLE handle = GetModuleHandle(TEXT("NTDLL"));
int(__stdcall *getversion)(void *) =
(int(__stdcall *)(void *))GetProcAddress(handle, "RtlGetVersion");
os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
if (!getversion || getversion(&os)) {
GetVersionExW(&os);
}
- if (handle) {
- FreeLibrary(handle);
- }
/* Write the first character last, preventing multi-thread issues. */
sprintf(buffer+1, "indows %d.%d %d %s", (int)os.dwMajorVersion,
(int)os.dwMinorVersion, (int)os.dwBuildNumber,
@@ -911,15 +899,24 @@ Tk_TranslateWinEvent(
Tk_PointerEvent(hwnd, (short) LOWORD(lParam), (short) HIWORD(lParam));
return 1;
+ case WM_SYSKEYDOWN:
+ case WM_KEYDOWN:
+ if (wParam == VK_PACKET) {
+ /*
+ * This will trigger WM_CHAR event(s) with unicode data.
+ */
+ *resultPtr =
+ PostMessageW(hwnd, message, HIWORD(lParam), LOWORD(lParam));
+ return 1;
+ }
+ /* else fall through */
case WM_CLOSE:
case WM_SETFOCUS:
case WM_KILLFOCUS:
case WM_DESTROYCLIPBOARD:
case WM_UNICHAR:
case WM_CHAR:
- case WM_SYSKEYDOWN:
case WM_SYSKEYUP:
- case WM_KEYDOWN:
case WM_KEYUP:
case WM_MOUSEWHEEL:
GenerateXEvent(hwnd, message, wParam, lParam);
@@ -1147,7 +1144,8 @@ GenerateXEvent(
event.type = KeyPress;
event.xany.send_event = -1;
event.xkey.keycode = wParam;
- GetTranslatedKey(&event.xkey);
+ GetTranslatedKey(&event.xkey, (message == WM_KEYDOWN) ? WM_CHAR :
+ WM_SYSCHAR);
break;
case WM_SYSKEYUP:
@@ -1197,17 +1195,35 @@ GenerateXEvent(
event.type = KeyPress;
event.xany.send_event = -1;
event.xkey.keycode = 0;
- event.xkey.nbytes = 1;
- event.xkey.trans_chars[0] = (char) wParam;
-
- if (IsDBCSLeadByte((BYTE) wParam)) {
- MSG msg;
+ if ((int)wParam & 0xff00) {
+ int ch1 = wParam & 0xffff;
- if ((PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) != 0)
- && (msg.message == WM_CHAR)) {
- GetMessage(&msg, NULL, 0, 0);
- event.xkey.nbytes = 2;
- event.xkey.trans_chars[1] = (char) msg.wParam;
+ if ((ch1 & 0xfc00) == 0xd800) {
+ tsdPtr->surrogateBuffer = ch1;
+ return;
+ }
+ if ((ch1 & 0xfc00) == 0xdc00) {
+ ch1 = ((tsdPtr->surrogateBuffer & 0x3ff) << 10) |
+ (ch1 & 0x3ff) | 0x10000;
+ tsdPtr->surrogateBuffer = 0;
+ }
+ event.xany.send_event = -3;
+ event.xkey.nbytes = 0;
+ event.xkey.keycode = ch1;
+ } else {
+ event.xkey.nbytes = 1;
+ event.xkey.trans_chars[0] = (char) wParam;
+
+ if (IsDBCSLeadByte((BYTE) wParam)) {
+ MSG msg;
+
+ if ((PeekMessage(&msg, NULL, WM_CHAR, WM_CHAR,
+ PM_NOREMOVE) != 0)
+ && (msg.message == WM_CHAR)) {
+ GetMessage(&msg, NULL, WM_CHAR, WM_CHAR);
+ event.xkey.nbytes = 2;
+ event.xkey.trans_chars[1] = (char) msg.wParam;
+ }
}
}
Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
@@ -1215,15 +1231,10 @@ GenerateXEvent(
break;
case WM_UNICHAR: {
- char buffer[TCL_UTF_MAX+1];
- int i;
event.type = KeyPress;
event.xany.send_event = -3;
event.xkey.keycode = wParam;
- event.xkey.nbytes = Tcl_UniCharToUtf((int)wParam, buffer);
- for (i=0; i<event.xkey.nbytes && i<TCL_UTF_MAX; ++i) {
- event.xkey.trans_chars[i] = buffer[i];
- }
+ event.xkey.nbytes = 0;
Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
event.type = KeyRelease;
break;
@@ -1321,11 +1332,7 @@ GetState(
state &= ~mask;
}
if (HIWORD(lParam) & KF_EXTENDED) {
- if (message == WM_SYSKEYDOWN || message == WM_KEYDOWN) {
- state |= EXTENDED_MASK;
- } else {
- state &= ~EXTENDED_MASK;
- }
+ state |= EXTENDED_MASK;
}
}
return state;
@@ -1352,19 +1359,20 @@ GetState(
static void
GetTranslatedKey(
- XKeyEvent *xkey)
+ XKeyEvent *xkey,
+ UINT type)
{
MSG msg;
xkey->nbytes = 0;
while ((xkey->nbytes < XMaxTransChars)
- && PeekMessageA(&msg, NULL, 0, 0, PM_NOREMOVE)) {
- if ((msg.message != WM_CHAR) && (msg.message != WM_SYSCHAR)) {
+ && (PeekMessageA(&msg, NULL, type, type, PM_NOREMOVE) != 0)) {
+ if (msg.message != type) {
break;
}
- GetMessageA(&msg, NULL, 0, 0);
+ GetMessageA(&msg, NULL, type, type);
/*
* If this is a normal character message, we may need to strip off the
@@ -1505,7 +1513,7 @@ TkWinGetUnicodeEncoding(void)
*
* HandleIMEComposition --
*
- * This function works around a definciency in some versions of Windows
+ * This function works around a deficiency in some versions of Windows
* 2000 to make it possible to entry multi-lingual characters under all
* versions of Windows 2000.
*
@@ -1535,6 +1543,7 @@ HandleIMEComposition(
{
HIMC hIMC;
int n;
+ int high = 0;
if ((lParam & GCS_RESULTSTR) == 0) {
/*
@@ -1552,18 +1561,18 @@ HandleIMEComposition(
n = ImmGetCompositionString(hIMC, GCS_RESULTSTR, NULL, 0);
if (n > 0) {
- char *buff = ckalloc(n);
+ WCHAR *buff = (WCHAR *) ckalloc(n);
TkWindow *winPtr;
XEvent event;
int i;
- n = ImmGetCompositionString(hIMC, GCS_RESULTSTR, buff, (unsigned) n);
+ n = ImmGetCompositionString(hIMC, GCS_RESULTSTR, buff, (unsigned) n) / 2;
/*
* Set up the fields pertinent to key event.
*
- * We set send_event to the special value of -2, so that TkpGetString
- * in tkWinKey.c knows that trans_chars[] already contains a UNICODE
+ * We set send_event to the special value of -3, so that TkpGetString
+ * in tkWinKey.c knows that keycode already contains a UNICODE
* char and there's no need to do encoding conversion.
*
* Note that the event *must* be zeroed out first; Tk plays cunning
@@ -1574,7 +1583,7 @@ HandleIMEComposition(
memset(&event, 0, sizeof(XEvent));
event.xkey.serial = winPtr->display->request++;
- event.xkey.send_event = -2;
+ event.xkey.send_event = -3;
event.xkey.display = winPtr->display;
event.xkey.window = winPtr->window;
event.xkey.root = RootWindow(winPtr->display, winPtr->screenNum);
@@ -1582,8 +1591,6 @@ HandleIMEComposition(
event.xkey.state = TkWinGetModifierState();
event.xkey.time = TkpGetMS();
event.xkey.same_screen = True;
- event.xkey.keycode = 0;
- event.xkey.nbytes = 2;
for (i=0; i<n; ) {
/*
@@ -1591,9 +1598,16 @@ HandleIMEComposition(
* UNICODE character in the composition.
*/
- event.xkey.trans_chars[0] = (char) buff[i++];
- event.xkey.trans_chars[1] = (char) buff[i++];
+ event.xkey.keycode = buff[i++];
+ if ((event.xkey.keycode & 0xfc00) == 0xd800) {
+ high = ((event.xkey.keycode & 0x3ff) << 10) + 0x10000;
+ break;
+ } else if (high && (event.xkey.keycode & 0xfc00) == 0xdc00) {
+ event.xkey.keycode &= 0x3ff;
+ event.xkey.keycode += high;
+ high = 0;
+ }
event.type = KeyPress;
Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c
index 08569a3..909660a 100644
--- a/win/ttkWinXPTheme.c
+++ b/win/ttkWinXPTheme.c
@@ -15,14 +15,12 @@
* shellcc/platform/commctls/userex/refentry.asp >
*/
+#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 +29,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,
@@ -208,6 +204,8 @@ static Ttk_StateTable checkbox_statemap[] =
*/
static Ttk_StateTable radiobutton_statemap[] =
{
+{RBS_UNCHECKEDDISABLED, TTK_STATE_ALTERNATE|TTK_STATE_DISABLED, 0},
+{RBS_UNCHECKEDNORMAL, TTK_STATE_ALTERNATE, 0},
{RBS_CHECKEDDISABLED, TTK_STATE_SELECTED|TTK_STATE_DISABLED, 0},
{RBS_CHECKEDPRESSED, TTK_STATE_SELECTED|TTK_STATE_PRESSED, 0},
{RBS_CHECKEDHOT, TTK_STATE_SELECTED|TTK_STATE_ACTIVE, 0},
diff --git a/xlib/xgc.c b/xlib/xgc.c
index e097d2e..78c7501 100644
--- a/xlib/xgc.c
+++ b/xlib/xgc.c
@@ -520,7 +520,7 @@ XDrawImageString(
}
#endif
-void
+int
XDrawPoint(
Display *display,
Drawable d,
@@ -528,10 +528,10 @@ XDrawPoint(
int x,
int y)
{
- XDrawLine(display, d, gc, x, y, x, y);
+ return XDrawLine(display, d, gc, x, y, x, y);
}
-void
+int
XDrawPoints(
Display *display,
Drawable d,
@@ -540,16 +540,19 @@ XDrawPoints(
int npoints,
int mode)
{
- int i;
+ int res = Success;
- for (i=0; i<npoints; i++) {
- XDrawLine(display, d, gc,
- points[i].x, points[i].y, points[i].x, points[i].y);
+ while (npoints-- > 0) {
+ res = XDrawLine(display, d, gc,
+ points[0].x, points[0].y, points[0].x, points[0].y);
+ if (res != Success) break;
+ ++points;
}
+ return res;
}
#if !defined(MAC_OSX_TK)
-void
+int
XDrawSegments(
Display *display,
Drawable d,
@@ -557,6 +560,7 @@ XDrawSegments(
XSegment *segments,
int nsegments)
{
+ return Success;
}
#endif
diff --git a/xlib/xutil.c b/xlib/xutil.c
index 0514d7a..7b69e18 100644
--- a/xlib/xutil.c
+++ b/xlib/xutil.c
@@ -12,6 +12,7 @@
#include <stdlib.h>
#include <tk.h>
+#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>