Restore the pre-r17946 UserGetAncestor behaviour and fix the code calling it.
authorFilip Navara <filip.navara@gmail.com>
Tue, 20 Sep 2005 10:45:27 +0000 (10:45 +0000)
committerFilip Navara <filip.navara@gmail.com>
Tue, 20 Sep 2005 10:45:27 +0000 (10:45 +0000)
svn path=/trunk/; revision=17947

reactos/subsys/win32k/ntuser/focus.c
reactos/subsys/win32k/ntuser/window.c

index 4d5a1ef..00f88e5 100644 (file)
@@ -520,7 +520,7 @@ HWND FASTCALL co_UserSetFocus(PWINDOW_OBJECT Window OPTIONAL)
       }
 
       TopWnd = UserGetAncestor(Window, GA_ROOT);
-      if (TopWnd->hSelf != UserGetActiveWindow())
+      if (TopWnd && TopWnd->hSelf != UserGetActiveWindow())
       {
 //         PWINDOW_OBJECT WndTops = UserGetWindowObject(hWndTop);
          UserRefObjectCo(TopWnd);
index ced4dcb..dffa1e7 100644 (file)
@@ -1374,9 +1374,9 @@ co_IntCreateWindowEx(DWORD dwExStyle,
       else
       {
          //temp hack
-         PWINDOW_OBJECT Par = UserGetWindowObject(hWndParent);
-         if (Par)
-            OwnerWindowHandle = UserGetAncestor(Par, GA_ROOT)->hSelf;
+         PWINDOW_OBJECT Par = UserGetWindowObject(hWndParent), Root;
+         if (Par && (Root = UserGetAncestor(Par, GA_ROOT)))
+            OwnerWindowHandle = Root->hSelf;
       }
    }
    else if ((dwStyle & (WS_CHILD | WS_POPUP)) == WS_CHILD)
@@ -2543,6 +2543,11 @@ PWINDOW_OBJECT FASTCALL UserGetAncestor(PWINDOW_OBJECT Wnd, UINT Type)
 {
    PWINDOW_OBJECT WndAncestor, Parent;
 
+   if (Wnd->hSelf == IntGetDesktopWindow())
+   {
+      return NULL;
+   }
+
    switch (Type)
    {
       case GA_PARENT: