From eea932674bd95e7f785560fbedd785fcb2bdaa1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Thu, 14 Feb 2002 20:30:49 +0000 Subject: [PATCH] fill wxFocusEvent::m_win properly git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14213 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mgl/window.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/mgl/window.cpp b/src/mgl/window.cpp index 382a5ed038..dd5bfd6c40 100644 --- a/src/mgl/window.cpp +++ b/src/mgl/window.cpp @@ -4,7 +4,7 @@ // Author: Vaclav Slavik // (based on GTK & MSW implementations) // RCS-ID: $Id$ -// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) +// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com) // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// @@ -66,6 +66,9 @@ MGLDevCtx *g_displayDC = NULL; // the window that has keyboard focus: static wxWindowMGL *gs_focusedWindow = NULL; +// the window that is about to be focused after currently focused +// one looses focus: +static wxWindow *gs_toBeFocusedWindow = NULL; // the window that is currently under mouse cursor: static wxWindowMGL *gs_windowUnderMouse = NULL; // the window that has mouse capture @@ -666,8 +669,14 @@ void wxWindowMGL::SetFocus() { if ( gs_focusedWindow == this ) return; + wxWindowMGL *oldFocusedWindow = gs_focusedWindow; + if ( gs_focusedWindow ) + { + gs_toBeFocusedWindow = (wxWindow*)this; gs_focusedWindow->KillFocus(); + gs_toBeFocusedWindow = NULL; + } gs_focusedWindow = this; @@ -691,6 +700,7 @@ void wxWindowMGL::SetFocus() wxFocusEvent event(wxEVT_SET_FOCUS, GetId()); event.SetEventObject(this); + event.SetWindow((wxWindow*)oldFocusedWindow); GetEventHandler()->ProcessEvent(event); #if wxUSE_CARET @@ -719,6 +729,7 @@ void wxWindowMGL::KillFocus() wxFocusEvent event(wxEVT_KILL_FOCUS, GetId()); event.SetEventObject(this); + event.SetWindow(gs_toBeFocusedWindow); GetEventHandler()->ProcessEvent(event); }