@matheusbsbs / matheus-bagliano / commits / d277e89f87
Fork 0

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 <paulus@samba.org>

Paul Mackerras committed Sep 21, 2008 at 18:11 UTC d277e89f87fda01daa1e1a35fc1f7118678faa1f
1 file changed +13 -5
gitk
+13 -5
@@ -2166,7 +2166,8 @@ proc makewindow {} {
2166 bind $cflist <1> {sel_flist %W %x %y; break}
2167 bind $cflist <B1-Motion> {sel_flist %W %x %y; break}
2168 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}
2171
2172 set maincursor [. cget -cursor]
2173 set textcursor [$ctext cget -cursor]
@@ -4919,7 +4920,7 @@ proc drawcmittext {id row col} {
4920 global rowtextx idpos idtags idheads idotherrefs
4921 global linehtag linentag linedtag selectedline
4922 global canvxmax boldrows boldnamerows fgcolor
4922 - global mainheadid nullid nullid2 circleitem circlecolors
4923 + global mainheadid nullid nullid2 circleitem circlecolors ctxbut
4924
4925 # listed is 0 for boundary, 1 for normal, 2 for negative, 3 for left, 4 for right
4926 set listed $cmitlisted($curview,$id)
@@ -4992,7 +4993,7 @@ proc drawcmittext {id row col} {
4993 }
4994 set linehtag($row) [$canv create text $xt $y -anchor w -fill $fgcolor \
4995 -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"
4997 set linentag($row) [$canv2 create text 3 $y -anchor w -fill $fgcolor \
4998 -text $name -font $nfont -tags text]
4999 set linedtag($row) [$canv3 create text 3 $y -anchor w -fill $fgcolor \
@@ -5334,7 +5335,7 @@ proc bindline {t id} {
5335 proc drawtags {id x xt y1} {
5336 global idtags idheads idotherrefs mainhead
5337 global linespc lthickness
5337 - global canv rowtextx curview fgcolor bgcolor
5338 + global canv rowtextx curview fgcolor bgcolor ctxbut
5339
5340 set marks {}
5341 set ntags 0
@@ -5412,7 +5413,7 @@ proc drawtags {id x xt y1} {
5413 if {$ntags >= 0} {
5414 $canv bind $t <1> [list showtag $tag 1]
5415 } 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]
5417 }
5418 }
5419 return $xt
@@ -9851,6 +9852,13 @@ set selectbgcolor gray85
9852
9853 set circlecolors {white blue gray blue blue}
9854
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 +
9862 ## For msgcat loading, first locate the installation location.
9863 if { [info exists ::env(GITK_MSGSDIR)] } {
9864 ## Msgsdir was manually set in the environment.