ReleaseDC(hwnd, hDC);
- iTextItemHeight = ((13 * baseUnitY) / 8);
+#if 0
+ iTextItemHeight = ((13 * baseUnitY) / 8);
/*
* This "formula" calculates the height of the complete control.
* borders.
*/
iTextItemHeight -= 2*COMBO_YBORDERSIZE();
+#endif
+
+ /* Joakim: This seems to work better, the old formula caused the combo box
+ to be waaay to big with big font sizes */
+ iTextItemHeight = baseUnitY+2*COMBO_YBORDERSIZE();
}
/*
-/* $Id: window.c,v 1.41 2003/07/07 06:39:34 jimtabor Exp $
+/* $Id: window.c,v 1.42 2003/07/10 00:24:04 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
HWND STDCALL
FindWindowW(LPCWSTR lpClassName, LPCWSTR lpWindowName)
{
- //FIXME: FindWindow does not search children, but FindWindowEx does.
- // what should we do about this?
+ /*
+
+ There was a FIXME here earlier, but I think it is just a documentation unclarity.
+
+ FindWindow only searches top level windows. What they mean is that child
+ windows of other windows than the desktop can be searched.
+ FindWindowExW never does a recursive search.
+
+ / Joakim
+ */
+
return FindWindowExW (NULL, NULL, lpClassName, lpWindowName);
}
LPCWSTR lpszClass,
LPCWSTR lpszWindow)
{
- PUNICODE_STRING ucClassName;
- PUNICODE_STRING ucWindowName;
+ UNICODE_STRING ucClassName;
+ UNICODE_STRING ucWindowName;
if (IS_ATOM(lpszClass))
{
- RtlInitUnicodeString(ucClassName, NULL);
- ucClassName->Buffer = (LPWSTR)lpszClass;
+ RtlInitUnicodeString(&ucClassName, NULL);
+ ucClassName.Buffer = (LPWSTR)lpszClass;
}
else
{
- RtlInitUnicodeString(ucClassName, lpszClass);
- }
- if (IS_ATOM(lpszWindow))
- {
- RtlInitUnicodeString(ucWindowName, NULL);
- ucClassName->Buffer = (LPWSTR)lpszWindow;
- }
- else
- {
- RtlInitUnicodeString(ucWindowName, lpszWindow);
+ RtlInitUnicodeString(&ucClassName, lpszClass);
}
- return NtUserFindWindowEx(hwndParent, hwndChildAfter, ucClassName, ucWindowName);
+ // Window names can't be atoms, and if lpszWindow = NULL,
+ // RtlInitUnicodeString will clear it
+
+ RtlInitUnicodeString(&ucWindowName, lpszWindow);
+
+
+ return NtUserFindWindowEx(hwndParent, hwndChildAfter, &ucClassName, &ucWindowName);
}
WINBOOL STDCALL
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: painting.c,v 1.18 2003/06/15 20:08:02 gvg Exp $
+/* $Id: painting.c,v 1.19 2003/07/10 00:24:04 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
Client.x = Window->ClientRect.left - Window->WindowRect.left;
Client.y = Window->ClientRect.top - Window->WindowRect.top;
+ ExAcquireFastMutexUnsafe(&Window->ChildrenListLock);
ChildListEntry = Window->ChildrenListHead.Flink;
while (ChildListEntry != &Window->ChildrenListHead)
{
}
ChildListEntry = ChildListEntry->Flink;
}
+ ExReleaseFastMutexUnsafe(&Window->ChildrenListLock);
+
W32kOffsetRgn(hRgn, Total.x, Total.y);
HasChildren = FALSE;
}
PWINDOW_OBJECT Child;
PLIST_ENTRY ChildListEntry;
+ ExAcquireFastMutexUnsafe(&Window->ChildrenListLock);
ChildListEntry = Window->ChildrenListHead.Flink;
while (ChildListEntry != &Window->ChildrenListHead)
{
}
ChildListEntry = ChildListEntry->Flink;
}
+ ExReleaseFastMutexUnsafe(&Window->ChildrenListLock);
}
PaintUpdateInternalPaint(Window, Flags);
while (current_entry != &BaseWindow->ChildrenListHead)
{
Window = CONTAINING_RECORD(current_entry, WINDOW_OBJECT,
- ChildrenListHead);
+ SiblingListEntry);
if (Window->Style & WS_VISIBLE)
{
hFoundWnd = PaintingFindWinToRepaint(Window->Self, Thread);
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: windc.c,v 1.12 2003/06/15 20:08:02 gvg Exp $
+/* $Id: windc.c,v 1.13 2003/07/10 00:24:04 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
PWINDOW_OBJECT Child;
RECT Rect1;
+
+ ExAcquireFastMutexUnsafe(&Parent->ChildrenListLock);
ChildListEntry = Parent->ChildrenListHead.Flink;
while (ChildListEntry != &Parent->ChildrenListHead)
{
SiblingListEntry);
if (Child == End)
{
+ ExReleaseFastMutexUnsafe(&Parent->ChildrenListLock);
return(TRUE);
}
if (Child->Style & WS_VISIBLE)
}
ChildListEntry = ChildListEntry->Flink;
}
+ ExReleaseFastMutexUnsafe(&Parent->ChildrenListLock);
return(FALSE);
}
* 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.61 2003/07/07 06:09:45 jimtabor Exp $
+/* $Id: window.c,v 1.62 2003/07/10 00:24:04 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
WindowObject->ClientRect = WindowObject->WindowRect;
WindowObject->UserData = 0;
WindowObject->WndProc = DesktopClass->Class.lpfnWndProc;
+
InitializeListHead(&WindowObject->ChildrenListHead);
+ ExInitializeFastMutex(&WindowObject->ChildrenListLock);
WindowName = ExAllocatePool(NonPagedPool, sizeof(L"DESKTOP"));
wcscpy(WindowName, L"DESKTOP");
WindowObject->Parent = ParentWindow;
WindowObject->UserData = 0;
WindowObject->WndProc = ClassObject->Class.lpfnWndProc;
+
+ ExAcquireFastMutexUnsafe(&ParentWindow->ChildrenListLock);
InsertHeadList(&ParentWindow->ChildrenListHead,
&WindowObject->SiblingListEntry);
+ ExReleaseFastMutexUnsafe(&ParentWindow->ChildrenListLock);
+
InitializeListHead(&WindowObject->ChildrenListHead);
InitializeListHead(&WindowObject->PropListHead);
ExInitializeFastMutex(&WindowObject->ChildrenListLock);
WINPROC_FreeProc(Window->winproc, WIN_PROC_WINDOW);
CLASS_RemoveWindow(Window->Class);
#endif
+
+ ExAcquireFastMutexUnsafe(&Window->Parent->ChildrenListLock);
RemoveEntryList(&Window->SiblingListEntry);
+ ExReleaseFastMutexUnsafe(&Window->Parent->ChildrenListLock);
+
RemoveEntryList(&Window->DesktopListEntry);
+
+ ExAcquireFastMutexUnsafe (&ThreadData->WindowListLock);
RemoveEntryList(&Window->ThreadListEntry);
+ ExReleaseFastMutexUnsafe (&ThreadData->WindowListLock);
+
Window->Class = NULL;
ObmCloseHandle(ProcessData->WindowStation->HandleTable, Window->Self);
return 0;
}
+/*
+ * FUNCTION:
+ * Searches a window's children for a window with the specified
+ * class and name
+ * ARGUMENTS:
+ * hwndParent = The window whose childs are to be searched.
+ * NULL = desktop
+ *
+ * hwndChildAfter = Search starts after this child window.
+ * NULL = start from beginning
+ *
+ * ucClassName = Class name to search for
+ * Reguired parameter.
+ *
+ * ucWindowName = Window name
+ * ->Buffer == NULL = don't care
+ *
+ * RETURNS:
+ * The HWND of the window if it was found, otherwise NULL
+ *
+ * FIXME:
+ * Should use MmCopyFromCaller, we don't want an access violation in here
+ *
+ */
+
HWND STDCALL
NtUserFindWindowEx(HWND hwndParent,
HWND hwndChildAfter,
NTSTATUS status;
HWND windowHandle;
PWINDOW_OBJECT windowObject;
+ PWINDOW_OBJECT ParentWindow;
PLIST_ENTRY currentEntry;
PWNDCLASS_OBJECT classObject;
+ // Get a pointer to the class
status = ClassReferenceClassByNameOrAtom(&classObject, ucClassName->Buffer);
if (!NT_SUCCESS(status))
{
- return (HWND)0;
+ return NULL;
}
+
+ // If hwndParent==NULL use the desktop window instead
+ if(!hwndParent)
+ hwndParent = PsGetWin32Thread()->Desktop->DesktopWindow;
- //ExAcquireFastMutexUnsafe (&PsGetWin32Process()->WindowListLock);
- currentEntry = W32kGetActiveDesktop()->WindowListHead.Flink;
- while (currentEntry != &W32kGetActiveDesktop()->WindowListHead)
+ // Get the object
+ ParentWindow = W32kGetWindowObject(hwndParent);
+
+ if(!ParentWindow)
+ {
+ ObmDereferenceObject(classObject);
+ return NULL;
+ }
+
+ ExAcquireFastMutexUnsafe (&ParentWindow->ChildrenListLock);
+ currentEntry = ParentWindow->ChildrenListHead.Flink;
+
+ if(hwndChildAfter)
+ {
+ while (currentEntry != &ParentWindow->ChildrenListHead)
+ {
+ windowObject = CONTAINING_RECORD (currentEntry, WINDOW_OBJECT,
+ SiblingListEntry);
+
+ if(windowObject->Self == hwndChildAfter)
+ {
+ /* "The search begins with the _next_ child window in the Z order." */
+ currentEntry = currentEntry->Flink;
+ break;
+ }
+
+ currentEntry = currentEntry->Flink;
+ }
+
+ /* If the child hwndChildAfter was not found:
+ currentEntry=&ParentWindow->ChildrenListHead now so the next
+ block of code will just fall through and the function returns NULL */
+ }
+
+ while (currentEntry != &ParentWindow->ChildrenListHead)
{
windowObject = CONTAINING_RECORD (currentEntry, WINDOW_OBJECT,
- ListEntry);
+ SiblingListEntry);
- if (classObject == windowObject->Class &&
- RtlCompareUnicodeString (ucWindowName, &windowObject->WindowName,
- TRUE) == 0)
+ if (classObject == windowObject->Class && (ucWindowName->Buffer==NULL ||
+ RtlCompareUnicodeString (ucWindowName, &windowObject->WindowName, TRUE) == 0))
{
- ObmCreateHandle(W32kGetActiveDesktop()->WindowStation->HandleTable,
- windowObject,
- &windowHandle);
- //ExReleaseFastMutexUnsafe (&PsGetWin32Process()->WindowListLock);
+ windowHandle = windowObject->Self;
+
+ ExReleaseFastMutexUnsafe (&ParentWindow->ChildrenListLock);
+ W32kReleaseWindowObject(ParentWindow);
ObmDereferenceObject (classObject);
return windowHandle;
}
currentEntry = currentEntry->Flink;
}
- //ExReleaseFastMutexUnsafe (&PsGetWin32Process()->WindowListLock);
-
+
+ ExReleaseFastMutexUnsafe (&ParentWindow->ChildrenListLock);
+ W32kReleaseWindowObject(ParentWindow);
ObmDereferenceObject (classObject);
- return (HWND)0;
+ return NULL;
}
DWORD STDCALL
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: winpos.c,v 1.12 2003/07/05 16:04:01 chorns Exp $
+/* $Id: winpos.c,v 1.13 2003/07/10 00:24:04 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
PLIST_ENTRY CurrentEntry;
PWINDOW_OBJECT Current;
+
+ ExAcquireFastMutexUnsafe(&ScopeWin->ChildrenListLock);
CurrentEntry = ScopeWin->ChildrenListHead.Flink;
while (CurrentEntry != &ScopeWin->ChildrenListHead)
{
*Window = Current;
if (Current->Style & WS_DISABLED)
{
+ ExReleaseFastMutexUnsafe(&ScopeWin->ChildrenListLock);
return(HTERROR);
}
if (Current->Style & WS_MINIMIZE)
{
+ ExReleaseFastMutexUnsafe(&ScopeWin->ChildrenListLock);
return(HTCAPTION);
}
if (Point.x >= Current->ClientRect.left &&
Point.x -= Current->ClientRect.left;
Point.y -= Current->ClientRect.top;
+ ExReleaseFastMutexUnsafe(&ScopeWin->ChildrenListLock);
return(WinPosSearchChildren(Current, Point, Window));
}
+
+ ExReleaseFastMutexUnsafe(&ScopeWin->ChildrenListLock);
return(0);
}
CurrentEntry = CurrentEntry->Flink;
}
+
+ ExReleaseFastMutexUnsafe(&ScopeWin->ChildrenListLock);
return(0);
}