diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-08-09 11:03:00 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-08-09 11:03:00 (GMT) |
commit | ebe99473e61961e6e6c4525ed9efe66f7c3de308 (patch) | |
tree | b8267b8025bccdba2a79df3790081030fc9e28ec | |
parent | 32e3d179b323a56e40cf6289607a63ee9b7daa9a (diff) | |
download | tk-ebe99473e61961e6e6c4525ed9efe66f7c3de308.zip tk-ebe99473e61961e6e6c4525ed9efe66f7c3de308.tar.gz tk-ebe99473e61961e6e6c4525ed9efe66f7c3de308.tar.bz2 |
[Bug 3555644]: Better use of virtual events.
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | library/console.tcl | 6 | ||||
-rw-r--r-- | library/demos/entry3.tcl | 4 | ||||
-rw-r--r-- | library/entry.tcl | 10 | ||||
-rw-r--r-- | library/iconlist.tcl | 4 | ||||
-rw-r--r-- | library/listbox.tcl | 12 | ||||
-rw-r--r-- | library/menu.tcl | 4 | ||||
-rw-r--r-- | library/scale.tcl | 12 | ||||
-rw-r--r-- | library/scrlbar.tcl | 12 | ||||
-rw-r--r-- | library/spinbox.tcl | 10 | ||||
-rw-r--r-- | library/text.tcl | 24 | ||||
-rw-r--r-- | library/tk.tcl | 12 | ||||
-rw-r--r-- | library/ttk/entry.tcl | 2 | ||||
-rw-r--r-- | library/ttk/scale.tcl | 15 |
14 files changed, 46 insertions, 85 deletions
@@ -1,3 +1,7 @@ +2012-08-?? Jan Nijtmans <nijtmans@users.sf.net> + + * library/*.tcl: [Bug 3555644]: Better use of virtual events. + 2012-07-31 Donal K. Fellows <dkf@users.sf.net> * unix/tkUnixKey.c (TkpSetKeycodeAndState, TkpInitKeymapInfo) diff --git a/library/console.tcl b/library/console.tcl index e6b7ce9..37832f2 100644 --- a/library/console.tcl +++ b/library/console.tcl @@ -499,18 +499,16 @@ proc ::tk::ConsoleBind {w} { } bind Console <Control-h> [bind Console <BackSpace>] - bind Console <Home> { + bind Console <<LineStart>> { if {[%W compare insert < promptEnd]} { tk::TextSetCursor %W {insert linestart} } else { tk::TextSetCursor %W promptEnd } } - bind Console <Control-a> [bind Console <Home>] - bind Console <End> { + bind Console <<LineEnd>> { tk::TextSetCursor %W {insert lineend} } - bind Console <Control-e> [bind Console <End>] bind Console <Control-d> { if {[%W compare insert < promptEnd]} { break diff --git a/library/demos/entry3.tcl b/library/demos/entry3.tcl index 3d76c2e..d4435c6 100644 --- a/library/demos/entry3.tcl +++ b/library/demos/entry3.tcl @@ -169,8 +169,8 @@ bind $w.l3.e <FocusIn> { after idle {%W selection clear} } } -bind $w.l3.e <Left> {phoneSkipLeft %W} -bind $w.l3.e <Right> {phoneSkipRight %W} +bind $w.l3.e <<PrevChar>> {phoneSkipLeft %W} +bind $w.l3.e <<NextChar>> {phoneSkipRight %W} pack $w.l3.e -fill x -expand 1 -padx 1m -pady 1m labelframe $w.l4 -text "Password Entry" diff --git a/library/entry.tcl b/library/entry.tcl index de6c463..5dbf063 100644 --- a/library/entry.tcl +++ b/library/entry.tcl @@ -227,11 +227,6 @@ if {[tk windowingsystem] ne "win32"} { # Additional emacs-like bindings: -bind Entry <Control-a> { - if {!$tk_strictMotif} { - tk::EntrySetCursor %W 0 - } -} bind Entry <Control-b> { if {!$tk_strictMotif} { tk::EntrySetCursor %W [expr {[%W index insert] - 1}] @@ -242,11 +237,6 @@ bind Entry <Control-d> { %W delete insert } } -bind Entry <Control-e> { - if {!$tk_strictMotif} { - tk::EntrySetCursor %W end - } -} bind Entry <Control-f> { if {!$tk_strictMotif} { tk::EntrySetCursor %W [expr {[%W index insert] + 1}] diff --git a/library/iconlist.tcl b/library/iconlist.tcl index fc8128d..15a4f53 100644 --- a/library/iconlist.tcl +++ b/library/iconlist.tcl @@ -446,8 +446,8 @@ package require Tk 8.6 bind $canvas <Up> [namespace code {my UpDown -1}] bind $canvas <Down> [namespace code {my UpDown 1}] - bind $canvas <Left> [namespace code {my LeftRight -1}] - bind $canvas <Right> [namespace code {my LeftRight 1}] + bind $canvas <<PrevChar>> [namespace code {my LeftRight -1}] + bind $canvas <<NextChar>> [namespace code {my LeftRight 1}] bind $canvas <Return> [namespace code {my ReturnKey}] bind $canvas <KeyPress> [namespace code {my KeyPress %A}] bind $canvas <Control-KeyPress> ";" diff --git a/library/listbox.tcl b/library/listbox.tcl index 99047f4..eae513a 100644 --- a/library/listbox.tcl +++ b/library/listbox.tcl @@ -81,16 +81,16 @@ bind Listbox <Down> { bind Listbox <Shift-Down> { tk::ListboxExtendUpDown %W 1 } -bind Listbox <Left> { +bind Listbox <<PrevChar>> { %W xview scroll -1 units } -bind Listbox <Control-Left> { +bind Listbox <<PrevWord>> { %W xview scroll -1 pages } -bind Listbox <Right> { +bind Listbox <<NextChar>> { %W xview scroll 1 units } -bind Listbox <Control-Right> { +bind Listbox <<NextWord>> { %W xview scroll 1 pages } bind Listbox <Prior> { @@ -107,10 +107,10 @@ bind Listbox <Control-Prior> { bind Listbox <Control-Next> { %W xview scroll 1 pages } -bind Listbox <Home> { +bind Listbox <<LineStart>> { %W xview moveto 0 } -bind Listbox <End> { +bind Listbox <<LineEnd>> { %W xview moveto 1 } bind Listbox <Control-Home> { diff --git a/library/menu.tcl b/library/menu.tcl index cc57532..8261e82 100644 --- a/library/menu.tcl +++ b/library/menu.tcl @@ -149,10 +149,10 @@ bind Menu <Return> { bind Menu <Escape> { tk::MenuEscape %W } -bind Menu <Left> { +bind Menu <<PrevChar>> { tk::MenuLeftArrow %W } -bind Menu <Right> { +bind Menu <<NextChar>> { tk::MenuRightArrow %W } bind Menu <Up> { diff --git a/library/scale.tcl b/library/scale.tcl index b4da824..72a254a 100644 --- a/library/scale.tcl +++ b/library/scale.tcl @@ -77,10 +77,10 @@ bind Scale <Up> { bind Scale <Down> { tk::ScaleIncrement %W down little noRepeat } -bind Scale <Left> { +bind Scale <<PrevChar>> { tk::ScaleIncrement %W up little noRepeat } -bind Scale <Right> { +bind Scale <<NextChar>> { tk::ScaleIncrement %W down little noRepeat } bind Scale <Control-Up> { @@ -89,16 +89,16 @@ bind Scale <Control-Up> { bind Scale <Control-Down> { tk::ScaleIncrement %W down big noRepeat } -bind Scale <Control-Left> { +bind Scale <<PrevWord>> { tk::ScaleIncrement %W up big noRepeat } -bind Scale <Control-Right> { +bind Scale <<NextWord>> { tk::ScaleIncrement %W down big noRepeat } -bind Scale <Home> { +bind Scale <<LineStart>> { %W set [%W cget -from] } -bind Scale <End> { +bind Scale <<LineEnd>> { %W set [%W cget -to] } diff --git a/library/scrlbar.tcl b/library/scrlbar.tcl index 9277160..4a16f0b 100644 --- a/library/scrlbar.tcl +++ b/library/scrlbar.tcl @@ -103,16 +103,16 @@ bind Scrollbar <Control-Up> { bind Scrollbar <Control-Down> { tk::ScrollByPages %W v 1 } -bind Scrollbar <Left> { +bind Scrollbar <<PrevChar>> { tk::ScrollByUnits %W h -1 } -bind Scrollbar <Right> { +bind Scrollbar <<NextChar>> { tk::ScrollByUnits %W h 1 } -bind Scrollbar <Control-Left> { +bind Scrollbar <<PrevWord>> { tk::ScrollByPages %W h -1 } -bind Scrollbar <Control-Right> { +bind Scrollbar <<NextWord>> { tk::ScrollByPages %W h 1 } bind Scrollbar <Prior> { @@ -121,10 +121,10 @@ bind Scrollbar <Prior> { bind Scrollbar <Next> { tk::ScrollByPages %W hv 1 } -bind Scrollbar <Home> { +bind Scrollbar <<LineStart>> { tk::ScrollToPos %W 0 } -bind Scrollbar <End> { +bind Scrollbar <<LineEnd>> { tk::ScrollToPos %W 1 } } diff --git a/library/spinbox.tcl b/library/spinbox.tcl index 20b477a..d5b4d79 100644 --- a/library/spinbox.tcl +++ b/library/spinbox.tcl @@ -231,11 +231,6 @@ if {[tk windowingsystem] ne "win32"} { # Additional emacs-like bindings: -bind Spinbox <Control-a> { - if {!$tk_strictMotif} { - ::tk::EntrySetCursor %W 0 - } -} bind Spinbox <Control-b> { if {!$tk_strictMotif} { ::tk::EntrySetCursor %W [expr {[%W index insert] - 1}] @@ -246,11 +241,6 @@ bind Spinbox <Control-d> { %W delete insert } } -bind Spinbox <Control-e> { - if {!$tk_strictMotif} { - ::tk::EntrySetCursor %W end - } -} bind Spinbox <Control-f> { if {!$tk_strictMotif} { ::tk::EntrySetCursor %W [expr {[%W index insert] + 1}] diff --git a/library/text.tcl b/library/text.tcl index 331d1b4..a71150a 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -287,11 +287,6 @@ if {[tk windowingsystem] eq "aqua"} { # Additional emacs-like bindings: -bind Text <Control-a> { - if {!$tk_strictMotif} { - tk::TextSetCursor %W {insert display linestart} - } -} bind Text <Control-b> { if {!$tk_strictMotif} { tk::TextSetCursor %W insert-1displayindices @@ -302,11 +297,6 @@ bind Text <Control-d> { %W delete insert } } -bind Text <Control-e> { - if {!$tk_strictMotif} { - tk::TextSetCursor %W {insert display lineend} - } -} bind Text <Control-f> { if {!$tk_strictMotif} { tk::TextSetCursor %W insert+1displayindices @@ -390,31 +380,19 @@ bind Text <Meta-Delete> { # Macintosh only bindings: if {[tk windowingsystem] eq "aqua"} { -bind Text <Option-Left> { - tk::TextSetCursor %W [tk::TextPrevPos %W insert tcl_startOfPreviousWord] -} -bind Text <Option-Right> { - tk::TextSetCursor %W [tk::TextNextWord %W insert] -} bind Text <Option-Up> { tk::TextSetCursor %W [tk::TextPrevPara %W insert] } bind Text <Option-Down> { tk::TextSetCursor %W [tk::TextNextPara %W insert] } -bind Text <Shift-Option-Left> { - tk::TextKeySelect %W [tk::TextPrevPos %W insert tcl_startOfPreviousWord] -} -bind Text <Shift-Option-Right> { - tk::TextKeySelect %W [tk::TextNextWord %W insert] -} bind Text <Shift-Option-Up> { tk::TextKeySelect %W [tk::TextPrevPara %W insert] } bind Text <Shift-Option-Down> { tk::TextKeySelect %W [tk::TextNextPara %W insert] } -bind Text <Control-v> { +bind Text <<Paste>> { tk::TextScrollPages %W 1 } diff --git a/library/tk.tcl b/library/tk.tcl index 928fc2e..33671ed 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -377,9 +377,9 @@ switch -exact -- [tk windowingsystem] { event add <<SelectNextWord>> <Shift-Control-Right> event add <<PrevWord>> <Control-Left> event add <<SelectPrevWord>> <Shift-Control-Left> - event add <<LineStart>> <Home> + event add <<LineStart>> <Home> <Control-Key-a> <Control-Lock-Key-A> event add <<SelectLineStart>> <Shift-Home> - event add <<LineEnd>> <End> + event add <<LineEnd>> <End> <Control-Key-e> <Control-Lock-Key-E> event add <<SelectLineEnd>> <Shift-End> # Some OS's define a goofy (as in, not <Shift-Tab>) keysym that is @@ -418,9 +418,9 @@ switch -exact -- [tk windowingsystem] { event add <<SelectNextWord>> <Shift-Control-Right> event add <<PrevWord>> <Control-Left> event add <<SelectPrevWord>> <Shift-Control-Left> - event add <<LineStart>> <Home> + event add <<LineStart>> <Home> <Control-Key-a> <Control-Lock-Key-A> event add <<SelectLineStart>> <Shift-Home> - event add <<LineEnd>> <End> + event add <<LineEnd>> <End> <Control-Key-e> <Control-Lock-Key-E> event add <<SelectLineEnd>> <Shift-End> } "aqua" { @@ -447,8 +447,8 @@ switch -exact -- [tk windowingsystem] { event add <<SelectLineEnd>> <Shift-End> <Shift-Command-Right> # Not official, but logical extensions of above. Also derived from # bindings present in MS Word on OSX. - event add <<LineStart>> <Home> <Command-Left> - event add <<LineEnd>> <End> <Command-Right> + event add <<LineStart>> <Home> <Command-Left> <Command-Key-a> <Control-Lock-Key-A> + event add <<LineEnd>> <End> <Command-Right> <Command-Key-e> <Control-Lock-Key-E> } } diff --git a/library/ttk/entry.tcl b/library/ttk/entry.tcl index a27921a..9e0d6e1 100644 --- a/library/ttk/entry.tcl +++ b/library/ttk/entry.tcl @@ -141,10 +141,8 @@ bind TEntry <Up> {# nothing} ## Additional emacs-like bindings: # -bind TEntry <Control-Key-a> { ttk::entry::Move %W home } bind TEntry <Control-Key-b> { ttk::entry::Move %W prevchar } bind TEntry <Control-Key-d> { ttk::entry::Delete %W } -bind TEntry <Control-Key-e> { ttk::entry::Move %W end } bind TEntry <Control-Key-f> { ttk::entry::Move %W nextchar } bind TEntry <Control-Key-h> { ttk::entry::Backspace %W } bind TEntry <Control-Key-k> { %W delete insert end } diff --git a/library/ttk/scale.tcl b/library/ttk/scale.tcl index 23d08ed..f270697 100644 --- a/library/ttk/scale.tcl +++ b/library/ttk/scale.tcl @@ -21,16 +21,19 @@ bind TScale <ButtonPress-3> { ttk::scale::Jump %W %x %y } bind TScale <B3-Motion> { ttk::scale::Drag %W %x %y } bind TScale <ButtonRelease-3> { ttk::scale::Release %W %x %y } -bind TScale <Left> { ttk::scale::Increment %W -1 } +## Keyboard navigation bindings: +# +bind TScale <<LineStart>> { %W set [%W cget -from] } +bind TScale <<LineEnd>> { %W set [%W cget -to] } + +bind TScale <<PrevChar>> { ttk::scale::Increment %W -1 } bind TScale <Up> { ttk::scale::Increment %W -1 } -bind TScale <Right> { ttk::scale::Increment %W 1 } +bind TScale <<NextChar>> { ttk::scale::Increment %W 1 } bind TScale <Down> { ttk::scale::Increment %W 1 } -bind TScale <Control-Left> { ttk::scale::Increment %W -10 } +bind TScale <<PrevWord>> { ttk::scale::Increment %W -10 } bind TScale <Control-Up> { ttk::scale::Increment %W -10 } -bind TScale <Control-Right> { ttk::scale::Increment %W 10 } +bind TScale <<NextWord>> { ttk::scale::Increment %W 10 } bind TScale <Control-Down> { ttk::scale::Increment %W 10 } -bind TScale <Home> { %W set [%W cget -from] } -bind TScale <End> { %W set [%W cget -to] } proc ttk::scale::Press {w x y} { variable State |