Skip to content

Commit a91be3f

Browse files
dasspearce
authored andcommitted
git-gui: Fixes for Mac OS X TkAqua
- detect more Tk.framework variants - fix apple menu setup, use native preferences menu item - don't set menu font Signed-off-by: Daniel A. Steffen <[email protected]> Signed-off-by: Shawn O. Pearce <[email protected]>
1 parent c736b4c commit a91be3f

File tree

2 files changed

+22
-19
lines changed

2 files changed

+22
-19
lines changed

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,11 @@ endif
105105

106106
ifeq ($(uname_S),Darwin)
107107
TKFRAMEWORK = /Library/Frameworks/Tk.framework/Resources/Wish.app
108-
ifeq ($(shell expr "$(uname_R)" : '9\.'),2)
109-
TKFRAMEWORK = /System/Library/Frameworks/Tk.framework/Resources/Wish\ Shell.app
108+
ifeq ($(shell echo "$(uname_R)" | awk -F. '{if ($$1 >= 9) print "y"}')_$(shell test -d $(TKFRAMEWORK) || echo n),y_n)
109+
TKFRAMEWORK = /System/Library/Frameworks/Tk.framework/Resources/Wish.app
110+
ifeq ($(shell test -d $(TKFRAMEWORK) || echo n),n)
111+
TKFRAMEWORK = /System/Library/Frameworks/Tk.framework/Resources/Wish\ Shell.app
112+
endif
110113
endif
111114
TKEXECUTABLE = $(shell basename "$(TKFRAMEWORK)" .app)
112115
endif

git-gui.sh

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -663,10 +663,13 @@ font create font_diffbold
663663
font create font_diffitalic
664664
665665
foreach class {Button Checkbutton Entry Label
666-
Labelframe Listbox Menu Message
666+
Labelframe Listbox Message
667667
Radiobutton Spinbox Text} {
668668
option add *$class.font font_ui
669669
}
670+
if {![is_MacOSX]} {
671+
option add *Menu.font font_ui
672+
}
670673
unset class
671674
672675
if {[is_Windows] || [is_MacOSX]} {
@@ -2301,6 +2304,12 @@ set ui_comm {}
23012304
# -- Menu Bar
23022305
#
23032306
menu .mbar -tearoff 0
2307+
if {[is_MacOSX]} {
2308+
# -- Apple Menu (Mac OS X only)
2309+
#
2310+
.mbar add cascade -label Apple -menu .mbar.apple
2311+
menu .mbar.apple
2312+
}
23042313
.mbar add cascade -label [mc Repository] -menu .mbar.repository
23052314
.mbar add cascade -label [mc Edit] -menu .mbar.edit
23062315
if {[is_enabled branch]} {
@@ -2316,7 +2325,6 @@ if {[is_enabled transport]} {
23162325
if {[is_enabled multicommit] || [is_enabled singlecommit]} {
23172326
.mbar add cascade -label [mc Tools] -menu .mbar.tools
23182327
}
2319-
. configure -menu .mbar
23202328
23212329
# -- Repository Menu
23222330
#
@@ -2569,19 +2577,7 @@ if {[is_enabled transport]} {
25692577
}
25702578
25712579
if {[is_MacOSX]} {
2572-
# -- Apple Menu (Mac OS X only)
2573-
#
2574-
.mbar add cascade -label Apple -menu .mbar.apple
2575-
menu .mbar.apple
2576-
2577-
.mbar.apple add command -label [mc "About %s" [appname]] \
2578-
-command do_about
2579-
.mbar.apple add separator
2580-
.mbar.apple add command \
2581-
-label [mc "Preferences..."] \
2582-
-command do_options \
2583-
-accelerator $M1T-,
2584-
bind . <$M1B-,> do_options
2580+
proc ::tk::mac::ShowPreferences {} {do_options}
25852581
} else {
25862582
# -- Edit Menu
25872583
#
@@ -2609,11 +2605,15 @@ if {[is_enabled multicommit] || [is_enabled singlecommit]} {
26092605
.mbar add cascade -label [mc Help] -menu .mbar.help
26102606
menu .mbar.help
26112607
2612-
if {![is_MacOSX]} {
2608+
if {[is_MacOSX]} {
2609+
.mbar.apple add command -label [mc "About %s" [appname]] \
2610+
-command do_about
2611+
.mbar.apple add separator
2612+
} else {
26132613
.mbar.help add command -label [mc "About %s" [appname]] \
26142614
-command do_about
26152615
}
2616-
2616+
. configure -menu .mbar
26172617
26182618
set doc_path [githtmldir]
26192619
if {$doc_path ne {}} {

0 commit comments

Comments
 (0)