Check-in [f36e4b71d1]
Not logged in

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

Overview
Comment:merge with trunk
Timelines: family | ancestors | descendants | both | wtf-8-experiment
Files: files | file ages | folders
SHA1: f36e4b71d158e00dfec121914969a2369da987b5
User & Date: chw 2020-06-28 18:10:26.514
Context
2020-07-02
15:05
merge with trunk check-in: c784fa6ed8 user: chw tags: wtf-8-experiment
2020-06-28
18:10
merge with trunk check-in: f36e4b71d1 user: chw tags: wtf-8-experiment
18:08
add selected tcl upstream changes check-in: 6f6a327c0b user: chw tags: trunk
2020-06-27
16:02
merge with trunk check-in: 2193648775 user: chw tags: wtf-8-experiment
Changes
Unified Diff Ignore Whitespace Patch
Changes to assets/tklib0.7/scrollutil/CHANGES.txt.
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
   widgets.

4. Made sure that in the "vista" and "xpnative" themes the indicators of
   the ttk::checkbutton and ttk::radiobutton widgets will be properly
   scaled, regardless of the Tk release being used (a long-standing bug
   in the implementation of these widgets was fixed in May 2020).

5. Made the demo-scripts fully scaling-aware.

6. Several further improvements in the demo scripts and documentation.

What was new in Scrollutil 1.5?
-------------------------------

1. On Windows and X11, Scrollutil now automatically creates mouse wheel







|







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
   widgets.

4. Made sure that in the "vista" and "xpnative" themes the indicators of
   the ttk::checkbutton and ttk::radiobutton widgets will be properly
   scaled, regardless of the Tk release being used (a long-standing bug
   in the implementation of these widgets was fixed in May 2020).

5. Made the demo-scripts scaling-aware.

6. Several further improvements in the demo scripts and documentation.

What was new in Scrollutil 1.5?
-------------------------------

1. On Windows and X11, Scrollutil now automatically creates mouse wheel
Changes to assets/tklib0.7/scrollutil/ChangeLog.





1
2
3
4
5
6
7





2020-06-25 Csaba Nemethi <csaba.nemethi@t-online.de>

	* scripts/scaleutil.tcl: Made sure that the scaled default width of the
	  Tk core scrollbar on X11 won't get overridden by an unscaled resource
	  database value.

	* ../../examples/scrollutil/*FrmContent.tcl: Minor improvements.
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
2020-06-27 Csaba Nemethi <csaba.nemethi@t-online.de>

	* CHANGES.txt:         Minor improvements.
	* doc/scrollutil.html:

2020-06-25 Csaba Nemethi <csaba.nemethi@t-online.de>

	* scripts/scaleutil.tcl: Made sure that the scaled default width of the
	  Tk core scrollbar on X11 won't get overridden by an unscaled resource
	  database value.

	* ../../examples/scrollutil/*FrmContent.tcl: Minor improvements.
Changes to assets/tklib0.7/tablelist/CHANGES.txt.
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
   related to the editing with the aid of Tk core checkbutton, BWidget
   SpinBox, BWidget ComboBox, iwidgets::dateentry, iwidgets::timeentry,
   iwidgets::combobox, and Oakley combobox widgets.  A tile widget used
   for cell editing will be properly scaled in all built-in themes; the
   only exception is ttk::checkbutton, which cannot be scaled if the
   theme is "alt" or "winnative".

6. Made all demo-scripts fully scaling-aware.

7. Several further improvements in the code and documentation, as well
   as minor bug fixes.

What was new in Tablelist 6.9?
------------------------------








|







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
   related to the editing with the aid of Tk core checkbutton, BWidget
   SpinBox, BWidget ComboBox, iwidgets::dateentry, iwidgets::timeentry,
   iwidgets::combobox, and Oakley combobox widgets.  A tile widget used
   for cell editing will be properly scaled in all built-in themes; the
   only exception is ttk::checkbutton, which cannot be scaled if the
   theme is "alt" or "winnative".

6. Made all demo-scripts scaling-aware.

7. Several further improvements in the code and documentation, as well
   as minor bug fixes.

What was new in Tablelist 6.9?
------------------------------

Changes to assets/tklib0.7/tablelist/ChangeLog.






1
2
3
4
5
6
7






2020-06-25 Csaba Nemethi <csaba.nemethi@t-online.de>

	* scripts/scaleutil.tcl: Made sure that the scaled default width of the
	  Tk core scrollbar on X11 won't get overridden by an unscaled resource
	  database value.

2020-06-23 Csaba Nemethi <csaba.nemethi@t-online.de>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
2020-06-27 Csaba Nemethi <csaba.nemethi@t-online.de>

	* CHANGES.txt:           Minor improvements.
	* scripts/scaleutil.tcl:
	* doc/tablelist.html:

2020-06-25 Csaba Nemethi <csaba.nemethi@t-online.de>

	* scripts/scaleutil.tcl: Made sure that the scaled default width of the
	  Tk core scrollbar on X11 won't get overridden by an unscaled resource
	  database value.

2020-06-23 Csaba Nemethi <csaba.nemethi@t-online.de>
Changes to assets/tklib0.7/tablelist/scripts/scaleutil.tcl.
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593

594
595
596
597
598
599
600
601
602
603
604

605
606

607
608
609
610
611
612
613
614
615
616
617
618

619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
    variable calendarImg
    if {![info exists calendarImg]} {
	set calendarImg [image create photo scaleutil_calendarImg]

	switch $pct {
	    100 {
		set data "
R0lGODlhFAAUAKUqAPVLPvVMP+1QRPFSRutVSvZVSfZWSvVaT/VdUeR1bdp4cfhyaOt3bvN3bvKG
f+GTjdGYlNOloeeinLa2tsPDw9fBv8bGxszMzM3Nzc/Pz9HR0dPT09XV1dfX19jY2NnZ2dvb29zc
3N3d3d/f3+Xe3eDg4OHh4eLi4uPj4+Tk5P//////////////////////////////////////////
/////////////////////////////////////////////yH5BAEKAD8ALAAAAAAUABQAAAa0wJ9w
SCwaj8giomBYGArQKNNZOAwBgIbKge1itVzAFSB4ELzd8lksRLvdQ4h8Tq/LhykQhcLJ7E17Fx57
Hil4HRMTGRaJJYkUG4kbhkIpiIqME44TkJKUPykoJSUnJqMpKSQpJ6Mnn5aJi40MARKRE5OHsZkl
AwAJt7mVIRYWHRrFJhEKFR/FH68jGRkgHdMnGRgcItMir5eymo/B37uN455Dph0dIyHsKOwgJewl
KEn4+fpBADs=
"
	    }
	    125 {
		set data "
R0lGODlhGQAZAKU5ANJANdtDN/JKPfRLP/VLPvVMP/FTR9tfVutcUexdUvFgVfZgVfdrYfdrYvds
YfdvZfdwZfBzael4b9iYk8Kwr7a2tri4uOerp7m5uby8vMO7ur+/v8PDw8bGxtjCwcfHx+jAvcrK
ys3Nzc/Pz9DQ0NHR0dLS0tPT09TU1PDOy/HOzNjY2NnZ2dvb29zc3OTb2t7e3uDg4OHh4eLi4uPj
4+Tk5Prt7fru7f3v7v///////////////////////////yH5BAEKAD8ALAAAAAAZABkAAAb+wJ9w
SCwaj8ikcrlsOJ7QqDTKIBYIhMcCy+1iFw9sgYiF5HBXL7eAy4UJZELillJ7VTYENi4ABOxdAQAC

e0MHh4iJiotEJiQWkCUfkBsmG5AfJZAWJCZENTEVojMlohw1HKIlM6IVMTWfoaOlFaepFautr58z
Ir40Lb4oNSi+LTS+IjOwQzXOz9DR0rEY1TQn1R01IAoRLzTVGLvNshWkpjUSWBesouNCoK3ntTUT
AwYe7a7M8MAtLaD+wajBgoIGGTX+HeP3owaNFRBBQXRRwwXEVxBX0GAYbxa6W7nccSw3z5Yqfe8a
xsjAkgYKlh9qfGCJggbLDClDjNjJs6cJz54hmAgdKjQIADs=
"
	    }
	    150 {
		set data "
R0lGODlhHgAeAKU9AOhHO+lHO+pIO/VLPvVMP/ROQfVOQfRYTOxcUfZjWNRwadRxafVpXtV1btZ2
b+5yae5zavdxZ/dyaNl7dPd2bMiIhO5+dfh8cu5/ddGHgvh9dOuBedyNh+2YkcWvrba2tre3t8HB
wcXFxcfHx8nJyc3NzefGw87OztHOztDQ0NPT09TU1NXV1dbW1tfX19jY2Nra2tvb29zc3N3d3eXb

29/f3+Dg4OHh4eXh4eLi4uPj4+Tk5P/+/v///////////yH5BAEKAD8ALAAAAAAeAB4AAAb+wJ9w
SCwaj8ikcslsOp9CRmJKrVqvVAbRMOhKKN2weEyJhA3EsITXu4zfA02PZ+6mu5BezwIfY/QPYXcD

AgsNAH1iAA4KAoJDYgIBiWMBjo9CFZqbnJ2enUQuLiUgpSQuIaUgLCyqIS4kqiWiRDs7LR+5KTsi
uR83N74iOym+Lba1t767vbnAwsTGyEO2uLq8vs+5w8W5xzvJtuLj5OXjyTk16jc7Nuo14jQ4tjfv
OdNC1cvYzjsdBAdMRPOG74e+a81+4SjQZcPAD9+SWfvALJsOBF04PIxIbUeMESBdEAM54p6HCRlQ
7HBBMkZBc+ZsnFABE1zHGSVywtixImdDiRw5fK7YAcPnjJfKEGYLtm0j0okVnTH9wE2azXxJKfL7
NbUqwas/ZLR7QRaeDLIvdOhAK7YGWhs7ZkCZS7euXSFBAAA7
"
	    }
	    175 {
		set data "
R0lGODlhIwAjAKU8AONIQe1JOuBOQvVIPvJORPVQQOFXS/BURPNXTe9bTfVaT/dbUNlmXtZqX/Bs
X+VwaPltY+55cOx+d+GIftyMhcmXl/uMhOecktKmpLW3tMiyr7i6t++sq+quq7q8uby+u/itqMi8
vL/CvtS+u8XHxMfJxsrMycvOys3QzNHT0NPV0tTW09XX1OnT0NbZ1dfa1tjb19vd2tze293f3OTe

3d7g3eDj3+Hk4OLl4f749//5+P3//P///////////////yH5BAEKAD8ALAAAAAAjACMAAAb+wJ9w
SCwaj8ikcslsOp9QJGRKrVqv16OiwO16v2DwwjgoDwoWiHnNNkMshTXZDNrlFu38QrcDyYtrHTs6
CHltCXwcf0RrAhQMhnkNFACLQ2wBkYaZlkIGn6ChoqOkBkYpqKmqq6ytKUY4sSketB84JrQeJDgk
uSY4H7kpsTiwsSgZyRs4JckZIjgiziU4G84oxMY4yMrMztDSydTWydix2twZy83J4NPV19lFxDAn
9tgs9ifDKfos2/pgyCNC7IaNgzZwGERYkBhCGzcGDiGWbt03HC0cDIhAA145iUIoOrPYDocEMxc8
ZjBXbN6xkd5KPjAzQSVLdDDZPcOBgcB/gAMjbIL8QWyGiqMrcMA4qsIFjhoaKoRIuILpjKHEasDY
KlDrVhk4ZMB4AaOGUq5mz7nclvNiuAzj4qkl+LKbTnfihM6dWFddzJ1v437cG7IvScDvyK0cmvBp
jMdgazyOcXXGZLMyLseycYREic+gQ4seHZpElNOoU6tezZpIEAA7
"
	    }
	    200 {
		set data "
R0lGODlhKAAoAKU4ANtDN+ZGOuZIO/JKPfVLPvVMP/VMQPVNQPROQfVOQd5YTt9YTfNXS+9aT/Bc
UORoX+hoXvdoXfdrYN11bet2bseFgNODfceMiMuWkdaVkPmOhuufmfifmPigmba2tr6+vvCxrPCy
rem6tsvEw8bGxsvLy+3Ewc3Nze3FwufIxc/Pz+fOzOLR0NXV1dfX19vb29zc3OXa2d3d3d7e3uXd
3N/f3+Hh4eTk5P///////////////////////////////yH5BAEKAD8ALAAAAAAoACgAAAb+wJ9w
SCwaj8ikcslsOp/QqHTqlESu2Kx2y71Kjo0CYUwum8/occFhFJQTGs0hnYbLywJjoNzB4Th0aH1/
ZQF6ZSF+IIFniTiLZIZFe2QKKCYLjGaWmIWHZAMAAAOaZaGjnpOlq2aSRBcVsbKztLW2sxdGL7u8
vb6/wL9GN8Q3Jx7IHic3H8keMDDOH8bOy8XDxcfJy83J0NLU28U32MTayNzO38nT58rj5eHozOrR
7PLv10Xj7une9sjaVYO3b5zBgwgT6iMyTkaLhy1k3HABsYUNYitExCDmEKLEhUP4DeyGDMaNDQYI
MEiBzxqxeP3oeaOBgAyFlgQZZhupjkWFGQg4QQoRKY7kMxsPyGQI+rIgsRYkopJocaOEVBI1boyw
MAGDixtQpVIV+kOhWRcqTJol5xTsVapWpdaocbWEW7E5Q+4sWg9cTLJE5xldF5ApW53meP7zOxDw
XsF97/1tSuQix4oSKUK0YaPi144PP96wcUT02tPjZlBZzbq169ewY0MJAgA7
"
	    }
	}
	scaleutil_calendarImg put $data
    }

    return $calendarImg







|
|
|
|
|
|
|
<




|
|
|
|
|
>
|
|
|
<




|
<
|
>
|
|
>
|
|
|
<
<




|
<
|
>
|
|
|
|
|
|
|
|




|
|
|
|
|
|
|
|
|
|
|







570
571
572
573
574
575
576
577
578
579
580
581
582
583

584
585
586
587
588
589
590
591
592
593
594
595
596

597
598
599
600
601

602
603
604
605
606
607
608
609


610
611
612
613
614

615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
    variable calendarImg
    if {![info exists calendarImg]} {
	set calendarImg [image create photo scaleutil_calendarImg]

	switch $pct {
	    100 {
		set data "
R0lGODlhFAAUAKUjAAAAAPVLPvVMP9p4cfFSRvVaT/VdUeR1bet3bra2ttGYlNOloeeinNfBv8PD
w8bGxszMzM3Nzc/Pz9HR0dPT09XV1dfX19jY2NnZ2dvb29zc3N3d3d/f3+Xe3eDg4OHh4eLi4uPj
4+Tk5P//////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////yH5BAEKAD8ALAAAAAAUABQAAAagwJ9w
SCwaj8iiIcBsOp+F4XM6lVKvASu2KlR4v+CwdyjKOBwVyflzhlzOFxHZkkhIHnVP3UGpU+RCInR2
eAl6CXx+gD8iIR4eIB+PIiIdIiCPIIuCdXd5CAIMfQl/c52FHgQBB6OlgRoPDxYTsR8LAw0YsRib
HBISGRa/IBIRFRu/G5uDnoZ7rcunec+KQ5IWFhwa2CHYGR7YHiFJ5OXmQQA7

"
	    }
	    125 {
		set data "
R0lGODlhGQAZAKUtAAAAAPVLPvRLP/VMP9tfVvFTR/FgVel4b/drYfdrYvdsYfBzaba2tri4uLm5
uby8vL+/v9iYk8Kwr8O7uuerp+jAvcPDw8bGxsfHx8rKys3Nzc/Pz9jCwdDQ0NHR0dLS0tPT09TU
1NjY2NnZ2dvb29zc3N7e3uTb2uDg4OHh4eLi4uPj4+Tk5P//////////////////////////////
/////////////////////////////////////////////yH5BAEKAD8ALAAAAAAZABkAAAbowJ9w
SCwaj8ikcrlMKJ7QqDSKIA4C2Kx2qx0QueDwN0zOjstkImHNbrvfxE+nQfdg6JAPhI7x0BsdH0Qs
KAyGKh6GFiwWhh4qhgwoLIOFh4kMi40Mj5GTgyoaoiskoiEsIaIkK6IaKpRDLLKztLW2lQ65KyC5
FywVBgsnK7kOn7GWDIiKLAdYFJCGx0KEkcuZLBECBRzRkrDUpCQkhOMmLCMSEyks46vgPywrIvSE
9CUsJfST9CIr8NUuMdvUSRrAZNc0OfI2LR6KBxBXhICIgQUGiCFWQHzQMMOGjyBDigyZgYnJkyaD
AAA7

"
	    }
	    150 {
		set data "
R0lGODlhHgAeAKUsAAAAAPVLPvVMP9l7dOxcUfROQfRYTPZjWPVpXuuBeba2tre3t8iIhNGHgtyN

h8Wvre2YkcHBwcXFxcfHx8nJyc3Nzc7OztHOztDQ0NPT09TU1NXV1dbW1tfX19jY2Nra2tvb29zc
3N3d3d/f3+fGw+Xb2+Dg4OHh4eLi4uPj4+Xh4eTk5P//////////////////////////////////
/////////////////////////////////////////////yH5BAEKAD8ALAAAAAAeAB4AAAb+wJ9w
SCwaj8ikcslsOp9CxGFKrVqvVASxEOh6v+Cwt0AUm8/dMnr9VbPZ7jeayKjb7/g8ntjpVBaAFB0R
gAsbG4URHRSFFX1EKyscCpQYKxKUCicnmRIrGJkckZCSmZaYlJudn6GjQ5GTlZeZqpSeoJSiK6SR
vb6/wL6kKCPFJysmxSO9JSqRJ8oorkKwprOpKxACBiSsudM/1bKomipcAQneCrqksQqntCkEXQ7q
7K8rIBP7HZ/7E9IeDGhwYUWHfyDABQtmwkKGhbvwiahA8cMKDRQroECRUcOKDxlFKCw1jhYnW/ZG
uoOX6qSCW60iUiP57pomlzC/yfwRApkZh5/LQvz0kCLF0J4jhppYIQKK06dQowoJAgA7


"
	    }
	    175 {
		set data "
R0lGODlhIwAjAKUuAAAAAPVIPuFXS/JORPBURPVQQPVaT/dbUPBsX+VwaO55cOx+d/ltY+GIfrW3

tLi6t7q8uby+u7/CvsmXl8iyr8i8vNKmpNS+u+ecksXHxMfJxsrMycvOys3QzNHT0NPV0tTW09XX
1NbZ1dfa1tjb19vd2tze293f3N7g3eTe3enT0ODj3+Hk4OLl4f//////////////////////////
/////////////////////////////////////////////yH5BAEKAD8ALAAAAAAjACMAAAb+wJ9w
SCwaj8ikcslsOp9QJGNKrVqv16OhwO16v2DwwRgom8/otDpAXrvf7CJ8nm7T7/b73Cjo+/+AgYIC
Rh6Gh4iJioseRi2PHhCSES0bkhAZLRmXGy0Rlx6PLY6PHQ6nDy0apw4SLRKsGi0PrB2ipC2mqKqs
rrCnsrSnto+4ug6pq6e+sbO1t0WiJBzUtiHUHKEe2CG52CTQRKIsK+UrLeTm46LmKyzhQ6LHyb0t
KggBCinOw/BC8qzoLWuxwAwGfg6IjYpWKiCvgQnMNECo0JhDZa1aWBgQgMAFiv5+iDrxoSSIFiRK
fhDRAgWFCRXOgVB5IqQoFCRygsOZ00RZCxMkRpBAgVIn0WIMc12s98tBsGdIxTXchZEZMJBR401F
9jBj06f9sv7bKtBrM2EJQ55rWaKtTxRtS9Q8EZeoibqPVhzJoKGv37+AA//NEKWw4cOIEysmEgQA
Ow==
"
	    }
	    200 {
		set data "
R0lGODlhKAAoAKUsAAAAAOZGOuZIO/VLPvVMP911be9aT/VMQPROQfNXS/BcUORoX+hoXvdoXet2
bvdrYNODfba2tr6+vseFgMeMiMuWkdaVkOufmem6tsbGxsvEw8vLy83Nzc/Pz9XV1dfX19vb29zc
3N3d3d7e3t/f3+fIxefOzOLR0OXa2eXd3OHh4eTk5P//////////////////////////////////
/////////////////////////////////////////////yH5BAEKAD8ALAAAAAAoACgAAAb+wJ9w
SCwaj8ikcslsOp/QqHTqfDSu2Kx2y70+jgbCYEwum8/oMUFhFKTfcLPAGIjb3wH6fW/OF+t8gX5E
gIF7g0OFhnaIQhQTkJGSk5SVkhRGIJqbnJ2en55GK6MrHBGnERwrEqgRISGtEqWtqqSipKaoqqyo
r7GzuqQrt6O5p7utvqiyxqnCxMDHq8mwy9HOtkXCzci91afMtM/awuXm5+jZRMIiHu4eIisf7x4q
oyYYKKPt7/HqQ9vE8ToVYsWFAwMSlLhWaxQ0btN6pUBAxgHDcetwCUx2ogyDi/+EBAw20JWKBWQs
gHRIbpSHDDAzeFixIWYGEis0QChQ4cNgipcxZ4b8ka7ohw4Fiw5r+dPmzJoxSZCwuaFpUIwANZKk
9gvi0JHSSioDt3JpxmIbvXUV91VrWK7WvLIkYm8fvXjz3qlQQc8nP3f+Vqg4ElipYWEjqChezLix
48eQoQQBADs=
"
	    }
	}
	scaleutil_calendarImg put $data
    }

    return $calendarImg
Changes to jni/tcl/macosx/tclMacOSXBundle.c.
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116

    if (!initialized) {
#if TCL_DYLD_USE_DLFCN
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1040
	if (tclMacOSXDarwinRelease >= 8)
#endif
	{
	    openresourcemap = dlsym(RTLD_NEXT,
		    "CFBundleOpenBundleResourceMap");
#ifdef TCL_DEBUG_LOAD
	    if (!openresourcemap) {
		const char *errMsg = dlerror();

		TclLoadDbgMsg("dlsym() failed: %s", errMsg);
	    }







|







102
103
104
105
106
107
108
109
110
111
112
113
114
115
116

    if (!initialized) {
#if TCL_DYLD_USE_DLFCN
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1040
	if (tclMacOSXDarwinRelease >= 8)
#endif
	{
	    openresourcemap = (short (*)(CFBundleRef))dlsym(RTLD_NEXT,
		    "CFBundleOpenBundleResourceMap");
#ifdef TCL_DEBUG_LOAD
	    if (!openresourcemap) {
		const char *errMsg = dlerror();

		TclLoadDbgMsg("dlsym() failed: %s", errMsg);
	    }
Changes to jni/tcl/macosx/tclMacOSXFCmd.c.
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
    u_int32_t creator;
    u_int16_t fdFlags;
    u_int32_t location;
    u_int16_t reserved;
    u_int32_t extendedFileInfo[4];
} __attribute__ ((__packed__)) finderinfo;

typedef struct fileinfobuf {
    u_int32_t info_length;
    u_int32_t data[8];
} fileinfobuf;

/*
 *----------------------------------------------------------------------
 *







|







102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
    u_int32_t creator;
    u_int16_t fdFlags;
    u_int32_t location;
    u_int16_t reserved;
    u_int32_t extendedFileInfo[4];
} __attribute__ ((__packed__)) finderinfo;

typedef struct {
    u_int32_t info_length;
    u_int32_t data[8];
} fileinfobuf;

/*
 *----------------------------------------------------------------------
 *
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
    bzero(&alist, sizeof(struct attrlist));
    alist.bitmapcount = ATTR_BIT_MAP_COUNT;
    if (objIndex == MACOSX_RSRCLENGTH_ATTRIBUTE) {
	alist.fileattr = ATTR_FILE_RSRCLENGTH;
    } else {
	alist.commonattr = ATTR_CMN_FNDRINFO;
    }
    native = Tcl_FSGetNativePath(fileName);
    result = getattrlist(native, &alist, &finfo, sizeof(fileinfobuf), 0);

    if (result != 0) {
	Tcl_SetObjResult(interp, Tcl_ObjPrintf(
		"could not read attributes of \"%s\": %s",
		TclGetString(fileName), Tcl_PosixError(interp)));
	return TCL_ERROR;







|







168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
    bzero(&alist, sizeof(struct attrlist));
    alist.bitmapcount = ATTR_BIT_MAP_COUNT;
    if (objIndex == MACOSX_RSRCLENGTH_ATTRIBUTE) {
	alist.fileattr = ATTR_FILE_RSRCLENGTH;
    } else {
	alist.commonattr = ATTR_CMN_FNDRINFO;
    }
    native = (const char *)Tcl_FSGetNativePath(fileName);
    result = getattrlist(native, &alist, &finfo, sizeof(fileinfobuf), 0);

    if (result != 0) {
	Tcl_SetObjResult(interp, Tcl_ObjPrintf(
		"could not read attributes of \"%s\": %s",
		TclGetString(fileName), Tcl_PosixError(interp)));
	return TCL_ERROR;
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
    bzero(&alist, sizeof(struct attrlist));
    alist.bitmapcount = ATTR_BIT_MAP_COUNT;
    if (objIndex == MACOSX_RSRCLENGTH_ATTRIBUTE) {
	alist.fileattr = ATTR_FILE_RSRCLENGTH;
    } else {
	alist.commonattr = ATTR_CMN_FNDRINFO;
    }
    native = Tcl_FSGetNativePath(fileName);
    result = getattrlist(native, &alist, &finfo, sizeof(fileinfobuf), 0);

    if (result != 0) {
	Tcl_SetObjResult(interp, Tcl_ObjPrintf(
		"could not read attributes of \"%s\": %s",
		TclGetString(fileName), Tcl_PosixError(interp)));
	return TCL_ERROR;







|







264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
    bzero(&alist, sizeof(struct attrlist));
    alist.bitmapcount = ATTR_BIT_MAP_COUNT;
    if (objIndex == MACOSX_RSRCLENGTH_ATTRIBUTE) {
	alist.fileattr = ATTR_FILE_RSRCLENGTH;
    } else {
	alist.commonattr = ATTR_CMN_FNDRINFO;
    }
    native = (const char *)Tcl_FSGetNativePath(fileName);
    result = getattrlist(native, &alist, &finfo, sizeof(fileinfobuf), 0);

    if (result != 0) {
	Tcl_SetObjResult(interp, Tcl_ObjPrintf(
		"could not read attributes of \"%s\": %s",
		TclGetString(fileName), Tcl_PosixError(interp)));
	return TCL_ERROR;
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
	     * Construct path to resource fork.
	     */

	    Tcl_DStringInit(&ds);
	    Tcl_DStringAppend(&ds, native, -1);
	    Tcl_DStringAppend(&ds, _PATH_RSRCFORKSPEC, -1);

	    result = truncate(Tcl_DStringValue(&ds), (off_t)0);
	    if (result != 0) {
		/*
		 * truncate() on a valid resource fork path may fail with a
		 * permission error in some OS releases, try truncating with
		 * open() instead:
		 */








|







343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
	     * Construct path to resource fork.
	     */

	    Tcl_DStringInit(&ds);
	    Tcl_DStringAppend(&ds, native, -1);
	    Tcl_DStringAppend(&ds, _PATH_RSRCFORKSPEC, -1);

	    result = truncate(Tcl_DStringValue(&ds), 0);
	    if (result != 0) {
		/*
		 * truncate() on a valid resource fork path may fail with a
		 * permission error in some OS releases, try truncating with
		 * open() instead:
		 */

Changes to jni/tcl/macosx/tclMacOSXNotify.c.
27
28
29
30
31
32
33



34
35
36
37
38
39
40
41
42
43
44

45
46
47
48
49

50
51
52

53
54
55
56
57
58
59
 * overhead. Note that these are not pure spinlocks, they employ various
 * strategies to back off and relinquish the processor, making them immune to
 * most priority-inversion livelocks (c.f. 'man 3 OSSpinLockLock' and Darwin
 * sources: xnu/osfmk/{ppc,i386}/commpage/spinlocks.s).
 */

#if defined(HAVE_LIBKERN_OSATOMIC_H) && defined(HAVE_OSSPINLOCKLOCK)



/*
 * Use OSSpinLock API where available (Tiger or later).
 */

#include <libkern/OSAtomic.h>

#if defined(HAVE_WEAK_IMPORT) && MAC_OS_X_VERSION_MIN_REQUIRED < 1040
/*
 * Support for weakly importing spinlock API.
 */
#define WEAK_IMPORT_SPINLOCKLOCK

#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
#define VOLATILE volatile
#else
#define VOLATILE
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */

#ifndef bool
#define bool int
#endif

extern void		OSSpinLockLock(VOLATILE OSSpinLock *lock)
			    WEAK_IMPORT_ATTRIBUTE;
extern void		OSSpinLockUnlock(VOLATILE OSSpinLock *lock)
			    WEAK_IMPORT_ATTRIBUTE;
extern bool		OSSpinLockTry(VOLATILE OSSpinLock *lock)
			    WEAK_IMPORT_ATTRIBUTE;
extern void		_spin_lock(VOLATILE OSSpinLock *lock)







>
>
>











>





>



>







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
 * overhead. Note that these are not pure spinlocks, they employ various
 * strategies to back off and relinquish the processor, making them immune to
 * most priority-inversion livelocks (c.f. 'man 3 OSSpinLockLock' and Darwin
 * sources: xnu/osfmk/{ppc,i386}/commpage/spinlocks.s).
 */

#if defined(HAVE_LIBKERN_OSATOMIC_H) && defined(HAVE_OSSPINLOCKLOCK)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#pragma GCC diagnostic ignored "-Wunused-function"
/*
 * Use OSSpinLock API where available (Tiger or later).
 */

#include <libkern/OSAtomic.h>

#if defined(HAVE_WEAK_IMPORT) && MAC_OS_X_VERSION_MIN_REQUIRED < 1040
/*
 * Support for weakly importing spinlock API.
 */
#define WEAK_IMPORT_SPINLOCKLOCK

#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
#define VOLATILE volatile
#else
#define VOLATILE
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */

#ifndef bool
#define bool int
#endif

extern void		OSSpinLockLock(VOLATILE OSSpinLock *lock)
			    WEAK_IMPORT_ATTRIBUTE;
extern void		OSSpinLockUnlock(VOLATILE OSSpinLock *lock)
			    WEAK_IMPORT_ATTRIBUTE;
extern bool		OSSpinLockTry(VOLATILE OSSpinLock *lock)
			    WEAK_IMPORT_ATTRIBUTE;
extern void		_spin_lock(VOLATILE OSSpinLock *lock)
97
98
99
100
101
102
103

104
105
106
107
108
109
110
extern void		_spin_unlock(OSSpinLock *lock);
extern int		_spin_lock_try(OSSpinLock *lock);
#define SpinLockLock(p) 	_spin_lock(p)
#define SpinLockUnlock(p)	_spin_unlock(p)
#define SpinLockTry(p)		_spin_lock_try(p)
#define SPINLOCK_INIT		0


#endif /* HAVE_LIBKERN_OSATOMIC_H && HAVE_OSSPINLOCKLOCK */

/*
 * These spinlocks lock access to the global notifier state.
 */

static OSSpinLock notifierInitLock = SPINLOCK_INIT;







>







103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
extern void		_spin_unlock(OSSpinLock *lock);
extern int		_spin_lock_try(OSSpinLock *lock);
#define SpinLockLock(p) 	_spin_lock(p)
#define SpinLockUnlock(p)	_spin_unlock(p)
#define SpinLockTry(p)		_spin_lock_try(p)
#define SPINLOCK_INIT		0

#pragma GCC diagnostic pop
#endif /* HAVE_LIBKERN_OSATOMIC_H && HAVE_OSSPINLOCKLOCK */

/*
 * These spinlocks lock access to the global notifier state.
 */

static OSSpinLock notifierInitLock = SPINLOCK_INIT;
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
} FileHandler;

/*
 * The following structure is what is added to the Tcl event queue when file
 * handlers are ready to fire.
 */

typedef struct FileHandlerEvent {
    Tcl_Event header;		/* Information that is standard for all
				 * events. */
    int fd;			/* File descriptor that is ready. Used to find
				 * the FileHandler structure for the file
				 * (can't point directly to the FileHandler
				 * structure because it could go away while
				 * the event is queued). */
} FileHandlerEvent;

/*
 * The following structure contains a set of select() masks to track readable,
 * writable, and exceptional conditions.
 */

typedef struct SelectMasks {
    fd_set readable;
    fd_set writable;
    fd_set exceptional;
} SelectMasks;

/*
 * The following static structure contains the state information for the







|














|







220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
} FileHandler;

/*
 * The following structure is what is added to the Tcl event queue when file
 * handlers are ready to fire.
 */

typedef struct {
    Tcl_Event header;		/* Information that is standard for all
				 * events. */
    int fd;			/* File descriptor that is ready. Used to find
				 * the FileHandler structure for the file
				 * (can't point directly to the FileHandler
				 * structure because it could go away while
				 * the event is queued). */
} FileHandlerEvent;

/*
 * The following structure contains a set of select() masks to track readable,
 * writable, and exceptional conditions.
 */

typedef struct {
    fd_set readable;
    fd_set writable;
    fd_set exceptional;
} SelectMasks;

/*
 * The following static structure contains the state information for the
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
 *	notifier instance.
 *
 *----------------------------------------------------------------------
 */

void
Tcl_FinalizeNotifier(
    ClientData clientData)		/* Not used. */
{
    ThreadSpecificData *tsdPtr;

    if (tclNotifierHooks.finalizeNotifierProc) {
	tclNotifierHooks.finalizeNotifierProc(clientData);
	return;
    }







|







726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
 *	notifier instance.
 *
 *----------------------------------------------------------------------
 */

void
Tcl_FinalizeNotifier(
    ClientData clientData)
{
    ThreadSpecificData *tsdPtr;

    if (tclNotifierHooks.finalizeNotifierProc) {
	tclNotifierHooks.finalizeNotifierProc(clientData);
	return;
    }
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
 *----------------------------------------------------------------------
 */

void
Tcl_AlertNotifier(
    ClientData clientData)
{
    ThreadSpecificData *tsdPtr = clientData;

    if (tclNotifierHooks.alertNotifierProc) {
	tclNotifierHooks.alertNotifierProc(clientData);
	return;
    }

    LOCK_NOTIFIER_TSD;







|







837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
 *----------------------------------------------------------------------
 */

void
Tcl_AlertNotifier(
    ClientData clientData)
{
    ThreadSpecificData *tsdPtr = (ThreadSpecificData *)clientData;

    if (tclNotifierHooks.alertNotifierProc) {
	tclNotifierHooks.alertNotifierProc(clientData);
	return;
    }

    LOCK_NOTIFIER_TSD;
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
    for (filePtr = tsdPtr->firstFileHandlerPtr; filePtr != NULL;
	    filePtr = filePtr->nextPtr) {
	if (filePtr->fd == fd) {
	    break;
	}
    }
    if (filePtr == NULL) {
	filePtr = ckalloc(sizeof(FileHandler));
	filePtr->fd = fd;
	filePtr->readyMask = 0;
	filePtr->nextPtr = tsdPtr->firstFileHandlerPtr;
	tsdPtr->firstFileHandlerPtr = filePtr;
    }
    filePtr->proc = proc;
    filePtr->clientData = clientData;







|







1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
    for (filePtr = tsdPtr->firstFileHandlerPtr; filePtr != NULL;
	    filePtr = filePtr->nextPtr) {
	if (filePtr->fd == fd) {
	    break;
	}
    }
    if (filePtr == NULL) {
	filePtr = (FileHandler *)ckalloc(sizeof(FileHandler));
	filePtr->fd = fd;
	filePtr->readyMask = 0;
	filePtr->nextPtr = tsdPtr->firstFileHandlerPtr;
	tsdPtr->firstFileHandlerPtr = filePtr;
    }
    filePtr->proc = proc;
    filePtr->clientData = clientData;
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366

static void
QueueFileEvents(
    void *info)
{
    SelectMasks readyMasks;
    FileHandler *filePtr;
    ThreadSpecificData *tsdPtr = info;

    /*
     * Queue all detected file events.
     */

    LOCK_NOTIFIER_TSD;
    FD_COPY(&tsdPtr->readyMasks.readable, &readyMasks.readable);







|







1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373

static void
QueueFileEvents(
    void *info)
{
    SelectMasks readyMasks;
    FileHandler *filePtr;
    ThreadSpecificData *tsdPtr = (ThreadSpecificData *)info;

    /*
     * Queue all detected file events.
     */

    LOCK_NOTIFIER_TSD;
    FD_COPY(&tsdPtr->readyMasks.readable, &readyMasks.readable);
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405

	/*
	 * Don't bother to queue an event if the mask was previously non-zero
	 * since an event must still be on the queue.
	 */

	if (filePtr->readyMask == 0) {
	    FileHandlerEvent *fileEvPtr = ckalloc(sizeof(FileHandlerEvent));

	    fileEvPtr->header.proc = FileHandlerEventProc;
	    fileEvPtr->fd = filePtr->fd;
	    Tcl_QueueEvent((Tcl_Event *) fileEvPtr, TCL_QUEUE_TAIL);
	}
	filePtr->readyMask = mask;
    }







|







1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412

	/*
	 * Don't bother to queue an event if the mask was previously non-zero
	 * since an event must still be on the queue.
	 */

	if (filePtr->readyMask == 0) {
	    FileHandlerEvent *fileEvPtr = (FileHandlerEvent *)ckalloc(sizeof(FileHandlerEvent));

	    fileEvPtr->header.proc = FileHandlerEventProc;
	    fileEvPtr->fd = filePtr->fd;
	    Tcl_QueueEvent((Tcl_Event *) fileEvPtr, TCL_QUEUE_TAIL);
	}
	filePtr->readyMask = mask;
    }
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438

static void
UpdateWaitingListAndServiceEvents(
    CFRunLoopObserverRef observer,
    CFRunLoopActivity activity,
    void *info)
{
    ThreadSpecificData *tsdPtr = info;

    if (tsdPtr->sleeping) {
	return;
    }
    switch (activity) {
    case kCFRunLoopEntry:
	tsdPtr->runLoopNestingLevel++;







|







1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445

static void
UpdateWaitingListAndServiceEvents(
    CFRunLoopObserverRef observer,
    CFRunLoopActivity activity,
    void *info)
{
    ThreadSpecificData *tsdPtr = (ThreadSpecificData *)info;

    if (tsdPtr->sleeping) {
	return;
    }
    switch (activity) {
    case kCFRunLoopEntry:
	tsdPtr->runLoopNestingLevel++;
1453
1454
1455
1456
1457
1458
1459

1460


1461
1462
1463
1464
1465
1466
1467
	tsdPtr->runLoopNestingLevel--;
	break;
    case kCFRunLoopBeforeWaiting:
	if (tsdPtr->runLoopTimer && !tsdPtr->runLoopServicingEvents &&
		(tsdPtr->runLoopNestingLevel > 1
			|| !tsdPtr->runLoopRunning)) {
	    tsdPtr->runLoopServicingEvents = 1;

            /* This call seems to simply force event processing through and prevents hangups that have long been observed with Tk-Cocoa.  */


	    Tcl_ServiceAll();
	    tsdPtr->runLoopServicingEvents = 0;
	}
	break;
    default:
	break;
    }







>
|
>
>







1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
	tsdPtr->runLoopNestingLevel--;
	break;
    case kCFRunLoopBeforeWaiting:
	if (tsdPtr->runLoopTimer && !tsdPtr->runLoopServicingEvents &&
		(tsdPtr->runLoopNestingLevel > 1
			|| !tsdPtr->runLoopRunning)) {
	    tsdPtr->runLoopServicingEvents = 1;
            /*
	     * This call seems to simply force event processing through and
	     * prevents hangups that have long been observed with Tk-Cocoa.
	     */
	    Tcl_ServiceAll();
	    tsdPtr->runLoopServicingEvents = 0;
	}
	break;
    default:
	break;
    }
1929
1930
1931
1932
1933
1934
1935

1936
1937
1938
1939
1940
1941
1942
		asyncPending = 0;
		TclAsyncMarkFromNotifier();
	    }

	    /*
	     * Try again immediately on an error.
	     */

	    continue;
	}

	/*
	 * Alert any threads that are waiting on a ready file descriptor.
	 */








>







1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
		asyncPending = 0;
		TclAsyncMarkFromNotifier();
	    }

	    /*
	     * Try again immediately on an error.
	     */

	    continue;
	}

	/*
	 * Alert any threads that are waiting on a ready file descriptor.
	 */

1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
		tsdPtr->polled = 0;
		if (tsdPtr->runLoop) {
		    CFRunLoopSourceSignal(tsdPtr->runLoopSource);
		    CFRunLoopWakeUp(tsdPtr->runLoop);
		}
	    }
	}

	UNLOCK_NOTIFIER;

	/*
	 * Consume the next byte from the notifier pipe if the pipe was
	 * readable. Note that there may be multiple bytes pending, but to
	 * avoid a race condition we only read one at a time.
	 */







<







2003
2004
2005
2006
2007
2008
2009

2010
2011
2012
2013
2014
2015
2016
		tsdPtr->polled = 0;
		if (tsdPtr->runLoop) {
		    CFRunLoopSourceSignal(tsdPtr->runLoopSource);
		    CFRunLoopWakeUp(tsdPtr->runLoop);
		}
	    }
	}

	UNLOCK_NOTIFIER;

	/*
	 * Consume the next byte from the notifier pipe if the pipe was
	 * readable. Note that there may be multiple bytes pending, but to
	 * avoid a race condition we only read one at a time.
	 */