From 5530538a2b26ca969484fec4952d35a04f3f3fe2 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sun, 8 Jan 2017 17:43:27 +0100 Subject: [PATCH] Added patch to fix handling of WM_WINDOWPOS{CHANGING,CHANGED} for deactivated topmost window. --- patches/patchinstall.sh | 65 ++++++++++++++----- ...-WM_WINDOWPOSCHANGING-WM_WINDOWPOSCH.patch | 46 +++++++++++++ .../winex11-WM_WINDOWPOSCHANGING/definition | 2 + 3 files changed, 95 insertions(+), 18 deletions(-) create mode 100644 patches/winex11-WM_WINDOWPOSCHANGING/0001-winex11.drv-Send-WM_WINDOWPOSCHANGING-WM_WINDOWPOSCH.patch create mode 100644 patches/winex11-WM_WINDOWPOSCHANGING/definition diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 975139ba..fe12565a 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -393,6 +393,7 @@ patch_enable_all () enable_winex11_Clipboard_HTML="$1" enable_winex11_DefaultDisplayFrequency="$1" enable_winex11_SC_KEYMENU="$1" + enable_winex11_WM_WINDOWPOSCHANGING="$1" enable_winex11_Window_Groups="$1" enable_winex11_Window_Style="$1" enable_winex11_XEMBED="$1" @@ -1369,6 +1370,9 @@ patch_enable () winex11-SC_KEYMENU) enable_winex11_SC_KEYMENU="$2" ;; + winex11-WM_WINDOWPOSCHANGING) + enable_winex11_WM_WINDOWPOSCHANGING="$2" + ;; winex11-Window_Groups) enable_winex11_Window_Groups="$2" ;; @@ -2038,6 +2042,13 @@ if test "$enable_wpcap_Dynamic_Linking" -eq 1; then enable_wpcap_Several_Fixes=1 fi +if test "$enable_winex11_WM_WINDOWPOSCHANGING" -eq 1; then + if test "$enable_winex11__NET_ACTIVE_WINDOW" -gt 1; then + abort "Patchset winex11-_NET_ACTIVE_WINDOW disabled, but winex11-WM_WINDOWPOSCHANGING depends on that." + fi + enable_winex11__NET_ACTIVE_WINDOW=1 +fi + if test "$enable_wined3d_CSMT_Main" -eq 1; then if test "$enable_wined3d_CSMT_Helper" -gt 1; then abort "Patchset wined3d-CSMT_Helper disabled, but wined3d-CSMT_Main depends on that." @@ -8235,6 +8246,42 @@ if test "$enable_winex11_SC_KEYMENU" -eq 1; then ) >> "$patchlist" fi +# Patchset winex11-_NET_ACTIVE_WINDOW +# | +# | This patchset fixes the following Wine bugs: +# | * [#2155] Forward activate window requests to WM using _NET_ACTIVE_WINDOW +# | +# | Modified files: +# | * dlls/user32/driver.c, dlls/user32/focus.c, dlls/user32/user_private.h, dlls/winex11.drv/event.c, +# | dlls/winex11.drv/window.c, dlls/winex11.drv/winex11.drv.spec, dlls/winex11.drv/x11drv.h, dlls/winex11.drv/x11drv_main.c +# | +if test "$enable_winex11__NET_ACTIVE_WINDOW" -eq 1; then + patch_apply winex11-_NET_ACTIVE_WINDOW/0001-winex11.drv-Add-support-for-_NET_ACTIVE_WINDOW.patch + patch_apply winex11-_NET_ACTIVE_WINDOW/0002-user32-Before-asking-a-WM-to-activate-a-window-make-.patch + ( + echo '+ { "Dmitry Timoshkov", "winex11.drv: Add support for _NET_ACTIVE_WINDOW.", 2 },'; + echo '+ { "Dmitry Timoshkov", "user32: Before asking a WM to activate a window make sure that the window is in foreground and not minimized.", 1 },'; + ) >> "$patchlist" +fi + +# Patchset winex11-WM_WINDOWPOSCHANGING +# | +# | This patchset has the following (direct or indirect) dependencies: +# | * winex11-_NET_ACTIVE_WINDOW +# | +# | This patchset fixes the following Wine bugs: +# | * [#34594] Fix handling of WM_WINDOWPOS{CHANGING,CHANGED} for deactivated topmost window +# | +# | Modified files: +# | * dlls/winex11.drv/event.c +# | +if test "$enable_winex11_WM_WINDOWPOSCHANGING" -eq 1; then + patch_apply winex11-WM_WINDOWPOSCHANGING/0001-winex11.drv-Send-WM_WINDOWPOSCHANGING-WM_WINDOWPOSCH.patch + ( + echo '+ { "Dmitry Timoshkov", "winex11.drv: Send WM_WINDOWPOSCHANGING/WM_WINDOWPOSCHANGED messages to a being deactivated topmost window.", 1 },'; + ) >> "$patchlist" +fi + # Patchset winex11-Window_Groups # | # | This patchset fixes the following Wine bugs: @@ -8277,24 +8324,6 @@ if test "$enable_winex11_XEMBED" -eq 1; then ) >> "$patchlist" fi -# Patchset winex11-_NET_ACTIVE_WINDOW -# | -# | This patchset fixes the following Wine bugs: -# | * [#2155] Forward activate window requests to WM using _NET_ACTIVE_WINDOW -# | -# | Modified files: -# | * dlls/user32/driver.c, dlls/user32/focus.c, dlls/user32/user_private.h, dlls/winex11.drv/event.c, -# | dlls/winex11.drv/window.c, dlls/winex11.drv/winex11.drv.spec, dlls/winex11.drv/x11drv.h, dlls/winex11.drv/x11drv_main.c -# | -if test "$enable_winex11__NET_ACTIVE_WINDOW" -eq 1; then - patch_apply winex11-_NET_ACTIVE_WINDOW/0001-winex11.drv-Add-support-for-_NET_ACTIVE_WINDOW.patch - patch_apply winex11-_NET_ACTIVE_WINDOW/0002-user32-Before-asking-a-WM-to-activate-a-window-make-.patch - ( - echo '+ { "Dmitry Timoshkov", "winex11.drv: Add support for _NET_ACTIVE_WINDOW.", 2 },'; - echo '+ { "Dmitry Timoshkov", "user32: Before asking a WM to activate a window make sure that the window is in foreground and not minimized.", 1 },'; - ) >> "$patchlist" -fi - # Patchset winex11-wglShareLists # | # | This patchset fixes the following Wine bugs: diff --git a/patches/winex11-WM_WINDOWPOSCHANGING/0001-winex11.drv-Send-WM_WINDOWPOSCHANGING-WM_WINDOWPOSCH.patch b/patches/winex11-WM_WINDOWPOSCHANGING/0001-winex11.drv-Send-WM_WINDOWPOSCHANGING-WM_WINDOWPOSCH.patch new file mode 100644 index 00000000..58ade870 --- /dev/null +++ b/patches/winex11-WM_WINDOWPOSCHANGING/0001-winex11.drv-Send-WM_WINDOWPOSCHANGING-WM_WINDOWPOSCH.patch @@ -0,0 +1,46 @@ +From 59692b046e936dc25ecab6adaf258533a7404635 Mon Sep 17 00:00:00 2001 +From: Dmitry Timoshkov +Date: Tue, 27 Dec 2016 17:45:05 +0800 +Subject: winex11.drv: Send WM_WINDOWPOSCHANGING/WM_WINDOWPOSCHANGED messages + to a being deactivated topmost window. + +--- + dlls/winex11.drv/event.c | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c +index bf2cbb07429..e38b76a7274 100644 +--- a/dlls/winex11.drv/event.c ++++ b/dlls/winex11.drv/event.c +@@ -593,16 +593,27 @@ static void set_input_focus( struct x11drv_win_data *data ) + */ + static void set_focus( Display *display, HWND hwnd, Time time ) + { +- HWND focus; ++ HWND focus, old_active; + Window win; + GUITHREADINFO threadinfo; + ++ old_active = GetForegroundWindow(); ++ + /* prevent recursion */ + x11drv_thread_data()->active_window = hwnd; + + TRACE( "setting foreground window to %p\n", hwnd ); + SetForegroundWindow( hwnd ); + ++ /* Some applications expect that a being deactivated topmost window ++ * receives the WM_WINDOWPOSCHANGING/WM_WINDOWPOSCHANGED messages, ++ * and perform some specific actions. Chessmaster is one of such apps. ++ * Window Manager keeps a topmost window on top in z-oder, so there is ++ * no need to actually do anything, just send the messages. ++ */ ++ if (old_active && (GetWindowLongW( old_active, GWL_EXSTYLE ) & WS_EX_TOPMOST)) ++ SetWindowPos( old_active, hwnd, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOOWNERZORDER ); ++ + threadinfo.cbSize = sizeof(threadinfo); + GetGUIThreadInfo(0, &threadinfo); + focus = threadinfo.hwndFocus; +-- +2.11.0 + diff --git a/patches/winex11-WM_WINDOWPOSCHANGING/definition b/patches/winex11-WM_WINDOWPOSCHANGING/definition new file mode 100644 index 00000000..ba4c8c5e --- /dev/null +++ b/patches/winex11-WM_WINDOWPOSCHANGING/definition @@ -0,0 +1,2 @@ +Fixes: [34594] Fix handling of WM_WINDOWPOS{CHANGING,CHANGED} for deactivated topmost window +Depends: winex11-_NET_ACTIVE_WINDOW