]> git.saurik.com Git - wxWidgets.git/commitdiff
fill wxFocusEvent::m_win properly
authorVáclav Slavík <vslavik@fastmail.fm>
Thu, 14 Feb 2002 20:30:49 +0000 (20:30 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Thu, 14 Feb 2002 20:30:49 +0000 (20:30 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14213 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mgl/window.cpp

index 382a5ed038a3c80f03b510aa06819e21bbb798a3..dd5bfd6c403f21446d829399734e6c840df5507b 100644 (file)
@@ -4,7 +4,7 @@
 // Author:      Vaclav Slavik
 //              (based on GTK & MSW implementations)
 // RCS-ID:      $Id$
 // 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
 /////////////////////////////////////////////////////////////////////////////
 
 // 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 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
 // 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;
 
 {
     if ( gs_focusedWindow == this ) return;
 
+    wxWindowMGL *oldFocusedWindow = gs_focusedWindow;
+
     if ( gs_focusedWindow )
     if ( gs_focusedWindow )
+    {
+        gs_toBeFocusedWindow = (wxWindow*)this;
         gs_focusedWindow->KillFocus();
         gs_focusedWindow->KillFocus();
+        gs_toBeFocusedWindow = NULL;
+    }
     
     gs_focusedWindow = this;
     
     
     gs_focusedWindow = this;
     
@@ -691,6 +700,7 @@ void wxWindowMGL::SetFocus()
     
     wxFocusEvent event(wxEVT_SET_FOCUS, GetId());
     event.SetEventObject(this);
     
     wxFocusEvent event(wxEVT_SET_FOCUS, GetId());
     event.SetEventObject(this);
+    event.SetWindow((wxWindow*)oldFocusedWindow);
     GetEventHandler()->ProcessEvent(event);
 
 #if wxUSE_CARET
     GetEventHandler()->ProcessEvent(event);
 
 #if wxUSE_CARET
@@ -719,6 +729,7 @@ void wxWindowMGL::KillFocus()
 
     wxFocusEvent event(wxEVT_KILL_FOCUS, GetId());
     event.SetEventObject(this);
 
     wxFocusEvent event(wxEVT_KILL_FOCUS, GetId());
     event.SetEventObject(this);
+    event.SetWindow(gs_toBeFocusedWindow);
     GetEventHandler()->ProcessEvent(event);
 }
 
     GetEventHandler()->ProcessEvent(event);
 }