]> git.saurik.com Git - wxWidgets.git/commitdiff
bring the parent of a wxFRAME_FLOAT_ON_PARENT frame to the top when deleting it as...
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 5 Jun 2002 22:37:24 +0000 (22:37 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 5 Jun 2002 22:37:24 +0000 (22:37 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15756 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/toplevel.cpp

index 14caef0e56274076a4aecf70ac80e3ffc48f26cd..e65ef6c1518f38e39229eb3eb82d6f41bc353800 100644 (file)
@@ -473,6 +473,19 @@ wxTopLevelWindowMSW::~wxTopLevelWindowMSW()
     if ( wxModelessWindows.Find(this) )
         wxModelessWindows.DeleteObject(this);
 
+    // after destroying an owned window, Windows activates the next top level
+    // window in Z order but it may be different from our owner (to reproduce
+    // this simply Alt-TAB to another application and back before closing the
+    // owned frame) whereas we always want to yield activation to our parent
+    if ( HasFlag(wxFRAME_FLOAT_ON_PARENT) )
+    {
+        wxWindow *parent = GetParent();
+        if ( parent )
+        {
+            ::BringWindowToTop(GetHwndOf(parent));
+        }
+    }
+
     // If this is the last top-level window, exit.
     if ( wxTheApp && (wxTopLevelWindows.Number() == 0) )
     {
@@ -757,10 +770,13 @@ long wxTopLevelWindowMSW::HandleNcActivate(bool activate)
 long
 wxTopLevelWindowMSW::MSWWindowProc(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam)
 {
-    if ( msg == WM_NCACTIVATE && HandleNcActivate(wParam != 0) )
+    if ( msg == WM_NCACTIVATE )
     {
-        // we processed WM_NCACTIVATE ourselves
-        return TRUE;
+        if ( HandleNcActivate(wParam != 0) )
+        {
+            // we processed WM_NCACTIVATE ourselves
+            return TRUE;
+        }
     }
 
     return wxTopLevelWindowBase::MSWWindowProc(msg, wParam, lParam);