make tooltips go away if the drracket window isn't

the top-level window (and make them not appear in
that case, too)

closes PR 13139
This commit is contained in:
Robby Findler 2012-09-28 23:08:24 -05:00
parent e958c33739
commit 60a035889f

View File

@ -999,20 +999,33 @@ If the namespace does not, they are colored the unbound color.
(define-values (pos text) (get-pos/text-dc-location x y))
(define arrow-record (and text pos (hash-ref arrow-records text #f)))
(define eles (and arrow-record (interval-map-ref arrow-record pos null)))
(define tooltip (cond [(equal? latent-eles eles) latent-tooltip]
(define we-focused-frame?
(let ([f (get-top-level-focus-window)])
(and f
(eq? f
(let loop ([w (get-canvas)])
(cond
[(is-a? w top-level-window<%>)
w]
[(is-a? w area<%>)
(loop (send w get-parent))]
[else #f]))))))
(define tooltip (cond [(not we-focused-frame?) #f]
[(equal? latent-eles eles) latent-tooltip]
[else (get-tooltip eles)]))
(values pos text eles tooltip)]
[else
(values #f #f #f #f)]))
(define text-changed? (not (eq? latent-text text)))
(define eles-changed? (not (equal? latent-eles eles)))
(define tooltip-changed? (not (equal? latent-tooltip tooltip)))
(set! latent-pos pos)
(set! latent-text text)
(set! latent-eles eles)
(set! latent-tooltip tooltip)
(or text-changed? eles-changed?))
(or text-changed? eles-changed? tooltip-changed?))
(define (update-drawn-arrows)
(set! cursor-pos latent-pos)