diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-01-06 12:49:16 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-01-06 12:49:16 (GMT) |
commit | c50c3b612ba50c205771d13c6165254eb6d3a08f (patch) | |
tree | aba16824ea837ae0491f49f6d94c0f17d4343de8 | |
parent | 20a005ef0c7ab42b7f4f703572c56ac2af790137 (diff) | |
parent | 0fad0657c2f97cbfbbbfd7dbe1da39e618fcd33b (diff) | |
download | tk-c50c3b612ba50c205771d13c6165254eb6d3a08f.zip tk-c50c3b612ba50c205771d13c6165254eb6d3a08f.tar.gz tk-c50c3b612ba50c205771d13c6165254eb6d3a08f.tar.bz2 |
Merge trunk
48 files changed, 685 insertions, 421 deletions
@@ -1,6 +1,6 @@ # README: Tk -This is the **Tk 8.7a2** source distribution. +This is the **Tk 8.7a3** source distribution. You can get any source release of Tk from [our distribution site](https://sourceforge.net/projects/tcl/files/Tcl/). @@ -7416,6 +7416,29 @@ Tk Cocoa 2.0: More drawing internals refinements (culler,walzer) --- Released 8.6.7, August 9, 2017 --- https://core.tcl-lang.org/tk/ for details +Changes to 8.7a1 include all changes to the 8.6 line through 8.6.7, +plus the following, which focuses on the high-level feature changes +in this changeset (new minor version) rather than bug fixes: + +2016-03-07 (feature)[841280] spinbox autoswap -to/-from to get ordering (vogel) + +2016-03-27 (feature)[38dc27] Support <Button-6> & <Button-7> (nijtmans) + +2016-08-29 (TIP 449) [text] undo/redo return character range (vogel) + +2016-11-02 (feature) Removed undocumented command [tk_getFileType] (vogel) + *** POTENTIAL INCOMPATIBILITY *** + +2017-02-05 (bug)[c0dbdd] Compatibility fonts shadowed system fonts (vogel) + +2017-03-21 (TIP 442) display text in a progressbar (zaumseil) + +2017-04-13 \u escaped content in msg files converted to true utf-8 (nijtmans) + +2017-08-28 (TIP 166) Extended color notation for alpha channel (bachmann) + +--- Released 8.7a1, September 8, 2017 --- http://core.tcl.tk/tk/ for details + 2017-08-24 (bug)[f1a3ca] Memory leak in [text] B-tree (edhume3) 2017-08-24 (bug)[ee40fd] Report [console] init errors (the) @@ -7540,7 +7563,7 @@ Tk Cocoa 2.0: More drawing internals refinements (culler,walzer) 2018-07-17 (bug)[1088825] fix frame-2.17,3.9,3.10 on Mac (vogel) -2018-07-27 (bug)[fabed1] GIF photo support for "deferred clear code" (vogel) +2018-07-27 (bug)[fbaed1] GIF photo support for "deferred clear code" (vogel) 2018-08-08 (feature) Modern full-screen support on Mac OSX (walzer) @@ -7568,27 +7591,170 @@ Tk Cocoa 2.0: More drawing internals refinements (culler,walzer) 2018-11-04 (bug)[6b22d4] [treeview] binding fix (ohagan) -- Released 8.6.9, November 16, 2018 - https://core.tcl-lang.org/tk/ for details - +- Released 8.6.9, November 16, 2018 - https://core.tcl-lang.org/tk/ for details -Changes to 8.7a1 include all changes to the 8.6 line through 8.6.7, +2018-11-19 (bug)[0a9c91] crash in text-11a.22 (vogel) + +2018-11-20 (bug)[9705d1] crash activating "Alt" theme (culler) + +2018-11-24 (bug)[e3b954] cursor offset at full screen display (culler) + +2019-01-04 (bug)[18a4ba] cross-platform [winfo containing] (culler) + +2019-01-08 (feature) local grab on Mac OSX (culler) + +2019-01-10 (build) 'None', 'ControlMask' symbol conflicts (nijtmans) + +2019-01-20 (bug)[509caf] [treeview tag configure] regression (mcdonald,vogel) + +2019-01-26 (bug)[3003895] [scale] res rounds and -from (tischler,pieper,vogel) + +2019-02-02 (new)[TIP 533] [$mb post x y idx] (culler,vogel) + +2019-02-08 (bug)[1529659] embed toplevel blocks outer menu (culler) + +2019-02-10 (bug)[8814bd] crash in [NSMenu size] (culler) + +2019-02-13 (bug)[b389df] Aqua: mouse position on dual screen (culler) + +2019-02-23 (bug)[56a182] Aqua: [tk_getOpenFile] causes off-screen toplevels (culler,walzer) + +2019-02-23 (bug)[9771ae] Aqua: workaround incompatible transient window models (culler,walzer) + +2019-03-01 (bug)[1951ab] Prevent transient window cycles (crashed on Aqua) (culler,vogel) + *** POTENTIAL INCOMPATIBILITY *** + +2019-03-04 (bug)[4da219] Incomplete read of multi-image GIF (oehlmann) + +2019-03-14 (bug)[609e00] Aqua: wrong coords from MouseWheel binding (vogel,culler) + +2019-03-25 (bug)[48c394] Aqua: recompute text layout for empty string (culler) + +2019-03-31 (new)[TIP 535] Precision of ::scale widget tick mark values (vogel) + *** POTENTIAL INCOMPATIBILITY *** + +2019-03-31 (bug)[da3914] [$treeview identify element] failure (ulfalizer,vogel) + +2019-04-06 (bug)[897ffe] Prevent cross-manager loops of geom management (culler,vogel) + +2019-04-11 (new) Apple Dark Mode support (culler) + +2019-04-14 (new) Aqua: Use color names consistent with NSColor (culler) + *** POTENTIAL INCOMPATIBILITY *** + +2019-04-14 (new) Aqua: [tk::unsupported::MacWindowStyle isdark] (culler) + +2019-04-19 (bug)[368fa4] Prevent toggle of hidden treeview indicators (ulfalizer,vogel) + +2019-04-24 (bug)[4d2e8d] Aqua: notebook pane redraws (culler) + +2019-04-24 (bug)[928652] Apply TIP 533 for ttk::menubutton (culler,vogel) + +2019-04-24 (bug)[1001070] X-platform rework of label options -highlight* (seal,culler,vogel) + +2019-04-28 (bug)[6286fd] checkbutton handling of -selectcolor (ralfixx) + +2019-04-30 (bug)[4f9a99] Win: crash in [style element create] (oehlman,vogel) + +2019-05-08 (bug) Ttk scrolling bugs, see tests treeview-9.1, entry-3.[3-6] (vogel) + +2019-05-08 (bug)[51b4b1] Aqua: combobox use native ttk scrollbar (bll,vogel) + *** POTENTIAL INCOMPATIBILITY *** + +2019-05-18 (new)[eb2996] Win: support for horizontal scrolling (chavez,vogel) + +2019-05-26 (new)[TIP 541] [combobox current] support "end" index (vogel) + +2019-05-26 (bug)[2a6c62] <<TreeviewSelect>> trigger on item delete (vogel) + +2019-06-05 (bug)[9ebc6f] Aqua: fix incorrect reports of mouse coords (chavez, culler) + +2019-06-14 (bug)[436ad6] Corrected Aqua regressions in [wm manage] (walzer, culler) + +2019-06-15 (bug)[75b8fb] Crash with some [event generate]d <ButtonRelease> (leunissen,vogel) + +2019-06-15 (new)[TIP 536] New tk::mac::* commands for IPC on Mac OSX (walzer) + +2019-07-13 (bug)[4566e2] Aqua: Make default background color of Tk and Ttk agree (walzer,culler) + *** POTENTIAL INCOMPATIBILITY *** + +2019-07-16 (bug)[5ddeca] Stop app switching exposing withdrawn windows as zombies (culler) + +2019-07-25 (new)[1fb7af] Win support for buttons 4 and 5 (chavez,vogel,nijtmans) + +2019-08-18 (new) Refactor all MouseWheel bindings (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2019-08-21 (bug)[c8ccd1] up array key in [text] takes to index 1.0 (ulfalizer,vogel) + +2019-08-28 (new)[TIP 532] Tk event loop rewrite to prevent ring overflow (cramer) + *** POTENTIAL INCOMPATIBILITY *** + +2019-08-28 (bug)[943d5e] Win: embedded widget destruction cancels window resize (nemethi,vogel,nijtmans) + +2019-09-12 (bug)[2834776] Stop disabled spinbox from generating <<Increment>> & <<Decrement>> (vogel) + +2019-09-24 (bug)[96bce5] Aqua: Prevent crash drawing 1x1 rounded rectangles (bll,culler) + +2019-10-03 (bug)[3ed5b6] Win: root window position with highlightthickness>0 (leunissem,vogel,nijtmans) + +2019-10-09 (bug)[a01b6f7] Workaround XWayland bug reporting screen width (werner,nijtmans) + +2019-10-10 (bug) Aqua: Prevent crash deactivating menu during menu deletion (culler) + +2019-10-21 (bug)[aea00b] Aqua: Better handling of resolution changes (chavez, culler) + +2019-10-25 (bug)[b82bd4] Fix [style configure -compound] (culler,vogel) + +2019-10-27 (bug)[f7a4f7] Aqua: embedded toplevel, forced focus and mouse coords (naaus,culler) + +2019-11-13 (new) Win: keycodes Mail, AudioMedia, Launch0, Launch1 (nijtmans) + +2019-11-15 (bug)[69b48f] failing test textTag-18.1 (vogel) + +2019-11-17 (bug)[c4abd2] panic in stackorder command (culler) + +2019-11-17 (bug)[53d280] [wm iconphoto] crash on empty image (culler) + +2019-11-17 [90d555] workaround NSFontManager bad selections (culler) + +2019-11-19 (new) Partial Emoji support in text displays (nijtmans,culler) + +- Released 8.6.10, Nov 21, 2019 - https://core.tcl-lang.org/tk/ for details + +Changes to 8.7a3 include all changes to the 8.6 line through 8.6.10, plus the following, which focuses on the high-level feature changes in this changeset (new minor version) rather than bug fixes: -2016-03-07 (feature)[841280] spinbox autoswap -to/-from to get ordering (vogel) +2017-11-25 [TIP 161] $menu -tearoff default changed to false (roseman,vogel) + *** POTENTIAL INCOMPATIBILITY *** -2016-03-27 (feature)[38dc27] Support <Button-6> & <Button-7> (nijtmans) +2017-12-07 [TIP 487] End support for pre-XP Windows (nijtmans) -2016-08-29 (TIP 449) [text] undo/redo return character range (vogel) +2018-03-04 [TIP 489] New subcommand [$canvas image] (pitcher,vogel) -2016-11-02 (feature) Removed undocumented command [tk_getFileType] (vogel) - *** POTENTIAL INCOMPATIBILITY *** +2018-05-13 [TIP 496] New options -placeholder* for entries (zaumseil,vogel) -2017-02-05 (bug)[c0dbdd] Compatibility fonts shadowed system fonts (vogel) +2018-09-23 [TIP 517] New option -activerelief for menus (vogel) -2017-03-21 (TIP 442) display text in a progressbar (zaumseil) +2018-11-03 [TIP 512] Deprecate stub for Tk_MainEx() (nijtmans) -2017-04-13 \u escaped content in msg files converted to true utf-8 (nijtmans) +2018-11-06 [TIP 415] New option -height for [$canvas create arc] (geard) -2017-08-28 (TIP 166) Extended color notation for alpha channel (bachmann) +2018-11-06 [TIP 518] New event <<NoMangedChild>> (oehlmann) ---- Released 8.7a1, September 8, 2017 --- http://core.tcl.tk/tk/ for details +2019-04-14 [TIP 164] New subcommand [$canvas rotate] (fellows) + +2019-04-14 [TIP 507] New photo image format 'svg' (zaumseil) + +2019-04-14 [TIP 483] Record more configuration items (cassoff) + +2019-04-14 [TIP 482] Record configured directory for demos (cassoff) + +2019-05-25 [TIP 262] New frame options -backgroundimage, -tile (fellows) + +2019-06-15 [TIP 528] Deprecate Tk_Offset() (nijtmans) + +2019-08-19 [TIP 545] Revised options for photo image format 'svg' (oehlmann) + +--- Released 8.7a3, November 25, 2019 --- http://core.tcl.tk/tk/ for details diff --git a/generic/tk.h b/generic/tk.h index 7e523f6..e4d78e3 100644 --- a/generic/tk.h +++ b/generic/tk.h @@ -68,10 +68,10 @@ extern "C" { #define TK_MAJOR_VERSION 8 #define TK_MINOR_VERSION 7 #define TK_RELEASE_LEVEL TCL_ALPHA_RELEASE -#define TK_RELEASE_SERIAL 2 +#define TK_RELEASE_SERIAL 3 #define TK_VERSION "8.7" -#define TK_PATCH_LEVEL "8.7a2" +#define TK_PATCH_LEVEL "8.7a3" /* * A special definition used to allow this header file to be included from diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 133761e..9ae3a03 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -197,15 +197,15 @@ static const Tk_OptionSpec sbOptSpec[] = { NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", DEF_ENTRY_BORDER_WIDTH, -1, offsetof(Entry, borderWidth), 0, 0, 0}, - {TK_OPTION_BORDER, "-buttonbackground", "Button.background", "Background", + {TK_OPTION_BORDER, "-buttonbackground", "buttonBackground", "Background", DEF_BUTTON_BG_COLOR, -1, offsetof(Spinbox, buttonBorder), 0, DEF_BUTTON_BG_MONO, 0}, - {TK_OPTION_CURSOR, "-buttoncursor", "Button.cursor", "Cursor", + {TK_OPTION_CURSOR, "-buttoncursor", "buttonCursor", "Cursor", DEF_BUTTON_CURSOR, -1, offsetof(Spinbox, bCursor), TK_OPTION_NULL_OK, 0, 0}, - {TK_OPTION_RELIEF, "-buttondownrelief", "Button.relief", "Relief", + {TK_OPTION_RELIEF, "-buttondownrelief", "buttonDownRelief", "Relief", DEF_BUTTON_RELIEF, -1, offsetof(Spinbox, bdRelief), 0, 0, 0}, - {TK_OPTION_RELIEF, "-buttonuprelief", "Button.relief", "Relief", + {TK_OPTION_RELIEF, "-buttonuprelief", "buttonUpRelief", "Relief", DEF_BUTTON_RELIEF, -1, offsetof(Spinbox, buRelief), 0, 0, 0}, {TK_OPTION_STRING, "-command", "command", "Command", DEF_SPINBOX_CMD, -1, offsetof(Spinbox, command), @@ -1957,7 +1957,7 @@ EntryComputeGeometry( if (entryPtr->showChar != NULL) { int ch; - char buf[6]; + char buf[4]; int size; /* diff --git a/generic/tkInt.h b/generic/tkInt.h index 282ac8f..7ef7862 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -69,6 +69,8 @@ #if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 7) # define Tcl_WCharToUtfDString Tcl_UniCharToUtfDString # define Tcl_UtfToWCharDString Tcl_UtfToUniCharDString +# define Tcl_Char16ToUtfDString Tcl_UniCharToUtfDString +# define Tcl_UtfToChar16DString Tcl_UtfToUniCharDString #endif /* diff --git a/generic/tkMain.c b/generic/tkMain.c index 17031dc..ccb624b 100644 --- a/generic/tkMain.c +++ b/generic/tkMain.c @@ -14,21 +14,6 @@ * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ -/** - * On Windows, this file needs to be compiled twice, once with - * TK_ASCII_MAIN defined. This way both Tk_MainEx and Tk_MainExW - * can be implemented, sharing the same source code. - */ -#if defined(TK_ASCII_MAIN) -# ifdef UNICODE -# undef UNICODE -# undef _UNICODE -# else -# define UNICODE -# define _UNICODE -# endif -#endif - #include "tkInt.h" extern int TkCygwinMainEx(int, char **, Tcl_AppInitProc *, Tcl_Interp *); diff --git a/generic/tkUtil.c b/generic/tkUtil.c index e014a41..89f68be 100644 --- a/generic/tkUtil.c +++ b/generic/tkUtil.c @@ -1215,26 +1215,28 @@ TkSendVirtualEvent( size_t TkUtfToUniChar( const char *src, /* The UTF-8 string. */ - int *chPtr) /* Filled with the Tcl_UniChar represented by + int *chPtr) /* Filled with the Unicode value represented by * the UTF-8 string. */ { Tcl_UniChar uniChar = 0; size_t len = Tcl_UtfToUniChar(src, &uniChar); - if ((uniChar & 0xfc00) == 0xd800) { - Tcl_UniChar high = uniChar; + if ((sizeof(Tcl_UniChar) == 2) + && ((uniChar & 0xFC00) == 0xD800) +#if TCL_MAJOR_VERSION > 8 + && (len == 1) +#endif + ) { + Tcl_UniChar low = 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 */ - size_t len2 = Tcl_UtfToUniChar(src+len, &uniChar); - if ((uniChar & 0xfc00) == 0xdc00) { - *chPtr = (((high & 0x3ff) << 10) | (uniChar & 0x3ff)) + 0x10000; - len += len2; - } else { - *chPtr = high; + size_t len2 = Tcl_UtfToUniChar(src+len, &low); + if ((low & 0xFC00) == 0xDC00) { + *chPtr = (((uniChar & 0x3FF) << 10) | (low & 0x3FF)) + 0x10000; + return len + len2; } - } else { - *chPtr = uniChar; } + *chPtr = uniChar; return len; } @@ -1258,17 +1260,16 @@ TkUtfToUniChar( size_t TkUniCharToUtf(int ch, char *buf) { - size_t size = Tcl_UniCharToUtf(ch, buf); - if ((((unsigned)(ch - 0x10000) <= 0xFFFFF)) && (size < 4)) { - /* Hey, this is wrong, we must be running TCL_UTF_MAX==3 - * The best thing we can do is spit out a 4-byte UTF-8 character */ - buf[3] = (char) ((ch | 0x80) & 0xBF); - buf[2] = (char) (((ch >> 6) | 0x80) & 0xBF); - buf[1] = (char) (((ch >> 12) | 0x80) & 0xBF); - buf[0] = (char) ((ch >> 18) | 0xF0); - size = 4; + if (((unsigned)(ch - 0x10000) <= 0xFFFFF)) { + /* Spit out a 4-byte UTF-8 character */ + *buf++ = (char) ((ch >> 18) | 0xF0); + *buf++ = (char) (((ch >> 12) | 0x80) & 0xBF); + *buf++ = (char) (((ch >> 6) | 0x80) & 0xBF); + *buf = (char) ((ch | 0x80) & 0xBF); + return 4; + } else { + return Tcl_UniCharToUtf(ch, buf); } - return size; } diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index 38970d8..37b4dbc 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -294,7 +294,7 @@ static char *EntryDisplayString(const char *showChar, int numChars) char *displayString, *p; int size; int ch; - char buf[6]; + char buf[4]; TkUtfToUniChar(showChar, &ch); size = TkUniCharToUtf(ch, buf); diff --git a/library/demos/unicodeout.tcl b/library/demos/unicodeout.tcl index 25ee932..ca325a4 100644 --- a/library/demos/unicodeout.tcl +++ b/library/demos/unicodeout.tcl @@ -109,10 +109,10 @@ if {[usePresentationFormsFor Arabic]} { } addSample $w "Trad. Chinese" "\u4E2D\u570B\u7684\u6F22\u5B57" addSample $w "Simpl. Chinese" "\u6C49\u8BED" -addSample $w French "Langue fran\u00E7aise" +addSample $w French "Langue fran\xE7aise" addSample $w Greek \ - "\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AE " \ - "\u03B3\u03BB\u03CE\u03C3\u03C3\u03B1" + "\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AE " \ + "\u03B3\u03BB\u03CE\u03C3\u03C3\u03B1" if {[usePresentationFormsFor Hebrew]} { # Visual order (pre-layouted) addSample $w Hebrew \ @@ -123,20 +123,22 @@ if {[usePresentationFormsFor Hebrew]} { "\u05DB\u05EA\u05D1 \u05E2\u05D1\u05E8\u05D9\u05EA" } addSample $w Hindi \ - "\u0939\u093f\u0928\u094d\u0926\u0940 \u092d\u093e\u0937\u093e" -addSample $w Icelandic "\u00CDslenska" + "\u0939\u093F\u0928\u094D\u0926\u0940 \u092D\u093E\u0937\u093E" +addSample $w Icelandic "\xCDslenska" addSample $w Japanese \ - "\u65E5\u672C\u8A9E\u306E\u3072\u3089\u304C\u306A, " \ - "\u6F22\u5B57\u3068\u30AB\u30BF\u30AB\u30CA" + "\u65E5\u672C\u8A9E\u306E\u3072\u3089\u304C\u306A, " \ + "\u6F22\u5B57\u3068\u30AB\u30BF\u30AB\u30CA" addSample $w Korean "\uB300\uD55C\uBBFC\uAD6D\uC758 \uD55C\uAE00" addSample $w Russian \ "\u0420\u0443\u0441\u0441\u043A\u0438\u0439 \u044F\u0437\u044B\u043A" -if {[package vsatisfies [package provide Tcl] 8.7-]} { - addSample $w Emoji \ - "\U1F600\U1F4A9\U1F44D\U1F1F3\U1F1F1" -} elseif {([tk windowingsystem] ne "x11") || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))} { - addSample $w Emoji \ - "\uD83D\uDE00\uD83D\uDCA9\uD83D\uDC4D\uD83C\uDDF3\uD83C\uDDF1" +if {([tk windowingsystem] ne "x11") || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))} { + if {[package vsatisfies [package provide Tcl] 8.7-]} { + addSample $w Emoji \ + "\U1F600\U1F4A9\U1F44D\U1F1F3\U1F1F1" + } else { + addSample $w Emoji \ + "\uD83D\uDE00\uD83D\uDCA9\uD83D\uDC4D\uD83C\uDDF3\uD83C\uDDF1" + } } ## We're done processing, so change things back to normal running... diff --git a/library/tk.tcl b/library/tk.tcl index 75574ca..96e671b 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -11,7 +11,7 @@ # this file, and for a DISCLAIMER OF ALL WARRANTIES. # Verify that we have Tk binary and script components from the same release -package require -exact Tk 8.7a2 +package require -exact Tk 8.7a3 # Create a ::tk namespace namespace eval ::tk { diff --git a/library/ttk/combobox.tcl b/library/ttk/combobox.tcl index 1355a04..2770142 100644 --- a/library/ttk/combobox.tcl +++ b/library/ttk/combobox.tcl @@ -149,12 +149,14 @@ proc ttk::combobox::Drag {w x} { # Set cursor. # proc ttk::combobox::Motion {w x y} { + variable State + ttk::saveCursor $w State(userConfCursor) [ttk::cursor text] if { [$w identify $x $y] eq "textarea" && [$w instate {!readonly !disabled}] } { ttk::setCursor $w text } else { - ttk::setCursor $w "" + ttk::setCursor $w $State(userConfCursor) } } diff --git a/library/ttk/cursors.tcl b/library/ttk/cursors.tcl index 852f01c..9125acb 100644 --- a/library/ttk/cursors.tcl +++ b/library/ttk/cursors.tcl @@ -137,8 +137,30 @@ proc ttk::cursor {name} { proc ttk::setCursor {w name} { variable Cursors - if {[$w cget -cursor] ne $Cursors($name)} { - $w configure -cursor $Cursors($name) + if {[info exists Cursors($name)]} { + set cursorname $Cursors($name) + } else { + set cursorname $name + } + if {[$w cget -cursor] ne $cursorname} { + $w configure -cursor $cursorname + } +} + +## ttk::saveCursor $w $saveVar $excludeList -- +# Set variable $saveVar to the -cursor value from widget $w, +# if either: +# a. $saveVar does not yet exist +# b. the currently user-specified cursor for $w is not in +# $excludeList + +proc ttk::saveCursor {w saveVar excludeList} { + upvar $saveVar sv + if {![info exists sv]} { + set sv [$w cget -cursor] + } + if {[$w cget -cursor] ni $excludeList} { + set sv [$w cget -cursor] } } diff --git a/library/ttk/panedwindow.tcl b/library/ttk/panedwindow.tcl index a2e073b..ba47003 100644 --- a/library/ttk/panedwindow.tcl +++ b/library/ttk/panedwindow.tcl @@ -62,13 +62,22 @@ proc ttk::panedwindow::Release {w x y} { # proc ttk::panedwindow::ResetCursor {w} { variable State + + ttk::saveCursor $w State(userConfCursor) \ + [list [ttk::cursor hresize] [ttk::cursor vresize]] + if {!$State(pressed)} { - ttk::setCursor $w {} + ttk::setCursor $w $State(userConfCursor) } } proc ttk::panedwindow::SetCursor {w x y} { - set cursor "" + variable State + + ttk::saveCursor $w State(userConfCursor) \ + [list [ttk::cursor hresize] [ttk::cursor vresize]] + + set cursor $State(userConfCursor) if {[llength [$w identify $x $y]]} { # Assume we're over a sash. switch -- [$w cget -orient] { diff --git a/library/ttk/spinbox.tcl b/library/ttk/spinbox.tcl index 90a1572..9728755 100644 --- a/library/ttk/spinbox.tcl +++ b/library/ttk/spinbox.tcl @@ -29,12 +29,14 @@ ttk::bindMouseWheel TSpinbox [list ttk::spinbox::MouseWheel %W] # Sets cursor. # proc ttk::spinbox::Motion {w x y} { + variable State + ttk::saveCursor $w State(userConfCursor) [ttk::cursor text] if { [$w identify $x $y] eq "textarea" && [$w instate {!readonly !disabled}] } { ttk::setCursor $w text } else { - ttk::setCursor $w "" + ttk::setCursor $w $State(userConfCursor) } } diff --git a/library/ttk/treeview.tcl b/library/ttk/treeview.tcl index ebf1451..99210af 100644 --- a/library/ttk/treeview.tcl +++ b/library/ttk/treeview.tcl @@ -102,7 +102,11 @@ proc ttk::treeview::Keynav {w dir} { # Sets cursor, active element ... # proc ttk::treeview::Motion {w x y} { - set cursor {} + variable State + + ttk::saveCursor $w State(userConfCursor) [ttk::cursor hresize] + + set cursor $State(userConfCursor) set activeHeading {} switch -- [$w identify region $x $y] { @@ -127,7 +131,7 @@ proc ttk::treeview::ActivateHeading {w heading} { # triggers a <Leave> event. A proc checking if the display column # $State(activeHeading) is really still present or not could be # written but it would need to check several special cases: - # a. -displaycolumns "#all" or being an explicit columns list + # a. -displaycolumns "#all" or being an explicit columns list # b. column #0 display is not governed by the -displaycolumn # list but by the value of the -show option # --> Let's rather catch the following line. diff --git a/library/ttk/xpTheme.tcl b/library/ttk/xpTheme.tcl index 4c4f680..da7b422 100644 --- a/library/ttk/xpTheme.tcl +++ b/library/ttk/xpTheme.tcl @@ -28,13 +28,6 @@ namespace eval ttk::theme::xpnative { ttk::style map TNotebook.Tab \ -expand [list selected {2 2 2 2}] - # Treeview: - ttk::style configure Heading -font TkHeadingFont - ttk::style configure Treeview -background SystemWindow - ttk::style map Treeview \ - -background [list selected SystemHighlight] \ - -foreground [list selected SystemHighlightText] ; - ttk::style configure TLabelframe.Label -foreground "#0046d5" # OR: -padding {3 3 3 6}, which some apps seem to use. diff --git a/macosx/tkMacOSXClipboard.c b/macosx/tkMacOSXClipboard.c index 6717afa..88a0d93 100644 --- a/macosx/tkMacOSXClipboard.c +++ b/macosx/tkMacOSXClipboard.c @@ -35,10 +35,7 @@ static Tk_Window clipboardOwner = NULL; targetPtr->type == dispPtr->utf8Atom) { for (TkClipboardBuffer *cbPtr = targetPtr->firstBufferPtr; cbPtr; cbPtr = cbPtr->nextPtr) { - NSString *s = [[NSString alloc] initWithBytesNoCopy: - cbPtr->buffer length:cbPtr->length - encoding:NSUTF8StringEncoding freeWhenDone:NO]; - + NSString *s = TkUtfToNSString(cbPtr->buffer, cbPtr->length); [string appendString:s]; [s release]; } @@ -130,7 +127,6 @@ TkSelGetSelection( && selection == dispPtr->clipboardAtom && (target == XA_STRING || target == dispPtr->utf8Atom)) { NSString *string = nil; - NSString *clean; NSPasteboard *pb = [NSPasteboard generalPasteboard]; NSString *type = [pb availableTypeFromArray:[NSArray arrayWithObject: NSStringPboardType]]; @@ -139,25 +135,20 @@ TkSelGetSelection( string = [pb stringForType:type]; } if (string) { + /* - * Replace all non-BMP characters by the replacement character 0xfffd. - * This is a workaround until Tcl supports TCL_UTF_MAX > 3. + * Encode the string using the encoding which is used in Tcl + * when TCL_UTF_MAX = 3. This replaces each UTF-16 surrogate with + * a 3-byte sequence generated using the UTF-8 algorithm. (Even + * though UTF-8 does not allow encoding surrogates, the algorithm + * does produce a 3-byte sequence.) */ - int i, j, len = [string length]; - CFRange all = CFRangeMake(0, len); - UniChar *buffer = ckalloc(len*sizeof(UniChar)); - CFStringGetCharacters((CFStringRef) string, all, buffer); - for (i = 0, j = 0 ; j < len ; i++, j++) { - if (CFStringIsSurrogateHighCharacter(buffer[j])) { - buffer[i] = 0xfffd; - j++; - } else { - buffer[i] = buffer[j]; - } + + char *bytes = TkNSStringToUtf(string, NULL); + result = proc(clientData, interp, bytes); + if (bytes) { + ckfree(bytes); } - clean = (NSString *)CFStringCreateWithCharacters(NULL, buffer, i); - ckfree(buffer); - result = proc(clientData, interp, [clean UTF8String]); } } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index 80b368f..9b72732 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -211,10 +211,12 @@ static const struct SystemColorMapEntry systemColorMap[] = { { "TextBackgroundColor", semantic, 6 }, /* 180 */ { "SelectedTextBackgroundColor", semantic, 7 }, /* 181 */ { "ControlAccentColor", semantic, 8 }, /* 182 */ + /* Apple's SecondaryLabelColor is the same as their LabelColor so we roll our own. */ + { "SecondaryLabelColor", ttkBackground, 14 }, /* 183 */ { NULL, 0, 0 } }; #define FIRST_SEMANTIC_COLOR 166 -#define MAX_PIXELCODE 182 +#define MAX_PIXELCODE 183 /* *---------------------------------------------------------------------- @@ -264,8 +266,7 @@ GetEntryFromPixelCode( *---------------------------------------------------------------------- */ -static NSColorSpace* deviceRGB = NULL; -static CGFloat blueAccentRGBA[4] = {0, 122.0 / 255, 1.0, 1.0}; +static NSColorSpace* sRGB = NULL; static CGFloat windowBackground[4] = {236.0 / 255, 236.0 / 255, 236.0 / 255, 1.0}; @@ -284,8 +285,8 @@ SetCGColorComponents( {152.0 / 255, 152.0 / 255, 152.0 / 255, 1.0}; #endif - if (!deviceRGB) { - deviceRGB = [NSColorSpace deviceRGBColorSpace]; + if (!sRGB) { + sRGB = [NSColorSpace sRGBColorSpace]; } /* @@ -316,8 +317,7 @@ SetCGColorComponents( rgba[i] = windowBackground[i]; } } else { - bgColor = [[NSColor windowBackgroundColor] colorUsingColorSpace: - deviceRGB]; + bgColor = [[NSColor windowBackgroundColor] colorUsingColorSpace:sRGB]; [bgColor getComponents: rgba]; } if (rgba[0] + rgba[1] + rgba[2] < 1.5) { @@ -333,78 +333,61 @@ SetCGColorComponents( case semantic: switch (entry.value) { case 0: - color = [[NSColor textColor] colorUsingColorSpace: deviceRGB]; + color = [[NSColor textColor] colorUsingColorSpace:sRGB]; break; case 1: - color = [[NSColor selectedTextColor] colorUsingColorSpace: deviceRGB]; + color = [[NSColor selectedTextColor] colorUsingColorSpace:sRGB]; break; case 2: if ([NSApp macMinorVersion] > 9) { #if MAC_OS_X_VERSION_MAX_ALLOWED > 1090 - color = [[NSColor labelColor] colorUsingColorSpace: deviceRGB]; + color = [[NSColor labelColor] colorUsingColorSpace:sRGB]; #endif } else { - color = [[NSColor textColor] colorUsingColorSpace: deviceRGB]; + color = [[NSColor textColor] colorUsingColorSpace:sRGB]; } break; case 3: - color = [[NSColor controlTextColor] colorUsingColorSpace: - deviceRGB]; + color = [[NSColor controlTextColor] colorUsingColorSpace:sRGB]; break; case 4: - color = [[NSColor disabledControlTextColor] colorUsingColorSpace: - deviceRGB]; + color = [[NSColor disabledControlTextColor] + colorUsingColorSpace:sRGB]; break; case 5: if ([NSApp macMinorVersion] > 6) { - color = [[NSColor whiteColor] colorUsingColorSpace: - deviceRGB]; + color = [[NSColor whiteColor] colorUsingColorSpace:sRGB]; } else { - color = [[NSColor blackColor] colorUsingColorSpace: - deviceRGB]; + color = [[NSColor blackColor] colorUsingColorSpace:sRGB]; } break; case 6: - color = [[NSColor textBackgroundColor] colorUsingColorSpace: - deviceRGB]; + color = [[NSColor textBackgroundColor] colorUsingColorSpace:sRGB]; break; case 7: - color = [[NSColor selectedTextBackgroundColor] colorUsingColorSpace: - deviceRGB]; + color = [[NSColor selectedTextBackgroundColor] + colorUsingColorSpace:sRGB]; break; case 8: + if ([NSApp macMinorVersion] >= 14) { #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 - if (@available(macOS 10.14, *)) { - color = [[NSColor controlAccentColor] colorUsingColorSpace: - deviceRGB]; - } else { - color = [NSColor colorWithColorSpace: deviceRGB - components: blueAccentRGBA - count: 4]; - } -#else - colorVariant = [[NSUserDefaults standardUserDefaults] - integerForKey:@"AppleAquaColorVariant"]; - if (colorVariant == 6) { - color = [NSColor colorWithColorSpace: deviceRGB - components: graphiteAccentRGBA - count: 4]; + color = [[NSColor controlAccentColor] + colorUsingColorSpace:sRGB]; +#endif } else { - color = [NSColor colorWithColorSpace: deviceRGB - components: blueAccentRGBA - count: 4]; + color = [[NSColor + colorForControlTint:[NSColor currentControlTint]] + colorUsingColorSpace: sRGB]; } -#endif break; default: -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000 if ([NSApp macMinorVersion] >= 10) { - color = [[NSColor labelColor] colorUsingColorSpace: - deviceRGB]; - break; - } +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000 + color = [[NSColor labelColor] colorUsingColorSpace:sRGB]; #endif - color = [[NSColor textColor] colorUsingColorSpace: deviceRGB]; + } else { + color = [[NSColor textColor] colorUsingColorSpace:sRGB]; + } break; } [color getComponents: rgba]; @@ -424,7 +407,7 @@ SetCGColorComponents( default: break; } - *c = CGColorCreate(deviceRGB.CGColorSpace, rgba); + *c = CGColorCreate(sRGB.CGColorSpace, rgba); [pool drain]; return err; } @@ -451,14 +434,23 @@ TkMacOSXInDarkMode(Tk_Window tkwin) int result = false; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 + static NSAppearanceName darkAqua = @"NSAppearanceNameDarkAqua"; + if ([NSApp macMinorVersion] >= 14) { - static NSAppearanceName darkAqua = @"NSAppearanceNameDarkAqua"; TkWindow *winPtr = (TkWindow*) tkwin; - NSView *view = TkMacOSXDrawableView(winPtr->privatePtr); - result = (view && - [view.effectiveAppearance.name isEqualToString:darkAqua]); + NSView *view = nil; + if (winPtr && winPtr->privatePtr) { + view = TkMacOSXDrawableView(winPtr->privatePtr); + } + if (view) { + result = [view.effectiveAppearance.name isEqualToString:darkAqua]; + } else { + result = [[NSAppearance currentAppearance].name + isEqualToString:darkAqua]; + } } #endif + return result; } @@ -678,11 +670,7 @@ TkMacOSXSetColorInContext( CGRect rect; int code = (pixel >> 24) & 0xff; HIThemeBackgroundDrawInfo info = {0, kThemeStateActive, 0};; - static CGColorSpaceRef deviceRGBSpace = NULL; - if (!deviceRGBSpace) { - deviceRGBSpace = CGColorSpaceCreateDeviceRGB(); - } if (code < FIRST_SEMANTIC_COLOR) { cgColor = CopyCachedColor(gc, pixel); } diff --git a/macosx/tkMacOSXCursor.c b/macosx/tkMacOSXCursor.c index 03d13dd..894a44d 100644 --- a/macosx/tkMacOSXCursor.c +++ b/macosx/tkMacOSXCursor.c @@ -312,6 +312,7 @@ FindCursorByName( if (bitmapImageRep) { image = [[NSImage alloc] initWithSize:NSMakeSize(pix, pix)]; [image addRepresentation:bitmapImageRep]; + [image setTemplate:YES]; [bitmapImageRep release]; } diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c index 41da390..6cc5da2 100644 --- a/macosx/tkMacOSXFont.c +++ b/macosx/tkMacOSXFont.c @@ -101,6 +101,141 @@ static void DrawCharsInContext(Display *display, Drawable drawable, #pragma mark - #pragma mark Font Helpers: +/* + *--------------------------------------------------------------------------- + * + * TkUtfToNSString -- + * + * When Tcl is compiled with TCL_UTF_MAX = 3 (the default for 8.6) it cannot + * deal directly with UTF-8 encoded non-BMP characters, since their UTF-8 + * encoding requires 4 bytes. + * + * As a workaround, these versions of Tcl encode non-BMP characters as a string + * of length 6 in which the high and low UTF-16 surrogates have been encoded + * using the UTF-8 algorithm. The UTF-8 encoding does not allow encoding + * surrogates, so these 6-byte strings are not valid UTF-8, and hence Apple's + * NString class will refuse to instantiate an NSString from the 6-byte + * encoding. This function allows creating an NSString from a C-string which + * has been encoded using this scheme. + * + * Results: + * An NSString, which may be nil. + * + * Side effects: + * None. + *--------------------------------------------------------------------------- + */ + +MODULE_SCOPE NSString* +TkUtfToNSString( + const char *source, + size_t numBytes) +{ + NSString *string; + Tcl_DString ds; + + Tcl_DStringInit(&ds); + Tcl_UtfToChar16DString(source, numBytes, &ds); + string = [[NSString alloc] initWithCharacters:(const unichar *)Tcl_DStringValue(&ds) + length:(Tcl_DStringLength(&ds)>>1)]; + Tcl_DStringFree(&ds); + return string; +} + +/* + *--------------------------------------------------------------------------- + * + * TkUtfAtIndex -- + * + * Write a sequence of bytes up to length 6 which is an encoding of a UTF-16 + * character in an NSString. Also record the unicode code point of the character. + * this may be a non-BMP character constructed by reading two surrogates from + * the NSString. + * + * Results: + * Returns the number of bytes written. + * + * Side effects: + * Bytes are written to the char array referenced by the pointer uni and + * the unicode code point is written to the integer referenced by the + * pointer code. + * + */ + +MODULE_SCOPE int +TkUtfAtIndex( + NSString *string, + int index, + char *uni, + unsigned int *code) +{ + char *ptr = uni; + UniChar uniChar = [string characterAtIndex: index]; + if (CFStringIsSurrogateHighCharacter(uniChar)) { + UniChar lowChar = [string characterAtIndex: ++index]; + *code = CFStringGetLongCharacterForSurrogatePair( + uniChar, lowChar); + ptr += Tcl_UniCharToUtf(uniChar, ptr); + ptr += Tcl_UniCharToUtf(lowChar, ptr); + return ptr - uni; + } else { + *code = (int) uniChar; + [[string substringWithRange: NSMakeRange(index, 1)] + getCString: uni + maxLength: XMaxTransChars + encoding: NSUTF8StringEncoding]; + return strlen(uni); + } +} + +/* + *--------------------------------------------------------------------------- + * + * TkNSStringToUtf -- + * + * Encodes the unicode string represented by an NSString object with the + * internal encoding that Tcl uses when TCL_UTF_MAX = 3. This encoding + * is similar to UTF-8 except that non-BMP characters are encoded as two + * successive 3-byte sequences which are constructed from UTF-16 surrogates + * by applying the UTF-8 algorithm. Even though the UTF-8 encoding does not + * allow encoding surrogates, the algorithm does produce a well-defined + * 3-byte sequence. + * + * Results: + * Returns a pointer to a null-terminated byte array which encodes the + * NSString. + * + * Side effects: + * Memory is allocated to hold the byte array, which must be freed with + * ckalloc. If the pointer numBytes is not NULL the number of non-null + * bytes written to the array is stored in the integer it references. + */ + +MODULE_SCOPE char* +TkNSStringToUtf( + NSString *string, + int *numBytes) +{ + unsigned int code; + size_t i; + char *ptr, *bytes = ckalloc(6*[string length] + 1); + + ptr = bytes; + if (ptr) { + for (i = 0; i < [string length]; i++) { + ptr += TkUtfAtIndex(string, i, ptr, &code); + if (code > 0xffff){ + i++; + } + } + *ptr = '\0'; + } + if (numBytes) { + *numBytes = ptr - bytes; + } + return bytes; +} + #define GetNSFontTraitsFromTkFontAttributes(faPtr) \ ((faPtr)->weight == TK_FW_BOLD ? NSBoldFontMask : NSUnboldFontMask) | \ ((faPtr)->slant == TK_FS_ITALIC ? NSItalicFontMask : NSUnitalicFontMask) @@ -844,8 +979,7 @@ TkpMeasureCharsInContext( if (maxLength > 32767) { maxLength = 32767; } - string = [[NSString alloc] initWithBytesNoCopy:(void*)source - length:numBytes encoding:NSUTF8StringEncoding freeWhenDone:NO]; + string = TkUtfToNSString((const char *)source, numBytes); if (!string) { length = 0; fit = rangeLength; @@ -1124,8 +1258,7 @@ DrawCharsInContext( !TkMacOSXSetupDrawingContext(drawable, gc, 1, &drawingContext)) { return; } - string = [[NSString alloc] initWithBytesNoCopy:(void*)source - length:numBytes encoding:NSUTF8StringEncoding freeWhenDone:NO]; + string = TkUtfToNSString((const char *)source, numBytes); if (!string) { return; } diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c index e3aed98..d3704d2 100644 --- a/macosx/tkMacOSXKeyEvent.c +++ b/macosx/tkMacOSXKeyEvent.c @@ -331,42 +331,30 @@ static unsigned isFunctionKey(unsigned int code); } /* - * NSString represents a non-BMP character as a string of length 2 where - * the first character is the high surrogate and the second character is - * the low surrogate. We could record this in the XEvent by setting the - * keycode to the unicode code point and setting the trans_chars to the - * 4-byte UTF-8 string. However, that will not help as long as TCL_UTF_MAX - * is set to 3. Until that changes, we just replace non-BMP characters by - * the "replacement character" U+FFFD. + * Next we generate an XEvent for each unicode character in our string. + * + * NSString uses UTF-16 internally, which means that a non-BMP character is + * represented by a sequence of two 16-bit "surrogates". In principle we + * could record this in the XEvent by setting the keycode to the 32-bit + * unicode code point and setting the trans_chars string to the 4-byte + * UTF-8 string for the non-BMP character. However, that will not work + * when TCL_UTF_MAX is set to 3, as is the case for Tcl 8.6. A workaround + * used internally by Tcl 8.6 is to encode each surrogate as a 3-byte + * sequence using the UTF-8 algorithm (ignoring the fact that the UTF-8 + * encoding specification does not allow encoding UTF-16 surrogates). + * This gives a 6-byte encoding of the non-BMP character which we write into + * the trans_chars field of the XEvent. */ for (i = 0; i < len; i++) { - UniChar nextChar = [str characterAtIndex: i]; - if (CFStringIsSurrogateHighCharacter(nextChar)) { -#if 0 - UniChar lowChar = [str characterAtIndex: ++i]; - xEvent.xkey.keycode = CFStringGetLongCharacterForSurrogatePair( - nextChar, lowChar); - xEvent.xkey.nbytes = TkUniCharToUtf(xEvent.xkey.keycode, - &xEvent.xkey.trans_chars); -#else + xEvent.xkey.nbytes = TkUtfAtIndex(str, i, xEvent.xkey.trans_chars, + &xEvent.xkey.keycode); + if (xEvent.xkey.keycode > 0xffff){ i++; - xEvent.xkey.keycode = 0xfffd; - strcpy(xEvent.xkey.trans_chars, "\xef\xbf\xbd"); - xEvent.xkey.nbytes = strlen(xEvent.xkey.trans_chars); -#endif - } else { - xEvent.xkey.keycode = (int) nextChar; - [[str substringWithRange: NSMakeRange(i,1)] - getCString: xEvent.xkey.trans_chars - maxLength: XMaxTransChars encoding: NSUTF8StringEncoding]; - xEvent.xkey.nbytes = strlen(xEvent.xkey.trans_chars); } - xEvent.xany.type = KeyPress; - releaseCode = (UInt16) nextChar; - Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL); + xEvent.xany.type = KeyPress; + Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL); } - releaseCode = (UInt16) [str characterAtIndex: 0]; } diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h index 7aa6840..7f291f1 100644 --- a/macosx/tkMacOSXPrivate.h +++ b/macosx/tkMacOSXPrivate.h @@ -144,10 +144,6 @@ MODULE_SCOPE long tkMacOSXMacOSXVersion; * Prototypes for TkMacOSXRegion.c. */ -#if 0 -MODULE_SCOPE void TkMacOSXEmtpyRegion(Region r); -MODULE_SCOPE int TkMacOSXIsEmptyRegion(Region r); -#endif MODULE_SCOPE HIShapeRef TkMacOSXGetNativeRegion(Region r); MODULE_SCOPE void TkMacOSXSetWithNativeRegion(Region r, HIShapeRef rgn); @@ -239,6 +235,10 @@ MODULE_SCOPE int TkMacOSXServices_Init(Tcl_Interp *interp); MODULE_SCOPE int TkMacOSXRegisterServiceWidgetObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +MODULE_SCOPE NSString* TkUtfToNSString(const char *source, size_t numBytes); +MODULE_SCOPE int TkUtfAtIndex(NSString *string, int index, char *uni, + unsigned int *code); +MODULE_SCOPE char* TkNSStringToUtf(NSString *string, int *numBytes); #pragma mark Private Objective-C Classes diff --git a/macosx/tkMacOSXRegion.c b/macosx/tkMacOSXRegion.c index 0afc752..0a5ff6d 100644 --- a/macosx/tkMacOSXRegion.c +++ b/macosx/tkMacOSXRegion.c @@ -175,7 +175,7 @@ XUnionRectWithRegion( *---------------------------------------------------------------------- */ -int +static int TkMacOSXIsEmptyRegion( Region r) { diff --git a/tests/font.test b/tests/font.test index 09c2dc6..c918673 100644 --- a/tests/font.test +++ b/tests/font.test @@ -11,6 +11,9 @@ namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands +# Some tests require support for 4-byte UTF-8 sequences +testConstraint fullutf [expr {[format %c 0x010000] != "\uFFFD"}] +testConstraint utfcompat [expr {([string length "\U10000"] == 2) && [package vsatisfies [package provide Tcl] 8]}] set defaultfontlist [font names] @@ -151,12 +154,15 @@ test font-4.12 {font command: actual} -body { 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 +test font-4.14 {font command: actual} -constraints {utfcompat 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-4.16 {font command: actual} -constraints {fullutf win} -body { + font actual {-family times} -family -- \U10000 +} -result {times} test font-5.1 {font command: configure} -body { diff --git a/tests/ttk/ttk.test b/tests/ttk/ttk.test index 9f78966..9fb4c30 100644 --- a/tests/ttk/ttk.test +++ b/tests/ttk/ttk.test @@ -507,6 +507,19 @@ test ttk-12.2 "-cursor option" -body { .b cget -cursor } -result arrow +test ttk-12.2.1 "-cursor option, widget doesn't overwrite it" -setup { + ttk::treeview .tr + pack .tr + update +} -body { + .tr configure -cursor X_cursor + event generate .tr <Motion> + update + .tr cget -cursor +} -cleanup { + destroy .tr +} -result {X_cursor} + test ttk-12.3 "-borderwidth frame option" -body { destroy .t toplevel .t diff --git a/unix/configure b/unix/configure index 70a5bef..03f0e68 100755 --- a/unix/configure +++ b/unix/configure @@ -2285,7 +2285,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu TK_VERSION=8.7 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=7 -TK_PATCH_LEVEL="a2" +TK_PATCH_LEVEL="a3" VERSION=${TK_VERSION} LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv" @@ -5041,7 +5041,6 @@ fi SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" - LDFLAGS="" if test $doRpath = yes; then : CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' @@ -5245,6 +5244,7 @@ fi $as_echo "#define MODULE_SCOPE __private_extern__" >>confdefs.h + tcl_cv_cc_visibility_hidden=yes fi CC_SEARCH_FLAGS="" @@ -5439,13 +5439,13 @@ fi # below. if test "$GCC" = yes; then : - SHLIB_CFLAGS="-fPIC -melf" - LDFLAGS="$LDFLAGS -melf -Wl,-Bexport" + SHLIB_CFLAGS="-fPIC -melf" + LDFLAGS="$LDFLAGS -melf -Wl,-Bexport" else - SHLIB_CFLAGS="-Kpic -belf" - LDFLAGS="$LDFLAGS -belf -Wl,-Bexport" + SHLIB_CFLAGS="-Kpic -belf" + LDFLAGS="$LDFLAGS -belf -Wl,-Bexport" fi SHLIB_LD="ld -G" diff --git a/unix/configure.ac b/unix/configure.ac index 0853809..3f22bd9 100644 --- a/unix/configure.ac +++ b/unix/configure.ac @@ -25,7 +25,7 @@ m4_ifdef([SC_USE_CONFIG_HEADERS], [ TK_VERSION=8.7 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=7 -TK_PATCH_LEVEL="a2" +TK_PATCH_LEVEL="a3" VERSION=${TK_VERSION} LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv" diff --git a/unix/tcl.m4 b/unix/tcl.m4 index d617259..9c88a42 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1385,7 +1385,6 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" - LDFLAGS="" AS_IF([test $doRpath = yes], [ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}']) @@ -1476,6 +1475,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [ AC_DEFINE(MODULE_SCOPE, [__private_extern__], [Compiler support for module scope symbols]) + tcl_cv_cc_visibility_hidden=yes ]) CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" @@ -1588,11 +1588,11 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ # this test works, since "uname -s" was non-standard in 3.2.4 and # below. AS_IF([test "$GCC" = yes], [ - SHLIB_CFLAGS="-fPIC -melf" - LDFLAGS="$LDFLAGS -melf -Wl,-Bexport" + SHLIB_CFLAGS="-fPIC -melf" + LDFLAGS="$LDFLAGS -melf -Wl,-Bexport" ], [ - SHLIB_CFLAGS="-Kpic -belf" - LDFLAGS="$LDFLAGS -belf -Wl,-Bexport" + SHLIB_CFLAGS="-Kpic -belf" + LDFLAGS="$LDFLAGS -belf -Wl,-Bexport" ]) SHLIB_LD="ld -G" SHLIB_LD_LIBS="" @@ -1935,7 +1935,6 @@ dnl # preprocessing tests use only CPPFLAGS. # NO_SYS_WAIT_H # NO_DLFCN_H # HAVE_SYS_PARAM_H -# HAVE_STDBOOL_H # HAVE_STRING_H ? # #-------------------------------------------------------------------- diff --git a/unix/tk.spec b/unix/tk.spec index d7861a2..3ed49b1 100644 --- a/unix/tk.spec +++ b/unix/tk.spec @@ -4,7 +4,7 @@ Name: tk Summary: Tk graphical toolkit for the Tcl scripting language. -Version: 8.7a2 +Version: 8.7a3 Release: 2 License: BSD Group: Development/Languages diff --git a/unix/tkUnixColor.c b/unix/tkUnixColor.c index 512b20c..96e8937 100644 --- a/unix/tkUnixColor.c +++ b/unix/tkUnixColor.c @@ -136,17 +136,17 @@ TkpGetColor( if (*name != '#') { XColor screen; - if (((*name - 'A') & 0xdf) < sizeof(tkWebColors)/sizeof(tkWebColors[0])) { - if (!((name[0] - 'G') & 0xdf) && !((name[1] - 'R') & 0xdf) - && !((name[2] - 'A') & 0xdb) && !((name[3] - 'Y') & 0xdf) + if (((*name - 'A') & 0xDF) < sizeof(tkWebColors)/sizeof(tkWebColors[0])) { + if (!((name[0] - 'G') & 0xDF) && !((name[1] - 'R') & 0xDF) + && !((name[2] - 'A') & 0xDB) && !((name[3] - 'Y') & 0xDF) && !name[4]) { name = "#808080808080"; goto gotWebColor; } else { - const char *p = tkWebColors[((*name - 'A') & 0x1f)]; + const char *p = tkWebColors[((*name - 'A') & 0x1F)]; if (p) { const char *q = name; - while (!((*p - *(++q)) & 0xdf)) { + while (!((*p - *(++q)) & 0xDF)) { if (!*p++) { name = p; goto gotWebColor; diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c index 9a8d1f7..f448da7 100644 --- a/unix/tkUnixFont.c +++ b/unix/tkUnixFont.c @@ -12,8 +12,6 @@ #include "tkUnixInt.h" #include "tkFont.h" -#include <netinet/in.h> /* for htons() prototype */ -#include <arpa/inet.h> /* inet_ntoa() */ /* * The preferred font encodings. @@ -417,15 +415,15 @@ ControlUtfProc( dst += 2; } else if ((size_t)ch < 256) { dst[1] = 'x'; - dst[2] = hexChars[(ch >> 4) & 0xf]; - dst[3] = hexChars[ch & 0xf]; + dst[2] = hexChars[(ch >> 4) & 0xF]; + dst[3] = hexChars[ch & 0xF]; dst += 4; } else if ((size_t)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[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 */ @@ -487,9 +485,13 @@ Ucs2beToUtfProc( * output buffer. */ { const char *srcStart, *srcEnd; - char *dstEnd, *dstStart; - int result, numChars; + const char *dstEnd, *dstStart; + int result, numChars, charLimit = INT_MAX; + unsigned short ch; + if (flags & TCL_ENCODING_CHAR_LIMIT) { + charLimit = *dstCharsPtr; + } result = TCL_OK; /* check alignment with ucs-2 (2 == sizeof(UCS-2)) */ @@ -509,19 +511,24 @@ Ucs2beToUtfProc( dstStart = dst; dstEnd = dst + dstLen - 4; - for (numChars = 0; src < srcEnd; numChars++) { + for (numChars = 0; src < srcEnd && numChars <= charLimit; numChars++) { if (dst > dstEnd) { result = TCL_CONVERT_NOSPACE; break; } + ch = (src[0] & 0xFF) << 8 | (src[1] & 0xFF); + src += 2 /* sizeof(UTF-16) */; + /* - * Need to swap byte-order on little-endian machines (x86) for - * UCS-2BE. We know this is an LE->BE swap. + * Special case for 1-byte utf chars for speed. Make sure we work with + * unsigned short-size data. */ - - dst += Tcl_UniCharToUtf(htons(*((short *)src)), dst); - src += 2 /* sizeof(UCS-2) */; + if (ch && ch < 0x80) { + *dst++ = (ch & 0xFF); + } else { + dst += Tcl_UniCharToUtf(ch, dst); + } } *srcReadPtr = src - srcStart; @@ -576,17 +583,13 @@ UtfToUcs2beProc( { const char *srcStart, *srcEnd, *srcClose, *dstStart, *dstEnd; int result, numChars; - Tcl_UniChar *chPtr = (Tcl_UniChar *)statePtr; - - if (flags & TCL_ENCODING_START) { - *statePtr = 0; - } + int ch; srcStart = src; srcEnd = src + srcLen; srcClose = srcEnd; if (!(flags & TCL_ENCODING_END)) { - srcClose -= 4; + srcClose -= 6; } dstStart = dst; @@ -606,17 +609,17 @@ UtfToUcs2beProc( result = TCL_CONVERT_NOSPACE; break; } - src += Tcl_UtfToUniChar(src, chPtr); + src += TkUtfToUniChar(src, &ch); + if (ch > 0xFFFF) { + ch = 0xFFFD; + } /* * Ensure big-endianness (store big bits first). - * XXX: This hard-codes the assumed size of Tcl_UniChar as 2. Make - * sure to work in char* for Tcl_UtfToUniChar alignment. [Bug 1122671] */ - - *dst++ = (char)(*chPtr >> 8); - *dst++ = (char)*chPtr; + *dst++ = (char)((ch >> 8) & 0xFF); + *dst++ = (char)(ch & 0xFF); } *srcReadPtr = src - srcStart; *dstWrotePtr = dst - dstStart; @@ -1976,7 +1979,7 @@ FindSubFontForChar( Tcl_DString ds; if (ch < 0 || ch > 0x30000) { - ch = 0xfffd; + ch = 0xFFFD; } for (i = 0; i < fontPtr->numSubFonts; i++) { diff --git a/unix/tkUnixKey.c b/unix/tkUnixKey.c index fa93edc..6681ad9 100644 --- a/unix/tkUnixKey.c +++ b/unix/tkUnixKey.c @@ -279,9 +279,9 @@ TkpSetKeycodeAndState( mincode = 0; maxcode = -1; XDisplayKeycodes(dispPtr->display, &mincode, &maxcode); - if (keycode < mincode) { + if (keycode < (KeyCode)mincode) { keycode = mincode; - } else if (keycode > maxcode) { + } else if (keycode > (KeyCode)maxcode) { keycode = maxcode; } diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c index 0d3d255..6abb2fd 100644 --- a/unix/tkUnixMenu.c +++ b/unix/tkUnixMenu.c @@ -1110,7 +1110,7 @@ TkpComputeMenubarGeometry( maxWindowWidth = Tk_Width(menuPtr->tkwin); if (maxWindowWidth == 1) { - maxWindowWidth = 0x7ffffff; + maxWindowWidth = 0x7FFFFFF; } currentRowHeight = 0; Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr, diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index e69dab0..37b2f95 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -836,7 +836,7 @@ LookUpColor(Display *display, /* Display to lookup colors on */ fontPtr->colors[last].color.color.red = xcolor.red; fontPtr->colors[last].color.color.green = xcolor.green; fontPtr->colors[last].color.color.blue = xcolor.blue; - fontPtr->colors[last].color.color.alpha = 0xffff; + fontPtr->colors[last].color.color.alpha = 0xFFFF; fontPtr->colors[last].color.pixel = pixel; /* diff --git a/win/Makefile.in b/win/Makefile.in index db61eae..b6a4819 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -168,7 +168,7 @@ LDFLAGS_OPTIMIZE = @LDFLAGS_OPTIMIZE@ #CFLAGS = $(CFLAGS_DEBUG) #CFLAGS = $(CFLAGS_OPTIMIZE) #CFLAGS = $(CFLAGS_DEBUG) $(CFLAGS_OPTIMIZE) -CFLAGS = @CFLAGS@ @CFLAGS_DEFAULT@ -DUNICODE -D_UNICODE -D_ATL_XP_TARGETING +CFLAGS = @CFLAGS@ @CFLAGS_DEFAULT@ -D_ATL_XP_TARGETING # Special compiler flags to use when building man2tcl on Windows. MAN2TCLFLAGS = @MAN2TCLFLAGS@ @@ -634,7 +634,7 @@ ${TEST_DLL_FILE}: ${TKTEST_OBJS} ${TK_STUB_LIB_FILE} $(TCL_SRC_DIR)/win/cat.c: cat32.${OBJEXT}: $(TCL_SRC_DIR)/win/cat.c - $(CC) -c $(CC_SWITCHES) "$(TCL_SRC_DIR)/win/cat.c" $(CC_OBJNAME) + $(CC) -c $(CC_SWITCHES) -DUNICODE -D_UNICODE "$(TCL_SRC_DIR)/win/cat.c" $(CC_OBJNAME) $(CAT32): cat32.${OBJEXT} $(CC) $(CFLAGS) cat32.$(OBJEXT) $(CC_EXENAME) $(LIBS) $(LDFLAGS_CONSOLE) @@ -660,10 +660,10 @@ ${TK_LIB_FILE}: ${TK_OBJS} # Special case object file targets winMain.$(OBJEXT): winMain.c - $(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME) + $(CC) -c $(CC_SWITCHES) -DUNICODE=1 -D_UNICODE=1 @DEPARG@ $(CC_OBJNAME) testMain.$(OBJEXT): winMain.c - $(CC) -c $(CC_SWITCHES) @DEPARG@ -DTK_TEST $(CC_OBJNAME) + $(CC) -c $(CC_SWITCHES) -DTK_TEST -DUNICODE=1 -D_UNICODE=1 @DEPARG@ $(CC_OBJNAME) tkTest.$(OBJEXT): tkTest.c $(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME) @@ -678,11 +678,12 @@ tkSquare.$(OBJEXT): tkSquare.c $(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME) tkMain2.$(OBJEXT): tkMain.c - $(CC) -c $(CC_SWITCHES) -DBUILD_tk -DTK_ASCII_MAIN @DEPARG@ $(CC_OBJNAME) + $(CC) -c $(CC_SWITCHES) -DBUILD_tk -DUNICODE=1 -D_UNICODE=1 @DEPARG@ $(CC_OBJNAME) # Extra dependency info tkConsole.$(OBJEXT): configure Makefile tkMain.$(OBJEXT): configure Makefile +tkMain2.$(OBJEXT): configure Makefile tkWindow.$(OBJEXT): configure Makefile # Add the object extension to the implicit rules. By default .obj is not diff --git a/win/configure b/win/configure index 3bb8570..af50495 100755 --- a/win/configure +++ b/win/configure @@ -1604,83 +1604,6 @@ fi } # ac_fn_c_try_run -# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES -# --------------------------------------------- -# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR -# accordingly. -ac_fn_c_check_decl () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - as_decl_name=`echo $2|sed 's/ *(.*//'` - as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 -$as_echo_n "checking whether $as_decl_name is declared... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -#ifndef $as_decl_name -#ifdef __cplusplus - (void) $as_decl_use; -#else - (void) $as_decl_name; -#endif -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_decl - -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_compile - # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using @@ -1767,6 +1690,37 @@ fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -2129,7 +2083,7 @@ SHELL=/bin/sh TK_VERSION=8.7 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=7 -TK_PATCH_LEVEL="a2" +TK_PATCH_LEVEL="a3" VER=$TK_MAJOR_VERSION$TK_MINOR_VERSION #------------------------------------------------------------------------ @@ -4072,14 +4026,14 @@ $as_echo "$ac_cv_cross" >&6; } if test "$ac_cv_cross" = "yes"; then case "$do64bit" in amd64|x64|yes) - CC="x86_64-w64-mingw32-gcc" + CC="x86_64-w64-mingw32-${CC}" LD="x86_64-w64-mingw32-ld" AR="x86_64-w64-mingw32-ar" RANLIB="x86_64-w64-mingw32-ranlib" RC="x86_64-w64-mingw32-windres" ;; *) - CC="i686-w64-mingw32-gcc" + CC="i686-w64-mingw32-${CC}" LD="i686-w64-mingw32-ld" AR="i686-w64-mingw32-ar" RANLIB="i686-w64-mingw32-ranlib" @@ -4313,10 +4267,19 @@ $as_echo "using shared flags" >&6; } CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" - CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wdeclaration-after-statement -Wpointer-arith" + CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wpointer-arith" LDFLAGS_DEBUG= LDFLAGS_OPTIMIZE= + case "${CC}" in + *++) + CFLAGS_WARNING="${CFLAGS_WARNING} -Wno-format" + ;; + *) + CFLAGS_WARNING="${CFLAGS_WARNING} -Wdeclaration-after-statement" + ;; + esac + # Specify the CC output file names based on the target name CC_OBJNAME="-o \$@" CC_EXENAME="-o \$@" @@ -4411,29 +4374,15 @@ $as_echo "using shared flags" >&6; } LIBSUFFIX="\${DBGX}.lib" LIBFLAGSUFFIX="\${DBGX}" - # This is a 2-stage check to make sure we have the 64-bit SDK - # We have to know where the SDK is installed. - # This magic is based on MS Platform SDK for Win2003 SP1 - hobbs if test "$do64bit" != "no" ; then - if test "x${MSSDK}x" = "xx" ; then - MSSDK="C:/Progra~1/Microsoft Platform SDK" - fi - MSSDK=`echo "$MSSDK" | sed -e 's!\\\!/!g'` - PATH64="" case "$do64bit" in amd64|x64|yes) MACHINE="AMD64" ; # assume AMD64 as default 64-bit build - PATH64="${MSSDK}/Bin/Win64/x86/AMD64" ;; ia64) MACHINE="IA64" - PATH64="${MSSDK}/Bin/Win64" ;; esac - if test ! -d "${PATH64}" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Could not find 64-bit $MACHINE SDK" >&5 -$as_echo "$as_me: WARNING: Could not find 64-bit $MACHINE SDK" >&2;} - fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using 64-bit $MACHINE mode" >&5 $as_echo " Using 64-bit $MACHINE mode" >&6; } fi @@ -4449,26 +4398,12 @@ $as_echo " Using 64-bit $MACHINE mode" >&6; } esac if test "$do64bit" != "no" ; then - # The space-based-path will work for the Makefile, but will - # not work if AC_TRY_COMPILE is called. TEA has the - # TEA_PATH_NOSPACE to avoid this issue. - # Check if _WIN64 is already recognized, and if so we don't - # need to modify CC. - ac_fn_c_check_decl "$LINENO" "_WIN64" "ac_cv_have_decl__WIN64" "$ac_includes_default" -if test "x$ac_cv_have_decl__WIN64" = xyes; then : - -else - CC="\"${PATH64}/cl.exe\" -I\"${MSSDK}/Include\" \ - -I\"${MSSDK}/Include/crt\" \ - -I\"${MSSDK}/Include/crt/sys\"" -fi - - RC="\"${MSSDK}/bin/rc.exe\"" + RC="rc" CFLAGS_DEBUG="-nologo -Zi -Od ${runtime}d" # Do not use -O2 for Win64 - this has proved buggy in code gen. CFLAGS_OPTIMIZE="-nologo -O1 ${runtime}" - lflags="${lflags} -nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\"" - LINKBIN="\"${PATH64}/link.exe\"" + lflags="${lflags} -nologo -MACHINE:${MACHINE}" + LINKBIN="link" # Avoid 'unresolved external symbol __security_cookie' errors. # c.f. http://support.microsoft.com/?id=894573 LIBS="$LIBS bufferoverflowU.lib" diff --git a/win/configure.ac b/win/configure.ac index a000115..fa3dec3 100644 --- a/win/configure.ac +++ b/win/configure.ac @@ -14,7 +14,7 @@ SHELL=/bin/sh TK_VERSION=8.7 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=7 -TK_PATCH_LEVEL="a2" +TK_PATCH_LEVEL="a3" VER=$TK_MAJOR_VERSION$TK_MINOR_VERSION #------------------------------------------------------------------------ diff --git a/win/makefile.vc b/win/makefile.vc index 311be18..709566d 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -317,7 +317,7 @@ PRJ_INCLUDES = -I"$(BITMAPDIR)" -I"$(XLIBDIR)" CONFIG_DEFS =/DSTDC_HEADERS=1 /DHAVE_SYS_TYPES_H=1 /DHAVE_SYS_STAT_H=1 \
/DHAVE_STRING_H=1 /DHAVE_MEMORY_H=1 \
/DHAVE_STRINGS_H=1 /DHAVE_INTTYPES_H=1 \
- /DSUPPORT_CONFIG_EMBEDDED /DUNICODE /D_UNICODE \
+ /DSUPPORT_CONFIG_EMBEDDED \
!if $(HAVE_UXTHEME_H)
/DHAVE_UXTHEME_H=1 \
!endif
@@ -468,7 +468,7 @@ $(TKTEST): $(TKTESTOBJS) $(TKSTUBLIB) $(TKIMPLIB) $(CAT32): $(_TCLDIR)\win\cat.c
- $(cc32) $(cflags) $(crt) /D_CRT_NONSTDC_NO_DEPRECATE /DCONSOLE -Fo$(TMP_DIR)\ $?
+ $(cc32) $(cflags) $(crt) /D_CRT_NONSTDC_NO_DEPRECATE /DCONSOLE /DUNICODE /D_UNICODE -Fo$(TMP_DIR)\ $?
$(CONEXECMD) /DCONSOLE -stack:16384 $(TMP_DIR)\cat.obj
$(_VC_MANIFEST_EMBED_EXE)
@@ -544,7 +544,7 @@ install-pdbs: #---------------------------------------------------------------------
$(TMP_DIR)\testMain.obj: $(WIN_DIR)\winMain.c
- $(cc32) $(appcflags_nostubs) /DTK_TEST \
+ $(cc32) $(appcflags_nostubs) /DTK_TEST /DUNICODE /D_UNICODE \
/DTCL_USE_STATIC_PACKAGES=$(TCL_USE_STATIC_PACKAGES) \
-Fo$@ $?
@@ -561,12 +561,12 @@ $(TMP_DIR)\tkSquare.obj: $(GENERICDIR)\tkSquare.c $(cc32) $(appcflags_nostubs) -Fo$@ $?
$(TMP_DIR)\winMain.obj: $(WIN_DIR)\winMain.c
- $(cc32) $(appcflags_nostubs) \
+ $(cc32) $(appcflags_nostubs) /DUNICODE /D_UNICODE \
/DTCL_USE_STATIC_PACKAGES=$(TCL_USE_STATIC_PACKAGES) \
-Fo$@ $?
$(TMP_DIR)\tkMain2.obj: $(GENERICDIR)\tkMain.c
- $(cc32) $(pkgcflags) /DTK_ASCII_MAIN -Fo$@ $?
+ $(cc32) $(pkgcflags) /DUNICODE /D_UNICODE -Fo$@ $?
# The following objects are part of the stub library and should not
# be built as DLL objects but none of the symbols should be exported
@@ -541,14 +541,14 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ if test "$ac_cv_cross" = "yes"; then case "$do64bit" in amd64|x64|yes) - CC="x86_64-w64-mingw32-gcc" + CC="x86_64-w64-mingw32-${CC}" LD="x86_64-w64-mingw32-ld" AR="x86_64-w64-mingw32-ar" RANLIB="x86_64-w64-mingw32-ranlib" RC="x86_64-w64-mingw32-windres" ;; *) - CC="i686-w64-mingw32-gcc" + CC="i686-w64-mingw32-${CC}" LD="i686-w64-mingw32-ld" AR="i686-w64-mingw32-ar" RANLIB="i686-w64-mingw32-ranlib" @@ -685,10 +685,19 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" - CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wdeclaration-after-statement -Wpointer-arith" + CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wpointer-arith" LDFLAGS_DEBUG= LDFLAGS_OPTIMIZE= + case "${CC}" in + *++) + CFLAGS_WARNING="${CFLAGS_WARNING} -Wno-format" + ;; + *) + CFLAGS_WARNING="${CFLAGS_WARNING} -Wdeclaration-after-statement" + ;; + esac + # Specify the CC output file names based on the target name CC_OBJNAME="-o \[$]@" CC_EXENAME="-o \[$]@" @@ -764,28 +773,15 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ LIBSUFFIX="\${DBGX}.lib" LIBFLAGSUFFIX="\${DBGX}" - # This is a 2-stage check to make sure we have the 64-bit SDK - # We have to know where the SDK is installed. - # This magic is based on MS Platform SDK for Win2003 SP1 - hobbs if test "$do64bit" != "no" ; then - if test "x${MSSDK}x" = "xx" ; then - MSSDK="C:/Progra~1/Microsoft Platform SDK" - fi - MSSDK=`echo "$MSSDK" | sed -e 's!\\\!/!g'` - PATH64="" case "$do64bit" in amd64|x64|yes) MACHINE="AMD64" ; # assume AMD64 as default 64-bit build - PATH64="${MSSDK}/Bin/Win64/x86/AMD64" ;; ia64) MACHINE="IA64" - PATH64="${MSSDK}/Bin/Win64" ;; esac - if test ! -d "${PATH64}" ; then - AC_MSG_WARN([Could not find 64-bit $MACHINE SDK]) - fi AC_MSG_RESULT([ Using 64-bit $MACHINE mode]) fi @@ -800,21 +796,12 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ esac if test "$do64bit" != "no" ; then - # The space-based-path will work for the Makefile, but will - # not work if AC_TRY_COMPILE is called. TEA has the - # TEA_PATH_NOSPACE to avoid this issue. - # Check if _WIN64 is already recognized, and if so we don't - # need to modify CC. - AC_CHECK_DECL([_WIN64], [], - [CC="\"${PATH64}/cl.exe\" -I\"${MSSDK}/Include\" \ - -I\"${MSSDK}/Include/crt\" \ - -I\"${MSSDK}/Include/crt/sys\""]) - RC="\"${MSSDK}/bin/rc.exe\"" + RC="rc" CFLAGS_DEBUG="-nologo -Zi -Od ${runtime}d" # Do not use -O2 for Win64 - this has proved buggy in code gen. CFLAGS_OPTIMIZE="-nologo -O1 ${runtime}" - lflags="${lflags} -nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\"" - LINKBIN="\"${PATH64}/link.exe\"" + lflags="${lflags} -nologo -MACHINE:${MACHINE}" + LINKBIN="link" # Avoid 'unresolved external symbol __security_cookie' errors. # c.f. http://support.microsoft.com/?id=894573 LIBS="$LIBS bufferoverflowU.lib" diff --git a/win/tkWin32Dll.c b/win/tkWin32Dll.c index 3c3d83a..88b0507 100644 --- a/win/tkWin32Dll.c +++ b/win/tkWin32Dll.c @@ -150,7 +150,7 @@ DllMain( * Call TkFinalize */ - "movq $0x0, 0x0(%%esp)" "\n\t" + "movq $0x0, 0x0(%%rsp)" "\n\t" "call TkFinalize" "\n\t" /* diff --git a/win/tkWinFont.c b/win/tkWinFont.c index e4f0624..451dc68 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -2179,9 +2179,9 @@ FontMapLoadPage( { FontFamily *familyPtr; Tcl_Encoding encoding; - char src[XMaxTransChars], buf[16]; - USHORT *startCount, *endCount; int i, j, bitOffset, end, segCount; + USHORT *startCount, *endCount; + char buf[16], src[4]; subFontPtr->fontMap[row] = ckalloc(FONTMAP_BITSPERPAGE / 8); memset(subFontPtr->fontMap[row], 0, FONTMAP_BITSPERPAGE / 8); diff --git a/win/tkWinKey.c b/win/tkWinKey.c index 8a83874..29f2ff0 100644 --- a/win/tkWinKey.c +++ b/win/tkWinKey.c @@ -97,8 +97,8 @@ TkpGetString( * result. */ { XKeyEvent *keyEv = &eventPtr->xkey; - char buf[6]; int len; + char buf[4]; Tcl_DStringInit(dsPtr); if (keyEv->send_event == -1) { diff --git a/win/tkWinPointer.c b/win/tkWinPointer.c index e7e041f..06cbe67 100644 --- a/win/tkWinPointer.c +++ b/win/tkWinPointer.c @@ -368,6 +368,19 @@ void TkSetCursorPos( input.type = INPUT_MOUSE; input.mi.dx = (x * 65535 + xscreen/2) / xscreen; input.mi.dy = (y * 65535 + yscreen/2) / yscreen; + + /* + * Horrible workaround here. There is a bug on Win 10: when warping to + * pixel (x = 0, y = 0) the SendInput() below just does not move the + * mouse pointer. However, as soon as dx or dy is non zero it moves as + * expected. Given the scaling factor of 65535 (see above), + * (dx = 1 , dy = 0) still means pixel (x = 0, y = 0). + * See ticket [69b48f427e]. + */ + if (input.mi.dx == 0 && input.mi.dy == 0) { + input.mi.dx = 1; + } + input.mi.mouseData = 0; input.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE; input.mi.time = 0; diff --git a/win/tkWinX.c b/win/tkWinX.c index 2bda128..7b2d004 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.c @@ -1437,8 +1437,7 @@ GetTranslatedKey( if ((msg.message == WM_CHAR) && (msg.lParam & 0x20000000)) { xkey->state = 0; } - xkey->trans_chars[xkey->nbytes] = (char) msg.wParam; - xkey->nbytes++; + xkey->trans_chars[xkey->nbytes++] = (char) msg.wParam; if (((unsigned short) msg.wParam) > ((unsigned short) 0xff)) { /* diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index 8a97852..784a96d 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -1025,7 +1025,7 @@ static ElementInfo ElementInfoTable[] = { { "Menubutton.dropdown", &GenericElementSpec, L"TOOLBAR", TP_SPLITBUTTONDROPDOWN,toolbutton_statemap, NOPAD,0 }, { "Treeview.field", &GenericElementSpec, L"TREEVIEW", - TVP_TREEITEM, treeview_statemap, PAD(1, 1, 1, 1), 0 }, + TVP_TREEITEM, treeview_statemap, PAD(1, 1, 1, 1), IGNORE_THEMESIZE }, { "Treeitem.indicator", &TreeIndicatorElementSpec, L"TREEVIEW", TVP_GLYPH, tvpglyph_statemap, PAD(1,1,6,0), PAD_MARGINS }, { "Treeheading.border", &GenericElementSpec, L"HEADER", diff --git a/xlib/X11/Xlib.h b/xlib/X11/Xlib.h index 44f556f..2db3f10 100644 --- a/xlib/X11/Xlib.h +++ b/xlib/X11/Xlib.h @@ -1048,7 +1048,7 @@ typedef union _XEvent { XKeymapEvent xkeymap; XGenericEvent xgeneric; XGenericEventCookie xcookie; - long pad[24]; + XID pad[24]; } XEvent; #endif diff --git a/xlib/X11/Xutil.h b/xlib/X11/Xutil.h index eab1225..6a22c97 100644 --- a/xlib/X11/Xutil.h +++ b/xlib/X11/Xutil.h @@ -764,6 +764,14 @@ EXTERN int XmbTextListToTextProperty( XTextProperty* text_prop_return ); +EXTERN int XwcTextListToTextProperty( + Display* display, + wchar_t** list, + int count, + XICCEncodingStyle style, + XTextProperty* text_prop_return +); + EXTERN int Xutf8TextListToTextProperty( Display* display, char** list, @@ -772,6 +780,10 @@ EXTERN int Xutf8TextListToTextProperty( XTextProperty* text_prop_return ); +EXTERN void XwcFreeStringList( + wchar_t** list +); + EXTERN Status XTextPropertyToStringList( XTextProperty* /* text_prop */, char*** /* list_return */, @@ -785,6 +797,13 @@ EXTERN int XmbTextPropertyToTextList( int* count_return ); +EXTERN int XwcTextPropertyToTextList( + Display* display, + const XTextProperty* text_prop, + wchar_t*** list_return, + int* count_return +); + EXTERN int Xutf8TextPropertyToTextList( Display* display, const XTextProperty* text_prop, diff --git a/xlib/X11/keysymdef.h b/xlib/X11/keysymdef.h index 30ca537..728320c 100644 --- a/xlib/X11/keysymdef.h +++ b/xlib/X11/keysymdef.h @@ -104,11 +104,11 @@ SOFTWARE. * When adding new keysyms to this file, do not forget to also update the * following as needed: * - * - the mappings in src/KeyBind.c in the repo - * git://anongit.freedesktop.org/xorg/lib/libX11.git + * - the mappings in src/KeyBind.c in the libX11 repo + * https://gitlab.freedesktop.org/xorg/lib/libx11 * - * - the protocol specification in specs/keysyms.xml - * in the repo git://anongit.freedesktop.org/xorg/proto/x11proto.git + * - the protocol specification in specs/keysyms.xml in this repo + * https://gitlab.freedesktop.org/xorg/proto/xorgproto * */ |