user32: Do not change focus if the window is no longer active.

This commit is contained in:
Dmitry Timoshkov 2008-11-19 13:52:36 +08:00 committed by Alexandre Julliard
parent 16920c1da7
commit 5dfcadd7a3
1 changed files with 3 additions and 0 deletions

View File

@ -276,6 +276,9 @@ HWND WINAPI SetFocus( HWND hwnd )
{ {
if (!set_active_window( hwndTop, NULL, FALSE, FALSE )) return 0; if (!set_active_window( hwndTop, NULL, FALSE, FALSE )) return 0;
if (!IsWindow( hwnd )) return 0; /* Abort if window destroyed */ if (!IsWindow( hwnd )) return 0; /* Abort if window destroyed */
/* Do not change focus if the window is no longer active */
if (hwndTop != GetActiveWindow()) return 0;
} }
} }
else /* NULL hwnd passed in */ else /* NULL hwnd passed in */