@matheusbsbs / matheus-bagliano / commits / 7d0d289e45
Fork 0

git-gui: Refactor mouse clicking on file names/icons.

I'm not a huge fan of putting the left and right mouse actions into the same procedure. Originally this is how Paul had implemented the logic in gitool and I had carried some of that over into git-gui, but now that I'm getting ready to implement right mouse click features to act on files I really should split this apart. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Nov 13, 2006 at 14:25 UTC 7d0d289e457eb643b8638b6385a0ce056f1f5a97
1 file changed +6 -9
git-gui
+6 -9
@@ -1935,10 +1935,8 @@ proc do_save_config {w} {
1935 destroy $w
1936 }
1937
1938 -# shift == 1: left click
1939 -# 3: right click
1940 -proc click {w x y shift wx wy} {
1941 - global ui_index ui_other file_lists
1938 +proc file_left_click {w x y} {
1939 + global file_lists
1940
1941 set pos [split [$w index @$x,$y] .]
1942 set lno [lindex $pos 0]
@@ -1946,12 +1944,12 @@ proc click {w x y shift wx wy} {
1944 set path [lindex $file_lists($w) [expr $lno - 1]]
1945 if {$path eq {}} return
1946
1949 - if {$col > 0 && $shift == 1} {
1947 + if {$col > 0} {
1948 show_diff $path $w $lno
1949 }
1950 }
1951
1954 -proc unclick {w x y} {
1952 +proc file_left_unclick {w x y} {
1953 global file_lists
1954
1955 set pos [split [$w index @$x,$y] .]
@@ -2457,9 +2455,8 @@ bind all <$M1B-Key-Q> do_quit
2455 bind all <$M1B-Key-w> {destroy [winfo toplevel %W]}
2456 bind all <$M1B-Key-W> {destroy [winfo toplevel %W]}
2457 foreach i [list $ui_index $ui_other] {
2460 - bind $i <Button-1> {click %W %x %y 1 %X %Y; break}
2461 - bind $i <ButtonRelease-1> {unclick %W %x %y; break}
2462 - bind_button3 $i {click %W %x %y 3 %X %Y; break}
2458 + bind $i <Button-1> {file_left_click %W %x %y; break}
2459 + bind $i <ButtonRelease-1> {file_left_unclick %W %x %y; break}
2460 }
2461 unset i
2462