Non-client painting fixes.
authorDavid Welch <welch@cwcom.net>
Sat, 31 Aug 2002 23:18:47 +0000 (23:18 +0000)
committerDavid Welch <welch@cwcom.net>
Sat, 31 Aug 2002 23:18:47 +0000 (23:18 +0000)
svn path=/trunk/; revision=3447

18 files changed:
reactos/iface/addsys/w32ksvc.db
reactos/include/user32/callback.h
reactos/include/win32k/ntuser.h
reactos/lib/gdi32/misc/stubs.c
reactos/lib/gdi32/objects/dc.c
reactos/lib/user32/misc/desktop.c
reactos/lib/user32/misc/dllmain.c
reactos/lib/user32/misc/stubs.c
reactos/lib/user32/windows/defwnd.c
reactos/lib/user32/windows/window.c
reactos/subsys/win32k/include/callback.h
reactos/subsys/win32k/makefile
reactos/subsys/win32k/ntuser/callback.c
reactos/subsys/win32k/ntuser/metric.c
reactos/subsys/win32k/ntuser/painting.c
reactos/subsys/win32k/ntuser/window.c
reactos/subsys/win32k/ntuser/winpos.c
reactos/subsys/win32k/objects/cliprgn.c

index 5b95995..3d978a1 100644 (file)
@@ -395,6 +395,7 @@ NtUserGetPriorityClipboardFormat        2
 NtUserGetProcessWindowStation           0
 NtUserGetScrollBarInfo                  3
 NtUserGetSystemMenu                     2
+NtUserGetSystemMetrics                 1
 NtUserGetThreadDesktop                  2
 NtUserGetThreadState                    1
 NtUserGetTitleBarInfo                   2
@@ -403,6 +404,7 @@ NtUserGetUpdateRgn                      3
 NtUserGetWindowDC                       1
 NtUserGetWindowPlacement                2
 NtUserGetWindowLong                    2
+NtUserGetWindowRect                    2
 NtUserGetWOWClass                       2
 NtUserHideCaret                         1
 NtUserHiliteMenuItem                    4
index ee2bc98..e6f2fd5 100644 (file)
@@ -79,5 +79,7 @@ NTSTATUS STDCALL
 User32SendCREATEMessageForKernel(PVOID Arguments, ULONG ArgumentLength);
 NTSTATUS STDCALL
 User32SendGETMINMAXINFOMessageForKernel(PVOID Arguments, ULONG ArgumentLength);
+NTSTATUS STDCALL
+User32SendNCCALCSIZEMessageForKernel(PVOID Arguments, ULONG ArgumentLength);
 
 #endif /* __INCLUDE_USER32_CALLBACK_H */
index 34376fa..aca3017 100644 (file)
@@ -9,6 +9,8 @@ DWORD STDCALL
 NtUserGetWindowLong(HWND hWnd, DWORD Index);
 INT STDCALL
 NtUserReleaseDC(HWND hWnd, HDC hDc);
+BOOL STDCALL
+NtUserGetWindowRect(HWND hWnd, LPRECT Rect);
 
 NTSTATUS
 STDCALL
index 5c407d6..0b31c04 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: stubs.c,v 1.8 2002/08/18 07:02:56 ei Exp $
+/* $Id: stubs.c,v 1.9 2002/08/31 23:18:45 dwelch Exp $
  *
  * reactos/lib/gdi32/misc/stubs.c
  *
@@ -466,20 +466,6 @@ GetBrushOrgEx(
 }
 
 
-
-int
-STDCALL
-GetClipBox(
-       HDC     a0,
-       LPRECT  a1
-       )
-{
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-
-
 int
 STDCALL
 GetClipRgn(
index 6b0c4a8..454fb65 100644 (file)
@@ -7,6 +7,13 @@
 #include <ddk/ntddk.h>
 #include <win32k/kapi.h>
 
+int STDCALL
+GetClipBox(HDC hDc, LPRECT Rect)
+{
+  return(W32kGetClipBox(hDc, Rect));
+}
+
+
 HDC
 STDCALL
 CreateDCA (
index a4a9686..a40f2d6 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: desktop.c,v 1.3 2002/07/04 19:56:34 dwelch Exp $
+/* $Id: desktop.c,v 1.4 2002/08/31 23:18:46 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS user32.dll
 #include <user32.h>
 #include <debug.h>
 
+int STDCALL
+GetSystemMetrics(int nIndex)
+{
+  return(NtUserGetSystemMetrics(nIndex));
+}
+
+WINBOOL STDCALL
+SystemParametersInfoA(UINT uiAction,
+                     UINT uiParam,
+                     PVOID pvParam,
+                     UINT fWinIni)
+{
+  return(SystemParametersInfoW(uiAction, uiParam, pvParam, fWinIni));
+}
+
+WINBOOL STDCALL
+SystemParametersInfoW(UINT uiAction,
+                     UINT uiParam,
+                     PVOID pvParam,
+                     UINT fWinIni)
+{
+  switch (uiAction)
+    {
+    case SPI_GETWORKAREA:
+      {
+       ((PRECT)pvParam)->left = 0;
+       ((PRECT)pvParam)->top = 0;
+       ((PRECT)pvParam)->right = 640;
+       ((PRECT)pvParam)->bottom = 480;
+       return(TRUE);
+      }
+    }
+  return(FALSE);
+}
+
 
 WINBOOL
 STDCALL
index cce1e76..6c3e33c 100644 (file)
@@ -61,6 +61,8 @@ Init(VOID)
     (PVOID)User32SendCREATEMessageForKernel;
   NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDGETMINMAXINFO] =
     (PVOID)User32SendGETMINMAXINFOMessageForKernel;
+  NtCurrentPeb()->KernelCallbackTable[USER32_CALLBACK_SENDNCCALCSIZE] =
+    (PVOID)User32SendNCCALCSIZEMessageForKernel;
 
   GdiDllInitialize(NULL, DLL_PROCESS_ATTACH, NULL);
 
index c962931..0c798e0 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: stubs.c,v 1.9 2002/07/04 19:56:34 dwelch Exp $
+/* $Id: stubs.c,v 1.10 2002/08/31 23:18:46 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS user32.dll
@@ -231,15 +231,6 @@ GetSysColorBrush(
   return (HBRUSH)0;
 }
 
-/* ReactOS extension */
-HPEN
-STDCALL
-GetSysColorPen(
-  int nIndex)
-{
-  return (HPEN)0;
-}
-
 HMENU
 STDCALL
 GetSystemMenu(
@@ -249,12 +240,6 @@ GetSystemMenu(
   return (HMENU)0;
 }
 
-int
-STDCALL
-GetSystemMetrics(
-  int nIndex)
-{
-}
 
 
 
@@ -563,29 +548,6 @@ SwapMouseButton(
   return FALSE;
 }
 
-WINBOOL
-STDCALL
-SystemParametersInfoA(
-  UINT uiAction,
-  UINT uiParam,
-  PVOID pvParam,
-  UINT fWinIni)
-{
-  return FALSE;
-}
-
-WINBOOL
-STDCALL
-SystemParametersInfoW(
-  UINT uiAction,
-  UINT uiParam,
-  PVOID pvParam,
-  UINT fWinIni)
-{
-  return FALSE;
-}
-
-
 WINBOOL
 STDCALL
 TrackMouseEvent(
index 520340e..1caab23 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: defwnd.c,v 1.4 2002/07/04 19:56:34 dwelch Exp $
+/* $Id: defwnd.c,v 1.5 2002/08/31 23:18:46 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS user32.dll
@@ -27,8 +27,49 @@ static HBITMAP hbitmapMaximizeD;
 static HBITMAP hbitmapRestore;
 static HBITMAP hbitmapRestoreD;
 
+static COLORREF SysColours[] =
+  {
+    RGB(224, 224, 224) /* COLOR_SCROLLBAR */,
+    RGB(192, 192, 192) /* COLOR_BACKGROUND */,
+    RGB(0, 64, 128) /* COLOR_ACTIVECAPTION */,
+    RGB(255, 255, 255) /* COLOR_INACTIVECAPTION */,
+    RGB(255, 255, 255) /* COLOR_MENU */,
+    RGB(255, 255, 255) /* COLOR_WINDOW */,
+    RGB(0, 0, 0) /* COLOR_WINDOWFRAME */,
+    RGB(0, 0, 0) /* COLOR_MENUTEXT */,
+    RGB(0, 0, 0) /* COLOR_WINDOWTEXT */,
+    RGB(255, 255, 255) /* COLOR_CAPTIONTEXT */,
+    RGB(128, 128, 128) /* COLOR_ACTIVEBORDER */,
+    RGB(255, 255, 255) /* COLOR_INACTIVEBORDER */,
+    RGB(255, 255, 232) /* COLOR_APPWORKSPACE */,
+    RGB(224, 224, 224) /* COLOR_HILIGHT */,
+    RGB(0, 0, 0) /* COLOR_HILIGHTTEXT */,
+    RGB(192, 192, 192) /* COLOR_BTNFACE */,
+    RGB(128, 128, 128) /* COLOR_BTNSHADOW */,
+    RGB(192, 192, 192) /* COLOR_GRAYTEXT */,
+    RGB(0, 0, 0) /* COLOR_BTNTEXT */,
+    RGB(0, 0, 0) /* COLOR_INACTIVECAPTIONTEXT */,
+    RGB(255, 255, 255) /* COLOR_BTNHILIGHT */,
+    RGB(32, 32, 32) /* COLOR_3DDKSHADOW */,
+    RGB(192, 192, 192) /* COLOR_3DLIGHT */,
+    RGB(0, 0, 0) /* COLOR_INFOTEXT */,
+    RGB(255, 255, 192) /* COLOR_INFOBK */,
+    RGB(184, 180, 184) /* COLOR_ALTERNATEBTNFACE */,
+    RGB(0, 0, 255) /* COLOR_HOTLIGHT */,
+    RGB(16, 132, 208) /* COLOR_GRADIENTACTIVECAPTION */,
+    RGB(181, 181, 181) /* COLOR_GRADIENTINACTIVECAPTION */,
+  };
+
 /* FUNCTIONS *****************************************************************/
 
+/* ReactOS extension */
+HPEN STDCALL
+GetSysColorPen(int nIndex)
+{
+  return(CreatePen(PS_SOLID, 1, SysColours[nIndex]));
+}
+
+
 LRESULT STDCALL
 DefFrameProcA(HWND hWnd,
              HWND hWndMDIClient,
index b9877fe..9b43a57 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: window.c,v 1.9 2002/08/30 02:47:36 dwelch Exp $
+/* $Id: window.c,v 1.10 2002/08/31 23:18:46 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS user32.dll
 
 /* FUNCTIONS *****************************************************************/
 
+NTSTATUS STDCALL
+User32SendNCCALCSIZEMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
+{
+  PSENDNCCALCSIZEMESSAGE_CALLBACK_ARGUMENTS CallbackArgs;
+  SENDNCCALCSIZEMESSAGE_CALLBACK_RESULT Result;
+  WNDPROC Proc;
+
+  DbgPrint("User32SendNCCALCSIZEMessageForKernel.\n");
+  CallbackArgs = (PSENDNCCALCSIZEMESSAGE_CALLBACK_ARGUMENTS)Arguments;
+  if (ArgumentLength != sizeof(SENDNCCALCSIZEMESSAGE_CALLBACK_ARGUMENTS))
+    {
+      DbgPrint("Wrong length.\n");
+      return(STATUS_INFO_LENGTH_MISMATCH);
+    }
+  Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
+  DbgPrint("Proc %X\n", Proc);
+  /* Call the window procedure; notice kernel messages are always unicode. */
+  if (CallbackArgs->Validate)
+    {
+      Result.Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_NCCALCSIZE, 
+                                     TRUE, 
+                                     (LPARAM)&CallbackArgs->Params);
+      Result.Params = CallbackArgs->Params;
+    }
+  else
+    {
+      Result.Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_NCCALCSIZE,
+                                     FALSE, (LPARAM)&CallbackArgs->Rect);
+      Result.Rect = CallbackArgs->Rect;
+    }
+  DbgPrint("Returning result %d.\n", Result);
+  ZwCallbackReturn(&Result, sizeof(Result), STATUS_SUCCESS);
+  /* Doesn't return. */
+}
+
 NTSTATUS STDCALL
 User32SendGETMINMAXINFOMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
 {
@@ -652,7 +687,7 @@ WINBOOL STDCALL
 GetWindowRect(HWND hWnd,
              LPRECT lpRect)
 {
-  return FALSE;
+  return(NtUserGetWindowRect(hWnd, lpRect));
 }
 
 int STDCALL
index ef1bae9..b620bee 100644 (file)
@@ -24,8 +24,8 @@ W32kCallSentMessageCallback(SENDASYNCPROC CompletionCallback,
                            ULONG_PTR CompletionCallbackContext,
                            LRESULT Result);
 LRESULT STDCALL
-W32kSendNCCALCSIZEMessage(HWND Wnd, BOOL Validate, RECT Rect1,
-                         RECT Rect2, RECT Rect3, PWINDOWPOS Pos);
+W32kSendNCCALCSIZEMessage(HWND Wnd, BOOL Validate, PRECT Rect,
+                         NCCALCSIZE_PARAMS* Params);
 LRESULT STDCALL
 W32kSendGETMINMAXINFOMessage(HWND Wnd, MINMAXINFO* MinMaxInfo);
 
index 68aac87..1438c19 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: makefile,v 1.47 2002/08/24 01:45:37 ekohl Exp $
+# $Id: makefile,v 1.48 2002/08/31 23:18:46 dwelch Exp $
 
 PATH_TO_TOP = ../..
 
@@ -77,7 +77,7 @@ DEP_OBJECTS := $(TARGET_OBJECTS)
 DEP_EXCLUDE_FILTER := main/svctabm.d
 include $(PATH_TO_TOP)/tools/depend.mk
 
-misc/svctabm.o: misc/svctab.c
+main/svctabm.o: main/svctab.c
 
 .dummy:
 
index f09e607..7d46f62 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: callback.c,v 1.6 2002/07/17 21:04:57 dwelch Exp $
+/* $Id: callback.c,v 1.7 2002/08/31 23:18:46 dwelch Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -19,6 +19,7 @@
 #include <include/winsta.h>
 #include <include/msgqueue.h>
 #include <user32/callback.h>
+#include <include/callback.h>
 
 #define NDEBUG
 #include <debug.h>
index d1b2118..9ce0972 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: metric.c,v 1.1 2002/07/04 20:12:27 dwelch Exp $
+/* $Id: metric.c,v 1.2 2002/08/31 23:18:47 dwelch Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
 ULONG STDCALL
 NtUserGetSystemMetrics(ULONG Index)
 {
+  switch (Index)
+    {
+    case SM_CXSCREEN:
+      return(640);
+    case SM_CYSCREEN:
+      return(480);
+    case SM_CXMINTRACK:
+      return(100);
+    case SM_CYMINTRACK:
+      return(28);
+    case SM_CXDLGFRAME:
+      return(4);
+    case SM_CYDLGFRAME:
+      return(4);
+    case SM_CXFRAME:
+      return(5);
+    case SM_CYFRAME:
+      return(5);
+    case SM_CXBORDER:
+      return(1);
+    case SM_CYBORDER:
+      return(1);
+    case SM_CXVSCROLL:
+      return(17);
+    case SM_CYHSCROLL:
+      return(17);
+    default:
+      return(0xFFFFFFFF);
+    }
 }
 
 /* EOF */
index 26bda81..45f3873 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: painting.c,v 1.4 2002/08/27 23:29:40 dwelch Exp $
+/* $Id: painting.c,v 1.5 2002/08/31 23:18:47 dwelch Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -705,7 +705,7 @@ PaintUpdateNCRegion(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
   if (hClip == NULL && Flags & UNC_ENTIRE)
     {
       if (RtlCompareMemory(&Window->WindowRect, &Window->ClientRect,
-                          sizeof(RECT)) == sizeof(RECT))
+                          sizeof(RECT)) != sizeof(RECT))
        {
          hClip = (HANDLE)1;
        }
index f8efd30..04d7ea9 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: window.c,v 1.12 2002/08/30 02:47:37 dwelch Exp $
+/* $Id: window.c,v 1.13 2002/08/31 23:18:47 dwelch Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -163,6 +163,31 @@ W32kGetClientRect(PWINDOW_OBJECT WindowObject, PRECT Rect)
   Rect->top = WindowObject->ClientRect.bottom - WindowObject->ClientRect.top;
 }
 
+BOOL STDCALL
+W32kGetWindowRect(HWND hWnd, LPRECT Rect)
+{
+  PWINDOW_OBJECT WindowObject;
+
+  WindowObject = W32kGetWindowObject(hWnd);
+  if (WindowObject == NULL)
+    {
+      return(FALSE);
+    }
+  *Rect = WindowObject->WindowRect;
+  if (WindowObject->Style & WS_CHILD)
+    {
+      DbgBreakPoint();
+    }
+  W32kReleaseWindowObject(WindowObject);
+  return(TRUE);
+}
+
+BOOL STDCALL
+NtUserGetWindowRect(HWND hWnd, LPRECT Rect)
+{
+  return(W32kGetWindowRect(hWnd, Rect));
+}
+
 HWND
 W32kGetActiveWindow(VOID)
 {
index b080269..6fdefa9 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: winpos.c,v 1.3 2002/07/17 21:04:57 dwelch Exp $
+/* $Id: winpos.c,v 1.4 2002/08/31 23:18:47 dwelch Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -521,6 +521,8 @@ WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
 LRESULT
 WinPosGetNonClientSize(HWND Wnd, RECT* WindowRect, RECT* ClientRect)
 {
+  *ClientRect = *WindowRect;
+  return(W32kSendNCCALCSIZEMessage(Wnd, FALSE, ClientRect, NULL));
 }
 
 BOOLEAN
index 40c63e3..831e2ca 100644 (file)
@@ -6,6 +6,7 @@
 #include <win32k/dc.h>
 #include <win32k/region.h>
 #include <win32k/cliprgn.h>
+#include <win32k/coord.h>
 
 // #define NDEBUG
 #include <win32k/debug1.h>