Author: jimtabor
Date: Thu Jun 7 11:52:13 2012
New Revision: 56705
URL: http://svn.reactos.org/svn/reactos?rev=56705&view=rev
Log:
[Win32k]
- Turn off a debug print. Fixed wine Edit test_edit_control_2 SetFocus return and one more in Msg test_SetFocus.
Modified:
trunk/reactos/win32ss/user/ntuser/focus.c
trunk/reactos/win32ss/user/ntuser/window.c
Modified: trunk/reactos/win32ss/user/ntuser/focus.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/focus.…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/focus.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/focus.c [iso-8859-1] Thu Jun 7 11:52:13 2012
@@ -596,12 +596,9 @@
}
// Check again! SetActiveWindow could have set the focus via WM_ACTIVATE.
- if (ThreadQueue->spwndFocus && ThreadQueue->spwndFocus == Window)
- {
- hWndPrev = UserHMGetHandle(ThreadQueue->spwndFocus);
- }
-
- /* check if the specified window can be set in the input data of a given queue */
+ hWndPrev = ThreadQueue->spwndFocus ? UserHMGetHandle(ThreadQueue->spwndFocus) : 0;
+
+ /* check if the specified window can be set in the input data of a given queue */
if (ThreadQueue == Window->head.pti->MessageQueue)
/* set the current thread focus window */
ThreadQueue->spwndFocus = Window;
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 Jun 7 11:52:13 2012
@@ -2413,7 +2413,7 @@
if (!co_WinPosShowWindow(Window, SW_HIDE))
{ // Rule #1.
if (ti->MessageQueue->spwndActive == Window && ti->MessageQueue == IntGetFocusMessageQueue())
- { ERR("DestroyWindow AOW\n");
+ { //ERR("DestroyWindow AOW\n");
co_WinPosActivateOtherWindow(Window);
}
}
Author: jimtabor
Date: Thu Jun 7 01:08:41 2012
New Revision: 56703
URL: http://svn.reactos.org/svn/reactos?rev=56703&view=rev
Log:
[Win32k]
- Fast fix attach thread input. Tested with win Msg test_SetFocus, fixed the WM_ACTIVATE issue, still needs more testing. See bug 7098, used the test case and it works.
Modified:
trunk/reactos/win32ss/user/ntuser/focus.c
trunk/reactos/win32ss/user/ntuser/input.c
Modified: trunk/reactos/win32ss/user/ntuser/focus.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/focus.…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/focus.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/focus.c [iso-8859-1] Thu Jun 7 01:08:41 2012
@@ -595,8 +595,14 @@
}
}
- /* check if the specified window can be set in the input data of a given queue */
- if ( !Window || ThreadQueue == Window->head.pti->MessageQueue)
+ // Check again! SetActiveWindow could have set the focus via WM_ACTIVATE.
+ if (ThreadQueue->spwndFocus && ThreadQueue->spwndFocus == Window)
+ {
+ hWndPrev = UserHMGetHandle(ThreadQueue->spwndFocus);
+ }
+
+ /* check if the specified window can be set in the input data of a given queue */
+ if (ThreadQueue == Window->head.pti->MessageQueue)
/* set the current thread focus window */
ThreadQueue->spwndFocus = Window;
Modified: trunk/reactos/win32ss/user/ntuser/input.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/input.…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/input.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/input.c [iso-8859-1] Thu Jun 7 01:08:41 2012
@@ -395,17 +395,17 @@
}
BOOL FASTCALL
-UserAttachThreadInput(PTHREADINFO pti, PTHREADINFO ptiTo, BOOL fAttach)
+UserAttachThreadInput(PTHREADINFO ptiFrom, PTHREADINFO ptiTo, BOOL fAttach)
{
PATTACHINFO pai;
/* Can not be the same thread. */
- if (pti == ptiTo) return FALSE;
+ if (ptiFrom == ptiTo) return FALSE;
/* Do not attach to system threads or between different desktops. */
- if (pti->TIF_flags & TIF_DONTATTACHQUEUE ||
+ if (ptiFrom->TIF_flags & TIF_DONTATTACHQUEUE ||
ptiTo->TIF_flags & TIF_DONTATTACHQUEUE ||
- pti->rpdesk != ptiTo->rpdesk)
+ ptiFrom->rpdesk != ptiTo->rpdesk)
return FALSE;
/* If Attach set, allocate and link. */
@@ -415,9 +415,16 @@
if (!pai) return FALSE;
pai->paiNext = gpai;
- pai->pti1 = pti;
+ pai->pti1 = ptiFrom;
pai->pti2 = ptiTo;
gpai = pai;
+ ERR("Attach Allocated! ptiFrom 0x%p ptiTo 0x%p\n",ptiFrom,ptiTo);
+
+ ptiFrom->pqAttach = ptiFrom->MessageQueue;
+ ptiFrom->MessageQueue = ptiTo->MessageQueue;
+ // FIXME: conditions?
+ ptiFrom->MessageQueue->spwndActive = ptiFrom->pqAttach->spwndActive;
+ ptiFrom->MessageQueue->spwndFocus = ptiFrom->pqAttach->spwndFocus;
}
else /* If clear, unlink and free it. */
{
@@ -430,7 +437,7 @@
/* Search list and free if found or return false. */
do
{
- if (pai->pti2 == ptiTo && pai->pti1 == pti) break;
+ if (pai->pti2 == ptiTo && pai->pti1 == ptiFrom) break;
paiprev = pai;
pai = pai->paiNext;
} while (pai);
@@ -440,8 +447,19 @@
if (paiprev) paiprev->paiNext = pai->paiNext;
ExFreePoolWithTag(pai, USERTAG_ATTACHINFO);
- }
-
+ ERR("Attach Free! ptiFrom 0x%p ptiTo 0x%p\n",ptiFrom,ptiTo);
+
+ ptiFrom->MessageQueue = ptiFrom->pqAttach;
+ // FIXME: conditions?
+ ptiFrom->MessageQueue->spwndActive = NULL;
+ ptiFrom->MessageQueue->spwndFocus = NULL;
+ ptiFrom->pqAttach = NULL;
+ }
+ /* Note that key state, which can be ascertained by calls to the GetKeyState
+ or GetKeyboardState function, is reset after a call to AttachThreadInput.
+ ATM which one?
+ */
+ RtlCopyMemory(ptiTo->MessageQueue->afKeyState, gafAsyncKeyState, sizeof(gafAsyncKeyState));
return TRUE;
}