Attachment "bwidget-mainframe-2.patch" to
ticket [83ce3e84e7]
added by
anonymous
2013-06-13 13:19:22.
--- original-bwidget-1.9.6/mainframe.tcl 2013-06-13 14:06:28.000000000 +0100
+++ patched-bwidget-1.9.6/mainframe.tcl 2013-06-13 14:09:01.000000000 +0100
@@ -671,18 +671,21 @@
# desc a list with the following format:
# ?sequence? key
# sequence may be None, Ctrl, Alt, or CtrlAlt
+# Shift, Cmd or ShiftCmd
# key may be any key
#
# Results:
# {accel event} a list containing the accelerator string and the event
proc MainFrame::_parse_accelerator { desc } {
+ set fkey 0
if { [llength $desc] == 1 } {
set seq None
set key [string tolower [lindex $desc 0]]
# If the key is an F key (ie, F1, F2, etc), it has to be capitalized
if {[regexp {^f([1-9]|([12][0-9]|3[0-5]))$} $key]} {
set key [string toupper $key]
+ set fkey 1
}
} elseif { [llength $desc] == 2 } {
set seq [lindex $desc 0]
@@ -690,15 +693,42 @@
# If the key is an F key (ie, F1, F2, etc), it has to be capitalized
if {[regexp {^f([1-9]|([12][0-9]|3[0-5]))$} $key]} {
set key [string toupper $key]
+ set fkey 1
}
} else {
return {}
}
+ if {$seq eq "Shift" && (!$fkey)} {
+ return -code error {Shift accelerator can be used only with F keys}
+ }
+ # Plain "Shift" can be used only with F keys, but "ShiftCmd" is allowed.
switch -- $seq {
None {
set accel "[string toupper $key]"
set event "<Key-$key>"
}
+ Shift {
+ # Used only with Function keys.
+ set accel "Shift+[string toupper $key]"
+ set event "<Shift-Key-$key>"
+ }
+ Cmd {
+ set accel "Cmd+[string toupper $key]"
+ set event "<Command-Key-$key>"
+ }
+ ShiftCmd {
+ if { ([tk windowingsystem] eq "aqua")
+ && ([string first AppKit [winfo server .]] == -1)
+ } {
+ # Carbon
+ set accel "Shift+Cmd+[string toupper $key]"
+ set event "<Shift-Command-Key-[string toupper $key]>"
+ } else {
+ # Cocoa and anything else that uses Cmd
+ set accel "Shift+Cmd+[string toupper $key]"
+ set event "<Shift-Command-Key-$key>"
+ }
+ }
Ctrl {
set accel "Ctrl+[string toupper $key]"
set event "<Control-Key-$key>"