[Win32k]
authorJames Tabor <james.tabor@reactos.org>
Fri, 11 Oct 2013 21:46:30 +0000 (21:46 +0000)
committerJames Tabor <james.tabor@reactos.org>
Fri, 11 Oct 2013 21:46:30 +0000 (21:46 +0000)
- Fix CORE-6945.
- Miscellaneous adds and changes.

svn path=/trunk/; revision=60622

17 files changed:
reactos/win32ss/include/callback.h
reactos/win32ss/include/ntgdityp.h
reactos/win32ss/include/ntuser.h
reactos/win32ss/user/ntuser/callback.c
reactos/win32ss/user/ntuser/callback.h
reactos/win32ss/user/ntuser/class.c
reactos/win32ss/user/ntuser/defwnd.c
reactos/win32ss/user/ntuser/painting.c
reactos/win32ss/user/ntuser/painting.h
reactos/win32ss/user/ntuser/prop.c
reactos/win32ss/user/ntuser/prop.h
reactos/win32ss/user/ntuser/window.c
reactos/win32ss/user/user32/include/user32p.h
reactos/win32ss/user/user32/misc/dllmain.c
reactos/win32ss/user/user32/windows/defwnd.c
reactos/win32ss/user/user32/windows/nonclient.c
reactos/win32ss/user/user32/windows/prop.c

index d491f96..4955bef 100644 (file)
@@ -12,7 +12,8 @@
 #define USER32_CALLBACK_CLIENTLOADLIBRARY     (8)
 #define USER32_CALLBACK_GETCHARSETINFO        (9)
 #define USER32_CALLBACK_COPYIMAGE             (10)
-#define USER32_CALLBACK_MAXIMUM               (10)
+#define USER32_CALLBACK_SETWNDICONS           (11)
+#define USER32_CALLBACK_MAXIMUM               (11)
 
 typedef struct _WINDOWPROC_CALLBACK_ARGUMENTS
 {
@@ -105,9 +106,17 @@ typedef struct _GET_CHARSET_INFO
     CHARSETINFO Cs;
 } GET_CHARSET_INFO, *PGET_CHARSET_INFO;
 
+typedef struct _SETWNDICONS_CALLBACK_ARGUMENTS
+{
+    HICON hIconSmWindows;
+    HICON hIconWindows;
+} SETWNDICONS_CALLBACK_ARGUMENTS, *PSETWNDICONS_CALLBACK_ARGUMENTS;
+
 NTSTATUS WINAPI
 User32CallCopyImageFromKernel(PVOID Arguments, ULONG ArgumentLength);
 NTSTATUS WINAPI
+User32CallSetWndIconsFromKernel(PVOID Arguments, ULONG ArgumentLength);
+NTSTATUS WINAPI
 User32CallWindowProcFromKernel(PVOID Arguments, ULONG ArgumentLength);
 NTSTATUS WINAPI
 User32CallSendAsyncProcForKernel(PVOID Arguments, ULONG ArgumentLength);
index 956c6d2..d0f6b60 100644 (file)
@@ -742,5 +742,6 @@ ASSERT_PFN(DeriveSurface);
 ASSERT_PFN(QueryGlyphAttrs);
 ASSERT_PFN(Notify);
 ASSERT_PFN(SynchronizeSurface);
+ASSERT_PFN(ResetDevice);
 
 #endif
index e64fa9d..1677a76 100644 (file)
@@ -69,6 +69,7 @@ typedef enum _USERTHREADINFOCLASS
     UserThreadWOWInformation,
     UserThreadHungStatus,
     UserThreadInitiateShutdown,
+
     UserThreadEndShutdown,
     UserThreadUseActiveDesktop,
     UserThreadUseDesktop,
@@ -119,6 +120,7 @@ typedef struct _DESKTOPINFO
     HWND hTaskManWindow;
     HWND hProgmanWindow;
     HWND hShellWindow;
+    struct _WND * spwndShell;
 
     PPROCESSINFO ppiShellProcess;
 
@@ -857,7 +859,7 @@ typedef struct _PERUSERSERVERINFO
     TEXTMETRICW   tmSysFont;
     DPISERVERINFO dpiSystem;
     HICON         hIconSmWindows;
-    HICON         hIcoWindows;
+    HICON         hIconWindows;
     DWORD         dwKeyCache;
     DWORD         dwAsyncKeyCache;
     ULONG         cCaptures;
index 833da09..3d6c53d 100644 (file)
@@ -881,7 +881,6 @@ co_IntClientThreadSetup(VOID)
    return Status;
 }
 
-
 HANDLE FASTCALL
 co_IntCopyImage(HANDLE hnd, UINT type, INT desiredx, INT desiredy, UINT flags)
 {
@@ -993,4 +992,53 @@ co_IntGetCharsetInfo(LCID Locale, PCHARSETINFO pCs)
    return TRUE;
 }
 
+BOOL FASTCALL
+co_IntSetWndIcons(VOID)
+{
+   NTSTATUS Status;
+   ULONG ArgumentLength, ResultLength;
+   PVOID Argument, ResultPointer;
+   PSETWNDICONS_CALLBACK_ARGUMENTS Common;
+
+   ArgumentLength = ResultLength = 0;
+   Argument = ResultPointer = NULL;
+
+   ArgumentLength = sizeof(SETWNDICONS_CALLBACK_ARGUMENTS);
+
+   Argument = IntCbAllocateMemory(ArgumentLength);
+   if (NULL == Argument)
+   {
+      ERR("Set Window Icons callback failed: out of memory\n");
+      return FALSE;
+   }
+   Common = (PSETWNDICONS_CALLBACK_ARGUMENTS) Argument;
+
+   UserLeaveCo();
+
+   Status = KeUserModeCallback(USER32_CALLBACK_SETWNDICONS,
+                               Argument,
+                               ArgumentLength,
+                               &ResultPointer,
+                               &ResultLength);
+
+
+   UserEnterCo();
+
+   /* FIXME: Need to setup Registry System Cursor & Icons via Callbacks at init time! */
+   gpsi->hIconSmWindows = Common->hIconSmWindows;
+   gpsi->hIconWindows   = Common->hIconWindows;
+
+   ERR("hIconSmWindows %p hIconWindows %p \n",gpsi->hIconSmWindows,gpsi->hIconWindows);
+
+   IntCbFreeMemory(Argument);
+
+   if (!NT_SUCCESS(Status))
+   {
+      ERR("Set Window Icons callback failed!\n");
+      return FALSE;
+   }
+
+   return TRUE;
+}
+
 /* EOF */
index 5537e72..0464b48 100644 (file)
@@ -69,3 +69,5 @@ APIENTRY
 co_IntGetCharsetInfo(LCID Locale, PCHARSETINFO pCs);
 
 HANDLE FASTCALL co_IntCopyImage(HANDLE,UINT,INT,INT,UINT);
+
+BOOL FASTCALL co_IntSetWndIcons(VOID);
index 6bf41a6..6b11866 100644 (file)
@@ -1899,8 +1899,6 @@ UserSetClassLongPtr(IN PCLS Class,
 
                if (hIconSmIntern) Class->CSF_flags |= CSF_CACHEDSMICON;
                //// FIXME: Very hacky here but it passes the tests....
-               //// We should not kill a users handle!!! 
-               if (Class->hIconSm) IntClassDestroyIcon(Class->hIconSm); // Fixes 1013
                Ret = 0;                                                 // Fixes 1009
             }
             Class->hIconSm = (HANDLE)NewLong;
index ff14af4..f544580 100644 (file)
@@ -172,6 +172,7 @@ IntDefWindowProc(
    BOOL Ansi)
 {
    LRESULT lResult = 0;
+   USER_REFERENCE_ENTRY Ref;
 
    if (Msg > WM_USER) return 0;
 
@@ -205,6 +206,20 @@ IntDefWindowProc(
       case WM_CLIENTSHUTDOWN:
          return IntClientShutdown(Wnd, wParam, lParam);
 
+      case WM_APPCOMMAND:
+         ERR("WM_APPCOMMAND\n");
+         if ( (Wnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD &&
+               Wnd != co_GetDesktopWindow(Wnd) )
+         {
+            if (!co_HOOK_CallHooks(WH_SHELL, HSHELL_APPCOMMAND, wParam, lParam))
+               co_IntShellHookNotify(HSHELL_APPCOMMAND, wParam, lParam);
+            break;
+         }
+         UserRefObjectCo(Wnd->spwndParent, &Ref);
+         lResult = co_IntSendMessage(UserHMGetHandle(Wnd->spwndParent), WM_APPCOMMAND, wParam, lParam);
+         UserDerefObjectCo(Wnd->spwndParent);
+         break;
+
       case WM_CTLCOLORMSGBOX:
       case WM_CTLCOLOREDIT:
       case WM_CTLCOLORLISTBOX:
@@ -303,20 +318,22 @@ IntDefWindowProc(
    return lResult;
 }
 
-static HICON NC_IconForWindow( PWND pWnd )
+HICON FASTCALL NC_IconForWindow( PWND pWnd )
 {
    HICON hIcon = 0;
+   // First thing to do, init the Window Logo icons.
+   if (!gpsi->hIconSmWindows) co_IntSetWndIcons();
 
-   if (!pWnd->pcls || pWnd->fnid == FNID_DESKTOP) return hIcon;
+   if (!hIcon) hIcon = UserGetProp(pWnd, gpsi->atomIconSmProp);
+   if (!hIcon) hIcon = UserGetProp(pWnd, gpsi->atomIconProp);
    if (!hIcon) hIcon = pWnd->pcls->hIconSm;
    if (!hIcon) hIcon = pWnd->pcls->hIcon;
 
    if (!hIcon && pWnd->style & DS_MODALFRAME)
-   { // Fake it out for now, we use it as a test.
-      hIcon = (HICON)1;
-   /* FIXME: Need to setup Registry System Cursor & Icons via Callbacks at init time! */
+   {
       if (!hIcon) hIcon = gpsi->hIconSmWindows; // Both are IDI_WINLOGO Small
-      if (!hIcon) hIcon = gpsi->hIcoWindows;    // Reg size.
+      if (!hIcon) hIcon = gpsi->hIconWindows;   // Reg size.
+      hIcon = (HICON)1;
    }
    return hIcon;
 }
index 52e2b5f..72e6287 100644 (file)
@@ -1987,9 +1987,7 @@ BOOL UserDrawCaption(
 
       if (!hIcon && pWnd)
       {
-          hIcon = pWnd->pcls->hIconSm; // FIXME: Windows does not do that
-          if(!hIcon)
-             hIcon = pWnd->pcls->hIcon;
+          hIcon = NC_IconForWindow( pWnd );
       }
 
       if (hIcon)
index f2b31b6..f584cd1 100644 (file)
@@ -10,3 +10,4 @@ BOOL FASTCALL IntValidateParent(PWND Child, HRGN hValidateRgn, BOOL Recurse);
 BOOL FASTCALL IntIsWindowDirty(PWND);
 BOOL FASTCALL IntEndPaint(PWND,PPAINTSTRUCT);
 HDC FASTCALL IntBeginPaint(PWND,PPAINTSTRUCT);
+HICON FASTCALL NC_IconForWindow( PWND );
index 5628d33..5ffc7b7 100644 (file)
@@ -30,6 +30,15 @@ IntGetProp(PWND Window, ATOM Atom)
    return(NULL);
 }
 
+HANDLE
+FASTCALL
+UserGetProp(PWND pWnd, ATOM Atom)
+{
+  PPROPERTY Prop;
+  Prop = IntGetProp(pWnd, Atom);
+  return Prop ? Prop->Data : NULL;
+}
+
 BOOL FASTCALL
 IntRemoveProp(PWND Window, ATOM Atom)
 {
index 0804556..9ba3eaf 100644 (file)
@@ -3,3 +3,4 @@
 PPROPERTY FASTCALL IntGetProp(PWND,ATOM);
 BOOL FASTCALL IntRemoveProp(PWND,ATOM);
 BOOL FASTCALL IntSetProp(PWND, ATOM, HANDLE);
+HANDLE FASTCALL UserGetProp(PWND, ATOM);
index 428d644..5aa8ee9 100644 (file)
@@ -426,6 +426,8 @@ static LRESULT co_UserFreeWindow(PWND Window,
    PWND Child;
    PMENU_OBJECT Menu;
    BOOLEAN BelongsToThreadData;
+   PLIST_ENTRY ListEntry;
+   PPROPERTY Property;
 
    ASSERT(Window);
 
@@ -554,6 +556,14 @@ static LRESULT co_UserFreeWindow(PWND Window,
 
    IntUnlinkWindow(Window);
 
+   ListEntry = Window->PropListHead.Flink;
+   while (ListEntry != &Window->PropListHead)
+   {
+       Property = CONTAINING_RECORD(ListEntry, PROPERTY, PropListEntry);
+       ListEntry = ListEntry->Flink;
+       IntRemoveProp(Window, Property->Atom);
+   }
+
    UserReferenceObject(Window);
    UserDeleteObject(Window->head.h, TYPE_WINDOW);
 
index 1df2c17..4edf164 100644 (file)
@@ -32,6 +32,7 @@ extern HINSTANCE hImmInstance;
 extern RTL_CRITICAL_SECTION gcsUserApiHook;
 extern USERAPIHOOK guah;
 extern HINSTANCE ghmodUserApiHook;
+extern HICON hIconSmWindows, hIconWindows;
 
 #define IS_ATOM(x) \
   (((ULONG_PTR)(x) > 0x0) && ((ULONG_PTR)(x) < 0x10000))
@@ -101,5 +102,6 @@ BOOL UserDrawSysMenuButton( HWND hWnd, HDC hDC, LPRECT, BOOL down );
 HWND* WIN_ListChildren (HWND hWndparent);
 VOID DeleteFrameBrushes(VOID);
 BOOL WINAPI GdiValidateHandle(HGDIOBJ);
+HANDLE FASTCALL UserGetProp(HWND hWnd, ATOM Atom);
 
 /* EOF */
index 156629e..7876056 100644 (file)
@@ -15,6 +15,7 @@ PSERVERINFO gpsi = NULL;
 ULONG_PTR g_ulSharedDelta;
 BOOLEAN gfLogonProcess  = FALSE;
 BOOLEAN gfServerProcess = FALSE;
+HICON hIconSmWindows = NULL, hIconWindows = NULL;
 
 WCHAR szAppInit[KEY_LENGTH];
 
@@ -207,6 +208,7 @@ PVOID apfnDispatch[USER32_CALLBACK_MAXIMUM + 1] =
     User32CallClientLoadLibraryFromKernel,
     User32CallGetCharsetInfo,
     User32CallCopyImageFromKernel,
+    User32CallSetWndIconsFromKernel,
 };
 
 /*
@@ -352,11 +354,38 @@ DllMain(
    return TRUE;
 }
 
+
+VOID
+FASTCALL
+GetConnected(VOID)
+{
+  USERCONNECT UserCon;
+//  ERR("GetConnected\n");
+
+  if ((PTHREADINFO)NtCurrentTeb()->Win32ThreadInfo == NULL)
+     NtUserGetThreadState(THREADSTATE_GETTHREADINFO);
+
+  if (gpsi && g_ppi) return;
+// FIXME HAX: Due to the "Dll Initialization Bug" we have to call this too.
+  GdiDllInitialize(NULL, DLL_PROCESS_ATTACH, NULL);
+
+  NtUserProcessConnect( NtCurrentProcess(),
+                         &UserCon,
+                         sizeof(USERCONNECT));
+
+  g_ppi = GetWin32ClientInfo()->ppi;
+  g_ulSharedDelta = UserCon.siClient.ulSharedDelta;
+  gpsi = SharedPtrToUser(UserCon.siClient.psi);
+  gHandleTable = SharedPtrToUser(UserCon.siClient.aheList);
+  gHandleEntries = SharedPtrToUser(gHandleTable->handles);  
+
+}
+
 NTSTATUS
 WINAPI
 User32CallClientThreadSetupFromKernel(PVOID Arguments, ULONG ArgumentLength)
 {
-  ERR("GetConnected\n");
+  ERR("ClientThreadSetup\n");
   ClientThreadSetup();
   return ZwCallbackReturn(NULL, 0, STATUS_SUCCESS);  
 }
@@ -374,3 +403,20 @@ User32CallGetCharsetInfo(PVOID Arguments, ULONG ArgumentLength)
 
   return ZwCallbackReturn(Arguments, ArgumentLength, Ret ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL);  
 }
+
+NTSTATUS
+WINAPI
+User32CallSetWndIconsFromKernel(PVOID Arguments, ULONG ArgumentLength)
+{
+  PSETWNDICONS_CALLBACK_ARGUMENTS Common = Arguments;
+
+  if (!hIconSmWindows)
+  {
+      hIconSmWindows = LoadImageW(0, IDI_WINLOGO, IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
+      hIconWindows   = LoadImageW(0, IDI_WINLOGO, IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
+  }
+  Common->hIconSmWindows = hIconSmWindows;
+  Common->hIconWindows = hIconWindows;
+
+  return ZwCallbackReturn(Arguments, ArgumentLength, STATUS_SUCCESS);
+}
index 2fed939..6920cb0 100644 (file)
@@ -982,6 +982,68 @@ UserSendUiUpdateMsg(HWND hwnd, LPARAM lParam)
     return TRUE;
 }
 
+// WM_SETICON
+LRESULT FASTCALL
+DefWndSetIcon(PWND pWnd, WPARAM wParam, LPARAM lParam)
+{
+    HICON hIcon, hIconSmall, hIconOld;
+    if ( wParam > ICON_SMALL2 )
+    {  
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return 0;
+    }
+    hIconSmall = UserGetProp(UserHMGetHandle(pWnd), gpsi->atomIconSmProp);
+    hIcon = UserGetProp(UserHMGetHandle(pWnd), gpsi->atomIconProp);
+
+    hIconOld = wParam == ICON_BIG ? hIcon : hIconSmall;
+
+    switch(wParam)
+    {
+        case ICON_BIG:
+            hIcon = (HICON)lParam;
+            break;
+        case ICON_SMALL:
+            hIconSmall = (HICON)lParam;
+            break;
+        case ICON_SMALL2:
+            ERR("FIXME: Set ICON_SMALL2 support!\n");
+        default:
+            break;
+    }
+
+    NtUserSetProp(UserHMGetHandle(pWnd), gpsi->atomIconProp, hIcon);
+    NtUserSetProp(UserHMGetHandle(pWnd), gpsi->atomIconSmProp, hIconSmall);
+
+    if ((pWnd->style & WS_CAPTION ) == WS_CAPTION)
+       DefWndNCPaint(UserHMGetHandle(pWnd), HRGN_WINDOW, -1);  /* Repaint caption */
+
+    return (LRESULT)hIconOld;
+}
+
+LRESULT FASTCALL
+DefWndGetIcon(PWND pWnd, WPARAM wParam, LPARAM lParam)
+{
+    HICON hIconRet;
+    if ( wParam > ICON_SMALL2 )
+    {
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return 0;
+    }
+    switch(wParam)
+    {
+        case ICON_BIG:
+            hIconRet = UserGetProp(UserHMGetHandle(pWnd), gpsi->atomIconProp);
+            break;
+        case ICON_SMALL:
+        case ICON_SMALL2:
+            hIconRet = UserGetProp(UserHMGetHandle(pWnd), gpsi->atomIconSmProp);
+            break;
+        default:
+            break;
+    }
+    return (LRESULT)hIconRet;
+}
 
 VOID FASTCALL
 DefWndScreenshot(HWND hWnd)
@@ -1523,19 +1585,12 @@ User32DefWindowProc(HWND hWnd,
 
         case WM_SETICON:
         {
-           INT Index = (wParam != 0) ? GCL_HICON : GCL_HICONSM;
-           HICON hOldIcon = (HICON)GetClassLongPtrW(hWnd, Index);
-           SetClassLongPtrW(hWnd, Index, lParam);
-           SetWindowPos(hWnd, 0, 0, 0, 0, 0,
-                      SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE |
-                      SWP_NOACTIVATE | SWP_NOZORDER);
-           return ((LRESULT)hOldIcon);
+           return DefWndSetIcon(pWnd, wParam, lParam);
         }
 
         case WM_GETICON:
         {
-            INT Index = (wParam == ICON_BIG) ? GCL_HICON : GCL_HICONSM;
-            return (GetClassLongPtrW(hWnd, Index));
+           return DefWndGetIcon(pWnd, wParam, lParam);
         }
 
         case WM_HELP:
index 713e2c0..1f8803a 100644 (file)
@@ -24,6 +24,7 @@
 #include <user32.h>
 
 #include <wine/debug.h>
+WINE_DEFAULT_DEBUG_CHANNEL(user32);
 
 #define HAS_DLGFRAME(Style, ExStyle) \
             (((ExStyle) & WS_EX_DLGMODALFRAME) || \
@@ -124,18 +125,15 @@ UserGetWindowIcon(HWND hwnd)
 
    SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL2, 0, SMTO_ABORTIFHUNG, 1000, (PDWORD_PTR)&hIcon);
 
-   if (!hIcon)
-      SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL, 0, SMTO_ABORTIFHUNG, 1000, (PDWORD_PTR)&hIcon);
-
-   if (!hIcon)
-      SendMessageTimeout(hwnd, WM_GETICON, ICON_BIG, 0, SMTO_ABORTIFHUNG, 1000, (PDWORD_PTR)&hIcon);
-
-   if (!hIcon)
-      hIcon = (HICON)GetClassLongPtr(hwnd, GCL_HICONSM);
-
-   if (!hIcon)
-      hIcon = (HICON)GetClassLongPtr(hwnd, GCL_HICON);
-
+   if (!hIcon) hIcon = UserGetProp(hwnd, gpsi->atomIconSmProp);
+   if (!hIcon) hIcon = UserGetProp(hwnd, gpsi->atomIconProp);
+   if (!hIcon) hIcon = (HICON)GetClassLongPtr(hwnd, GCL_HICONSM);
+   if (!hIcon) hIcon = (HICON)GetClassLongPtr(hwnd, GCL_HICON);
+   if (!hIcon && (GetWindowLongW( hwnd, GWL_STYLE ) & DS_MODALFRAME))
+   {
+      if (!hIcon) hIcon = gpsi->hIconSmWindows; // Both are IDI_WINLOGO Small
+      if (!hIcon) hIcon = gpsi->hIconWindows;   // Reg size.
+   }
    return hIcon;
 }
 
@@ -1035,6 +1033,14 @@ DefWndNCLButtonDown(HWND hWnd, WPARAM wParam, LPARAM lParam)
         case HTBOTTOMLEFT:
         case HTBOTTOMRIGHT:
         {
+           /* Old comment:
+            * "make sure hittest fits into 0xf and doesn't overlap with HTSYSMENU"
+            * This was previously done by setting wParam=SC_SIZE + wParam - 2
+            */
+           /* But that is not what WinNT does. Instead it sends this. This
+            * is easy to differentiate from HTSYSMENU, because HTSYSMENU adds
+            * SC_MOUSEMENU into wParam.
+            */
             SendMessageW(hWnd, WM_SYSCOMMAND, SC_SIZE + wParam - (HTLEFT - WMSZ_LEFT), lParam);
             break;
         }
@@ -1073,25 +1079,125 @@ DefWndNCLButtonDblClk(HWND hWnd, WPARAM wParam, LPARAM lParam)
   return(0);
 }
 
-VOID
-DefWndTrackScrollBar(HWND hWnd, WPARAM wParam, POINT Point)
+/***********************************************************************
+ *           NC_HandleNCRButtonDown
+ *
+ * Handle a WM_NCRBUTTONDOWN message. Called from DefWindowProc().
+ */
+LRESULT NC_HandleNCRButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam ) 
 {
-   //INT ScrollBar;
+  MSG msg;
+  INT hittest = wParam;
 
-   if ((wParam & 0xfff0) == SC_HSCROLL)
-   {
-      if ((wParam & 0x0f) != HTHSCROLL)
-         return;
-      //ScrollBar = SB_HORZ;
-   }
-   else
-   {
-      if ((wParam & 0x0f) != HTVSCROLL)
-         return;
-      //ScrollBar = SB_VERT;
-   }
+  switch (hittest)
+  {
+  case HTCAPTION:
+  case HTSYSMENU:
+      if (!GetSystemMenu( hwnd, FALSE )) break;
+
+      SetCapture( hwnd );
+      for (;;)
+      {
+          if (!GetMessageW( &msg, 0, WM_MOUSEFIRST, WM_MOUSELAST )) break;
+          if (CallMsgFilterW( &msg, MSGF_MAX )) continue;
+          if (msg.message == WM_RBUTTONUP)
+          {
+             hittest = DefWndNCHitTest( hwnd, msg.pt );
+             break;
+          }
+          if (hwnd != GetCapture()) return 0;
+      }
+      ReleaseCapture();
+      if (hittest == HTCAPTION || hittest == HTSYSMENU)
+      {
+         ERR("Msg pt %x and Msg.lParam %x and lParam %x\n",MAKELONG(msg.pt.x,msg.pt.y),msg.lParam,lParam);
+         SendMessageW( hwnd, WM_SYSCOMMAND, SC_MOUSEMENU + HTSYSMENU, msg.lParam );
+      }
+      break;
+  }
+  return 0;
+}
+
+/***********************************************************************
+ *           NcGetInsideRect
+ *
+ * Get the 'inside' rectangle of a window, i.e. the whole window rectangle
+ * but without the borders (if any).
+ * The rectangle is in window coordinates (for drawing with GetWindowDC()).
+ */
+static void FASTCALL
+NcGetInsideRect(HWND Wnd, RECT *Rect)
+{
+  DWORD Style;
+  DWORD ExStyle;
+
+  GetWindowRect(Wnd, Rect);
+  Rect->right = Rect->right - Rect->left;
+  Rect->left = 0;
+  Rect->bottom = Rect->bottom - Rect->top;
+  Rect->top = 0;
+
+  Style = GetWindowLongPtrW(Wnd, GWL_STYLE);
+  if (0 != (Style & WS_ICONIC))
+    {
+      return;
+    }
+
+  /* Remove frame from rectangle */
+  ExStyle = GetWindowLongPtrW(Wnd, GWL_EXSTYLE);
+  if (HAS_THICKFRAME(Style, ExStyle))
+    {
+      InflateRect(Rect, - GetSystemMetrics(SM_CXFRAME), - GetSystemMetrics(SM_CYFRAME));
+    }
+  else if (HAS_DLGFRAME(Style, ExStyle))
+    {
+      InflateRect(Rect, - GetSystemMetrics(SM_CXDLGFRAME), - GetSystemMetrics(SM_CYDLGFRAME));
+    }
+  else if (HAS_THINFRAME(Style, ExStyle))
+    {
+      InflateRect(Rect, - GetSystemMetrics(SM_CXBORDER), - GetSystemMetrics(SM_CYBORDER));
+    }
 
-   /* FIXME */
+  /* We have additional border information if the window
+   * is a child (but not an MDI child) */
+  if (0 != (Style & WS_CHILD)
+      && 0 == (ExStyle & WS_EX_MDICHILD))
+    {
+      if (0 != (ExStyle & WS_EX_CLIENTEDGE))
+        {
+          InflateRect(Rect, - GetSystemMetrics(SM_CXEDGE), - GetSystemMetrics(SM_CYEDGE));
+        }
+      if (0 != (ExStyle & WS_EX_STATICEDGE))
+        {
+          InflateRect(Rect, - GetSystemMetrics(SM_CXBORDER), - GetSystemMetrics(SM_CYBORDER));
+        }
+    }
+}
+
+/***********************************************************************
+ *           NcGetSysPopupPos
+ */
+void FASTCALL
+NcGetSysPopupPos(HWND Wnd, RECT *Rect)
+{
+  RECT WindowRect;
+
+  if (IsIconic(Wnd))
+    {
+      GetWindowRect(Wnd, Rect);
+    }
+  else
+    {
+      NcGetInsideRect(Wnd, Rect);
+      GetWindowRect(Wnd, &WindowRect);
+      OffsetRect(Rect, WindowRect.left, WindowRect.top);
+      if (0 != (GetWindowLongPtrW(Wnd, GWL_STYLE) & WS_CHILD))
+        {
+          ClientToScreen(GetParent(Wnd), (POINT *) Rect);
+        }
+      Rect->right = Rect->left + GetSystemMetrics(SM_CYCAPTION) - 1;
+      Rect->bottom = Rect->top + GetSystemMetrics(SM_CYCAPTION) - 1;
+    }
 }
 
 /* PUBLIC FUNCTIONS ***********************************************************/
@@ -1251,85 +1357,3 @@ DrawCaptionTempA(
   }
   return ret;
 }
-
-/***********************************************************************
- *           NcGetInsideRect
- *
- * Get the 'inside' rectangle of a window, i.e. the whole window rectangle
- * but without the borders (if any).
- * The rectangle is in window coordinates (for drawing with GetWindowDC()).
- */
-static void FASTCALL
-NcGetInsideRect(HWND Wnd, RECT *Rect)
-{
-  DWORD Style;
-  DWORD ExStyle;
-
-  GetWindowRect(Wnd, Rect);
-  Rect->right = Rect->right - Rect->left;
-  Rect->left = 0;
-  Rect->bottom = Rect->bottom - Rect->top;
-  Rect->top = 0;
-
-  Style = GetWindowLongPtrW(Wnd, GWL_STYLE);
-  if (0 != (Style & WS_ICONIC))
-    {
-      return;
-    }
-
-  /* Remove frame from rectangle */
-  ExStyle = GetWindowLongPtrW(Wnd, GWL_EXSTYLE);
-  if (HAS_THICKFRAME(Style, ExStyle))
-    {
-      InflateRect(Rect, - GetSystemMetrics(SM_CXFRAME), - GetSystemMetrics(SM_CYFRAME));
-    }
-  else if (HAS_DLGFRAME(Style, ExStyle))
-    {
-      InflateRect(Rect, - GetSystemMetrics(SM_CXDLGFRAME), - GetSystemMetrics(SM_CYDLGFRAME));
-    }
-  else if (HAS_THINFRAME(Style, ExStyle))
-    {
-      InflateRect(Rect, - GetSystemMetrics(SM_CXBORDER), - GetSystemMetrics(SM_CYBORDER));
-    }
-
-  /* We have additional border information if the window
-   * is a child (but not an MDI child) */
-  if (0 != (Style & WS_CHILD)
-      && 0 == (ExStyle & WS_EX_MDICHILD))
-    {
-      if (0 != (ExStyle & WS_EX_CLIENTEDGE))
-        {
-          InflateRect(Rect, - GetSystemMetrics(SM_CXEDGE), - GetSystemMetrics(SM_CYEDGE));
-        }
-      if (0 != (ExStyle & WS_EX_STATICEDGE))
-        {
-          InflateRect(Rect, - GetSystemMetrics(SM_CXBORDER), - GetSystemMetrics(SM_CYBORDER));
-        }
-    }
-}
-
-/***********************************************************************
- *           NcGetSysPopupPos
- */
-void FASTCALL
-NcGetSysPopupPos(HWND Wnd, RECT *Rect)
-{
-  RECT WindowRect;
-
-  if (IsIconic(Wnd))
-    {
-      GetWindowRect(Wnd, Rect);
-    }
-  else
-    {
-      NcGetInsideRect(Wnd, Rect);
-      GetWindowRect(Wnd, &WindowRect);
-      OffsetRect(Rect, WindowRect.left, WindowRect.top);
-      if (0 != (GetWindowLongPtrW(Wnd, GWL_STYLE) & WS_CHILD))
-        {
-          ClientToScreen(GetParent(Wnd), (POINT *) Rect);
-        }
-      Rect->right = Rect->left + GetSystemMetrics(SM_CYCAPTION) - 1;
-      Rect->bottom = Rect->top + GetSystemMetrics(SM_CYCAPTION) - 1;
-    }
-}
index 16bbbd5..8f9b1b8 100644 (file)
@@ -18,8 +18,8 @@
  */
 /*
  * PROJECT:         ReactOS user32.dll
- * FILE:            lib/user32/windows/input.c
- * PURPOSE:         Input
+ * FILE:            user/user32/windows/prop.c
+ * PURPOSE:         Window Property
  * PROGRAMMER:      Casper S. Hornstrup (chorns@users.sourceforge.net)
  * UPDATE HISTORY:
  *      09-05-2001  CSH  Created
@@ -63,6 +63,14 @@ IntGetProp(HWND hWnd, ATOM Atom)
   return NULL;
 }
 
+HANDLE
+FASTCALL
+UserGetProp(HWND hWnd, ATOM Atom)
+{
+  PPROPERTY Prop;
+  Prop = IntGetProp(hWnd, Atom);
+  return Prop ? Prop->Data : NULL;
+}
 
 /* FUNCTIONS *****************************************************************/