- Fixed GetFullPathNameA and debug message in GetFullPathNameW. The path handling is still wrong in some cases, I am trying to find out why.

- Very basic implementaion of NtUserPaintDesktop.
- Fixed bug in default window WM_ERASEBKGND.
- Fixed bug in default window WM_PAINT.
- Made BeginDeferWindowPos, DeferWindowPos, EndDeferWindowPos pseudo-working by returning values that make sense and calling SetWindowPos.

svn path=/trunk/; revision=6379
This commit is contained in:
Filip Navara 2003-10-19 19:51:48 +00:00
parent e3a669e3fa
commit dba6345f47
6 changed files with 86 additions and 39 deletions

View file

@ -1,4 +1,4 @@
/* $Id: dir.c,v 1.38 2003/10/19 16:17:50 navaraf Exp $ /* $Id: dir.c,v 1.39 2003/10/19 19:51:48 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@ -339,6 +339,7 @@ GetFullPathNameA (
UNICODE_STRING nameW; UNICODE_STRING nameW;
WCHAR bufferW[MAX_PATH]; WCHAR bufferW[MAX_PATH];
DWORD ret, retW; DWORD ret, retW;
LPWSTR FilePart = NULL;
DPRINT("GetFullPathNameA(lpFileName %s, nBufferLength %d, lpBuffer %p, " DPRINT("GetFullPathNameA(lpFileName %s, nBufferLength %d, lpBuffer %p, "
"lpFilePart %p)\n",lpFileName,nBufferLength,lpBuffer,lpFilePart); "lpFilePart %p)\n",lpFileName,nBufferLength,lpBuffer,lpFilePart);
@ -355,7 +356,12 @@ GetFullPathNameA (
return 0; return 0;
} }
retW = GetFullPathNameW(nameW.Buffer, MAX_PATH, bufferW, NULL); if (lpFilePart)
{
*lpFilePart = NULL;
}
retW = GetFullPathNameW(nameW.Buffer, MAX_PATH, bufferW, &FilePart);
if (!retW) if (!retW)
{ {
@ -368,25 +374,22 @@ GetFullPathNameA (
} }
else else
{ {
ret = WideCharToMultiByte(CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL); ANSI_STRING AnsiBuffer;
if (ret <= nBufferLength) UNICODE_STRING UnicodeBuffer;
UnicodeBuffer.Length = wcslen(bufferW) * sizeof(WCHAR);
ret = nameW.Length;
if (nameW.Length <= nBufferLength)
{ {
WideCharToMultiByte(CP_ACP, 0, bufferW, -1, lpBuffer, nBufferLength, NULL, NULL); UnicodeBuffer.Buffer = bufferW;
ret--; /* length without 0 */ AnsiBuffer.MaximumLength = nBufferLength;
AnsiBuffer.Length = 0;
AnsiBuffer.Buffer = lpBuffer;
RtlUnicodeStringToAnsiString(&AnsiBuffer, &UnicodeBuffer, FALSE);
if (lpFilePart) if (lpFilePart && FilePart != NULL)
{ {
LPSTR p = lpBuffer + strlen(lpBuffer); *lpFilePart = (FilePart - bufferW) + lpBuffer;
if (*p != '\\')
{
while ((p > lpBuffer + 2) && (*p != '\\')) p--;
*lpFilePart = p + 1;
}
else
{
*lpFilePart = NULL;
}
} }
} }
} }
@ -394,7 +397,7 @@ GetFullPathNameA (
RtlFreeUnicodeString(&nameW); RtlFreeUnicodeString(&nameW);
DPRINT("lpBuffer %s lpFilePart %s Length %ld\n", DPRINT("lpBuffer %s lpFilePart %s Length %ld\n",
lpBuffer, lpFilePart, nameW.Length); lpBuffer, (lpFilePart == NULL) ? "NULL" : *lpFilePart, nameW.Length);
return ret; return ret;
} }
@ -423,7 +426,7 @@ GetFullPathNameW (
lpFilePart); lpFilePart);
DPRINT("lpBuffer %S lpFilePart %S Length %ld\n", DPRINT("lpBuffer %S lpFilePart %S Length %ld\n",
lpBuffer, lpFilePart, Length / sizeof(WCHAR)); lpBuffer, (lpFilePart == NULL) ? L"NULL" : *lpFilePart, Length / sizeof(WCHAR));
return (Length / sizeof(WCHAR)); return (Length / sizeof(WCHAR));
} }

View file

@ -1,4 +1,4 @@
/* $Id: path.c,v 1.23 2003/10/19 16:17:50 navaraf Exp $ /* $Id: path.c,v 1.24 2003/10/19 19:51:48 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@ -711,6 +711,7 @@ CHECKPOINT;
/* find file part */ /* find file part */
if (FilePart) if (FilePart)
{ {
#if 0
*FilePart = wcsrchr(buf, L'\\'); *FilePart = wcsrchr(buf, L'\\');
if (*FilePart) if (*FilePart)
{ {
@ -720,6 +721,13 @@ CHECKPOINT;
{ {
*FilePart = buf; *FilePart = buf;
} }
#else
*FilePart = buf + len;
while (*FilePart != buf && **FilePart != L'\\')
--(*FilePart);
if (**FilePart == L'\\')
++(*FilePart);
#endif
} }
} }

View file

@ -1,4 +1,4 @@
/* $Id: defwnd.c,v 1.99 2003/10/17 20:31:56 weiden Exp $ /* $Id: defwnd.c,v 1.100 2003/10/19 19:51:48 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll * PROJECT: ReactOS user32.dll
@ -710,6 +710,9 @@ DefWndDoPaintNC(HWND hWnd, HRGN clip)
DbgPrint("3. rect.top == %d\n", rect.top); DbgPrint("3. rect.top == %d\n", rect.top);
} }
if (ExStyle & WS_EX_CLIENTEDGE)
DrawEdge(hDC, &rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
/* Draw scrollbars */ /* Draw scrollbars */
if((Style & WS_VSCROLL) && (clientrect.right < rect.right - (2 * FrameSize.cx))) if((Style & WS_VSCROLL) && (clientrect.right < rect.right - (2 * FrameSize.cx)))
SCROLL_DrawScrollBar(hWnd, hDC, SB_VERT, TRUE, TRUE); SCROLL_DrawScrollBar(hWnd, hDC, SB_VERT, TRUE, TRUE);
@ -1968,21 +1971,15 @@ User32DefWindowProc(HWND hWnd,
if (GetWindowLongW(hWnd, GWL_STYLE) & WS_MINIMIZE && if (GetWindowLongW(hWnd, GWL_STYLE) & WS_MINIMIZE &&
(hIcon = (HICON)GetClassLongW(hWnd, GCL_HICON)) != NULL) (hIcon = (HICON)GetClassLongW(hWnd, GCL_HICON)) != NULL)
{ {
RECT WindowRect; RECT ClientRect;
INT x, y; INT x, y;
GetWindowRect(hWnd, &WindowRect); GetClientRect(hWnd, &ClientRect);
x = (WindowRect.right - WindowRect.left - x = (ClientRect.right - ClientRect.left -
GetSystemMetrics(SM_CXICON)) / 2; GetSystemMetrics(SM_CXICON)) / 2;
y = (WindowRect.bottom - WindowRect.top - y = (ClientRect.bottom - ClientRect.top -
GetSystemMetrics(SM_CYICON)) / 2; GetSystemMetrics(SM_CYICON)) / 2;
DrawIcon(hDC, x, y, hIcon); DrawIcon(hDC, x, y, hIcon);
} }
if (GetWindowLongW(hWnd, GWL_EXSTYLE) & WS_EX_CLIENTEDGE)
{
RECT WindowRect;
GetClientRect(hWnd, &WindowRect);
DrawEdge(hDC, &WindowRect, EDGE_SUNKEN, BF_RECT);
}
EndPaint(hWnd, &Ps); EndPaint(hWnd, &Ps);
} }
return (0); return (0);
@ -2076,11 +2073,16 @@ User32DefWindowProc(HWND hWnd,
{ {
return 0; return 0;
} }
if (0 == (((DWORD) hBrush) & 0xffff0000)) if (GetClassLongW(hWnd, GCL_STYLE) & CS_PARENTDC)
{ {
hBrush = GetSysColorBrush((DWORD) hBrush - 1); /* can't use GetClipBox with a parent DC or we fill the whole parent */
GetClientRect(hWnd, &Rect);
DPtoLP((HDC)wParam, (LPPOINT)&Rect, 2);
}
else
{
GetClipBox((HDC)wParam, &Rect);
} }
GetClipBox((HDC)wParam, &Rect);
FillRect((HDC)wParam, &Rect, hBrush); FillRect((HDC)wParam, &Rect, hBrush);
return (1); return (1);
} }

View file

@ -1,4 +1,4 @@
/* $Id: window.c,v 1.73 2003/09/20 19:52:23 gvg Exp $ /* $Id: window.c,v 1.74 2003/10/19 19:51:48 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll * PROJECT: ReactOS user32.dll
@ -392,8 +392,12 @@ ArrangeIconicWindows(HWND hWnd)
HDWP STDCALL HDWP STDCALL
BeginDeferWindowPos(int nNumWindows) BeginDeferWindowPos(int nNumWindows)
{ {
#if 0
UNIMPLEMENTED; UNIMPLEMENTED;
return (HDWP)0; return (HDWP)0;
#else
return (HDWP)1;
#endif
} }
@ -737,7 +741,12 @@ DeferWindowPos(HDWP hWinPosInfo,
int cy, int cy,
UINT uFlags) UINT uFlags)
{ {
#if 0
return NtUserDeferWindowPos(hWinPosInfo, hWnd, hWndInsertAfter, x, y, cx, cy, uFlags); return NtUserDeferWindowPos(hWinPosInfo, hWnd, hWndInsertAfter, x, y, cx, cy, uFlags);
#else
SetWindowPos(hWnd, hWndInsertAfter, x, y, cx, cy, uFlags);
return hWinPosInfo;
#endif
} }
@ -757,8 +766,12 @@ DestroyWindow(HWND hWnd)
WINBOOL STDCALL WINBOOL STDCALL
EndDeferWindowPos(HDWP hWinPosInfo) EndDeferWindowPos(HDWP hWinPosInfo)
{ {
#if 0
UNIMPLEMENTED; UNIMPLEMENTED;
return FALSE; return FALSE;
#else
return TRUE;
#endif
} }

View file

@ -2,4 +2,5 @@ const PALETTEENTRY* FASTCALL COLOR_GetSystemPaletteTemplate (VOID);
COLORREF STDCALL COLOR_LookupNearestColor (PALETTEENTRY* palPalEntry, INT size, COLORREF color); COLORREF STDCALL COLOR_LookupNearestColor (PALETTEENTRY* palPalEntry, INT size, COLORREF color);
INT STDCALL COLOR_PaletteLookupExactIndex (PALETTEENTRY* palPalEntry, INT size, COLORREF col); INT STDCALL COLOR_PaletteLookupExactIndex (PALETTEENTRY* palPalEntry, INT size, COLORREF col);
INT STDCALL COLOR_PaletteLookupPixel(PALETTEENTRY *palPalEntry, INT size, PXLATEOBJ XlateObj, COLORREF col, BOOL skipReserved); INT STDCALL COLOR_PaletteLookupPixel(PALETTEENTRY *palPalEntry, INT size, PXLATEOBJ XlateObj, COLORREF col, BOOL skipReserved);
ULONG FASTCALL NtGdiGetSysColor(int nIndex);
HBRUSH STDCALL NtGdiGetSysColorBrush(int nIndex); HBRUSH STDCALL NtGdiGetSysColorBrush(int nIndex);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: winsta.c,v 1.38 2003/10/12 09:46:51 gvg Exp $ /* $Id: winsta.c,v 1.39 2003/10/19 19:51:48 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -47,6 +47,7 @@
#include <include/error.h> #include <include/error.h>
#include <include/mouse.h> #include <include/mouse.h>
#include <include/callback.h> #include <include/callback.h>
#include <include/color.h>
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
@ -898,9 +899,28 @@ NtUserOpenInputDesktop(
BOOL STDCALL BOOL STDCALL
NtUserPaintDesktop(HDC hDC) NtUserPaintDesktop(HDC hDC)
{ {
UNIMPLEMENTED HWND hwnd = IntGetDesktopWindow();
return FALSE; /*
* Check for an owning thread, otherwise don't paint anything
* (non-desktop mode)
*/
if (NtUserGetWindowThreadProcessId(hwnd, NULL))
{
RECT Rect;
HBRUSH PreviousBrush;
NtUserGetClientRect(hwnd, &Rect);
/*
* Paint desktop background
*/
PreviousBrush = NtGdiSelectObject(hDC, NtGdiGetSysColorBrush(COLOR_BACKGROUND));
NtGdiPatBlt(hDC, Rect.left, Rect.top, Rect.right, Rect.bottom, PATCOPY);
NtGdiSelectObject(hDC, PreviousBrush);
}
return TRUE;
} }
DWORD STDCALL DWORD STDCALL