@@ -1739,6 +1739,24 @@ proc removehead {id name} {
1739
1739
unset headids($name )
1740
1740
}
1741
1741
1742
+ proc make_transient {window origin} {
1743
+ global have_tk85
1744
+
1745
+ # In MacOS Tk 8.4 transient appears to work by setting
1746
+ # overrideredirect, which is utterly useless, since the
1747
+ # windows get no border, and are not even kept above
1748
+ # the parent.
1749
+ if {!$have_tk85 && [tk windowingsystem] eq {aqua}} return
1750
+
1751
+ wm transient $window $origin
1752
+
1753
+ # Windows fails to place transient windows normally, so
1754
+ # schedule a callback to center them on the parent.
1755
+ if {[tk windowingsystem] eq {win32}} {
1756
+ after idle [list tk::PlaceWindow $window widget $origin ]
1757
+ }
1758
+ }
1759
+
1742
1760
proc show_error {w top msg} {
1743
1761
message $w .m -text $msg -justify center -aspect 400
1744
1762
pack $w .m -side top -fill x -padx 20 -pady 20
@@ -1754,7 +1772,7 @@ proc show_error {w top msg} {
1754
1772
proc error_popup {msg {owner .}} {
1755
1773
set w .error
1756
1774
toplevel $w
1757
- wm transient $w $owner
1775
+ make_transient $w $owner
1758
1776
show_error $w $w $msg
1759
1777
}
1760
1778
@@ -1763,7 +1781,7 @@ proc confirm_popup {msg {owner .}} {
1763
1781
set confirm_ok 0
1764
1782
set w .confirm
1765
1783
toplevel $w
1766
- wm transient $w $owner
1784
+ make_transient $w $owner
1767
1785
message $w .m -text $msg -justify center -aspect 400
1768
1786
pack $w .m -side top -fill x -padx 20 -pady 20
1769
1787
button $w .ok -text [mc OK] -command " set confirm_ok 1; destroy $w "
@@ -2558,7 +2576,7 @@ proc about {} {
2558
2576
}
2559
2577
toplevel $w
2560
2578
wm title $w [mc " About gitk" ]
2561
- wm transient $w .
2579
+ make_transient $w .
2562
2580
message $w .m -text [mc "
2563
2581
Gitk - a commit viewer for git
2564
2582
@@ -2587,7 +2605,7 @@ proc keys {} {
2587
2605
}
2588
2606
toplevel $w
2589
2607
wm title $w [mc " Gitk key bindings" ]
2590
- wm transient $w .
2608
+ make_transient $w .
2591
2609
message $w .m -text "
2592
2610
[ mc " Gitk key bindings:" ]
2593
2611
@@ -3669,7 +3687,7 @@ proc vieweditor {top n title} {
3669
3687
3670
3688
toplevel $top
3671
3689
wm title $top $title
3672
- wm transient $top .
3690
+ make_transient $top .
3673
3691
3674
3692
# View name
3675
3693
frame $top .nfr
@@ -7912,7 +7930,7 @@ proc mkpatch {} {
7912
7930
set patchtop $top
7913
7931
catch {destroy $top }
7914
7932
toplevel $top
7915
- wm transient $top .
7933
+ make_transient $top .
7916
7934
label $top .title -text [mc " Generate patch" ]
7917
7935
grid $top .title - -pady 10
7918
7936
label $top .from -text [mc " From:" ]
@@ -7999,7 +8017,7 @@ proc mktag {} {
7999
8017
set mktagtop $top
8000
8018
catch {destroy $top }
8001
8019
toplevel $top
8002
- wm transient $top .
8020
+ make_transient $top .
8003
8021
label $top .title -text [mc " Create tag" ]
8004
8022
grid $top .title - -pady 10
8005
8023
label $top .id -text [mc " ID:" ]
@@ -8102,7 +8120,7 @@ proc writecommit {} {
8102
8120
set wrcomtop $top
8103
8121
catch {destroy $top }
8104
8122
toplevel $top
8105
- wm transient $top .
8123
+ make_transient $top .
8106
8124
label $top .title -text [mc " Write commit to file" ]
8107
8125
grid $top .title - -pady 10
8108
8126
label $top .id -text [mc " ID:" ]
@@ -8159,7 +8177,7 @@ proc mkbranch {} {
8159
8177
set top .makebranch
8160
8178
catch {destroy $top }
8161
8179
toplevel $top
8162
- wm transient $top .
8180
+ make_transient $top .
8163
8181
label $top .title -text [mc " Create new branch" ]
8164
8182
grid $top .title - -pady 10
8165
8183
label $top .id -text [mc " ID:" ]
@@ -8322,7 +8340,7 @@ proc resethead {} {
8322
8340
set confirm_ok 0
8323
8341
set w " .confirmreset"
8324
8342
toplevel $w
8325
- wm transient $w .
8343
+ make_transient $w .
8326
8344
wm title $w [mc " Confirm reset" ]
8327
8345
message $w .m -text \
8328
8346
[mc " Reset branch %s to %s?" $mainhead [string range $rowmenuid 0 7]] \
@@ -8502,7 +8520,7 @@ proc showrefs {} {
8502
8520
}
8503
8521
toplevel $top
8504
8522
wm title $top [mc " Tags and heads: %s" [file tail [pwd ]]]
8505
- wm transient $top .
8523
+ make_transient $top .
8506
8524
text $top .list -background $bgcolor -foreground $fgcolor \
8507
8525
-selectbackground $selectbgcolor -font mainfont \
8508
8526
-xscrollcommand " $top .xsb set" -yscrollcommand " $top .ysb set" \
@@ -9844,7 +9862,7 @@ proc choosefont {font which} {
9844
9862
font create sample
9845
9863
eval font config sample [font actual $font ]
9846
9864
toplevel $top
9847
- wm transient $top $prefstop
9865
+ make_transient $top $prefstop
9848
9866
wm title $top [mc " Gitk font chooser" ]
9849
9867
label $top .l -textvariable fontparam(which)
9850
9868
pack $top .l -side top
@@ -9961,7 +9979,7 @@ proc doprefs {} {
9961
9979
}
9962
9980
toplevel $top
9963
9981
wm title $top [mc " Gitk preferences" ]
9964
- wm transient $top .
9982
+ make_transient $top .
9965
9983
label $top .ldisp -text [mc " Commit list display options" ]
9966
9984
grid $top .ldisp - -sticky w -pady 10
9967
9985
label $top .spacer -text " "
0 commit comments