Author: jimtabor
Date: Thu Feb 12 21:28:39 2015
New Revision: 66237
URL:
http://svn.reactos.org/svn/reactos?rev=66237&view=rev
Log:
[NtUser]
- Reorder Destroy and Free window, getting close to how wine does it. Still more work is
needed.
Modified:
trunk/reactos/win32ss/user/ntuser/window.c
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] Thu Feb 12 21:28:39 2015
@@ -367,36 +367,30 @@
*/
static void IntSendDestroyMsg(HWND hWnd)
{
-
+ PTHREADINFO ti;
PWND Window;
-#if 0 /* FIXME */
-
- GUITHREADINFO info;
-
- if (GetGUIThreadInfo(GetCurrentThreadId(), &info))
- {
- if (hWnd == info.hwndCaret)
- {
- DestroyCaret();
- }
- }
-#endif
-
+
+ ti = PsGetCurrentThreadWin32Thread();
Window = UserGetWindowObject(hWnd);
+
if (Window)
{
-// USER_REFERENCE_ENTRY Ref;
-// UserRefObjectCo(Window, &Ref);
-
- if (!Window->spwndOwner && !IntGetParent(Window))
- {
- co_IntShellHookNotify(HSHELL_WINDOWDESTROYED, (WPARAM) hWnd, 0);
- }
-
-// UserDerefObjectCo(Window);
- }
-
- /* The window could already be destroyed here */
+ /* Look whether the focus is within the tree of windows we will
+ * be destroying.
+ */
+ // Rule #1
+ if ( ti->MessageQueue->spwndActive == Window ||
+ (ti->MessageQueue->spwndActive == NULL && ti->MessageQueue ==
IntGetFocusMessageQueue()) )
+ {
+ co_WinPosActivateOtherWindow(Window);
+ }
+
+ if (ti->MessageQueue->CaretInfo->hWnd == UserHMGetHandle(Window))
+ {
+ co_IntDestroyCaret(ti);
+ }
+
+ }
/*
* Send the WM_DESTROY to the window.
@@ -485,7 +479,6 @@
Window->style &= ~WS_VISIBLE;
Window->head.pti->cVisWindows--;
- IntNotifyWinEvent(EVENT_OBJECT_DESTROY, Window, OBJID_WINDOW, CHILDID_SELF, 0);
/* remove the window already at this point from the thread window list so we
don't get into trouble when destroying the thread windows while we're
still
@@ -494,7 +487,7 @@
BelongsToThreadData = IntWndBelongsToThread(Window, ThreadData);
- IntDeRegisterShellHookWindow(Window->head.h);
+ IntDeRegisterShellHookWindow(UserHMGetHandle(Window));
/* free child windows */
Children = IntWinListChildren(Window);
@@ -528,13 +521,13 @@
RDW_VALIDATE | RDW_NOFRAME | RDW_NOERASE |
RDW_NOINTERNALPAINT | RDW_NOCHILDREN);
if(BelongsToThreadData)
- co_IntSendMessage(Window->head.h, WM_NCDESTROY, 0, 0);
+ co_IntSendMessage(UserHMGetHandle(Window), WM_NCDESTROY, 0, 0);
}
DestroyTimersForWindow(ThreadData, Window);
/* Unregister hot keys */
- UnregisterWindowHotKeys (Window);
+ UnregisterWindowHotKeys(Window);
/* flush the message queue */
MsqRemoveWindowMessagesFromQueue(Window);
@@ -555,19 +548,10 @@
ThreadData->rpdesk->rpwinstaParent->ShellListView = NULL;
}
- /* FIXME: do we need to fake QS_MOUSEMOVE wakebit? */
-
-#if 0 /* FIXME */
-
- WinPosCheckInternalPos(Window->head.h);
- if (Window->head.h == GetCapture())
- {
- ReleaseCapture();
- }
-
- /* free resources associated with the window */
- TIMER_RemoveWindowTimers(Window->head.h);
-#endif
+ if (ThreadData->MessageQueue->spwndCapture == Window)
+ {
+ IntReleaseCapture();
+ }
if ( ((Window->style & (WS_CHILD|WS_POPUP)) != WS_CHILD) &&
Window->IDMenu &&
@@ -585,11 +569,6 @@
}
DceFreeWindowDCE(Window); /* Always do this to catch orphaned DCs */
-#if 0 /* FIXME */
-
- WINPROC_FreeProc(Window->winproc, WIN_PROC_WINDOW);
- CLASS_RemoveWindow(Window->Class);
-#endif
IntUnlinkWindow(Window);
@@ -601,7 +580,7 @@
}
UserReferenceObject(Window);
- UserDeleteObject(Window->head.h, TYPE_WINDOW);
+ UserDeleteObject(UserHMGetHandle(Window), TYPE_WINDOW);
IntDestroyScrollBars(Window);
@@ -2582,15 +2561,20 @@
IntSendParentNotify(Window, WM_DESTROY);
}
- /* Look whether the focus is within the tree of windows we will
- * be destroying.
- */
- if (!co_WinPosShowWindow(Window, SW_HIDE))
- { // Rule #1.
- if ( ti->MessageQueue->spwndActive == Window ||
- (ti->MessageQueue->spwndActive == NULL && ti->MessageQueue ==
IntGetFocusMessageQueue()) )
- {
- co_WinPosActivateOtherWindow(Window);
+ if (!Window->spwndOwner && !IntGetParent(Window))
+ {
+ co_IntShellHookNotify(HSHELL_WINDOWDESTROYED, (WPARAM) hWnd, 0);
+ }
+
+ if (Window->style & WS_VISIBLE)
+ {
+ if (Window->style & WS_CHILD)
+ {
+ co_WinPosShowWindow(Window, SW_HIDE);
+ }
+ else
+ {
+ co_WinPosSetWindowPos(Window, 0, 0, 0, 0, 0,
SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_HIDEWINDOW );
}
}
@@ -2604,7 +2588,7 @@
pwndTemp->spwndLastActive = Window->spwndOwner;
}
- if (Window->spwndParent && IntIsWindow(Window->head.h))
+ if (Window->spwndParent && IntIsWindow(UserHMGetHandle(Window)))
{
if ((Window->style & (WS_POPUP | WS_CHILD)) == WS_CHILD)
{
@@ -2640,7 +2624,7 @@
IntEngWindowChanged(Window, WOC_DELETE);
- if (!IntIsWindow(Window->head.h))
+ if (!IntIsWindow(UserHMGetHandle(Window)))
{
return TRUE;
}
@@ -2705,11 +2689,13 @@
msg.pt = gpsi->ptCursor;
co_MsqInsertMouseMessage(&msg, 0, 0, TRUE);
+ IntNotifyWinEvent(EVENT_OBJECT_DESTROY, Window, OBJID_WINDOW, CHILDID_SELF, 0);
+
/* Send destroy messages */
- IntSendDestroyMsg(Window->head.h);
-
- if (!IntIsWindow(Window->head.h))
+ IntSendDestroyMsg(UserHMGetHandle(Window));
+
+ if (!IntIsWindow(UserHMGetHandle(Window)))
{
return TRUE;
}