Patch by Filip Navara.

- Don't try to move window on the top if it is already.
- Removed small block of commented-out code.
- Activated the message queue locking which caused dead-lock earlier.

svn path=/trunk/; revision=7659
This commit is contained in:
Gé van Geldorp 2004-01-15 21:00:49 +00:00
parent aded6947aa
commit 1ccba09119

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* $Id: focus.c,v 1.9 2004/01/12 20:51:05 gvg Exp $ * $Id: focus.c,v 1.10 2004/01/15 21:00:49 gvg Exp $
*/ */
#include <win32k/win32k.h> #include <win32k/win32k.h>
@ -75,8 +75,9 @@ IntSendActivateMessages(HWND hWndPrev, HWND hWnd, BOOL MouseActivate)
(WPARAM)hWnd, 0); (WPARAM)hWnd, 0);
} }
WinPosSetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, if (NtUserGetWindow(hWnd, GW_HWNDPREV) != NULL)
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOSENDCHANGING); WinPosSetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOSENDCHANGING);
/* FIXME: IntIsWindow */ /* FIXME: IntIsWindow */
@ -131,14 +132,6 @@ IntSetForegroundAndFocusWindow(PWINDOW_OBJECT Window, PWINDOW_OBJECT FocusWindow
hWndPrev = PrevForegroundQueue->ActiveWindow; hWndPrev = PrevForegroundQueue->ActiveWindow;
} }
/*
if (IntIsDesktopWindow(Window))
{
IntSendDeactivateMessages(hWndPrev, hWnd);
IntSetFocusMessageQueue(NULL);
}
*/
if (hWndPrev == hWnd) if (hWndPrev == hWnd)
{ {
DPRINT("Failed - Same\n"); DPRINT("Failed - Same\n");
@ -151,18 +144,18 @@ IntSetForegroundAndFocusWindow(PWINDOW_OBJECT Window, PWINDOW_OBJECT FocusWindow
/* FIXME: Call hooks. */ /* FIXME: Call hooks. */
IntSetFocusMessageQueue(Window->MessageQueue); IntSetFocusMessageQueue(Window->MessageQueue);
/* ExAcquireFastMutex(&Window->MessageQueue->Lock);*/ ExAcquireFastMutex(&Window->MessageQueue->Lock);
if (Window->MessageQueue) if (Window->MessageQueue)
{ {
Window->MessageQueue->ActiveWindow = hWnd; Window->MessageQueue->ActiveWindow = hWnd;
} }
/* ExReleaseFastMutex(&Window->MessageQueue->Lock);*/ ExReleaseFastMutex(&Window->MessageQueue->Lock);
/* ExAcquireFastMutex(&FocusWindow->MessageQueue->Lock);*/ ExAcquireFastMutex(&FocusWindow->MessageQueue->Lock);
if (FocusWindow->MessageQueue) if (FocusWindow->MessageQueue)
{ {
FocusWindow->MessageQueue->FocusWindow = hWndFocus; FocusWindow->MessageQueue->FocusWindow = hWndFocus;
} }
/* ExReleaseFastMutex(&Window->MessageQueue->Lock);*/ ExReleaseFastMutex(&Window->MessageQueue->Lock);
IntSendDeactivateMessages(hWndPrev, hWnd); IntSendDeactivateMessages(hWndPrev, hWnd);
IntSendKillFocusMessages(hWndFocusPrev, hWndFocus); IntSendKillFocusMessages(hWndFocusPrev, hWndFocus);
@ -188,7 +181,7 @@ IntMouseActivateWindow(PWINDOW_OBJECT Window)
HWND Top; HWND Top;
PWINDOW_OBJECT TopWindow; PWINDOW_OBJECT TopWindow;
Top = NtUserGetAncestor(Window->Self, GA_ROOT); Top = NtUserGetAncestor(Window->Self, GA_ROOTOWNER);
if (Top != Window->Self) if (Top != Window->Self)
{ {
TopWindow = IntGetWindowObject(Top); TopWindow = IntGetWindowObject(Top);
@ -234,9 +227,9 @@ IntSetActiveWindow(PWINDOW_OBJECT Window)
/* FIXME: Call hooks. */ /* FIXME: Call hooks. */
/* ExAcquireFastMutex(&ThreadQueue->Lock);*/ ExAcquireFastMutex(&ThreadQueue->Lock);
ThreadQueue->ActiveWindow = hWnd; ThreadQueue->ActiveWindow = hWnd;
/* ExReleaseFastMutex(&ThreadQueue->Lock);*/ ExReleaseFastMutex(&ThreadQueue->Lock);
IntSendDeactivateMessages(hWndPrev, hWnd); IntSendDeactivateMessages(hWndPrev, hWnd);
IntSendActivateMessages(hWndPrev, hWnd, FALSE); IntSendActivateMessages(hWndPrev, hWnd, FALSE);
@ -262,9 +255,9 @@ IntSetFocusWindow(PWINDOW_OBJECT Window)
return hWndPrev; return hWndPrev;
} }
/* ExAcquireFastMutex(&ThreadQueue->Lock);*/ ExAcquireFastMutex(&ThreadQueue->Lock);
ThreadQueue->FocusWindow = hWnd; ThreadQueue->FocusWindow = hWnd;
/* ExReleaseFastMutex(&ThreadQueue->Lock);*/ ExReleaseFastMutex(&ThreadQueue->Lock);
IntSendKillFocusMessages(hWndPrev, hWnd); IntSendKillFocusMessages(hWndPrev, hWnd);
IntSendSetFocusMessages(hWndPrev, hWnd); IntSendSetFocusMessages(hWndPrev, hWnd);
@ -368,9 +361,9 @@ NtUserSetCapture(HWND hWnd)
} }
hWndPrev = ThreadQueue->CaptureWindow; hWndPrev = ThreadQueue->CaptureWindow;
IntSendMessage(hWndPrev, WM_CAPTURECHANGED, 0, (LPARAM)hWnd); IntSendMessage(hWndPrev, WM_CAPTURECHANGED, 0, (LPARAM)hWnd);
/* ExAcquireFastMutex(&ThreadQueue->Lock);*/ ExAcquireFastMutex(&ThreadQueue->Lock);
ThreadQueue->CaptureWindow = hWnd; ThreadQueue->CaptureWindow = hWnd;
/* ExReleaseFastMutex(&ThreadQueue->Lock);*/ ExReleaseFastMutex(&ThreadQueue->Lock);
return hWndPrev; return hWndPrev;
} }