win32: fix problem with focus directly on a frame

This commit is contained in:
Matthew Flatt 2010-12-31 08:31:29 -07:00
parent b0e07bde60
commit c7977441e4

View File

@ -288,19 +288,21 @@
(memq v focus-window-path)) (memq v focus-window-path))
(set! focus-window-path #f))) (set! focus-window-path #f)))
(define/override (set-top-focus win win-path child-hwnd) (define/override (set-top-focus win win-path child-hwnd)
(set! focus-window-path win-path) (set! focus-window-path (cons this win-path))
(when (ptr-equal? hwnd (GetActiveWindow)) (when (ptr-equal? hwnd (GetActiveWindow))
(void (SetFocus child-hwnd)))) (void (SetFocus child-hwnd))))
(define/private (set-frame-focus) (define/private (set-frame-focus)
(when (pair? focus-window-path) (let ([p focus-window-path])
(SetFocus (send (last focus-window-path) get-focus-hwnd)))) (when (pair? p)
(SetFocus (send (last p) get-focus-hwnd)))))
(define/public (get-focus-window [even-if-not-active? #f]) (define/public (get-focus-window [even-if-not-active? #f])
(and focus-window-path (let ([p focus-window-path])
(or even-if-not-active? (and (pair? p)
(ptr-equal? hwnd (GetActiveWindow))) (or even-if-not-active?
(last focus-window-path))) (ptr-equal? hwnd (GetActiveWindow)))
(last p))))
(define/override (can-accept-focus?) (define/override (can-accept-focus?)
#f) #f)