Skip to content

Commit 6aaaada

Browse files
committed
Fix board navigation using the buttons
1 parent 8568f44 commit 6aaaada

1 file changed

Lines changed: 15 additions & 16 deletions

File tree

tcl/main.tcl

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -511,13 +511,13 @@ proc showVars {} {
511511
# No need to display an empty menu
512512
if {$numVars == 0} { return }
513513

514+
set prev_focus [focus]
514515
set w .variations
515-
if {[winfo exists $w]} { return }
516+
destroy $w
516517

517-
# Present a menu of the possible variations
518+
# Present a non-blocking popup of the possible variations
518519
toplevel $w
519-
::setTitle $w $::tr(Variations)
520-
setWinLocation $w
520+
wm overrideredirect $w 1
521521
set h [expr $numVars + 1]
522522
if { $h> 19} { set h 19 }
523523
ttk::treeview $w.lbVar -columns {0} -show {} -selectmode browse
@@ -550,20 +550,19 @@ proc showVars {} {
550550
$w.lbVar insert {} end -id $j -values [list "$str"]
551551
incr j
552552
}
553-
$w.lbVar focus 0
554-
$w.lbVar selection set 0
555553

556-
bind $w <Configure> "recordWinSize $w"
557-
bind $w <Escape> "destroy $w"
558-
bind $w <Left> "destroy $w"
559-
bind $w <Right> "::move::EnterVar \[$w.lbVar selection\]; destroy $w"
560-
bind $w <Return> "event generate $w <Right>"
561-
bind $w <ButtonRelease-1> "event generate $w <Right>"
554+
bind $w <FocusOut> [list destroy $w]
555+
bind $w <Escape> [list focus $prev_focus]
556+
bind $w <Left> [list focus $prev_focus]
557+
bind $w <Return> [list focus $prev_focus]
558+
bind $w <Return> {+::move::EnterVar [%W selection]}
559+
bind $w <Right> {event generate %W <Return> -when tail}
560+
bind $w <ButtonRelease-1> {event generate %W <Return> -when tail}
562561

563-
tkwait visibility $w
564-
::tk::SetFocusGrab $w $w.lbVar
565-
tkwait window $w
566-
::tk::RestoreFocusGrab $w $w.lbVar
562+
::tk::PlaceWindow $w widget .main.board
563+
focus $w.lbVar
564+
$w.lbVar focus 0
565+
$w.lbVar selection set 0
567566
}
568567
################################################################################
569568
#

0 commit comments

Comments
 (0)