From c7977441e4339b33f371b1230c36d5cf7ec9bc87 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 31 Dec 2010 08:31:29 -0700 Subject: [PATCH] win32: fix problem with focus directly on a frame --- collects/mred/private/wx/win32/frame.rkt | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/collects/mred/private/wx/win32/frame.rkt b/collects/mred/private/wx/win32/frame.rkt index 4b21674045..fc8ced45c9 100644 --- a/collects/mred/private/wx/win32/frame.rkt +++ b/collects/mred/private/wx/win32/frame.rkt @@ -288,19 +288,21 @@ (memq v focus-window-path)) (set! focus-window-path #f))) (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)) (void (SetFocus child-hwnd)))) (define/private (set-frame-focus) - (when (pair? focus-window-path) - (SetFocus (send (last focus-window-path) get-focus-hwnd)))) + (let ([p focus-window-path]) + (when (pair? p) + (SetFocus (send (last p) get-focus-hwnd))))) (define/public (get-focus-window [even-if-not-active? #f]) - (and focus-window-path - (or even-if-not-active? - (ptr-equal? hwnd (GetActiveWindow))) - (last focus-window-path))) + (let ([p focus-window-path]) + (and (pair? p) + (or even-if-not-active? + (ptr-equal? hwnd (GetActiveWindow))) + (last p)))) (define/override (can-accept-focus?) #f)