Author: jimtabor
Date: Mon Apr 4 07:18:54 2011
New Revision: 51248
URL:
http://svn.reactos.org/svn/reactos?rev=51248&view=rev
Log:
[User32|Win32k]
- Working on wine win test_capture_4, pass all the tests in test_capture_4_proc but still
waiting forever in MenuTrackMenu:WaitMessage!
Modified:
trunk/reactos/dll/win32/user32/windows/menu.c
trunk/reactos/dll/win32/user32/windows/message.c
trunk/reactos/subsystems/win32/win32k/ntuser/focus.c
trunk/reactos/subsystems/win32/win32k/ntuser/misc.c
Modified: trunk/reactos/dll/win32/user32/windows/menu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/m…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/menu.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/menu.c [iso-8859-1] Mon Apr 4 07:18:54 2011
@@ -3207,8 +3207,10 @@
fEndMenu = !fRemove;
}
- SetCapture(mt.OwnerWnd);
- (void)NtUserSetGUIThreadHandle(MSQ_STATE_MENUOWNER, mt.OwnerWnd);
+ /* owner may not be visible when tracking a popup, so use the menu itself */
+ capture_win = (wFlags & TPM_POPUPMENU) ? MenuInfo.Wnd : mt.OwnerWnd;
+ (void)NtUserSetGUIThreadHandle(MSQ_STATE_MENUOWNER, capture_win); // 1
+ SetCapture(capture_win); // 2
FIXME("MenuTrackMenu 1\n");
while (! fEndMenu)
Modified: trunk/reactos/dll/win32/user32/windows/message.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/m…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/message.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/message.c [iso-8859-1] Mon Apr 4 07:18:54
2011
@@ -2380,8 +2380,9 @@
BOOL WINAPI
ReleaseCapture(VOID)
{
- NtUserSetCapture(NULL);
- return(TRUE);
+ HWND hwndPrev = NtUserSetCapture(NULL);
+ return(hwndPrev ? TRUE : FALSE);
+// return (BOOL)NtUserCallNoParam(NOPARAM_ROUTINE_RELEASECAPTURE);
}
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/focus.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/focus.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/focus.c [iso-8859-1] Mon Apr 4 07:18:54
2011
@@ -546,6 +546,9 @@
pti = PsGetCurrentThreadWin32Thread();
ThreadQueue = pti->MessageQueue;
+ if (ThreadQueue->QF_flags & QF_CAPTURELOCKED)
+ return NULL;
+
if ((Window = UserGetWindowObject(hWnd)))
{
if (Window->head.pti->MessageQueue != ThreadQueue)
@@ -553,7 +556,7 @@
return NULL;
}
}
-
+
hWndPrev = MsqSetStateWindow(ThreadQueue, MSQ_STATE_CAPTURE, hWnd);
if (hWndPrev)
@@ -563,19 +566,28 @@
IntNotifyWinEvent(EVENT_SYSTEM_CAPTUREEND, pWnd, OBJID_WINDOW, CHILDID_SELF,
WEF_SETBYWNDPTI);
}
+ if (Window)
+ IntNotifyWinEvent(EVENT_SYSTEM_CAPTURESTART, Window, OBJID_WINDOW, CHILDID_SELF,
WEF_SETBYWNDPTI);
+
+ if (hWndPrev && hWndPrev != hWnd)
+ {
+ if (ThreadQueue->MenuOwner && Window) ThreadQueue->QF_flags |=
QF_CAPTURELOCKED;
+
+ co_IntPostOrSendMessage(hWndPrev, WM_CAPTURECHANGED, 0, (LPARAM)hWnd);
+
+ ThreadQueue->QF_flags &= ~QF_CAPTURELOCKED;
+ }
+
+ ThreadQueue->CaptureWindow = hWnd;
+
+ /// These are hacks!
/* also remove other windows if not capturing anymore */
if (hWnd == NULL)
{
MsqSetStateWindow(ThreadQueue, MSQ_STATE_MENUOWNER, NULL);
MsqSetStateWindow(ThreadQueue, MSQ_STATE_MOVESIZE, NULL);
}
-
- if (Window)
- IntNotifyWinEvent(EVENT_SYSTEM_CAPTURESTART, Window, OBJID_WINDOW, CHILDID_SELF,
WEF_SETBYWNDPTI);
-
- co_IntPostOrSendMessage(hWndPrev, WM_CAPTURECHANGED, 0, (LPARAM)hWnd);
- ThreadQueue->CaptureWindow = hWnd;
-
+ ///
return hWndPrev;
}
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/misc.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/misc.c [iso-8859-1] Mon Apr 4 07:18:54
2011
@@ -179,7 +179,9 @@
GUITHREADINFO SafeGui;
PDESKTOP Desktop;
PUSER_MESSAGE_QUEUE MsgQueue;
+ PTHREADINFO W32Thread;
PETHREAD Thread = NULL;
+
DECLARE_RETURN(BOOLEAN);
DPRINT("Enter NtUserGetGUIThreadInfo\n");
@@ -198,7 +200,7 @@
RETURN( FALSE);
}
- if(idThread)
+ if (idThread)
{
Status = PsLookupThreadByThreadId((HANDLE)(DWORD_PTR)idThread, &Thread);
if(!NT_SUCCESS(Status))
@@ -206,24 +208,17 @@
EngSetLastError(ERROR_ACCESS_DENIED);
RETURN( FALSE);
}
- Desktop = ((PTHREADINFO)Thread->Tcb.Win32Thread)->rpdesk;
+ W32Thread = (PTHREADINFO)Thread->Tcb.Win32Thread;
+ Desktop = W32Thread->rpdesk;
}
else
- {
- /* get the foreground thread */
- PTHREADINFO W32Thread = (PTHREADINFO)PsGetCurrentThread()->Tcb.Win32Thread;
+ { /* get the foreground thread */
+ Thread = PsGetCurrentThread();
+ W32Thread = (PTHREADINFO)Thread->Tcb.Win32Thread;
Desktop = W32Thread->rpdesk;
- if(Desktop)
- {
- MsgQueue = Desktop->ActiveMessageQueue;
- if(MsgQueue)
- {
- Thread = MsgQueue->Thread;
- }
- }
- }
-
- if(!Thread || !Desktop)
+ }
+
+ if (!Thread || !Desktop )
{
if(idThread && Thread)
ObDereferenceObject(Thread);
@@ -231,13 +226,21 @@
RETURN( FALSE);
}
- MsgQueue = (PUSER_MESSAGE_QUEUE)Desktop->ActiveMessageQueue;
+ if ( W32Thread->MessageQueue )
+ MsgQueue = W32Thread->MessageQueue;
+ else
+ {
+ if ( Desktop ) MsgQueue = Desktop->ActiveMessageQueue;
+ }
+
CaretInfo = MsgQueue->CaretInfo;
SafeGui.flags = (CaretInfo->Visible ? GUI_CARETBLINKING : 0);
- if(MsgQueue->MenuOwner)
+
+ if (MsgQueue->MenuOwner)
SafeGui.flags |= GUI_INMENUMODE | MsgQueue->MenuState;
- if(MsgQueue->MoveSize)
+
+ if (MsgQueue->MoveSize)
SafeGui.flags |= GUI_INMOVESIZE;
/* FIXME add flag GUI_16BITTASK */
@@ -254,7 +257,7 @@
SafeGui.rcCaret.right = SafeGui.rcCaret.left + CaretInfo->Size.cx;
SafeGui.rcCaret.bottom = SafeGui.rcCaret.top + CaretInfo->Size.cy;
- if(idThread)
+ if (idThread)
ObDereferenceObject(Thread);
Status = MmCopyToCaller(lpgui, &SafeGui, sizeof(GUITHREADINFO));