Author: jimtabor Date: Fri Oct 11 21:46:30 2013 New Revision: 60622
URL: http://svn.reactos.org/svn/reactos?rev=60622&view=rev Log: [Win32k] - Fix CORE-6945. - Miscellaneous adds and changes.
Modified: trunk/reactos/win32ss/include/callback.h trunk/reactos/win32ss/include/ntgdityp.h trunk/reactos/win32ss/include/ntuser.h trunk/reactos/win32ss/user/ntuser/callback.c trunk/reactos/win32ss/user/ntuser/callback.h trunk/reactos/win32ss/user/ntuser/class.c trunk/reactos/win32ss/user/ntuser/defwnd.c trunk/reactos/win32ss/user/ntuser/painting.c trunk/reactos/win32ss/user/ntuser/painting.h trunk/reactos/win32ss/user/ntuser/prop.c trunk/reactos/win32ss/user/ntuser/prop.h trunk/reactos/win32ss/user/ntuser/window.c trunk/reactos/win32ss/user/user32/include/user32p.h trunk/reactos/win32ss/user/user32/misc/dllmain.c trunk/reactos/win32ss/user/user32/windows/defwnd.c trunk/reactos/win32ss/user/user32/windows/nonclient.c trunk/reactos/win32ss/user/user32/windows/prop.c
Modified: trunk/reactos/win32ss/include/callback.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/include/callback.h?... ============================================================================== --- trunk/reactos/win32ss/include/callback.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/include/callback.h [iso-8859-1] Fri Oct 11 21:46:30 2013 @@ -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,8 +106,16 @@ 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
Modified: trunk/reactos/win32ss/include/ntgdityp.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/include/ntgdityp.h?... ============================================================================== --- trunk/reactos/win32ss/include/ntgdityp.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/include/ntgdityp.h [iso-8859-1] Fri Oct 11 21:46:30 2013 @@ -742,5 +742,6 @@ ASSERT_PFN(QueryGlyphAttrs); ASSERT_PFN(Notify); ASSERT_PFN(SynchronizeSurface); +ASSERT_PFN(ResetDevice);
#endif
Modified: trunk/reactos/win32ss/include/ntuser.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/include/ntuser.h?re... ============================================================================== --- trunk/reactos/win32ss/include/ntuser.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/include/ntuser.h [iso-8859-1] Fri Oct 11 21:46:30 2013 @@ -69,6 +69,7 @@ UserThreadWOWInformation, UserThreadHungStatus, UserThreadInitiateShutdown, + UserThreadEndShutdown, UserThreadUseActiveDesktop, UserThreadUseDesktop, @@ -119,6 +120,7 @@ HWND hTaskManWindow; HWND hProgmanWindow; HWND hShellWindow; + struct _WND * spwndShell;
PPROCESSINFO ppiShellProcess;
@@ -857,7 +859,7 @@ TEXTMETRICW tmSysFont; DPISERVERINFO dpiSystem; HICON hIconSmWindows; - HICON hIcoWindows; + HICON hIconWindows; DWORD dwKeyCache; DWORD dwAsyncKeyCache; ULONG cCaptures;
Modified: trunk/reactos/win32ss/user/ntuser/callback.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/callbac... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/callback.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/callback.c [iso-8859-1] Fri Oct 11 21:46:30 2013 @@ -881,7 +881,6 @@ return Status; }
- HANDLE FASTCALL co_IntCopyImage(HANDLE hnd, UINT type, INT desiredx, INT desiredy, UINT flags) { @@ -993,4 +992,53 @@ 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 */
Modified: trunk/reactos/win32ss/user/ntuser/callback.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/callbac... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/callback.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/callback.h [iso-8859-1] Fri Oct 11 21:46:30 2013 @@ -69,3 +69,5 @@ co_IntGetCharsetInfo(LCID Locale, PCHARSETINFO pCs);
HANDLE FASTCALL co_IntCopyImage(HANDLE,UINT,INT,INT,UINT); + +BOOL FASTCALL co_IntSetWndIcons(VOID);
Modified: trunk/reactos/win32ss/user/ntuser/class.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/class.c... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/class.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/class.c [iso-8859-1] Fri Oct 11 21:46:30 2013 @@ -1899,8 +1899,6 @@
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;
Modified: trunk/reactos/win32ss/user/ntuser/defwnd.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/defwnd.... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/defwnd.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/defwnd.c [iso-8859-1] Fri Oct 11 21:46:30 2013 @@ -172,6 +172,7 @@ BOOL Ansi) { LRESULT lResult = 0; + USER_REFERENCE_ENTRY Ref;
if (Msg > WM_USER) return 0;
@@ -204,6 +205,20 @@ break; 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: @@ -303,20 +318,22 @@ return lResult; }
-static HICON NC_IconForWindow( PWND pWnd ) +HICON FASTCALL NC_IconForWindow( PWND pWnd ) { HICON hIcon = 0; - - if (!pWnd->pcls || pWnd->fnid == FNID_DESKTOP) return hIcon; + // First thing to do, init the Window Logo icons. + if (!gpsi->hIconSmWindows) co_IntSetWndIcons(); + + 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. + { + if (!hIcon) hIcon = gpsi->hIconSmWindows; // Both are IDI_WINLOGO Small + if (!hIcon) hIcon = gpsi->hIconWindows; // Reg size. 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. } return hIcon; }
Modified: trunk/reactos/win32ss/user/ntuser/painting.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/paintin... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/painting.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/painting.c [iso-8859-1] Fri Oct 11 21:46:30 2013 @@ -1987,9 +1987,7 @@
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)
Modified: trunk/reactos/win32ss/user/ntuser/painting.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/paintin... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/painting.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/painting.h [iso-8859-1] Fri Oct 11 21:46:30 2013 @@ -10,3 +10,4 @@ BOOL FASTCALL IntIsWindowDirty(PWND); BOOL FASTCALL IntEndPaint(PWND,PPAINTSTRUCT); HDC FASTCALL IntBeginPaint(PWND,PPAINTSTRUCT); +HICON FASTCALL NC_IconForWindow( PWND );
Modified: trunk/reactos/win32ss/user/ntuser/prop.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/prop.c?... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/prop.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/prop.c [iso-8859-1] Fri Oct 11 21:46:30 2013 @@ -30,6 +30,15 @@ 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) {
Modified: trunk/reactos/win32ss/user/ntuser/prop.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/prop.h?... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/prop.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/prop.h [iso-8859-1] Fri Oct 11 21:46:30 2013 @@ -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);
Modified: trunk/reactos/win32ss/user/ntuser/window.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/window.... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/window.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/window.c [iso-8859-1] Fri Oct 11 21:46:30 2013 @@ -426,6 +426,8 @@ PWND Child; PMENU_OBJECT Menu; BOOLEAN BelongsToThreadData; + PLIST_ENTRY ListEntry; + PPROPERTY Property;
ASSERT(Window);
@@ -553,6 +555,14 @@ #endif
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);
Modified: trunk/reactos/win32ss/user/user32/include/user32p.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/include... ============================================================================== --- trunk/reactos/win32ss/user/user32/include/user32p.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/include/user32p.h [iso-8859-1] Fri Oct 11 21:46:30 2013 @@ -32,6 +32,7 @@ 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 @@ HWND* WIN_ListChildren (HWND hWndparent); VOID DeleteFrameBrushes(VOID); BOOL WINAPI GdiValidateHandle(HGDIOBJ); +HANDLE FASTCALL UserGetProp(HWND hWnd, ATOM Atom);
/* EOF */
Modified: trunk/reactos/win32ss/user/user32/misc/dllmain.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/misc/dl... ============================================================================== --- trunk/reactos/win32ss/user/user32/misc/dllmain.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/misc/dllmain.c [iso-8859-1] Fri Oct 11 21:46:30 2013 @@ -15,6 +15,7 @@ ULONG_PTR g_ulSharedDelta; BOOLEAN gfLogonProcess = FALSE; BOOLEAN gfServerProcess = FALSE; +HICON hIconSmWindows = NULL, hIconWindows = NULL;
WCHAR szAppInit[KEY_LENGTH];
@@ -207,6 +208,7 @@ User32CallClientLoadLibraryFromKernel, User32CallGetCharsetInfo, User32CallCopyImageFromKernel, + User32CallSetWndIconsFromKernel, };
/* @@ -352,11 +354,38 @@ 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 @@
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); +}
Modified: trunk/reactos/win32ss/user/user32/windows/defwnd.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/windows... ============================================================================== --- trunk/reactos/win32ss/user/user32/windows/defwnd.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/windows/defwnd.c [iso-8859-1] Fri Oct 11 21:46:30 2013 @@ -982,6 +982,68 @@ 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 @@
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:
Modified: trunk/reactos/win32ss/user/user32/windows/nonclient.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/windows... ============================================================================== --- trunk/reactos/win32ss/user/user32/windows/nonclient.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/windows/nonclient.c [iso-8859-1] Fri Oct 11 21:46:30 2013 @@ -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 @@
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 @@ 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 @@ return(0); }
-VOID -DefWndTrackScrollBar(HWND hWnd, WPARAM wParam, POINT Point) -{ - //INT ScrollBar; - - if ((wParam & 0xfff0) == SC_HSCROLL) - { - if ((wParam & 0x0f) != HTHSCROLL) - return; - //ScrollBar = SB_HORZ; - } - else - { - if ((wParam & 0x0f) != HTVSCROLL) - return; - //ScrollBar = SB_VERT; - } - - /* FIXME */ +/*********************************************************************** + * NC_HandleNCRButtonDown + * + * Handle a WM_NCRBUTTONDOWN message. Called from DefWindowProc(). + */ +LRESULT NC_HandleNCRButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam ) +{ + MSG msg; + INT hittest = wParam; + + 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)); + } + + /* 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 @@ } 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; - } -}
Modified: trunk/reactos/win32ss/user/user32/windows/prop.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/windows... ============================================================================== --- trunk/reactos/win32ss/user/user32/windows/prop.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/windows/prop.c [iso-8859-1] Fri Oct 11 21:46:30 2013 @@ -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 @@ return NULL; }
+HANDLE +FASTCALL +UserGetProp(HWND hWnd, ATOM Atom) +{ + PPROPERTY Prop; + Prop = IntGetProp(hWnd, Atom); + return Prop ? Prop->Data : NULL; +}
/* FUNCTIONS *****************************************************************/