Author: jimtabor Date: Fri Dec 31 04:43:35 2010 New Revision: 50229
URL: http://svn.reactos.org/svn/reactos?rev=50229&view=rev Log: [Win32k|User32] - Add hack to mark desktop window as a desktop window and notes for creating a desktop with tips in win32k. Move user position code from window to winpos.
Modified: trunk/reactos/dll/win32/user32/windows/window.c trunk/reactos/dll/win32/user32/windows/winpos.c trunk/reactos/subsystems/win32/csrss/win32csr/desktopbg.c trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c trunk/reactos/subsystems/win32/win32k/ntuser/window.c
Modified: trunk/reactos/dll/win32/user32/windows/window.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/wi... ============================================================================== --- trunk/reactos/dll/win32/user32/windows/window.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/window.c [iso-8859-1] Fri Dec 31 04:43:35 2010 @@ -1831,92 +1831,6 @@ return FALSE; }
- -/* - * @implemented - */ -HWND WINAPI -WindowFromPoint(POINT Point) -{ - //TODO: Determine what the actual parameters to - // NtUserWindowFromPoint are. - return NtUserWindowFromPoint(Point.x, Point.y); -} - - -/* - * @implemented - */ -int WINAPI -MapWindowPoints(HWND hWndFrom, HWND hWndTo, LPPOINT lpPoints, UINT cPoints) -{ - PWND FromWnd, ToWnd; - POINT Delta; - UINT i; - - FromWnd = ValidateHwndOrDesk(hWndFrom); - if (!FromWnd) - return 0; - - ToWnd = ValidateHwndOrDesk(hWndTo); - if (!ToWnd) - return 0; - - Delta.x = FromWnd->rcClient.left - ToWnd->rcClient.left; - Delta.y = FromWnd->rcClient.top - ToWnd->rcClient.top; - - for (i = 0; i != cPoints; i++) - { - lpPoints[i].x += Delta.x; - lpPoints[i].y += Delta.y; - } - - return MAKELONG(LOWORD(Delta.x), LOWORD(Delta.y)); -} - - -/* - * @implemented - */ -BOOL WINAPI -ScreenToClient(HWND hWnd, LPPOINT lpPoint) -{ - PWND Wnd, DesktopWnd; - - Wnd = ValidateHwnd(hWnd); - if (!Wnd) - return FALSE; - - DesktopWnd = GetThreadDesktopWnd(); - - lpPoint->x += DesktopWnd->rcClient.left - Wnd->rcClient.left; - lpPoint->y += DesktopWnd->rcClient.top - Wnd->rcClient.top; - - return TRUE; -} - - -/* - * @implemented - */ -BOOL WINAPI -ClientToScreen(HWND hWnd, LPPOINT lpPoint) -{ - PWND Wnd, DesktopWnd; - - Wnd = ValidateHwnd(hWnd); - if (!Wnd) - return FALSE; - - DesktopWnd = GetThreadDesktopWnd(); - - lpPoint->x += Wnd->rcClient.left - DesktopWnd->rcClient.left; - lpPoint->y += Wnd->rcClient.top - DesktopWnd->rcClient.top; - - return TRUE; -} - - /* * @implemented */ @@ -1926,7 +1840,6 @@ { return NtUserSetWindowContextHelpId(hwnd, dwContextHelpId); } -
/* * @implemented
Modified: trunk/reactos/dll/win32/user32/windows/winpos.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/wi... ============================================================================== --- trunk/reactos/dll/win32/user32/windows/winpos.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/winpos.c [iso-8859-1] Fri Dec 31 04:43:35 2010 @@ -1,8 +1,7 @@ -/* $Id$ - * +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS user32.dll - * FILE: lib/user32/windows/window.c + * FILE: dll/win32/user32/windows/winpos.c * PURPOSE: Window management * PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net) * UPDATE HISTORY: @@ -111,3 +110,88 @@ { return NtUserCallHwndLock( hWnd, HWNDLOCK_ROUTINE_ARRANGEICONICWINDOWS); } + +/* + * @implemented + */ +HWND WINAPI +WindowFromPoint(POINT Point) +{ + //TODO: Determine what the actual parameters to + // NtUserWindowFromPoint are. + return NtUserWindowFromPoint(Point.x, Point.y); +} + + +/* + * @implemented + */ +int WINAPI +MapWindowPoints(HWND hWndFrom, HWND hWndTo, LPPOINT lpPoints, UINT cPoints) +{ + PWND FromWnd, ToWnd; + POINT Delta; + UINT i; + + FromWnd = ValidateHwndOrDesk(hWndFrom); + if (!FromWnd) + return 0; + + ToWnd = ValidateHwndOrDesk(hWndTo); + if (!ToWnd) + return 0; + + Delta.x = FromWnd->rcClient.left - ToWnd->rcClient.left; + Delta.y = FromWnd->rcClient.top - ToWnd->rcClient.top; + + for (i = 0; i != cPoints; i++) + { + lpPoints[i].x += Delta.x; + lpPoints[i].y += Delta.y; + } + + return MAKELONG(LOWORD(Delta.x), LOWORD(Delta.y)); +} + + +/* + * @implemented + */ +BOOL WINAPI +ScreenToClient(HWND hWnd, LPPOINT lpPoint) +{ + PWND Wnd, DesktopWnd; + + Wnd = ValidateHwnd(hWnd); + if (!Wnd) + return FALSE; + + DesktopWnd = GetThreadDesktopWnd(); + + lpPoint->x += DesktopWnd->rcClient.left - Wnd->rcClient.left; + lpPoint->y += DesktopWnd->rcClient.top - Wnd->rcClient.top; + + return TRUE; +} + + +/* + * @implemented + */ +BOOL WINAPI +ClientToScreen(HWND hWnd, LPPOINT lpPoint) +{ + PWND Wnd, DesktopWnd; + + Wnd = ValidateHwnd(hWnd); + if (!Wnd) + return FALSE; + + DesktopWnd = GetThreadDesktopWnd(); + + lpPoint->x += Wnd->rcClient.left - DesktopWnd->rcClient.left; + lpPoint->y += Wnd->rcClient.top - DesktopWnd->rcClient.top; + + return TRUE; +} +
Modified: trunk/reactos/subsystems/win32/csrss/win32csr/desktopbg.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/win3... ============================================================================== --- trunk/reactos/subsystems/win32/csrss/win32csr/desktopbg.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/win32csr/desktopbg.c [iso-8859-1] Fri Dec 31 04:43:35 2010 @@ -65,6 +65,7 @@ return (LRESULT)TRUE;
case WM_CREATE: + NtUserSetWindowFNID(Wnd, FNID_DESKTOP); // Anti-ReactOS hack! case WM_CLOSE: return 0;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] Fri Dec 31 04:43:35 2010 @@ -1036,12 +1036,16 @@ } ExFreePoolWithTag(DesktopName.Buffer, TAG_STRING);
+//// why is this here? +#if 0 if (! NT_SUCCESS(Status)) { DPRINT1("Failed to create desktop handle\n"); SetLastNtError(Status); RETURN( NULL); } +#endif +////
/* * Create a handle for CSRSS and notify CSRSS for Creating Desktop Window. @@ -1072,7 +1076,35 @@ SetLastNtError(Status); RETURN( NULL); } - +#if 0 // Turn on when server side proc is ready. + // + // Create desktop window. + // + ClassName.Buffer = ((PWSTR)((ULONG_PTR)(WORD)(gpsi->atomSysClass[ICLS_DESKTOP]))); + ClassName.Length = 0; + RtlZeroMemory(&MenuName, sizeof(MenuName)); + RtlZeroMemory(&WindowName, sizeof(WindowName)); + + RtlZeroMemory(&Cs, sizeof(Cs)); + Cs.x = UserGetSystemMetrics(SM_XVIRTUALSCREEN); + Cs.y = UserGetSystemMetrics(SM_YVIRTUALSCREEN); + Cs.cx = UserGetSystemMetrics(SM_CXVIRTUALSCREEN); + Cs.cy = UserGetSystemMetrics(SM_CYVIRTUALSCREEN); + Cs.style = WS_POPUP|WS_CLIPCHILDREN; + Cs.hInstance = hModClient; // Experimental mode... Move csr stuff to User32. hModuleWin; // Server side winproc! + Cs.lpszName = (LPCWSTR) &WindowName; + Cs.lpszClass = (LPCWSTR) &ClassName; + + pWndDesktop = co_UserCreateWindowEx(&Cs, &ClassName, &WindowName); + if (!pWnd) + { + DPRINT1("Failed to create Desktop window handle\n"); + } + else + { + DesktopObject->pDeskInfo->spwnd = pWndDesktop; + } +#endif W32Thread = PsGetCurrentThreadWin32Thread();
if (!W32Thread->rpdesk) IntSetThreadDesktop(DesktopObject,FALSE); @@ -1089,7 +1121,7 @@ RtlZeroMemory(&Cs, sizeof(Cs)); Cs.cx = Cs.cy = 100; Cs.style = WS_POPUP|WS_CLIPCHILDREN; - Cs.hInstance = hModClient; + Cs.hInstance = hModClient; // hModuleWin; // Server side winproc! Leave it to Timo to not pass on notes! Cs.lpszName = (LPCWSTR) &WindowName; Cs.lpszClass = (LPCWSTR) &ClassName;
@@ -1103,6 +1135,14 @@ DesktopObject->spwndMessage = pWnd; }
+ /* Now,,, + if !(WinStaObject->Flags & WSF_NOIO) is (not set) for desktop input output mode (see wiki) + Create Tooltip. Saved in DesktopObject->spwndTooltip. + Tooltip dwExStyle: WS_EX_TOOLWINDOW|WS_EX_TOPMOST + hWndParent are spwndMessage. Use hModuleWin for server side winproc! + The rest is same as message window. + http://msdn.microsoft.com/en-us/library/bb760250(VS.85).aspx + */ RETURN( Desktop);
CLEANUP:
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] Fri Dec 31 04:43:35 2010 @@ -2130,7 +2130,6 @@ } Window->rcClient = Window->rcWindow;
- /* Link the window*/ if (NULL != ParentWindow) { @@ -2140,7 +2139,7 @@ else IntLinkHwnd(Window, hwndInsertAfter); } - + /* Send the NCCREATE message */ Result = co_IntSendMessage(UserHMGetHandle(Window), WM_NCCREATE, 0, (LPARAM) Cs); if (!Result) @@ -3886,8 +3885,8 @@
// From user land we only set these. if (fnID != FNID_DESTROY) - { - if ( ((fnID < FNID_BUTTON) && (fnID > FNID_GHOST)) || + { // Hacked so we can mark desktop~! + if ( (/*(fnID < FNID_BUTTON)*/ (fnID < FNID_FIRST) && (fnID > FNID_GHOST)) || Wnd->fnid != 0 ) { EngSetLastError(ERROR_INVALID_PARAMETER);