diff --git a/reactos/subsys/win32k/ntuser/focus.c b/reactos/subsys/win32k/ntuser/focus.c index 04224cefe95..52068c515ec 100644 --- a/reactos/subsys/win32k/ntuser/focus.c +++ b/reactos/subsys/win32k/ntuser/focus.c @@ -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 @@ -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; } diff --git a/reactos/subsys/win32k/ntuser/windc.c b/reactos/subsys/win32k/ntuser/windc.c index aaf48cd292c..5fa1bcc073b 100644 --- a/reactos/subsys/win32k/ntuser/windc.c +++ b/reactos/subsys/win32k/ntuser/windc.c @@ -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); diff --git a/reactos/subsys/win32k/ntuser/window.c b/reactos/subsys/win32k/ntuser/window.c index 87f01920671..50627b90d74 100644 --- a/reactos/subsys/win32k/ntuser/window.c +++ b/reactos/subsys/win32k/ntuser/window.c @@ -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 */ diff --git a/reactos/subsys/win32k/ntuser/winpos.c b/reactos/subsys/win32k/ntuser/winpos.c index f4ea9b698d2..0e2f00f5e53 100644 --- a/reactos/subsys/win32k/ntuser/winpos.c +++ b/reactos/subsys/win32k/ntuser/winpos.c @@ -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