From a231c76ff4c0e8c2cac85564a9207baafb74756a Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Wed, 4 Oct 2017 03:46:59 +0200 Subject: [PATCH] user32-FlashWindowEx: Update and reenable patchset. --- patches/patchinstall.sh | 16 ++ ...ser32-Fix-FlashWindowEx-return-value.patch | 169 ------------------ ...lashWindowEx-message-and-return-valu.patch | 55 ++++++ patches/user32-FlashWindowEx/definition | 3 +- 4 files changed, 72 insertions(+), 171 deletions(-) delete mode 100644 patches/user32-FlashWindowEx/0001-user32-Fix-FlashWindowEx-return-value.patch create mode 100644 patches/user32-FlashWindowEx/0001-user32-Improve-FlashWindowEx-message-and-return-valu.patch diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 75d60420..d42ce578 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -400,6 +400,7 @@ patch_enable_all () enable_user32_Dialog_Paint_Event="$1" enable_user32_DrawMenuItem="$1" enable_user32_DrawTextExW="$1" + enable_user32_FlashWindowEx="$1" enable_user32_GetAutoRotationState="$1" enable_user32_GetSystemMetrics="$1" enable_user32_Groupbox_Rectangle="$1" @@ -1487,6 +1488,9 @@ patch_enable () user32-DrawTextExW) enable_user32_DrawTextExW="$2" ;; + user32-FlashWindowEx) + enable_user32_FlashWindowEx="$2" + ;; user32-GetAutoRotationState) enable_user32_GetAutoRotationState="$2" ;; @@ -8817,6 +8821,18 @@ if test "$enable_user32_DrawTextExW" -eq 1; then ) >> "$patchlist" fi +# Patchset user32-FlashWindowEx +# | +# | Modified files: +# | * dlls/user32/tests/win.c, dlls/user32/win.c +# | +if test "$enable_user32_FlashWindowEx" -eq 1; then + patch_apply user32-FlashWindowEx/0001-user32-Improve-FlashWindowEx-message-and-return-valu.patch + ( + printf '%s\n' '+ { "James Coonradt", "user32: Improve FlashWindowEx message and return value.", 1 },'; + ) >> "$patchlist" +fi + # Patchset user32-GetAutoRotationState # | # | Modified files: diff --git a/patches/user32-FlashWindowEx/0001-user32-Fix-FlashWindowEx-return-value.patch b/patches/user32-FlashWindowEx/0001-user32-Fix-FlashWindowEx-return-value.patch deleted file mode 100644 index 43708f47..00000000 --- a/patches/user32-FlashWindowEx/0001-user32-Fix-FlashWindowEx-return-value.patch +++ /dev/null @@ -1,169 +0,0 @@ -From f352713c8c6c8a34c1f9a7d688f8618843ad60de Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Tue, 19 Sep 2017 00:28:34 +0200 -Subject: user32: Fix FlashWindowEx return value. - -Based on a patch by James Coonradt . ---- - dlls/user32/tests/win.c | 80 +++++++++++++++++++++++++++++++++++++++---------- - dlls/user32/win.c | 12 ++++---- - 2 files changed, 70 insertions(+), 22 deletions(-) - -diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c -index 9b8d16adc5f..a6bab29bd2b 100644 ---- a/dlls/user32/tests/win.c -+++ b/dlls/user32/tests/win.c -@@ -77,6 +77,7 @@ static HWND hwndMessage; - static HWND hwndMain, hwndMain2; - static HHOOK hhook; - static BOOL app_activated, app_deactivated; -+static BOOL nc_activated, nc_deactivated; - - static const char* szAWRClass = "Winsize"; - static HMENU hmenu; -@@ -863,6 +864,10 @@ static LRESULT WINAPI main_window_procA(HWND hwnd, UINT msg, WPARAM wparam, LPAR - if (wparam) app_activated = TRUE; - else app_deactivated = TRUE; - break; -+ case WM_NCACTIVATE: -+ if (wparam) nc_activated = TRUE; -+ else nc_deactivated = TRUE; -+ break; - } - - return DefWindowProcA(hwnd, msg, wparam, lparam); -@@ -8283,7 +8288,8 @@ static void test_FlashWindowEx(void) - { - HWND hwnd; - FLASHWINFO finfo; -- BOOL prev, ret; -+ BOOL expected, ret; -+ int i; - - if (!pFlashWindowEx) - { -@@ -8314,7 +8320,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); -@@ -8347,25 +8353,69 @@ static void test_FlashWindowEx(void) - 0, 0, 0, 0, 0, 0, 0, NULL ); - ok( hwnd != 0, "CreateWindowExA error %d\n", GetLastError() ); - finfo.hwnd = hwnd; -+ finfo.uCount = 1; -+ expected = SendMessageA(hwnd, WM_ISACTIVEICON, 0, 0); - - SetLastError(0xdeadbeef); - ret = pFlashWindowEx(NULL); - ok(!ret && GetLastError() == ERROR_NOACCESS, - "FlashWindowEx returned with %d\n", GetLastError()); - -- SetLastError(0xdeadbeef); -- prev = pFlashWindowEx(&finfo); -- -- ok(finfo.cbSize == sizeof(FLASHWINFO), "FlashWindowEx modified cdSize to %x\n", finfo.cbSize); -- ok(finfo.hwnd == hwnd, "FlashWindowEx modified hwnd to %p\n", finfo.hwnd); -- ok(finfo.dwFlags == FLASHW_TIMER, "FlashWindowEx modified dwFlags to %x\n", finfo.dwFlags); -- ok(finfo.uCount == 3, "FlashWindowEx modified uCount to %x\n", finfo.uCount); -- ok(finfo.dwTimeout == 200, "FlashWindowEx modified dwTimeout to %x\n", finfo.dwTimeout); -- -- finfo.dwFlags = FLASHW_STOP; -- SetLastError(0xdeadbeef); -- ret = pFlashWindowEx(&finfo); -- ok(prev != ret, "previous window state should be different\n"); -+ /* Test FLASHW_CAPTION */ -+ for (i = 0; i < 10; i++) -+ { -+ nc_activated = nc_deactivated = FALSE; -+ finfo.dwFlags = FLASHW_CAPTION; -+ ret = pFlashWindowEx(&finfo) != 0; -+ Sleep(50); -+ flush_events(TRUE); -+ ok(nc_activated ^ nc_deactivated, "didn't get expected WM_NCACTIVATE message\n"); -+ ok(ret == nc_deactivated, "expected FlashWindowEx to return %u, got %u\n", nc_deactivated, ret); -+ ok(ret == expected, "expected FlashWindowEx to return %u, got %u\n", expected, ret); -+ expected = !ret; -+ } -+ -+ /* Test FLASHW_TRAY */ -+ for (i = 0; i < 10; i++) -+ { -+ nc_activated = nc_deactivated = FALSE; -+ finfo.dwFlags = FLASHW_TRAY; -+ ret = pFlashWindowEx(&finfo) != 0; -+ Sleep(50); -+ flush_events(TRUE); -+ todo_wine_if(ret) ok(!nc_deactivated, "didn't expect WM_NCACTIVE message with wParam == FALSE\n"); -+ ok(ret == !nc_activated, "expected FlashWindowEx to return %u, got %u\n", !nc_activated, ret); -+ ok(ret == expected, "expected FlashWindowEx to return %u, got %u\n", expected, ret); -+ expected = !ret; -+ } -+ -+ /* Test FLASHW_ALL */ -+ for (i = 0; i < 10; i++) -+ { -+ nc_activated = nc_deactivated = FALSE; -+ finfo.dwFlags = FLASHW_ALL; -+ ret = pFlashWindowEx(&finfo) != 0; -+ Sleep(50); -+ flush_events(TRUE); -+ ok(nc_activated ^ nc_deactivated, "didn't get expected WM_NCACTIVATE message\n"); -+ ok(ret == nc_deactivated, "expected FlashWindowEx to return %u, got %u\n", nc_deactivated, ret); -+ ok(ret == expected, "expected FlashWindowEx to return %u, got %u\n", expected, ret); -+ expected = !ret; -+ } -+ -+ /* Test FLASHW_STOP */ -+ for (i = 0; i < 10; i++) -+ { -+ nc_activated = nc_deactivated = FALSE; -+ finfo.dwFlags = FLASHW_STOP; -+ ret = pFlashWindowEx(&finfo) != 0; -+ Sleep(50); -+ flush_events(TRUE); -+ todo_wine_if(ret) ok(!nc_deactivated, "didn't expect WM_NCACTIVE message with wParam == FALSE\n"); -+ ok(ret == !nc_activated, "expected FlashWindowEx to return %u, got %u\n", !nc_activated, ret); -+ ok(ret == expected, "expected FlashWindowEx to return %u, got %u\n", expected, ret); -+ expected = !ret; -+ } - - DestroyWindow( hwnd ); - } -diff --git a/dlls/user32/win.c b/dlls/user32/win.c -index 3042a560ce9..23cb638ba28 100644 ---- a/dlls/user32/win.c -+++ b/dlls/user32/win.c -@@ -3538,20 +3538,18 @@ BOOL WINAPI FlashWindowEx( PFLASHWINFO pfinfo ) - } - else - { -- WPARAM wparam; - HWND hwnd = pfinfo->hwnd; -+ BOOL ret; - - wndPtr = WIN_GetPtr( hwnd ); - 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()); -- -+ ret = (wndPtr->flags & WIN_NCACTIVATED) != 0; - WIN_ReleasePtr( wndPtr ); -- SendMessageW( hwnd, WM_NCACTIVATE, wparam, 0 ); -+ -+ SendMessageW( hwnd, WM_NCACTIVATE, !ret, 0 ); - USER_Driver->pFlashWindowEx( pfinfo ); -- return wparam; -+ return ret; - } - } - --- -2.14.1 - diff --git a/patches/user32-FlashWindowEx/0001-user32-Improve-FlashWindowEx-message-and-return-valu.patch b/patches/user32-FlashWindowEx/0001-user32-Improve-FlashWindowEx-message-and-return-valu.patch new file mode 100644 index 00000000..7e5d0049 --- /dev/null +++ b/patches/user32-FlashWindowEx/0001-user32-Improve-FlashWindowEx-message-and-return-valu.patch @@ -0,0 +1,55 @@ +From 6f9a7411f7e0f9db155818b15c3bb1dfba2bbbd3 Mon Sep 17 00:00:00 2001 +From: James Coonradt +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 + diff --git a/patches/user32-FlashWindowEx/definition b/patches/user32-FlashWindowEx/definition index c87a3abe..2e5649e6 100644 --- a/patches/user32-FlashWindowEx/definition +++ b/patches/user32-FlashWindowEx/definition @@ -1,2 +1 @@ -Fixes: Fix return value of FlashWindowEx -Disabled: true +Fixes: Improve FlashWindowEx message and return value