Author: jimtabor
Date: Sat May 19 04:40:37 2012
New Revision: 56609

URL: http://svn.reactos.org/svn/reactos?rev=56609&view=rev
Log:
[Win32SS]
- Fix test_child_window_from_point results.
- Turn on process layout.
- Miscellaneous changes and fixups.

Modified:
    trunk/reactos/win32ss/user/ntuser/ntstubs.c
    trunk/reactos/win32ss/user/ntuser/winpos.c
    trunk/reactos/win32ss/user/ntuser/winpos.h
    trunk/reactos/win32ss/user/user32/misc/stubs.c
    trunk/reactos/win32ss/user/user32/user32.spec
    trunk/reactos/win32ss/user/user32/windows/window.c

Modified: trunk/reactos/win32ss/user/ntuser/ntstubs.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/ntstubs.c?rev=56609&r1=56608&r2=56609&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/ntstubs.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/ntstubs.c [iso-8859-1] Sat May 19 
04:40:37 2012
@@ -908,17 +908,6 @@
     return 0;
 }
 
-BOOL
-APIENTRY
-NtUserGetLayeredWindowAttributes(
-    HWND hwnd,
-    COLORREF *pcrKey,
-    BYTE *pbAlpha,
-    DWORD *pdwFlags)
-{
-    STUB;
-    return 0;
-}
 
 DWORD
 APIENTRY
@@ -1018,19 +1007,6 @@
 /*
  * @unimplemented
  */
-HWND APIENTRY
-NtUserRealChildWindowFromPoint(HWND Parent,
-                               LONG x,
-                               LONG y)
-{
-   STUB
-
-   return 0;
-}
-
-/*
- * @unimplemented
- */
 DWORD APIENTRY
 NtUserSetImeOwnerWindow(DWORD Unknown0,
                         DWORD Unknown1)
@@ -1038,6 +1014,18 @@
    STUB
 
    return 0;
+}
+
+BOOL
+APIENTRY
+NtUserGetLayeredWindowAttributes(
+    HWND hwnd,
+    COLORREF *pcrKey,
+    BYTE *pbAlpha,
+    DWORD *pdwFlags)
+{
+    STUB;
+    return 0;
 }
 
 /*

Modified: trunk/reactos/win32ss/user/ntuser/winpos.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/winpos.c?rev=56609&r1=56608&r2=56609&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/winpos.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/winpos.c [iso-8859-1] Sat May 19 04:40:37 
2012
@@ -150,10 +150,8 @@
     if (!Wnd) return FALSE;
 
     style = Wnd->style;
-    if (!(style & WS_VISIBLE) &&
-        Wnd->head.pti->pEThread->ThreadsProcess != CsrProcess) return FALSE;
-    if ((style & WS_MINIMIZE) &&
-        Wnd->head.pti->pEThread->ThreadsProcess != CsrProcess) return FALSE;
+    if (!(style & WS_VISIBLE)) return FALSE;
+    if (style & WS_MINIMIZE) return FALSE;
     if ((style & (WS_POPUP|WS_CHILD)) == WS_CHILD) return FALSE;
     return TRUE;
     /* FIXME: This window could be disable  because the child that closed
@@ -1783,8 +1781,10 @@
     WPARAM wParam = SIZE_RESTORED;
 
     IntGetClientRect(Wnd, &Rect);
+    lParam = MAKELONG(Rect.right-Rect.left, Rect.bottom-Rect.top);
 
     Wnd->state &= ~WNDS_SENDSIZEMOVEMSGS;
+
     if (Wnd->style & WS_MAXIMIZE)
     {
         wParam = SIZE_MAXIMIZED;
@@ -1792,9 +1792,10 @@
     else if (Wnd->style & WS_MINIMIZE)
     {
         wParam = SIZE_MINIMIZED;
+        lParam = 0;
     }
 
-    co_IntSendMessageNoWait(UserHMGetHandle(Wnd), WM_SIZE, wParam, 
MAKELONG(Rect.right-Rect.left, Rect.bottom-Rect.top));
+    co_IntSendMessageNoWait(UserHMGetHandle(Wnd), WM_SIZE, wParam, lParam);
 
     if (Wnd->spwndParent == UserGetDesktopWindow()) // Wnd->spwndParent->fnid 
!= FNID_DESKTOP )
        lParam = MAKELONG(Wnd->rcClient.left, Wnd->rcClient.top);
@@ -2010,8 +2011,7 @@
 
     UserReferenceObject(ScopeWin);
 
-    if (Point->x - ScopeWin->rcClient.left < ScopeWin->rcClient.right &&
-        Point->y - ScopeWin->rcClient.top < ScopeWin->rcClient.bottom )
+    if ( RECTL_bPointInRect(&ScopeWin->rcClient, Point->x, Point->y) )
     {
         List = IntWinListChildren(ScopeWin);
         if(List)
@@ -2075,6 +2075,99 @@
    ASSERT_REFS_CO(ScopeWin);
 
    return Window;
+}
+
+PWND FASTCALL
+IntRealChildWindowFromPoint(PWND Parent, LONG x, LONG y)
+{
+   POINTL Pt;
+   HWND *List, *phWnd;
+   PWND pwndHit = NULL;
+
+   Pt.x = x;
+   Pt.y = y;
+
+   if (Parent != UserGetDesktopWindow())
+   {
+      Pt.x += Parent->rcClient.left;
+      Pt.y += Parent->rcClient.top;
+   }
+
+   if (!IntPtInWindow(Parent, Pt.x, Pt.y)) return NULL;
+
+   if ((List = IntWinListChildren(Parent)))
+   {
+      for (phWnd = List; *phWnd; phWnd++)
+      {
+         PWND Child;
+         if ((Child = UserGetWindowObject(*phWnd)))
+         {
+            if ( Child->style & WS_VISIBLE && IntPtInWindow(Child, Pt.x, Pt.y) 
)
+            {
+               if ( Child->pcls->atomClassName != 
gpsi->atomSysClass[ICLS_BUTTON] ||
+                   (Child->style & BS_TYPEMASK) != BS_GROUPBOX )
+               {
+                  ExFreePool(List);
+                  return Child;
+               }
+               pwndHit = Child;
+            }
+         }
+      }
+      ExFreePool(List);
+   }
+   return pwndHit ? pwndHit : Parent;
+}
+
+PWND APIENTRY
+IntChildWindowFromPointEx(PWND Parent, LONG x, LONG y, UINT uiFlags)
+{
+   POINTL Pt;
+   HWND *List, *phWnd;
+   PWND pwndHit = NULL;
+
+   Pt.x = x;
+   Pt.y = y;
+
+   if (Parent != UserGetDesktopWindow())
+   {
+      if (Parent->ExStyle & WS_EX_LAYOUTRTL)
+         Pt.x = Parent->rcClient.right - Pt.x;
+      else
+         Pt.x += Parent->rcClient.left;
+      Pt.y += Parent->rcClient.top;
+   }
+
+   if (!IntPtInWindow(Parent, Pt.x, Pt.y)) return NULL;
+
+   if ((List = IntWinListChildren(Parent)))
+   {
+      for (phWnd = List; *phWnd; phWnd++)
+      {
+         PWND Child;
+         if ((Child = UserGetWindowObject(*phWnd)))
+         {
+            if (uiFlags & (CWP_SKIPINVISIBLE|CWP_SKIPDISABLED))
+            {
+               if (!(Child->style & WS_VISIBLE) && (uiFlags & 
CWP_SKIPINVISIBLE)) continue;
+               if ((Child->style & WS_DISABLED) && (uiFlags & 
CWP_SKIPDISABLED)) continue;
+            }
+
+            if (uiFlags & CWP_SKIPTRANSPARENT)
+            {
+               if (Child->ExStyle & WS_EX_TRANSPARENT) continue;
+            }
+
+            if (IntPtInWindow(Child, Pt.x, Pt.y))
+            {
+               pwndHit = Child;
+               break;
+            }
+         }
+      }
+      ExFreePool(List);
+   }
+   return pwndHit ? pwndHit : Parent;
 }
 
 HDWP
@@ -2191,7 +2284,7 @@
                winpos->pos.hwnd, winpos->pos.hwndInsertAfter, winpos->pos.x, 
winpos->pos.y,
                winpos->pos.cx, winpos->pos.cy, winpos->pos.flags);
 
-        pwnd = UserGetWindowObject(winpos->pos.hwnd);
+        pwnd = (PWND)UserGetObject(gHandleTable, winpos->pos.hwnd, otWindow);
         if (!pwnd)
            continue;
 
@@ -2207,7 +2300,7 @@
               /* Yes it's a pointer inside Win32k! */
               lRes = co_IntSendMessageNoWait( winpos->pos.hwnd, 
WM_ASYNC_SETWINDOWPOS, 0, (LPARAM)ppos);
               /* We handle this the same way as Event Hooks and Hooks. */
-              if ( -1 == (int) lRes )
+              if ( !lRes )
               {
                  ExFreePoolWithTag(ppos, USERTAG_SWP);
               }
@@ -2240,61 +2333,16 @@
                              LONG y,
                              UINT uiFlags)
 {
-   PWND Parent;
-   POINTL Pt;
-   HWND Ret;
-   HWND *List, *phWnd;
-
-   if(!(Parent = UserGetWindowObject(hwndParent)))
-   {
-      return NULL;
-   }
-
-   Pt.x = x;
-   Pt.y = y;
-
-   if(Parent->head.h != IntGetDesktopWindow())
-   {
-      Pt.x += Parent->rcClient.left;
-      Pt.y += Parent->rcClient.top;
-   }
-
-   if(!IntPtInWindow(Parent, Pt.x, Pt.y))
-   {
-      return NULL;
-   }
-
-   Ret = Parent->head.h;
-   if((List = IntWinListChildren(Parent)))
-   {
-      for(phWnd = List; *phWnd; phWnd++)
-      {
-         PWND Child;
-         if((Child = UserGetWindowObject(*phWnd)))
-         {
-            if(!(Child->style & WS_VISIBLE) && (uiFlags & CWP_SKIPINVISIBLE))
-            {
-               continue;
-            }
-            if((Child->style & WS_DISABLED) && (uiFlags & CWP_SKIPDISABLED))
-            {
-               continue;
-            }
-            if((Child->ExStyle & WS_EX_TRANSPARENT) && (uiFlags & 
CWP_SKIPTRANSPARENT))
-            {
-               continue;
-            }
-            if(IntPtInWindow(Child, Pt.x, Pt.y))
-            {
-               Ret = Child->head.h;
-               break;
-            }
-         }
-      }
-      ExFreePool(List);
-   }
-
-   return Ret;
+   PWND pwndParent;
+   TRACE("Enter NtUserChildWindowFromPointEx\n");
+   UserEnterExclusive();
+   if ((pwndParent = UserGetWindowObject(hwndParent)))
+   {
+      pwndParent = IntChildWindowFromPointEx(pwndParent, x, y, uiFlags);
+   }
+   UserLeave();
+   TRACE("Leave NtUserChildWindowFromPointEx\n");
+   return pwndParent ? UserHMGetHandle(pwndParent) : NULL;
 }
 
 /*
@@ -2521,9 +2569,9 @@
      goto Exit;
   }
 
-  co_WinPosMinMaximize(pWnd, cmd, &NewPos);
-
-  SwFlags = Hide ? SWP_NOACTIVATE|SWP_NOZORDER|SWP_FRAMECHANGED : 
SWP_NOZORDER|SWP_FRAMECHANGED;
+  SwFlags = co_WinPosMinMaximize(pWnd, cmd, &NewPos);
+
+  SwFlags |= Hide ? SWP_NOACTIVATE : 0;
 
   co_WinPosSetWindowPos( pWnd,
                          NULL,
@@ -2556,6 +2604,26 @@
    return NtUserSetWindowPos(hWnd, 0, X, Y, nWidth, nHeight,
                              (bRepaint ? SWP_NOZORDER | SWP_NOACTIVATE :
                               SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW));
+}
+
+/*
+ * @implemented
+ */
+HWND APIENTRY
+NtUserRealChildWindowFromPoint(HWND Parent,
+                               LONG x,
+                               LONG y)
+{
+   PWND pwndParent;
+   TRACE("Enter NtUserRealChildWindowFromPoint\n");
+   UserEnterShared();
+   if ((pwndParent = UserGetWindowObject(Parent)))
+   {
+      pwndParent = IntRealChildWindowFromPoint(pwndParent, x, y);
+   }
+   UserLeave();
+   TRACE("Leave NtUserRealChildWindowFromPoint\n");
+   return pwndParent ? UserHMGetHandle(pwndParent) : NULL;
 }
 
 /*

Modified: trunk/reactos/win32ss/user/ntuser/winpos.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/winpos.h?rev=56609&r1=56608&r2=56609&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/winpos.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/winpos.h [iso-8859-1] Sat May 19 04:40:37 
2012
@@ -53,4 +53,5 @@
 BOOLEAN FASTCALL co_WinPosShowWindow(PWND Window, INT Cmd);
 void FASTCALL co_WinPosSendSizeMove(PWND Window);
 PWND FASTCALL co_WinPosWindowFromPoint(PWND ScopeWin, POINT *WinPoint, USHORT* 
HitTest);
-VOID FASTCALL co_WinPosActivateOtherWindow(PWND Window);
+VOID FASTCALL co_WinPosActivateOtherWindow(PWND);
+PWND FASTCALL IntRealChildWindowFromPoint(PWND,LONG,LONG);

Modified: trunk/reactos/win32ss/user/user32/misc/stubs.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/misc/stubs.c?rev=56609&r1=56608&r2=56609&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/user32/misc/stubs.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/misc/stubs.c [iso-8859-1] Sat May 19 
04:40:37 2012
@@ -67,28 +67,6 @@
     PCLIENTINFO pci = GetWin32ClientInfo();
 
     return pci->dwCompatFlags2;
-}
-
-/*
- * @unimplemented
- */
-UINT
-WINAPI
-GetInternalWindowPos(
-                    HWND hwnd,
-                    LPRECT rectWnd,
-                    LPPOINT ptIcon
-                    )
-{
-    WINDOWPLACEMENT wndpl;
-
-    if (GetWindowPlacement(hwnd, &wndpl))
-    {
-               if (rectWnd) *rectWnd = wndpl.rcNormalPosition;
-               if (ptIcon)  *ptIcon = wndpl.ptMinPosition;
-               return wndpl.showCmd;
-    }
-    return 0;
 }
 
 /*

Modified: trunk/reactos/win32ss/user/user32/user32.spec
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/user32.spec?rev=56609&r1=56608&r2=56609&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/user32/user32.spec [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/user32.spec [iso-8859-1] Sat May 19 
04:40:37 2012
@@ -286,7 +286,7 @@
 @ stdcall GetIconInfo(long ptr)
 @ stdcall GetInputDesktop()
 @ stdcall GetInputState()
-@ stdcall GetInternalWindowPos(long ptr ptr) ; direct call 
NtUserGetInternalWindowPos
+@ stdcall GetInternalWindowPos(long ptr ptr) NtUserGetInternalWindowPos
 @ stdcall GetKBCodePage()
 @ stdcall GetKeyNameTextA(long ptr long)
 @ stdcall GetKeyNameTextW(long ptr long)

Modified: trunk/reactos/win32ss/user/user32/windows/window.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/windows/window.c?rev=56609&r1=56608&r2=56609&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/user32/windows/window.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/windows/window.c [iso-8859-1] Sat May 19 
04:40:37 2012
@@ -1028,21 +1028,12 @@
 
 
 /*
- * @unimplemented
+ * @implemented
  */
 BOOL WINAPI
 GetProcessDefaultLayout(DWORD *pdwDefaultLayout)
 {
-    if (!pdwDefaultLayout)
-    {
-        SetLastError(ERROR_INVALID_PARAMETER);
-        return FALSE;
-    }
-
-    UNIMPLEMENTED;
-
-    *pdwDefaultLayout = 0;
-    return TRUE;
+return (BOOL)NtUserCallOneParam( (DWORD_PTR)pdwDefaultLayout, 
ONEPARAM_ROUTINE_GETPROCDEFLAYOUT);
 }
 
 
@@ -1659,7 +1650,7 @@
 RealChildWindowFromPoint(HWND hwndParent,
                          POINT ptParentClientCoords)
 {
-    return ChildWindowFromPointEx(hwndParent, ptParentClientCoords, 
CWP_SKIPTRANSPARENT | CWP_SKIPINVISIBLE);
+    return NtUserRealChildWindowFromPoint(hwndParent, ptParentClientCoords.x, 
ptParentClientCoords.y);
 }
 
 /*
@@ -1673,16 +1664,12 @@
 
 
 /*
- * @unimplemented
+ * @implemented
  */
 BOOL WINAPI
 SetProcessDefaultLayout(DWORD dwDefaultLayout)
 {
-    if (dwDefaultLayout == 0)
-        return TRUE;
-
-    UNIMPLEMENTED;
-    return FALSE;
+return NtUserCallOneParam( (DWORD_PTR)dwDefaultLayout, 
ONEPARAM_ROUTINE_SETPROCDEFLAYOUT);
 }
 
 


Reply via email to