CVS: winex/windows winpos.c,1.12,1.13
[email protected] 31 Jul 2007 17:38:05 -0000
| Newsgroups | gmane.comp.emulators.winex.cvs |
|---|---|
| Message-ID | <[email protected]> |
Subject: winex/windows winpos.c,1.12,1.13Update of /var/lib/cvsd/cvsroot/winex/windows
In directory agravaine:/tmp/cvs-serv22027/windows
Modified Files:
winpos.c
Log Message:
- if the same thread owns both the previous and the next windows in SetForegroundWindow(), then do the operation in a single step
Index: winpos.c
===================================================================
RCS file: /var/lib/cvsd/cvsroot/winex/windows/winpos.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- winpos.c 30 Mar 2007 18:59:40 -0000 1.12
+++ winpos.c 31 Jul 2007 17:38:03 -0000 1.13
@@ -752,6 +752,8 @@
{
HWND PrevWindow;
BOOL Ret = TRUE;
+ DWORD PrevProcessId, PrevThreadId = 0;
+ DWORD NewProcessId, NewThreadId = 0;
TRACE ("(0x%08x)\n", hwnd);
if (!hwnd)
@@ -766,13 +768,33 @@
if (hwnd == PrevWindow)
return FALSE;
+ if (PrevWindow)
+ PrevThreadId = GetWindowThreadProcessId (PrevWindow, &PrevProcessId);
+ if (hwnd)
+ NewThreadId = GetWindowThreadProcessId (hwnd, &NewProcessId);
+
+ /* Optimization, and also "fixes" some issues seen with the event
+ splitting as done below. That really does need to be investigated
+ closely to see what's causing breakages */
+ if (PrevWindow && hwnd && (PrevProcessId == NewProcessId) &&
+ (PrevThreadId == NewThreadId))
+ {
+ if ((NewProcessId == GetCurrentProcessId ()) &&
+ (NewThreadId == GetCurrentThreadId ()))
+ return WINPOS_SetActiveWindow (hwnd, FALSE, TRUE, TRUE);
+ else
+ {
+ SendNotifyMessageA (hwnd, WM_WINE_SETFOREGROUNDWINDOW,
+ (WPARAM)hwnd, 0);
+ return TRUE;
+ }
+ }
+
+
/* If old window owned by different thread, send message; otherwise
clear directly */
if (PrevWindow)
{
- DWORD PrevProcessId, PrevThreadId;
-
- PrevThreadId = GetWindowThreadProcessId (PrevWindow, &PrevProcessId);
if ((PrevProcessId == GetCurrentProcessId ()) &&
(PrevThreadId == GetCurrentThreadId ()))
Ret = WINPOS_SetActiveWindow (0, FALSE, TRUE, TRUE);
@@ -784,9 +806,6 @@
set directly */
if (hwnd)
{
- DWORD NewProcessId, NewThreadId;
-
- NewThreadId = GetWindowThreadProcessId (hwnd, &NewProcessId);
if ((NewProcessId == GetCurrentProcessId ()) &&
(NewThreadId == GetCurrentThreadId ()))
Ret = WINPOS_SetActiveWindow (hwnd, FALSE, TRUE, TRUE);