From 84bb779a9b6a53366380005ac5ddfc5c2dabf22a Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Thu, 26 Nov 2020 08:22:35 +1100 Subject: [PATCH] Added user32-message-order patchset --- patches/patchinstall.sh | 16 ++++ ...ges-sent-on-a-window-without-WS_CHIL.patch | 76 +++++++++++++++++++ patches/user32-message-order/definition | 1 + 3 files changed, 93 insertions(+) create mode 100644 patches/user32-message-order/0001-user32-Fix-messages-sent-on-a-window-without-WS_CHIL.patch create mode 100644 patches/user32-message-order/definition diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index bb67ec45..d7c6a76e 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -250,6 +250,7 @@ patch_enable_all () enable_user32_QueryDisplayConfig="$1" enable_user32_Refresh_MDI_Menus="$1" enable_user32_ScrollWindowEx="$1" + enable_user32_message_order="$1" enable_user32_msgbox_Support_WM_COPY_mesg="$1" enable_user32_rawinput_hid="$1" enable_user32_rawinput_mouse="$1" @@ -831,6 +832,9 @@ patch_enable () user32-ScrollWindowEx) enable_user32_ScrollWindowEx="$2" ;; + user32-message-order) + enable_user32_message_order="$2" + ;; user32-msgbox-Support-WM_COPY-mesg) enable_user32_msgbox_Support_WM_COPY_mesg="$2" ;; @@ -4094,6 +4098,18 @@ if test "$enable_user32_ScrollWindowEx" -eq 1; then patch_apply user32-ScrollWindowEx/0001-user32-Fix-return-value-of-ScrollWindowEx-for-invisi.patch fi +# Patchset user32-message-order +# | +# | This patchset fixes the following Wine bugs: +# | * [#40262] Correct order of windows messages. +# | +# | Modified files: +# | * dlls/user32/tests/msg.c, dlls/user32/winpos.c +# | +if test "$enable_user32_message_order" -eq 1; then + patch_apply user32-message-order/0001-user32-Fix-messages-sent-on-a-window-without-WS_CHIL.patch +fi + # Patchset user32-msgbox-Support-WM_COPY-mesg # | # | This patchset fixes the following Wine bugs: diff --git a/patches/user32-message-order/0001-user32-Fix-messages-sent-on-a-window-without-WS_CHIL.patch b/patches/user32-message-order/0001-user32-Fix-messages-sent-on-a-window-without-WS_CHIL.patch new file mode 100644 index 00000000..2525fe67 --- /dev/null +++ b/patches/user32-message-order/0001-user32-Fix-messages-sent-on-a-window-without-WS_CHIL.patch @@ -0,0 +1,76 @@ +From 08fddee8b126a47b698e58d38aef37f62390c0e3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= +Date: Wed, 16 Sep 2020 17:35:09 +0300 +Subject: [PATCH] user32: Fix messages sent on a window without WS_CHILD, but + with an invisible parent, when it is shown. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Some applications depend on the fact that WM_WINDOWPOSCHANGING is sent +after WM_SHOWWINDOW when SetParent is called, even if the window ends up +not visible because its parent is not visible, and occurs when the window +itself does not have the WS_CHILD style set. + +This also fixes a TODO message sequence, so that Wine matches Windows. + +Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=40262 +Signed-off-by: Gabriel Ivăncescu +--- + dlls/user32/tests/msg.c | 3 ++- + dlls/user32/winpos.c | 11 +++++++---- + 2 files changed, 9 insertions(+), 5 deletions(-) + +diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c +index 2ce2b3c6e54..50e6ab0f883 100644 +--- a/dlls/user32/tests/msg.c ++++ b/dlls/user32/tests/msg.c +@@ -16449,6 +16449,7 @@ static const struct message WmSetParentSeq_2[] = { + { HCBT_ACTIVATE, hook|optional }, + { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 }, + { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE }, ++ { WM_QUERYNEWPALETTE, sent|optional }, + { WM_NCACTIVATE, sent|wparam|optional, 1 }, + { WM_ACTIVATE, sent|wparam|optional, 1 }, + { HCBT_SETFOCUS, hook|optional }, +@@ -16519,7 +16520,7 @@ static void test_SetParent(void) + + SetParent(popup, child); + flush_events(); +- ok_sequence(WmSetParentSeq_2, "SetParent() visible WS_POPUP", TRUE); ++ ok_sequence(WmSetParentSeq_2, "SetParent() visible WS_POPUP", FALSE); + + ok(GetWindowLongA(popup, GWL_STYLE) & WS_VISIBLE, "WS_VISIBLE should be set\n"); + ok(!IsWindowVisible(popup), "IsWindowVisible() should return FALSE\n"); +diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c +index 9e5a0c238af..31143e70abf 100644 +--- a/dlls/user32/winpos.c ++++ b/dlls/user32/winpos.c +@@ -1119,8 +1119,8 @@ static BOOL show_window( HWND hwnd, INT cmd ) + + swp = USER_Driver->pShowWindow( hwnd, cmd, &newPos, swp ); + +- parent = GetAncestor( hwnd, GA_PARENT ); +- if (parent && !IsWindowVisible( parent ) && !(swp & SWP_STATECHANGED)) ++ if ((style & WS_CHILD) && (parent = GetAncestor( hwnd, GA_PARENT )) && ++ !IsWindowVisible( parent ) && !(swp & SWP_STATECHANGED)) + { + /* if parent is not visible simply toggle WS_VISIBLE and return */ + if (showFlag) WIN_SetStyle( hwnd, WS_VISIBLE, 0 ); +@@ -1955,8 +1955,11 @@ static BOOL fixup_flags( WINDOWPOS *winpos, const RECT *old_window_rect, int par + if (winpos->cy < 0) winpos->cy = 0; + else if (winpos->cy > 32767) winpos->cy = 32767; + +- parent = GetAncestor( winpos->hwnd, GA_PARENT ); +- if (!IsWindowVisible( parent )) winpos->flags |= SWP_NOREDRAW; ++ if (wndPtr->dwStyle & WS_CHILD) ++ { ++ parent = GetAncestor( winpos->hwnd, GA_PARENT ); ++ if (!IsWindowVisible( parent )) winpos->flags |= SWP_NOREDRAW; ++ } + + if (wndPtr->dwStyle & WS_VISIBLE) winpos->flags &= ~SWP_SHOWWINDOW; + else +-- +2.29.2 + diff --git a/patches/user32-message-order/definition b/patches/user32-message-order/definition new file mode 100644 index 00000000..2e8d7e34 --- /dev/null +++ b/patches/user32-message-order/definition @@ -0,0 +1 @@ +Fixes: [40262] Correct order of windows messages.