mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
- Attempt to fix window activation bugs reported by G� van Geldorp and Thomas Weidenmueller.
svn path=/trunk/; revision=6849
This commit is contained in:
parent
c2642685e7
commit
b4e30cf77b
4 changed files with 56 additions and 74 deletions
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: focus.c,v 1.2 2003/11/30 22:48:11 navaraf Exp $
|
||||
* $Id: focus.c,v 1.3 2003/12/02 19:58:54 navaraf Exp $
|
||||
*/
|
||||
|
||||
#include <win32k/win32k.h>
|
||||
|
@ -144,8 +144,13 @@ IntSetForegroundWindow(PWINDOW_OBJECT Window)
|
|||
/* FIXME: Call hooks. */
|
||||
|
||||
IntSetFocusMessageQueue(Window->MessageQueue);
|
||||
Window->MessageQueue->ActiveWindow = hWnd;
|
||||
Window->MessageQueue->FocusWindow = hWnd;
|
||||
/* ExAcquireFastMutex(&Window->MessageQueue->Lock);*/
|
||||
if (Window->MessageQueue)
|
||||
{
|
||||
Window->MessageQueue->ActiveWindow = hWnd;
|
||||
Window->MessageQueue->FocusWindow = hWnd;
|
||||
}
|
||||
/* ExReleaseFastMutex(&Window->MessageQueue->Lock);*/
|
||||
|
||||
IntSendDeactivateMessages(hWndPrev, hWnd);
|
||||
IntSendKillFocusMessages(hWndPrev, hWnd);
|
||||
|
@ -187,7 +192,9 @@ IntSetActiveWindow(PWINDOW_OBJECT Window)
|
|||
|
||||
/* FIXME: Call hooks. */
|
||||
|
||||
/* ExAcquireFastMutex(&ThreadQueue->Lock);*/
|
||||
ThreadQueue->ActiveWindow = hWnd;
|
||||
/* ExReleaseFastMutex(&ThreadQueue->Lock);*/
|
||||
|
||||
IntSendDeactivateMessages(hWndPrev, hWnd);
|
||||
IntSendActivateMessages(hWndPrev, hWnd);
|
||||
|
@ -213,7 +220,9 @@ IntSetFocusWindow(PWINDOW_OBJECT Window)
|
|||
return hWndPrev;
|
||||
}
|
||||
|
||||
/* ExAcquireFastMutex(&ThreadQueue->Lock);*/
|
||||
ThreadQueue->FocusWindow = hWnd;
|
||||
/* ExReleaseFastMutex(&ThreadQueue->Lock);*/
|
||||
|
||||
IntSendKillFocusMessages(hWndPrev, hWnd);
|
||||
IntSendSetFocusMessages(hWndPrev, hWnd);
|
||||
|
@ -317,7 +326,9 @@ NtUserSetCapture(HWND hWnd)
|
|||
}
|
||||
hWndPrev = ThreadQueue->CaptureWindow;
|
||||
NtUserSendMessage(hWndPrev, WM_CAPTURECHANGED, 0, (LPARAM)hWnd);
|
||||
/* ExAcquireFastMutex(&ThreadQueue->Lock);*/
|
||||
ThreadQueue->CaptureWindow = hWnd;
|
||||
/* ExReleaseFastMutex(&ThreadQueue->Lock);*/
|
||||
|
||||
return hWndPrev;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* 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.39 2003/11/26 21:48:35 gvg Exp $
|
||||
/* $Id: windc.c,v 1.40 2003/12/02 19:58:54 navaraf Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -440,6 +440,23 @@ NtUserGetDCEx(HWND hWnd, HANDLE ClipRegion, ULONG Flags)
|
|||
Flags |= DCX_INTERSECTRGN;
|
||||
}
|
||||
|
||||
/*
|
||||
if (ClipRegion == (HRGN)1)
|
||||
{
|
||||
if (!(Flags & DCX_WINDOW))
|
||||
{
|
||||
ClipRegion = UnsafeIntCreateRectRgnIndirect(&Window->ClientRect);
|
||||
}
|
||||
else
|
||||
{
|
||||
ClipRegion = UnsafeIntCreateRectRgnIndirect(&Window->WindowRect);
|
||||
}
|
||||
NtGdiOffsetRgn(ClipRegion,
|
||||
-Window->WindowRect.left,
|
||||
-Window->WindowRect.top);
|
||||
}
|
||||
*/
|
||||
|
||||
if (NULL != ClipRegion)
|
||||
{
|
||||
Dce->hClipRgn = NtGdiCreateRectRgn(0, 0, 0, 0);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* 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.149 2003/11/30 20:03:47 navaraf Exp $
|
||||
/* $Id: window.c,v 1.150 2003/12/02 19:58:54 navaraf Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -1512,6 +1512,14 @@ NtUserDestroyWindow(HWND Wnd)
|
|||
* be destroying.
|
||||
*/
|
||||
WinPosActivateOtherWindow(Window);
|
||||
/* FIXME: Lock */
|
||||
if (Window->MessageQueue->ActiveWindow == Window->Self)
|
||||
Window->MessageQueue->ActiveWindow = NULL;
|
||||
if (Window->MessageQueue->FocusWindow == Window->Self)
|
||||
Window->MessageQueue->FocusWindow = NULL;
|
||||
if (Window->MessageQueue->CaptureWindow == Window->Self)
|
||||
Window->MessageQueue->CaptureWindow = NULL;
|
||||
/* FIXME: Unlock */
|
||||
|
||||
/* Call hooks */
|
||||
#if 0 /* FIXME */
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* 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.49 2003/11/30 22:48:11 navaraf Exp $
|
||||
/* $Id: winpos.c,v 1.50 2003/12/02 19:58:54 navaraf Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -95,81 +95,27 @@ NtUserGetClientOrigin(HWND hWnd, LPPOINT Point)
|
|||
return(TRUE);
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
* can_activate_window
|
||||
*
|
||||
* Check if we can activate the specified window.
|
||||
*/
|
||||
static BOOL FASTCALL
|
||||
can_activate_window(HWND hwnd)
|
||||
{
|
||||
LONG style;
|
||||
|
||||
if (! hwnd)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
style = NtUserGetWindowLong(hwnd, GWL_STYLE, FALSE);
|
||||
if (! (style & WS_VISIBLE))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if ((style & (WS_POPUP|WS_CHILD)) == WS_CHILD)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
return ! (style & WS_DISABLED);
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
* WinPosActivateOtherWindow
|
||||
*
|
||||
* Activates window other than pWnd.
|
||||
*/
|
||||
void FASTCALL
|
||||
VOID FASTCALL
|
||||
WinPosActivateOtherWindow(PWINDOW_OBJECT Window)
|
||||
{
|
||||
HWND hwndTo;
|
||||
HWND fg;
|
||||
|
||||
if ((NtUserGetWindowLong(Window->Self, GWL_STYLE, FALSE) & WS_POPUP)
|
||||
&& (hwndTo = NtUserGetWindow(Window->Self, GW_OWNER)))
|
||||
{
|
||||
hwndTo = NtUserGetAncestor(hwndTo, GA_ROOT);
|
||||
if (can_activate_window(hwndTo)) goto done;
|
||||
}
|
||||
|
||||
hwndTo = Window->Self;
|
||||
for (;;)
|
||||
{
|
||||
if (!(hwndTo = NtUserGetWindow(hwndTo, GW_HWNDNEXT)))
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (can_activate_window(hwndTo))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
fg = NtUserGetForegroundWindow();
|
||||
/* TRACE("win = %p fg = %p\n", hwndTo, fg); */
|
||||
if (! fg || (hwndTo == fg))
|
||||
{
|
||||
PWINDOW_OBJECT ToWindow = IntGetWindowObject(hwndTo);
|
||||
if (IntSetForegroundWindow(ToWindow))
|
||||
{
|
||||
IntReleaseWindowObject(ToWindow);
|
||||
return;
|
||||
}
|
||||
IntReleaseWindowObject(Window);
|
||||
}
|
||||
|
||||
if (!IntSetActiveWindow(hwndTo))
|
||||
{
|
||||
IntSetActiveWindow(NULL);
|
||||
}
|
||||
for (;;)
|
||||
{
|
||||
Window = IntGetParent(Window);
|
||||
if (!Window || IntIsDesktopWindow(Window))
|
||||
{
|
||||
IntSetFocusMessageQueue(NULL);
|
||||
return;
|
||||
}
|
||||
if (IntSetForegroundWindow(Window))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
POINT STATIC FASTCALL
|
||||
|
|
Loading…
Reference in a new issue