- Better implementation of window non-client area functions.

- Fixed GetWindowLong and SetWindowLong.
- Other small bug fixes.

svn path=/trunk/; revision=6436
This commit is contained in:
Filip Navara
2003-10-25 22:57:34 +00:00
parent 95f63185a4
commit 50382abaf9
8 changed files with 1315 additions and 1141 deletions
+2 -1
View File
@@ -1,4 +1,4 @@
# $Id: Makefile,v 1.26 2003/08/22 07:51:32 gvg Exp $
# $Id: Makefile,v 1.27 2003/10/25 22:57:34 navaraf Exp $
PATH_TO_TOP = ../..
@@ -70,6 +70,7 @@ WINDOWS_OBJECTS = \
windows/mdi.o \
windows/menu.o \
windows/messagebox.o \
windows/nonclient.o \
windows/paint.o \
windows/prop.o \
windows/rect.o \
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: menu.c,v 1.33 2003/08/29 10:20:53 gvg Exp $
/* $Id: menu.c,v 1.34 2003/10/25 22:57:34 navaraf Exp $
*
* PROJECT: ReactOS user32.dll
* FILE: lib/user32/windows/menu.c
@@ -395,6 +395,8 @@ MenuDrawMenuBar(HDC hDC, LPRECT Rect, HWND hWnd, BOOL Draw)
RECT *omir, *mir = NULL;
LPWSTR str;
FillRect(hDC, Rect, GetSysColorBrush(COLOR_MENU));
height = Rect->bottom - Rect->top;
mnu = GetMenu(hWnd); /* Fixme - pass menu handle as parameter */
/* get menu item list size */
File diff suppressed because it is too large Load Diff
+11 -96
View File
@@ -1,4 +1,4 @@
/* $Id: window.c,v 1.74 2003/10/19 19:51:48 navaraf Exp $
/* $Id: window.c,v 1.75 2003/10/25 22:57:34 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@@ -24,12 +24,6 @@
static BOOL ControlsInitCalled = FALSE;
/* FUNCTIONS *****************************************************************/
ULONG
WinHasThickFrameStyle(ULONG Style, ULONG ExStyle)
{
return((Style & WS_THICKFRAME) &&
(!((Style & (WS_DLGFRAME | WS_BORDER)) == WS_DLGFRAME)));
}
NTSTATUS STDCALL
@@ -275,95 +269,6 @@ User32CallWindowProcFromKernel(PVOID Arguments, ULONG ArgumentLength)
}
static void NC_AdjustRectOuter95 (LPRECT rect, DWORD style, BOOL menu, DWORD exStyle)
{
int adjust;
if(style & WS_ICONIC) return;
if ((exStyle & (WS_EX_STATICEDGE|WS_EX_DLGMODALFRAME)) ==
WS_EX_STATICEDGE)
{
adjust = 1; /* for the outer frame always present */
}
else
{
adjust = 0;
if ((exStyle & WS_EX_DLGMODALFRAME) ||
(style & (WS_THICKFRAME|WS_DLGFRAME))) adjust = 2; /* outer */
}
if (style & WS_THICKFRAME)
adjust += ( GetSystemMetrics (SM_CXFRAME)
- GetSystemMetrics (SM_CXDLGFRAME)); /* The resize border */
if ((style & (WS_BORDER|WS_DLGFRAME)) ||
(exStyle & WS_EX_DLGMODALFRAME))
adjust++; /* The other border */
InflateRect (rect, adjust, adjust);
if ((style & WS_CAPTION) == WS_CAPTION)
{
if (exStyle & WS_EX_TOOLWINDOW)
rect->top -= GetSystemMetrics(SM_CYSMCAPTION);
else
rect->top -= GetSystemMetrics(SM_CYCAPTION);
}
if (menu) rect->top -= GetSystemMetrics(SM_CYMENU);
}
static void
NC_AdjustRectInner95 (LPRECT rect, DWORD style, DWORD exStyle)
{
if(style & WS_ICONIC) return;
if (exStyle & WS_EX_CLIENTEDGE)
InflateRect(rect, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE));
if (style & WS_VSCROLL)
{
if((exStyle & WS_EX_LEFTSCROLLBAR) != 0)
rect->left -= GetSystemMetrics(SM_CXVSCROLL);
else
rect->right += GetSystemMetrics(SM_CXVSCROLL);
}
if (style & WS_HSCROLL) rect->bottom += GetSystemMetrics(SM_CYHSCROLL);
}
/*
* @implemented
*/
WINBOOL STDCALL
AdjustWindowRectEx(LPRECT lpRect,
DWORD dwStyle,
WINBOOL bMenu,
DWORD dwExStyle)
{
dwStyle &= (WS_DLGFRAME | WS_BORDER | WS_THICKFRAME | WS_CHILD);
dwExStyle &= (WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE |
WS_EX_STATICEDGE | WS_EX_TOOLWINDOW);
if (dwExStyle & WS_EX_DLGMODALFRAME) dwStyle &= ~WS_THICKFRAME;
NC_AdjustRectOuter95( lpRect, dwStyle, bMenu, dwExStyle );
NC_AdjustRectInner95( lpRect, dwStyle, dwExStyle );
lpRect->right += 2;
lpRect->bottom += 2;
return TRUE;
}
/*
* @implemented
*/
WINBOOL STDCALL
AdjustWindowRect(LPRECT lpRect,
DWORD dwStyle,
WINBOOL bMenu)
{
return(AdjustWindowRectEx(lpRect, dwStyle, bMenu, 0));
}
/*
* @unimplemented
*/
@@ -497,6 +402,11 @@ CreateWindowExA(DWORD dwExStyle,
ControlsInitCalled = TRUE;
}
if ((dwStyle & (WS_CHILD | WS_POPUP)) == WS_CHILD && !hWndParent)
{
return (HWND)0; /* WS_CHILD needs a parent, but WS_POPUP doesn't */
}
if (IS_ATOM(lpClassName))
{
RtlInitUnicodeString(&ClassName, NULL);
@@ -639,6 +549,11 @@ CreateWindowExW(DWORD dwExStyle,
ControlsInitCalled = TRUE;
}
if ((dwStyle & (WS_CHILD | WS_POPUP)) == WS_CHILD && !hWndParent)
{
return (HWND)0; /* WS_CHILD needs a parent, but WS_POPUP doesn't */
}
if (IS_ATOM(lpClassName))
{
RtlInitUnicodeString(&ClassName, NULL);
+1 -1
View File
@@ -51,7 +51,7 @@ typedef struct _WINDOW_OBJECT
/* Entry in the thread's list of windows. */
LIST_ENTRY ListEntry;
/* Pointer to the extra data associated with the window. */
PULONG ExtraData;
PCHAR ExtraData;
/* Size of the extra data associated with the window. */
ULONG ExtraDataSize;
/* Position of the window. */
+3 -1
View File
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: scrollbar.c,v 1.17 2003/10/06 17:25:16 weiden Exp $
/* $Id: scrollbar.c,v 1.18 2003/10/25 22:57:34 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -868,6 +868,8 @@ NtUserShowScrollBar(HWND hWnd, int wBar, DWORD bShow)
return FALSE; /* Nothing to do! */
}
IntReleaseWindowObject(Window);
if (fShowH || fShowV) /* frame has been changed, let the window redraw itself */
{
WinPosSetWindowPos (hWnd, 0, 0, 0, 0, 0,
+11 -9
View File
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: window.c,v 1.118 2003/10/23 09:07:54 gvg Exp $
/* $Id: window.c,v 1.119 2003/10/25 22:57:34 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -1340,7 +1340,7 @@ NtUserCreateWindowEx(DWORD dwExStyle,
/* extra window data */
if (ClassObject->cbWndExtra != 0)
{
WindowObject->ExtraData = (PULONG)(WindowObject + 1);
WindowObject->ExtraData = (PCHAR)(WindowObject + 1);
WindowObject->ExtraDataSize = ClassObject->cbWndExtra;
RtlZeroMemory(WindowObject->ExtraData, WindowObject->ExtraDataSize);
}
@@ -2242,13 +2242,14 @@ NtUserGetWindowLong(HWND hWnd, DWORD Index, BOOL Ansi)
if (0 <= (int) Index)
{
if (WindowObject->ExtraDataSize - sizeof(LONG) < Index ||
0 != Index % sizeof(LONG))
DbgPrint("GetWindowLong(%x, %d)\n", hWnd, Index);
if (Index > WindowObject->ExtraDataSize - sizeof(LONG))
{
SetLastWin32Error(ERROR_INVALID_PARAMETER);
return 0;
}
Result = WindowObject->ExtraData[Index / sizeof(LONG)];
Result = *((LONG *)(WindowObject->ExtraData + Index));
DbgPrint("Result: %x\n", Result);
}
else
{
@@ -2939,14 +2940,15 @@ NtUserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
if (0 <= (int) Index)
{
if (WindowObject->ExtraDataSize - sizeof(LONG) < Index ||
0 != Index % sizeof(LONG))
DbgPrint("SetWindowLong(%x, %d, %x)\n", hWnd, Index, NewValue);
if (Index > WindowObject->ExtraDataSize - sizeof(LONG))
{
SetLastWin32Error(ERROR_INVALID_PARAMETER);
return 0;
}
OldValue = WindowObject->ExtraData[Index / sizeof(LONG)];
WindowObject->ExtraData[Index / sizeof(LONG)] = NewValue;
OldValue = *((LONG *)(WindowObject->ExtraData + Index));
*((LONG *)(WindowObject->ExtraData + Index)) = NewValue;
DbgPrint("OldValue: %x\n", OldValue);
}
else
{