From ef47e8db59e2611c1a6c05da0f35b2db686daa78 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 28 Nov 2015 23:11:33 +0100 Subject: [PATCH] Added patch to send WM_CAPTURECHANGE also when capture has not changed. --- README.md | 3 +- patches/patchinstall.sh | 19 +++ ...-WM_CAPTURECHANGE-when-capture-has-n.patch | 117 ++++++++++++++++++ patches/user32-WM_CAPTURECHANGE/definition | 1 + staging/changelog | 1 + 5 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 patches/user32-WM_CAPTURECHANGE/0001-user32-Also-send-WM_CAPTURECHANGE-when-capture-has-n.patch create mode 100644 patches/user32-WM_CAPTURECHANGE/definition diff --git a/README.md b/README.md index c56f9794..f4022d6e 100644 --- a/README.md +++ b/README.md @@ -34,9 +34,10 @@ Wine. All those differences are also documented on the Included bug fixes and improvements ----------------------------------- -**Bug fixes and features included in the next upcoming release [4]:** +**Bug fixes and features included in the next upcoming release [5]:** * Add information for delayed end of DST in Europe/Istanbul +* Also send WM_CAPTURECHANGE when capture has not changed ([Wine Bug #13683](https://bugs.winehq.org/show_bug.cgi?id=13683)) * Check handle type for HSPFILEQ handles ([Wine Bug #12332](https://bugs.winehq.org/show_bug.cgi?id=12332)) * Fix font loading in Capella ([Wine Bug #12377](https://bugs.winehq.org/show_bug.cgi?id=12377)) * Skip invalid entries in GetPrivateProfileString16 ([Wine Bug #9919](https://bugs.winehq.org/show_bug.cgi?id=9919)) diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 24206879..89783438 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -287,6 +287,7 @@ patch_enable_all () enable_user32_Refresh_MDI_Menus="$1" enable_user32_ScrollWindowEx="$1" enable_user32_SetCoalescableTimer="$1" + enable_user32_WM_CAPTURECHANGE="$1" enable_user32_WM_MDICALCCHILDSCROLL="$1" enable_user32_WndProc="$1" enable_uxtheme_GTK_Theming="$1" @@ -969,6 +970,9 @@ patch_enable () user32-SetCoalescableTimer) enable_user32_SetCoalescableTimer="$2" ;; + user32-WM_CAPTURECHANGE) + enable_user32_WM_CAPTURECHANGE="$2" + ;; user32-WM_MDICALCCHILDSCROLL) enable_user32_WM_MDICALCCHILDSCROLL="$2" ;; @@ -5569,6 +5573,21 @@ if test "$enable_user32_SetCoalescableTimer" -eq 1; then ) >> "$patchlist" fi +# Patchset user32-WM_CAPTURECHANGE +# | +# | This patchset fixes the following Wine bugs: +# | * [#13683] Also send WM_CAPTURECHANGE when capture has not changed +# | +# | Modified files: +# | * dlls/comctl32/toolbar.c, dlls/comctl32/trackbar.c, dlls/user32/button.c, dlls/user32/input.c, dlls/user32/tests/msg.c +# | +if test "$enable_user32_WM_CAPTURECHANGE" -eq 1; then + patch_apply user32-WM_CAPTURECHANGE/0001-user32-Also-send-WM_CAPTURECHANGE-when-capture-has-n.patch + ( + echo '+ { "Christopher Thielen", "user32: Also send WM_CAPTURECHANGE when capture has not changed.", 1 },'; + ) >> "$patchlist" +fi + # Patchset user32-WM_MDICALCCHILDSCROLL # | # | Modified files: diff --git a/patches/user32-WM_CAPTURECHANGE/0001-user32-Also-send-WM_CAPTURECHANGE-when-capture-has-n.patch b/patches/user32-WM_CAPTURECHANGE/0001-user32-Also-send-WM_CAPTURECHANGE-when-capture-has-n.patch new file mode 100644 index 00000000..04bb2578 --- /dev/null +++ b/patches/user32-WM_CAPTURECHANGE/0001-user32-Also-send-WM_CAPTURECHANGE-when-capture-has-n.patch @@ -0,0 +1,117 @@ +From 5bfd73ad3ec48deae92927e8116fce81ac31cf66 Mon Sep 17 00:00:00 2001 +From: Christopher Thielen +Date: Mon, 23 Nov 2015 21:48:26 -0800 +Subject: user32: Also send WM_CAPTURECHANGE when capture has not changed. + +Fixes https://bugs.winehq.org/show_bug.cgi?id=13683 + +A window may be notified with WM_CAPTURECHANGED about itself +gaining mouse capture if it calls SetCapture() twice. + +Signed-off-by: Christopher Thielen +Signed-off-by: Sebastian Lackner +--- + dlls/comctl32/toolbar.c | 1 + + dlls/comctl32/trackbar.c | 1 + + dlls/user32/button.c | 1 + + dlls/user32/input.c | 2 +- + dlls/user32/tests/msg.c | 27 +++++++++++++++++++++++++++ + 5 files changed, 31 insertions(+), 1 deletion(-) + +diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c +index 890c18e..3251682 100644 +--- a/dlls/comctl32/toolbar.c ++++ b/dlls/comctl32/toolbar.c +@@ -6807,6 +6807,7 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) + return TOOLBAR_MouseLeave (infoPtr); + + case WM_CAPTURECHANGED: ++ if (lParam == (LPARAM)hwnd) return 0; + return TOOLBAR_CaptureChanged(infoPtr); + + case WM_NCACTIVATE: +diff --git a/dlls/comctl32/trackbar.c b/dlls/comctl32/trackbar.c +index 6d092a3..4d19a70 100644 +--- a/dlls/comctl32/trackbar.c ++++ b/dlls/comctl32/trackbar.c +@@ -1976,6 +1976,7 @@ TRACKBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) + + + case WM_CAPTURECHANGED: ++ if (lParam == (LPARAM)hwnd) return 0; + return TRACKBAR_CaptureChanged (infoPtr); + + case WM_CREATE: +diff --git a/dlls/user32/button.c b/dlls/user32/button.c +index 890d154..2fee3c8 100644 +--- a/dlls/user32/button.c ++++ b/dlls/user32/button.c +@@ -364,6 +364,7 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, + + case WM_CAPTURECHANGED: + TRACE("WM_CAPTURECHANGED %p\n", hWnd); ++ if (lParam == (LPARAM)hWnd) break; + state = get_button_state( hWnd ); + if (state & BUTTON_BTNPRESSED) + { +diff --git a/dlls/user32/input.c b/dlls/user32/input.c +index 40e35a9..63fae67 100644 +--- a/dlls/user32/input.c ++++ b/dlls/user32/input.c +@@ -108,7 +108,7 @@ BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret ) + { + USER_Driver->pSetCapture( hwnd, gui_flags ); + +- if (previous && previous != hwnd) ++ if (previous) + SendMessageW( previous, WM_CAPTURECHANGED, 0, (LPARAM)hwnd ); + + if (prev_ret) *prev_ret = previous; +diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c +index b90f8d0..151b77a 100644 +--- a/dlls/user32/tests/msg.c ++++ b/dlls/user32/tests/msg.c +@@ -14906,6 +14906,32 @@ else + flush_sequence(); + } + ++static const struct message DoubleSetCaptureSeq[] = ++{ ++ { WM_CAPTURECHANGED, sent }, ++ { 0 } ++}; ++ ++static void test_DoubleSetCapture(void) ++{ ++ HWND hwnd; ++ ++ hwnd = CreateWindowExA(0, "TestWindowClass", "Test DoubleSetCapture", ++ WS_OVERLAPPEDWINDOW | WS_VISIBLE, ++ 100, 100, 200, 200, 0, 0, 0, NULL); ++ ok(hwnd != 0, "Failed to create overlapped window\n"); ++ ++ ShowWindow( hwnd, SW_SHOW ); ++ flush_sequence(); ++ ++ SetCapture(hwnd); ++ ok_sequence(WmEmptySeq, "SetCapture(hwnd) empty sequence", FALSE); ++ SetCapture(hwnd); ++ ok_sequence(DoubleSetCaptureSeq, "SetCapture(hwnd) twice", FALSE); ++ ++ DestroyWindow(hwnd); ++} ++ + static void init_funcs(void) + { + HMODULE hKernel32 = GetModuleHandleA("kernel32.dll"); +@@ -15045,6 +15071,7 @@ START_TEST(msg) + test_layered_window(); + test_TrackPopupMenu(); + test_TrackPopupMenuEmpty(); ++ test_DoubleSetCapture(); + /* keep it the last test, under Windows it tends to break the tests + * which rely on active/foreground windows being correct. + */ +-- +2.6.2 + diff --git a/patches/user32-WM_CAPTURECHANGE/definition b/patches/user32-WM_CAPTURECHANGE/definition new file mode 100644 index 00000000..c5a0c9e4 --- /dev/null +++ b/patches/user32-WM_CAPTURECHANGE/definition @@ -0,0 +1 @@ +Fixes: [13683] Also send WM_CAPTURECHANGE when capture has not changed diff --git a/staging/changelog b/staging/changelog index af8e1391..4d8b4cbc 100644 --- a/staging/changelog +++ b/staging/changelog @@ -14,6 +14,7 @@ wine-staging (1.8~rc2) UNRELEASED; urgency=low * Added patch to implement check for invalid handle type for HSPFILEQ handles. * Added patch for delayed end of DST in Europe/Istanbul. * Added patch to skip invalid entries in GetPrivateProfileString16. + * Added patch to send WM_CAPTURECHANGE also when capture has not changed. -- Sebastian Lackner Wed, 25 Nov 2015 20:21:46 +0100 wine-staging (1.8~rc1) unstable; urgency=low