fixes for keyboard navigation and tab panels

The geometry used for keyboard navigation and tab-panel% instances
was wrong. That problem, in turn, exposed a potential infinite
loop in the function that computes the next tab position (when
geometries overlap). Fix both.

Closes PR 14255

Merge to v6.0

original commit: 37dd4fc2b0023d710e7e4d8c4fe35af67de326d3
This commit is contained in:
Matthew Flatt 2013-12-16 07:14:35 -07:00
parent 58301e4271
commit 6d1824019f
2 changed files with 13 additions and 7 deletions

View File

@ -196,7 +196,7 @@
(< (caar s) (cdr best)))))
(loop (cdr s) (car s))]
[else (loop (cdr s) best)])))]
[find (lambda (get-x get-w get-y get-h use-x? x w use-y? y h dests fail)
[find (lambda (v? get-x get-w get-y get-h use-x? x w use-y? y h dests fail)
;; find's variable names correspond to an h-stripe view, but everything is
;; flipped to v-stripes if the args are flipped
(let ([h-stripes (mk-stripes get-y get-h
@ -223,7 +223,13 @@
(next)
;; Non-empty h-stripe; now look for items in the same or later v-stripe
(if (null? (cdr in-init-h-stripe))
(if (or (null? (cdr in-init-h-stripe))
;; If we're already in "v-stripe" mode, then flipping back
;; to h-stripe mode is going to loop forever, so treat the
;; current strip as having only one item. (This should
;; happen only if the start positions overlap with the
;; destination positions.)
v?)
;; one item in the stripe; take it unless we're using x and it's
;; before x:
@ -235,12 +241,12 @@
(next))
;; Recur to work with v-stripes
(find get-y get-h get-x get-w use-y? y h use-x? x w in-init-h-stripe next)))))))])
(find #t get-y get-h get-x get-w use-y? y h use-x? x w in-init-h-stripe next)))))))])
(if (null? dests)
#f
(car (find get-x get-w get-y get-h #t x w #t y h dests
(car (find #f get-x get-w get-y get-h #t x w #t y h dests
(lambda ()
(find get-x get-w get-y get-h
(find #f get-x get-w get-y get-h
#f fail-start fail-start
#f fail-start fail-start
dests void))))))]

View File

@ -830,8 +830,8 @@
(inherit gets-focus?)
(super-new)
(define/override (tabbing-position x y w h)
;; claim that the panel is short:
(list this x y w 16))
;; claim that the panel is short and starts above its client area:
(list this x (- y 16) w 16))
(define/override (focus-on-self?) (gets-focus?))))
(define wx-panel% (wx-make-panel% wx:panel%))