Check-in [ac417d65fd]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:add tk upstream changes
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ac417d65fd430a095aa87486754e50e396852fb9
User & Date: chw 2019-07-16 04:55:34
Context
2019-07-16
04:57
in undroid/vanillawish build scripts set macosx min version to 10.10 check-in: 476b7c5f60 user: chw tags: trunk
04:55
add tk upstream changes check-in: ac417d65fd user: chw tags: trunk
2019-07-13
20:55
better error handling w.r.t. check-in [f125b3dc59] check-in: 4dcaf5f047 user: chw tags: trunk
Changes

Changes to jni/sdl2tk/library/demos/twind.tcl.

     4      4   # embedded windows.
     5      5   
     6      6   if {![info exists widgetDemo]} {
     7      7       error "This script should be run from the \"widget\" demo."
     8      8   }
     9      9   
    10     10   package require Tk
           11  +
           12  +# Make an Aqua button's fill color match its parent's background
           13  +proc blend {bt} {
           14  +    if {[tk windowingsystem] eq "aqua"} {
           15  +	$bt configure -highlightbackground [[winfo parent $bt] cget -background]
           16  +    }
           17  +    return $bt
           18  +}
    11     19   
    12     20   set w .twind
    13     21   catch {destroy $w}
    14     22   toplevel $w
    15     23   wm title $w "Text Demonstration - Embedded Windows and Other Features"
    16     24   wm iconname $w "Embedded Windows"
    17     25   positionWindow $w
................................................................................
    49     57   $t insert end "scrolling in all directions is provided.\n\n"
    50     58   
    51     59   $t insert end "A text widget can contain other widgets embedded "
    52     60   $t insert end "it.  These are called \"embedded windows\", "
    53     61   $t insert end "and they can consist of arbitrary widgets.  "
    54     62   $t insert end "For example, here are two embedded button "
    55     63   $t insert end "widgets.  You can click on the first button to "
    56         -$t window create end -window $t.on
           64  +$t window create end -window [blend $t.on]
    57     65   $t insert end " horizontal scrolling, which also turns off "
    58     66   $t insert end "word wrapping.  Or, you can click on the second "
    59     67   $t insert end "button to\n"
    60         -$t window create end -window $t.off
           68  +$t window create end -window [blend $t.off]
    61     69   $t insert end " horizontal scrolling and turn back on word wrapping.\n\n"
    62     70   
    63     71   $t insert end "Or, here is another example.  If you "
    64     72   $t window create end -create {
    65     73       button %W.click -text "Click Here" -command "textWindPlot %W" \
    66         -	    -cursor top_left_arrow}
           74  +	-cursor top_left_arrow
           75  +    blend %W.click
           76  +}
    67     77   
    68     78   $t insert end " a canvas displaying an x-y plot will appear right here."
    69     79   $t mark set plot insert
    70     80   $t mark gravity plot left
    71     81   $t insert end "  You can drag the data points around with the mouse, "
    72     82   $t insert end "or you can click here to "
    73     83   $t window create end -create {
    74     84       button %W.delete -text "Delete" -command "textWindDel %W" \
    75         -	    -cursor top_left_arrow
           85  +	-cursor top_left_arrow
           86  +    blend %W.delete
    76     87   }
    77     88   $t insert end " the plot again.\n\n"
    78     89   
    79     90   $t insert end "You can also create multiple text widgets each of which "
    80     91   $t insert end "display the same underlying text. Click this button to "
    81     92   $t window create end \
    82     93     -create {button %W.peer -text "Make A Peer" -command "textMakePeer %W" \
    83         -  -cursor top_left_arrow} -padx 3
           94  +	       -cursor top_left_arrow
           95  +      blend %W.peer} -padx 3
    84     96   $t insert end " widget.  Notice how peer widgets can have different "
    85     97   $t insert end "font settings, and by default contain all the images "
    86     98   $t insert end "of the 'parent', but that the embedded windows, "
    87     99   $t insert end "such as buttons may not appear in the peer.  To ensure "
    88    100   $t insert end "that embedded windows appear in all peers you can set the "
    89    101   $t insert end "'-create' option to a script or a string containing %W.  "
    90    102   $t insert end "(The plot above and the 'Make A Peer' button are "
    91    103   $t insert end "designed to show up in all peers.)  A good use of "
    92    104   $t insert end "peers is for "
    93    105   $t window create end \
    94    106     -create {button %W.split -text "Split Windows" -command "textSplitWindow %W" \
    95         -  -cursor top_left_arrow} -padx 3
          107  +	       -cursor top_left_arrow
          108  +      blend %W.split} -padx 3
    96    109   $t insert end " \n\n"
    97    110   
    98    111   $t insert end "Users of previous versions of Tk will also be interested "
    99    112   $t insert end "to note that now cursor movement is now by visual line by "
   100    113   $t insert end "default, and that all scrolling of this widget is by pixel.\n\n"
   101    114   
   102    115   $t insert end "You may also find it useful to put embedded windows in "
................................................................................
   124    137   $t window create end -window $t.toggle -padx 3 -pady 2
   125    138   set i 1
   126    139   foreach color {AntiqueWhite3 Bisque1 Bisque2 Bisque3 Bisque4
   127    140   	SlateBlue3 RoyalBlue1 SteelBlue2 DeepSkyBlue3 LightBlue1
   128    141   	DarkSlateGray1 Aquamarine2 DarkSeaGreen2 SeaGreen1
   129    142   	Yellow1 IndianRed1 IndianRed2 Tan1 Tan4} {
   130    143       button $t.color$i -text $color -cursor top_left_arrow -command \
   131         -	    "$t configure -bg $color"
   132         -    $t window create end -window $t.color$i -padx 3 -pady 2
          144  +	    "changeBg $t $color"
          145  +    $t window create end -window [blend $t.color$i] -padx 3 -pady 2
   133    146       incr i
   134    147   }
   135         -$t tag add buttons $t.default end
          148  +$t tag add buttons [blend $t.default] end
   136    149   
   137    150   button $t.bigB -text "Big borders" -command "textWindBigB $t" \
   138    151     -cursor top_left_arrow
   139    152   button $t.smallB -text "Small borders" -command "textWindSmallB $t" \
   140    153     -cursor top_left_arrow
   141    154   button $t.bigH -text "Big highlight" -command "textWindBigH $t" \
   142    155     -cursor top_left_arrow
................................................................................
   149    162   
   150    163   set text_normal(border) [$t cget -borderwidth]
   151    164   set text_normal(highlight) [$t cget -highlightthickness]
   152    165   set text_normal(pad) [$t cget -padx]
   153    166   
   154    167   $t insert end "\nYou can also change the usual border width and "
   155    168   $t insert end "highlightthickness and padding.\n"
   156         -$t window create end -window $t.bigB
   157         -$t window create end -window $t.smallB
   158         -$t window create end -window $t.bigH
   159         -$t window create end -window $t.smallH
   160         -$t window create end -window $t.bigP
   161         -$t window create end -window $t.smallP
          169  +$t window create end -window [blend $t.bigB]
          170  +$t window create end -window [blend $t.smallB]
          171  +$t window create end -window [blend $t.bigH]
          172  +$t window create end -window [blend $t.smallH]
          173  +$t window create end -window [blend $t.bigP]
          174  +$t window create end -window [blend $t.smallP]
   162    175   
   163    176   $t insert end "\n\nFinally, images fit comfortably in text widgets too:"
   164    177   
   165    178   $t image create end -image \
   166    179       [image create photo -file [file join $tk_demoDirectory images ouster.png]]
   167    180   
   168    181   proc textWindBigB w {
................................................................................
   184    197   proc textWindSmallH w {
   185    198       $w configure -highlightthickness $::text_normal(highlight)
   186    199   }
   187    200   
   188    201   proc textWindSmallP w {
   189    202       $w configure -padx $::text_normal(pad) -pady $::text_normal(pad)
   190    203   }
   191         -
   192    204   
   193    205   proc textWindOn w {
   194    206       catch {destroy $w.scroll2}
   195    207       set t $w.f.text
   196    208       ttk::scrollbar $w.scroll2 -orient horizontal -command "$t xview"
   197    209       pack $w.scroll2 -after $w.buttons -side bottom -fill x
   198    210       $t configure -xscrollcommand "$w.scroll2 set" -wrap none
................................................................................
   285    297   	$t delete $t.c
   286    298   	while {[string first [$t get plot] " \t\n"] >= 0} {
   287    299   	    $t delete plot
   288    300   	}
   289    301   	$t insert plot "  "
   290    302       }
   291    303   }
          304  +
          305  +proc changeBg {t c} {
          306  +    $t configure -background $c
          307  +    if {[tk windowingsystem] eq "aqua"} {
          308  +	foreach b [$t window names] {
          309  +	    if {[winfo class $b] eq "Button"} {
          310  +		$b configure -highlightbackground $c
          311  +	    }
          312  +	}
          313  +    }
          314  +}
   292    315   
   293    316   proc embDefBg t {
   294         -    $t configure -background [lindex [$t configure -background] 3]
          317  +    set bg [lindex [$t configure -background] 3]
          318  +    changeBg $t $bg 
   295    319   }
   296    320   
   297    321   proc textMakePeer {parent} {
   298    322       set n 1
   299    323       while {[winfo exists .peer$n]} { incr n }
   300    324       set w [toplevel .peer$n]
   301    325       wm title $w "Text Peer #$n"

Changes to jni/sdl2tk/macosx/tkMacOSXDefault.h.

    31     31    * TROUGH -		Background color for troughs in scales and scrollbars.
    32     32    * INDICATOR -		Color for indicator when button is selected.
    33     33    * DISABLED -		Foreground color when widget is disabled.
    34     34    */
    35     35   
    36     36   #define BLACK			"Black"
    37     37   #define WHITE			"White"
    38         -#define NORMAL_BG		"systemTextBackgroundColor"
           38  +#define NORMAL_BG		"systemWindowBackgroundColor"
           39  +#define TEXT_BG                 "systemTextBackgroundColor"
    39     40   #define NORMAL_FG		"systemTextColor"
    40         -#define ACTIVE_BG		"systemTextBackgroundColor"
           41  +#define ACTIVE_BG		"systemWindowBackgroundColor"
    41     42   #define ACTIVE_FG		"systemTextColor"
    42     43   #define SELECT_BG		"systemSelectedTextBackgroundColor"
    43     44   #define SELECT_FG		"systemSelectedTextColor"
    44     45   #define INACTIVE_SELECT_BG	"systemSelectedTextBackgroundColor"
    45     46   #define TROUGH			"#c3c3c3"
    46     47   #define INDICATOR		"#b03060"
    47     48   #define DISABLED		"#a3a3a3"
................................................................................
   167    168    */
   168    169   
   169    170   #define MAC_OSX_FOCUS_WIDTH		3
   170    171   #define MAC_OSX_ENTRY_BORDER		2
   171    172   #define MAC_OSX_ENTRY_RELIEF		TK_RELIEF_SUNKEN
   172    173   #define MAC_OSX_ENTRY_SELECT_RELIEF	TK_RELIEF_FLAT
   173    174   
   174         -#define DEF_ENTRY_BG_COLOR		NORMAL_BG
          175  +#define DEF_ENTRY_BG_COLOR		TEXT_BG
   175    176   #define DEF_ENTRY_BG_MONO		WHITE
   176    177   #define DEF_ENTRY_BORDER_WIDTH		"2"
   177    178   #define DEF_ENTRY_CURSOR		"xterm"
   178    179   #define DEF_ENTRY_DISABLED_BG_COLOR	NORMAL_BG
   179    180   #define DEF_ENTRY_DISABLED_BG_MONO	WHITE
   180    181   #define DEF_ENTRY_DISABLED_FG		DISABLED
   181    182   #define DEF_ENTRY_EXPORT_SELECTION	"1"
................................................................................
   244    245   #define DEF_LABELFRAME_LABELANCHOR	"nw"
   245    246   
   246    247   /*
   247    248    * Defaults for listboxes:
   248    249    */
   249    250   
   250    251   #define DEF_LISTBOX_ACTIVE_STYLE	"dotbox"
   251         -#define DEF_LISTBOX_BG_COLOR		NORMAL_BG
          252  +#define DEF_LISTBOX_BG_COLOR		TEXT_BG
   252    253   #define DEF_LISTBOX_BG_MONO		WHITE
   253    254   #define DEF_LISTBOX_BORDER_WIDTH	"1"
   254    255   #define DEF_LISTBOX_CURSOR		""
   255    256   #define DEF_LISTBOX_DISABLED_FG		DISABLED
   256    257   #define DEF_LISTBOX_EXPORT_SELECTION	"1"
   257    258   #define DEF_LISTBOX_FONT		"TkTextFont"
   258    259   #define DEF_LISTBOX_FG			NORMAL_FG
................................................................................
   497    498   #define DEF_SCROLLBAR_WIDTH		"15"
   498    499   
   499    500   /*
   500    501    * Defaults for texts:
   501    502    */
   502    503   
   503    504   #define DEF_TEXT_AUTO_SEPARATORS	"1"
   504         -#define DEF_TEXT_BG_COLOR		NORMAL_BG
          505  +#define DEF_TEXT_BG_COLOR		TEXT_BG
   505    506   #define DEF_TEXT_BG_MONO		WHITE
   506    507   #define DEF_TEXT_BLOCK_CURSOR		"0"
   507    508   #define DEF_TEXT_BORDER_WIDTH		"0"
   508    509   #define DEF_TEXT_CURSOR			"xterm"
   509    510   #define DEF_TEXT_FG			NORMAL_FG
   510    511   #define DEF_TEXT_EXPORT_SELECTION	"1"
   511    512   #define DEF_TEXT_FONT			"TkFixedFont"