changeset 1467:91bdd9840b9f

_toplevel_window() changes for Windows similar to the OS/2 changes... If the class checks are too slow we can remove them on both platforms... it is just an extra level of security to make sure we are actually returning a toplevel window.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 18 Dec 2011 12:12:46 +0000
parents 65986481a3d8
children b2235efd9914
files win/dw.c
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/win/dw.c	Sun Dec 18 11:34:41 2011 +0000
+++ b/win/dw.c	Sun Dec 18 12:12:46 2011 +0000
@@ -1068,13 +1068,21 @@
    /* Find the toplevel window */
    while((box = GetParent(lastbox)))
    {
+      /* If it hasn't been packed yet.. */
       if(box == DW_HWND_OBJECT)
          return 0;
       lastbox = box;
    }
    if(lastbox)
-      return lastbox;
-   return handle;
+   {
+      char tmpbuf[100];
+      
+      GetClassName(lastbox, tmpbuf, 99);
+      
+      if(strncmp(tmpbuf, ClassName, strlen(ClassName)+1)==0)
+         return lastbox;
+   }
+   return 0;
 }
 
 /* This function finds the current widget in the