Author: jimtabor Date: Fri May 18 18:08:54 2012 New Revision: 56608
URL: http://svn.reactos.org/svn/reactos?rev=56608&view=rev Log: [Win32k] - Fix all the wine Win test_SetForegroundWindow and todo tests.
Modified: trunk/reactos/win32ss/user/ntuser/focus.c trunk/reactos/win32ss/user/ntuser/simplecall.c
Modified: trunk/reactos/win32ss/user/ntuser/focus.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/focus.c... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/focus.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/focus.c [iso-8859-1] Fri May 18 18:08:54 2012 @@ -229,6 +229,38 @@ return NULL; }
+VOID FASTCALL +FindRemoveAsyncMsg(PWND Wnd) +{ + PUSER_MESSAGE_QUEUE MessageQueue; + PUSER_SENT_MESSAGE Message; + PLIST_ENTRY Entry; + + if (!Wnd) return; + + MessageQueue = Wnd->head.pti->MessageQueue; + + if (!IsListEmpty(&MessageQueue->SentMessagesListHead)) + { + // Scan sent queue messages to see if we received async messages. + Entry = MessageQueue->SentMessagesListHead.Flink; + Message = CONTAINING_RECORD(Entry, USER_SENT_MESSAGE, ListEntry); + do + { + if (Message->Msg.message == WM_ASYNC_SETACTIVEWINDOW && + Message->Msg.hwnd == UserHMGetHandle(Wnd) && + Message->Msg.wParam == 0 ) + { + TRACE("ASYNC SAW: Found one in the Sent Msg Queue! %p\n", Message->Msg.hwnd); + RemoveEntryList(Entry); // Purge the entry. + } + Entry = Message->ListEntry.Flink; + Message = CONTAINING_RECORD(Entry, USER_SENT_MESSAGE, ListEntry); + } + while (Entry != &MessageQueue->SentMessagesListHead); + } +} + /* Can the system force foreground from one or more conditions. */ @@ -307,15 +339,17 @@ { IntSetFocusMessageQueue(Wnd->head.pti->MessageQueue); gptiForeground = Wnd->head.pti; - fgRet = TRUE; - } -/* - Fix FG Bounce with regedit but breaks test_SFW todos: +/* Henri Verbeet, What happens is that we get the WM_WINE_SETACTIVEWINDOW message sent by the other thread after we already changed the foreground window back to our own window. */ + FindRemoveAsyncMsg(Wnd); // Do this to fix test_SFW todos! + fgRet = TRUE; + } + + // Fix FG Bounce with regedit. if (hWndPrev != hWnd ) { if (PrevForegroundQueue &&
Modified: trunk/reactos/win32ss/user/ntuser/simplecall.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/simplec... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/simplecall.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/simplecall.c [iso-8859-1] Fri May 18 18:08:54 2012 @@ -569,7 +569,9 @@ break;
case HWNDLOCK_ROUTINE_SETFOREGROUNDWINDOW: + TRACE("co_IntSetForegroundWindow 1 %p\n",hWnd); Ret = co_IntSetForegroundWindow(Window); + TRACE("co_IntSetForegroundWindow 2 \n"); break;
case HWNDLOCK_ROUTINE_UPDATEWINDOW: