Skip to content

Commit d277e89

Browse files
committed
gitk: Use <Button-2> for context menus on OSX
An OSX user has reported that gitk's context menus are not usable under OSX because it doesn't provide a way to generate <Button-3> events. Users can generate <Button-2> events with command+click, so use that for the context menus instead on OSX. Signed-off-by: Paul Mackerras <[email protected]>
1 parent 77aa0ae commit d277e89

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

gitk

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2166,7 +2166,8 @@ proc makewindow {} {
21662166
bind $cflist <1> {sel_flist %W %x %y; break}
21672167
bind $cflist <B1-Motion> {sel_flist %W %x %y; break}
21682168
bind $cflist <ButtonRelease-1> {treeclick %W %x %y}
2169-
bind $cflist <Button-3> {pop_flist_menu %W %X %Y %x %y}
2169+
global ctxbut
2170+
bind $cflist $ctxbut {pop_flist_menu %W %X %Y %x %y}
21702171

21712172
set maincursor [. cget -cursor]
21722173
set textcursor [$ctext cget -cursor]
@@ -4919,7 +4920,7 @@ proc drawcmittext {id row col} {
49194920
global rowtextx idpos idtags idheads idotherrefs
49204921
global linehtag linentag linedtag selectedline
49214922
global canvxmax boldrows boldnamerows fgcolor
4922-
global mainheadid nullid nullid2 circleitem circlecolors
4923+
global mainheadid nullid nullid2 circleitem circlecolors ctxbut
49234924

49244925
# listed is 0 for boundary, 1 for normal, 2 for negative, 3 for left, 4 for right
49254926
set listed $cmitlisted($curview,$id)
@@ -4992,7 +4993,7 @@ proc drawcmittext {id row col} {
49924993
}
49934994
set linehtag($row) [$canv create text $xt $y -anchor w -fill $fgcolor \
49944995
-text $headline -font $font -tags text]
4995-
$canv bind $linehtag($row) <Button-3> "rowmenu %X %Y $id"
4996+
$canv bind $linehtag($row) $ctxbut "rowmenu %X %Y $id"
49964997
set linentag($row) [$canv2 create text 3 $y -anchor w -fill $fgcolor \
49974998
-text $name -font $nfont -tags text]
49984999
set linedtag($row) [$canv3 create text 3 $y -anchor w -fill $fgcolor \
@@ -5334,7 +5335,7 @@ proc bindline {t id} {
53345335
proc drawtags {id x xt y1} {
53355336
global idtags idheads idotherrefs mainhead
53365337
global linespc lthickness
5337-
global canv rowtextx curview fgcolor bgcolor
5338+
global canv rowtextx curview fgcolor bgcolor ctxbut
53385339

53395340
set marks {}
53405341
set ntags 0
@@ -5412,7 +5413,7 @@ proc drawtags {id x xt y1} {
54125413
if {$ntags >= 0} {
54135414
$canv bind $t <1> [list showtag $tag 1]
54145415
} elseif {$nheads >= 0} {
5415-
$canv bind $t <Button-3> [list headmenu %X %Y $id $tag]
5416+
$canv bind $t $ctxbut [list headmenu %X %Y $id $tag]
54165417
}
54175418
}
54185419
return $xt
@@ -9851,6 +9852,13 @@ set selectbgcolor gray85
98519852

98529853
set circlecolors {white blue gray blue blue}
98539854

9855+
# button for popping up context menus
9856+
if {[tk windowingsystem] eq "aqua"} {
9857+
set ctxbut <Button-2>
9858+
} else {
9859+
set ctxbut <Button-3>
9860+
}
9861+
98549862
## For msgcat loading, first locate the installation location.
98559863
if { [info exists ::env(GITK_MSGSDIR)] } {
98569864
## Msgsdir was manually set in the environment.

0 commit comments

Comments
 (0)