From 6f9a7411f7e0f9db155818b15c3bb1dfba2bbbd3 Mon Sep 17 00:00:00 2001
From: James Coonradt <gamax92@aol.com>
Date: Tue, 19 Sep 2017 12:28:50 -0600
Subject: user32: Improve FlashWindowEx message and return value.

---
 dlls/user32/tests/win.c | 4 ++--
 dlls/user32/win.c       | 5 ++---
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index 9b8d16adc5f..ee923668995 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -8314,7 +8314,7 @@ static void test_FlashWindowEx(void)
 
     SetLastError(0xdeadbeef);
     ret = pFlashWindowEx(&finfo);
-    todo_wine ok(!ret, "previous window state should not be active\n");
+    ok(!ret, "previous window state should not be active\n");
 
     finfo.cbSize = sizeof(FLASHWINFO) - 1;
     SetLastError(0xdeadbeef);
@@ -8365,7 +8365,7 @@ static void test_FlashWindowEx(void)
     finfo.dwFlags = FLASHW_STOP;
     SetLastError(0xdeadbeef);
     ret = pFlashWindowEx(&finfo);
-    ok(prev != ret, "previous window state should be different\n");
+    todo_wine ok(prev != ret, "previous window state should be different\n");
 
     DestroyWindow( hwnd );
 }
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index 3042a560ce9..2fb33058b6c 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -3545,13 +3545,12 @@ BOOL WINAPI FlashWindowEx( PFLASHWINFO pfinfo )
         if (!wndPtr || wndPtr == WND_OTHER_PROCESS || wndPtr == WND_DESKTOP) return FALSE;
         hwnd = wndPtr->obj.handle;  /* make it a full handle */
 
-        if (pfinfo->dwFlags) wparam = !(wndPtr->flags & WIN_NCACTIVATED);
-        else wparam = (hwnd == GetForegroundWindow());
+        wparam = (wndPtr->flags & WIN_NCACTIVATED) != 0;
 
         WIN_ReleasePtr( wndPtr );
         SendMessageW( hwnd, WM_NCACTIVATE, wparam, 0 );
         USER_Driver->pFlashWindowEx( pfinfo );
-        return wparam;
+        return (pfinfo->dwFlags & FLASHW_CAPTION) ? TRUE : wparam;
     }
 }
 
-- 
2.14.1

