From f85b666de3d6de93f6c60d612e1c4abf5c671a90 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 30 Sep 2016 09:29:39 +0000 Subject: Add a few "const" keywords, just for 'correctness' --- unix/tkUnixFont.c | 6 +++--- unix/tkUnixRFont.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c index 1b0f175..e694573 100644 --- a/unix/tkUnixFont.c +++ b/unix/tkUnixFont.c @@ -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"}, @@ -408,8 +408,8 @@ ControlUtfProc( char *dstStart, *dstEnd; 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' }; diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index cf4127d..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 } }; -- cgit v0.12 From dbd5092cb00d45365d9260c2c767757fa4219ede Mon Sep 17 00:00:00 2001 From: fvogel Date: Wed, 2 Nov 2016 20:07:14 +0000 Subject: Removed proc ::tk_getFileType since it is used nowhere in Tk, is undocumented, is superseded by the -typevariable option of file dialogs, and was anyway only available if tk_strictMotif is true. --- library/tclIndex | 1 - library/xmfbox.tcl | 7 ------- 2 files changed, 8 deletions(-) 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/xmfbox.tcl b/library/xmfbox.tcl index 14d2be5..f1daea0 100644 --- a/library/xmfbox.tcl +++ b/library/xmfbox.tcl @@ -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 } @@ -981,9 +980,3 @@ proc ::tk::ListBoxKeyAccel_Reset {w} { unset -nocomplain Priv(lbAccel,$w) } -proc ::tk_getFileType {} { - variable ::tk::Priv - - return $Priv(selectFileType) -} - -- cgit v0.12 From 2da9e225ec7604a5ad4e4dc46e76d090d733b87c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 4 Nov 2016 15:38:45 +0000 Subject: More internal use of size_t, so refcounts can be bigger than before (2^31 -> 2^32 on 32-bit platforms, even more on 64-bit) --- generic/tkConfig.c | 21 ++++++++++----------- generic/tkConsole.c | 12 ++++++------ generic/tkFont.c | 5 ++--- unix/tkUnixFont.c | 15 +++++++-------- 4 files changed, 25 insertions(+), 28 deletions(-) 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..fc60d5f 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; /* @@ -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/tkFont.c b/generic/tkFont.c index 7f2715b..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. */ @@ -1434,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); } diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c index e694573..c96e562 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" }; /* @@ -42,7 +42,7 @@ static const char *const encodingList[] = { 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. */ /* @@ -1916,8 +1916,7 @@ FreeFontFamily( if (familyPtr == NULL) { return; } - familyPtr->refCount--; - if (familyPtr->refCount > 0) { + if (familyPtr->refCount-- > 1) { return; } Tcl_FreeEncoding(familyPtr->encoding); @@ -2686,7 +2685,7 @@ RankAttributes( penalty += 150 * diff; } if (gotPtr->xa.charset != wantPtr->xa.charset) { - int i; + size_t i; const char *gotAlias, *wantAlias; penalty += 65000; @@ -2694,7 +2693,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; @@ -3012,7 +3011,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)) { -- cgit v0.12 From 3b8a1a19064c05bb314d93d5ce9e2d51efbb5e44 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 9 Nov 2016 13:41:27 +0000 Subject: Bring all win32 version stuff to one place. Should work the same (should still work on XP, although I don't know if we really want that). --- win/tkWin.h | 12 +++++++++--- win/tkWinMenu.c | 17 ++++++----------- win/tkWinX.c | 10 ---------- win/ttkWinXPTheme.c | 6 +----- 4 files changed, 16 insertions(+), 29 deletions(-) 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/tkWinMenu.c b/win/tkWinMenu.c index 8e14669..0975633 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -3203,12 +3203,7 @@ SetDefaults( 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,17 +3222,17 @@ 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); GetTextFaceA(scratchDC, LF_FACESIZE, faceName); diff --git a/win/tkWinX.c b/win/tkWinX.c index cfd64af..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 #ifdef _MSC_VER # pragma comment (lib, "comctl32.lib") diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index 3de1504..909660a 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -15,14 +15,12 @@ * shellcc/platform/commctls/userex/refentry.asp > */ +#include #ifndef HAVE_UXTHEME_H /* Stub for platforms that lack the XP theme API headers: */ -#include int TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd) { return TCL_OK; } #else -#define WINVER 0x0501 /* Requires Windows XP APIs */ - #include #include #if defined(HAVE_VSSYM32_H) || _MSC_VER > 1500 @@ -31,8 +29,6 @@ int TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd) { return TCL_OK; } # include #endif -#include - #include "ttk/ttkTheme.h" typedef HTHEME (STDAPICALLTYPE OpenThemeDataProc)(HWND hwnd, -- cgit v0.12 From 39cfdaa0524f329527d9ee22d9229ce476560f05 Mon Sep 17 00:00:00 2001 From: fvogel Date: Wed, 30 Nov 2016 21:51:25 +0000 Subject: Fixed [3ee76e41c2] - New textTag test failures --- tests/textTag.test | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/tests/textTag.test b/tests/textTag.test index 2df8c5a..a2b2d73 100644 --- a/tests/textTag.test +++ b/tests/textTag.test @@ -11,6 +11,19 @@ namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands +set textWidgetFont {Courier 12} +set bigFont {Helvetica 24} + +# what is needed is a specific font *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 actual $textWidgetFont -size] == 12 && + [font actual $bigFont -size] == 24 } +] + destroy .t text .t -width 20 -height 10 @@ -19,7 +32,6 @@ 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. @@ -1313,9 +1325,13 @@ 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 {} -warp 1 -x -1 -y -1; update + set curFont [.t cget -font] + .t configure -font $textWidgetFont } -body { .t tag configure big -font $bigFont event gen .t -state 0x100 -x $x1 -y $y1 @@ -1326,6 +1342,7 @@ test textTag-16.2 {TkTextPickCurrent procedure} -setup { lappend x [.t index current] } -cleanup { .t tag delete big + .t configure -font $curFont } -result {3.2 3.1} test textTag-16.3 {TkTextPickCurrent procedure} -setup { @@ -1381,11 +1398,15 @@ 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 {} -warp 1 -x -1 -y -1; update + set curFont [.t cget -font] + .t configure -font $textWidgetFont } -body { .t tag configure big -font $bigFont event gen .t -x $x1 -y $y1 @@ -1395,13 +1416,18 @@ test textTag-16.5 {TkTextPickCurrent procedure} -setup { .t index current } -cleanup { .t tag delete a big + .t configure -font $curFont } -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 {} -warp 1 -x -1 -y -1; update + set curFont [.t cget -font] + .t configure -font $textWidgetFont } -body { .t tag configure big -font $bigFont event gen .t -x $x1 -y $y1 @@ -1412,13 +1438,18 @@ test textTag-16.6 {TkTextPickCurrent procedure} -setup { .t index current } -cleanup { .t tag delete a big + .t configure -font $curFont } -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 {} -warp 1 -x -1 -y -1; update + set curFont [.t cget -font] + .t configure -font $textWidgetFont } -body { .t tag configure big -font $bigFont .t tag bind a {.t tag add big 3.0 3.2} @@ -1432,6 +1463,7 @@ test textTag-16.7 {TkTextPickCurrent procedure} -setup { .t index current } -cleanup { .t tag delete a big + .t configure -font $curFont } -result {3.1} -- cgit v0.12 From 9d9cee0288f4ef2d88ddaa3a3f41c34751d851fd Mon Sep 17 00:00:00 2001 From: fvogel Date: Thu, 1 Dec 2016 19:27:08 +0000 Subject: Also the fact that the actually used fonts must be fixed-width needs to be checked when assessing the value of the haveFontSizes constraint --- tests/textTag.test | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/textTag.test b/tests/textTag.test index a2b2d73..6489c3a 100644 --- a/tests/textTag.test +++ b/tests/textTag.test @@ -12,16 +12,18 @@ eval tcltest::configure $argv tcltest::loadTestedCommands set textWidgetFont {Courier 12} -set bigFont {Helvetica 24} +set bigFont {Courier 24} -# what is needed is a specific font *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 +# 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 actual $textWidgetFont -size] == 12 && - [font actual $bigFont -size] == 24 } + [font metrics $textWidgetFont -fixed] && + [font actual $textWidgetFont -size] == 12 && + [font metrics $bigFont -fixed] && + [font actual $bigFont -size] == 24 } ] destroy .t -- cgit v0.12 From cabe11c363724790cf77f9a1c39b27703d0093b9 Mon Sep 17 00:00:00 2001 From: fvogel Date: Thu, 1 Dec 2016 21:45:34 +0000 Subject: When changing the text font, (x,y) coordinates previously saved in the (xi,yi) doublets are no longer relevant. Save coordinates for each of the two font possibilities, and use the right ones in each test. --- tests/textTag.test | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/tests/textTag.test b/tests/textTag.test index 6489c3a..ca34bc7 100644 --- a/tests/textTag.test +++ b/tests/textTag.test @@ -1210,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] @@ -1220,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 @@ -1333,18 +1343,18 @@ test textTag-16.2 {TkTextPickCurrent procedure} -constraints { .t tag delete {*}[.t tag names] event generate {} -warp 1 -x -1 -y -1; update set curFont [.t cget -font] - .t configure -font $textWidgetFont + .t configure -font $textWidgetFont -wrap none } -body { .t tag configure big -font $bigFont - event gen .t -state 0x100 -x $x1 -y $y1 - event gen .t -x $x2 -y $y2 + event gen .t -state 0x100 -x $x4 -y $y4 + event gen .t -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 + .t configure -font $curFont -wrap $curWrap } -result {3.2 3.1} test textTag-16.3 {TkTextPickCurrent procedure} -setup { @@ -1408,17 +1418,17 @@ test textTag-16.5 {TkTextPickCurrent procedure} -constraints { } event generate {} -warp 1 -x -1 -y -1; update set curFont [.t cget -font] - .t configure -font $textWidgetFont + .t configure -font $textWidgetFont -wrap none } -body { .t tag configure big -font $bigFont - event gen .t -x $x1 -y $y1 + event gen .t -x $x4 -y $y4 .t tag bind a {.t tag add big 3.0 3.2} .t tag add a 3.2 - event gen .t -x $x2 -y $y2 + event gen .t -x $x5 -y $y5 .t index current } -cleanup { .t tag delete a big - .t configure -font $curFont + .t configure -font $curFont -wrap $curWrap } -result {3.2} test textTag-16.6 {TkTextPickCurrent procedure} -constraints { @@ -1429,18 +1439,18 @@ test textTag-16.6 {TkTextPickCurrent procedure} -constraints { } event generate {} -warp 1 -x -1 -y -1; update set curFont [.t cget -font] - .t configure -font $textWidgetFont + .t configure -font $textWidgetFont -wrap none } -body { .t tag configure big -font $bigFont - event gen .t -x $x1 -y $y1 + event gen .t -x $x4 -y $y4 .t tag bind a {.t tag add big 3.0 3.2} .t tag add a 3.2 - event gen .t -x $x2 -y $y2 + event gen .t -x $x5 -y $y5 update .t index current } -cleanup { .t tag delete a big - .t configure -font $curFont + .t configure -font $curFont -wrap $curWrap } -result {3.1} test textTag-16.7 {TkTextPickCurrent procedure} -constraints { @@ -1451,21 +1461,21 @@ test textTag-16.7 {TkTextPickCurrent procedure} -constraints { } event generate {} -warp 1 -x -1 -y -1; update set curFont [.t cget -font] - .t configure -font $textWidgetFont + .t configure -font $textWidgetFont -wrap none } -body { .t tag configure big -font $bigFont .t tag bind a {.t tag add big 3.0 3.2} .t tag add a 3.2 - event gen .t -x $x1 -y $y1 + event gen .t -x $x4 -y $y4 .t tag bind a {.t tag add big 3.0 3.2} .t tag add a 2.1 - event gen .t -x $x2 -y $y2 + event gen .t -x $x5 -y $y5 update .t index current } -cleanup { .t tag delete a big - .t configure -font $curFont + .t configure -font $curFont -wrap $curWrap } -result {3.1} -- cgit v0.12 From 954d42e47de744904aac4b8d78c7f7b4048e8a17 Mon Sep 17 00:00:00 2001 From: fvogel Date: Fri, 2 Dec 2016 06:35:22 +0000 Subject: Remove superfluous lines (the default font of the text widget is already saved in $curFont before the tests start). --- tests/textTag.test | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/textTag.test b/tests/textTag.test index ca34bc7..93feb27 100644 --- a/tests/textTag.test +++ b/tests/textTag.test @@ -1342,7 +1342,6 @@ test textTag-16.2 {TkTextPickCurrent procedure} -constraints { } -setup { .t tag delete {*}[.t tag names] event generate {} -warp 1 -x -1 -y -1; update - set curFont [.t cget -font] .t configure -font $textWidgetFont -wrap none } -body { .t tag configure big -font $bigFont @@ -1417,7 +1416,6 @@ test textTag-16.5 {TkTextPickCurrent procedure} -constraints { .t tag remove $i 1.0 end } event generate {} -warp 1 -x -1 -y -1; update - set curFont [.t cget -font] .t configure -font $textWidgetFont -wrap none } -body { .t tag configure big -font $bigFont @@ -1438,7 +1436,6 @@ test textTag-16.6 {TkTextPickCurrent procedure} -constraints { .t tag remove $i 1.0 end } event generate {} -warp 1 -x -1 -y -1; update - set curFont [.t cget -font] .t configure -font $textWidgetFont -wrap none } -body { .t tag configure big -font $bigFont @@ -1460,7 +1457,6 @@ test textTag-16.7 {TkTextPickCurrent procedure} -constraints { .t tag remove $i 1.0 end } event generate {} -warp 1 -x -1 -y -1; update - set curFont [.t cget -font] .t configure -font $textWidgetFont -wrap none } -body { .t tag configure big -font $bigFont -- cgit v0.12 From fd7ab722c98be2bee1064d8721bbcae710a74f14 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 2 Dec 2016 12:57:58 +0000 Subject: [76e2d9c095] Repair broken test border-3.1 --- tests/border.test | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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}} {}} -- cgit v0.12 From c9609fa27feeb754fbbaa92539825a04d2c4d7f6 Mon Sep 17 00:00:00 2001 From: fvogel Date: Fri, 2 Dec 2016 20:58:36 +0000 Subject: Fix [ad98f10b3a] and [bd0017bf79] - bitmap-4.1 and cursor-4.1 tests failures. Also, apply again the same pattern to fix color-4.1 that was also failing (when the colorsFree constraint was met) despite there was no such report (yet). Thanks to dgp. --- tests/bitmap.test | 9 ++++++--- tests/color.test | 16 +++++++++++----- tests/cursor.test | 9 ++++++--- 3 files changed, 23 insertions(+), 11 deletions(-) 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/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/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}} {}} -- cgit v0.12 From e63cc287cacc144a9a0a5c405d49cca44b37e574 Mon Sep 17 00:00:00 2001 From: fvogel Date: Thu, 8 Dec 2016 20:46:48 +0000 Subject: Micro-optimization in tkTextDisp.c --- generic/tkTextDisp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index a6e665a..1c4925d 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -8981,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); -- cgit v0.12 From 6130ca3ef131a8459a378ee9e3fa67484d6fe178 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 15 Dec 2016 16:07:06 +0000 Subject: Proposed fix for [7d967c68a09e07e355358af40f36dd5dd84c7022|7d967c68]: Tk applications segmentation fault when ibus-daemon IME is restarted --- generic/tkEvent.c | 13 ++++++++++++- generic/tkInt.h | 6 ++++++ generic/tkWindow.c | 11 +++++++++-- unix/tkUnixEvent.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 73 insertions(+), 3 deletions(-) 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/tkInt.h b/generic/tkInt.h index 1615a81..f00d833 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -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; /* @@ -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; /* diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 5855b7c..85c5590 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; /* @@ -472,6 +475,9 @@ GetScreen( dispPtr->cursorFont = None; dispPtr->warpWindow = NULL; dispPtr->multipleAtom = None; +#ifdef TK_USE_INPUT_METHODS + dispPtr->ximGeneration = 0; +#endif /*TK_USE_INPUT_METHODS*/ /* * By default we do want to collapse motion events in @@ -1442,10 +1448,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); 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 */ -- cgit v0.12 From 07c65ee9c99b263ed8b6aefb42c7c5f6e47a441e Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 7 Jan 2017 14:51:58 +0000 Subject: Fix [ae32eb7e10]: Win + specific text widget configuration : textDisp-18.6, -20.2 -20.3 -20.4 fail --- generic/tkTextDisp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 2171cd0..c060687 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -8793,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; } -- cgit v0.12 From 161ab94f1c1e0e903cd217f89ff6981d9cd74923 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 29 Jan 2017 16:48:38 +0000 Subject: Remove superfluous 'textfonts' constraint in textDisp-20.1,2,3,4,5 --- tests/textDisp.test | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/textDisp.test b/tests/textDisp.test index 8342c46..44e3edc 100644 --- a/tests/textDisp.test +++ b/tests/textDisp.test @@ -2873,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.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} {textfonts} { +test textDisp-20.3 {FindDLine} { .t yview 100.0 .t yview 49.0 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} {textfonts} { +test textDisp-20.4 {FindDLine} { .t yview 100.0 .t yview 42.0 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] -- cgit v0.12 From 0691533b9281b179d99856732c3eb28f6a4256cf Mon Sep 17 00:00:00 2001 From: fvogel Date: Wed, 1 Feb 2017 21:09:34 +0000 Subject: Remove old pack syntax from the scripts of the Tk test suite --- tests/focusTcl.test | 8 ++++---- tests/pack.test | 4 ++-- tests/text.test | 30 +++++++++++++++--------------- tests/textDisp.test | 6 +++--- tests/textIndex.test | 6 +++--- tests/textMark.test | 2 +- tests/textTag.test | 2 +- tests/textWind.test | 2 +- 8 files changed, 30 insertions(+), 30 deletions(-) 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/pack.test b/tests/pack.test index eac1562..efb262b 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/text.test b/tests/text.test index 6812855..edd2a6e 100644 --- a/tests/text.test +++ b/tests/text.test @@ -2631,7 +2631,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 @@ -2727,7 +2727,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 @@ -2744,7 +2744,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 @@ -2856,7 +2856,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" @@ -2882,7 +2882,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 @@ -3432,7 +3432,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]] @@ -3449,7 +3449,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 @@ -3466,7 +3466,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] @@ -3756,7 +3756,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 @@ -3768,7 +3768,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 @@ -3841,7 +3841,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} { @@ -3856,7 +3856,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} { @@ -3876,7 +3876,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} { @@ -3890,7 +3890,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} { @@ -3910,7 +3910,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 { diff --git a/tests/textDisp.test b/tests/textDisp.test index 8342c46..a3a4553 100644 --- a/tests/textDisp.test +++ b/tests/textDisp.test @@ -39,7 +39,7 @@ 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} # 15 on XP, 13 on Solaris 8 @@ -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 . {} @@ -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 diff --git a/tests/textIndex.test b/tests/textIndex.test index 83a249e..7d44516 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 edd0e92..bbf226e 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 88081d0..ddbaa3b 100644 --- a/tests/textTag.test +++ b/tests/textTag.test @@ -17,7 +17,7 @@ testConstraint haveCourier12 [expr {[catch { .t configure -font {Courier 12} }] == 0}] -pack append . .t {top expand fill} +pack .t -expand 1 -fill both update .t debug on diff --git a/tests/textWind.test b/tests/textWind.test index 27b7309..fd29e19 100644 --- a/tests/textWind.test +++ b/tests/textWind.test @@ -22,7 +22,7 @@ option add *Text.font {Courier -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 -- cgit v0.12 From 57fc44c584797fe0a1f04d80fa255ad5e3339b86 Mon Sep 17 00:00:00 2001 From: fvogel Date: Wed, 8 Feb 2017 18:22:34 +0000 Subject: Fix [c492c96aa2]: Combobox arrow not grayed (alt, clam and default ttk themes) --- library/ttk/altTheme.tcl | 1 + library/ttk/clamTheme.tcl | 1 + library/ttk/defaults.tcl | 1 + 3 files changed, 3 insertions(+) diff --git a/library/ttk/altTheme.tcl b/library/ttk/altTheme.tcl index e792539..9aa6061 100644 --- a/library/ttk/altTheme.tcl +++ b/library/ttk/altTheme.tcl @@ -64,6 +64,7 @@ namespace eval ttk::theme::alt { ttk::style configure TCombobox -padding 1 ttk::style map TCombobox -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] + ttk::style map TCombobox -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 f4ad43b..b278e3f 100644 --- a/library/ttk/clamTheme.tcl +++ b/library/ttk/clamTheme.tcl @@ -111,6 +111,7 @@ namespace eval ttk::theme::clam { readonly $colors(-frame)] \ -foreground [list {readonly focus} $colors(-selectfg)] \ ; + ttk::style map TCombobox -arrowcolor [list disabled $colors(-disabledfg)] ttk::style configure ComboboxPopdownFrame \ -relief solid -borderwidth 1 diff --git a/library/ttk/defaults.tcl b/library/ttk/defaults.tcl index 853ed20..f38a4a2 100644 --- a/library/ttk/defaults.tcl +++ b/library/ttk/defaults.tcl @@ -74,6 +74,7 @@ namespace eval ttk::theme::default { -relief sunken -fieldbackground white -padding 1 ttk::style map TEntry -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] + ttk::style map TCombobox -arrowcolor [list disabled $colors(-disabledfg)] ttk::style configure TCombobox -arrowsize 12 -padding 1 ttk::style map TCombobox -fieldbackground \ -- cgit v0.12 From cb619ed5ddc6047ebf6fff8c2c64a42c37e95926 Mon Sep 17 00:00:00 2001 From: fvogel Date: Thu, 9 Feb 2017 19:28:56 +0000 Subject: Group multiple [style map TCombobox] statements into a single instruction --- library/ttk/altTheme.tcl | 4 ++-- library/ttk/clamTheme.tcl | 3 +-- library/ttk/defaults.tcl | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/library/ttk/altTheme.tcl b/library/ttk/altTheme.tcl index 9aa6061..5630e6c 100644 --- a/library/ttk/altTheme.tcl +++ b/library/ttk/altTheme.tcl @@ -63,8 +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)] - ttk::style map TCombobox -arrowcolor [list disabled $colors(-disabledfg)] + [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 b278e3f..808c365 100644 --- a/library/ttk/clamTheme.tcl +++ b/library/ttk/clamTheme.tcl @@ -110,8 +110,7 @@ namespace eval ttk::theme::clam { -fieldbackground [list {readonly focus} $colors(-selectbg) \ readonly $colors(-frame)] \ -foreground [list {readonly focus} $colors(-selectfg)] \ - ; - ttk::style map TCombobox -arrowcolor [list disabled $colors(-disabledfg)] + -arrowcolor [list disabled $colors(-disabledfg)] ttk::style configure ComboboxPopdownFrame \ -relief solid -borderwidth 1 diff --git a/library/ttk/defaults.tcl b/library/ttk/defaults.tcl index f38a4a2..56e2176 100644 --- a/library/ttk/defaults.tcl +++ b/library/ttk/defaults.tcl @@ -74,11 +74,11 @@ namespace eval ttk::theme::default { -relief sunken -fieldbackground white -padding 1 ttk::style map TEntry -fieldbackground \ [list readonly $colors(-frame) disabled $colors(-frame)] - ttk::style map TCombobox -arrowcolor [list disabled $colors(-disabledfg)] 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 \ -- cgit v0.12 From 1a74e9de135efaea49d48f7974960bc6e8426949 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 10 Feb 2017 11:38:55 +0000 Subject: Fix [7d967c68a09e07e355358af40f36dd5dd84c7022|7d967c68a0] follow-up: Tk applications segmentation fault when ibus-daemon IME is restarted. Patch by Brad Lanam. --- generic/tkWindow.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/generic/tkWindow.c b/generic/tkWindow.c index e4d696b..690a841 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -475,9 +475,6 @@ GetScreen( dispPtr->cursorFont = None; dispPtr->warpWindow = NULL; dispPtr->multipleAtom = None; -#ifdef TK_USE_INPUT_METHODS - dispPtr->ximGeneration = 0; -#endif /*TK_USE_INPUT_METHODS*/ /* * By default we do want to collapse motion events in @@ -656,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; -- cgit v0.12 -- cgit v0.12 From 8701bf597e98498ab4d757caa5a2bb9dd46a0554 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 6 Mar 2017 16:46:23 +0000 Subject: [6b3644a485] Fix -alpha applied to 16-bit color PNG. Thanks TheLemonMan. --- generic/tkImgPNG.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); -- cgit v0.12