gitk: Refactor code for binding modified function keys
The function includes a workaround for systems where F* keys are mapped to XF86_Switch_VT_* when modifiers are used. Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Andrew Wong committed
Oct 2, 2012 at 11:04 UTC
69ecfcd6ebcc42c73be25b876c79ee09d5f2901d
1 file changed
+6
-2
gitk
+6
-2
@@ -2503,8 +2503,7 @@ proc makewindow {} {
2503
bind . <F5> updatecommits
2504
bind . <Shift-F5> reloadcommits
2505
bind . <F2> showrefs
2506
- bind . <Shift-F4> {newview 0}
2507
- catch { bind . <Shift-Key-XF86_Switch_VT_4> {newview 0} }
2506
+ bindmodfunctionkey Shift 4 {newview 0}
2507
bind . <F4> edit_or_newview
2508
bind . <$M1B-q> doquit
2509
bind . <$M1B-f> {dofind 1 1}
@@ -2653,6 +2652,11 @@ proc bindkey {ev script} {
2652
}
2653
}
2654
2655
+proc bindmodfunctionkey {mod n script} {
2656
+ bind . <$mod-F$n> $script
2657
+ catch { bind . <$mod-XF86_Switch_VT_$n> $script }
2658
+}
2659
+
2660
# set the focus back to the toplevel for any click outside
2661
# the entry widgets
2662
proc click {w} {