diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 9bd565d9..1f9c5543 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -207,6 +207,7 @@ patch_enable_all () enable_user32_QueryDisplayConfig="$1" enable_user32_Refresh_MDI_Menus="$1" enable_user32_ScrollWindowEx="$1" + enable_user32_alttab_focus="$1" enable_user32_message_order="$1" enable_user32_msgbox_Support_WM_COPY_mesg="$1" enable_user32_rawinput_mouse="$1" @@ -647,6 +648,9 @@ patch_enable () user32-ScrollWindowEx) enable_user32_ScrollWindowEx="$2" ;; + user32-alttab-focus) + enable_user32_alttab_focus="$2" + ;; user32-message-order) enable_user32_message_order="$2" ;; @@ -1199,6 +1203,13 @@ if test "$enable_user32_rawinput_mouse_experimental" -eq 1; then enable_user32_rawinput_mouse=1 fi +if test "$enable_user32_alttab_focus" -eq 1; then + if test "$enable_winex11__NET_ACTIVE_WINDOW" -gt 1; then + abort "Patchset winex11-_NET_ACTIVE_WINDOW disabled, but user32-alttab-focus depends on that." + fi + enable_winex11__NET_ACTIVE_WINDOW=1 +fi + if test "$enable_stdole32_tlb_SLTG_Typelib" -eq 1; then if test "$enable_widl_SLTG_Typelib_Support" -gt 1; then abort "Patchset widl-SLTG_Typelib_Support disabled, but stdole32.tlb-SLTG_Typelib depends on that." @@ -3209,6 +3220,35 @@ if test "$enable_user32_ScrollWindowEx" -eq 1; then patch_apply user32-ScrollWindowEx/0001-user32-Fix-return-value-of-ScrollWindowEx-for-invisi.patch 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/win32u/driver.c, dlls/win32u/input.c, dlls/winex11.drv/event.c, dlls/winex11.drv/init.c, dlls/winex11.drv/window.c, +# | dlls/winex11.drv/x11drv.h, dlls/winex11.drv/x11drv_main.c, include/wine/gdi_driver.h +# | +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 +fi + +# Patchset user32-alttab-focus +# | +# | This patchset has the following (direct or indirect) dependencies: +# | * winex11-_NET_ACTIVE_WINDOW +# | +# | This patchset fixes the following Wine bugs: +# | * [#48121] Improve Alt+tab for unity games. +# | +# | Modified files: +# | * dlls/win32u/input.c +# | +if test "$enable_user32_alttab_focus" -eq 1; then + patch_apply user32-alttab-focus/0001-Send-WM_NCPOINTERUP-on-focus-regain.patch +fi + # Patchset user32-message-order # | # | This patchset fixes the following Wine bugs: @@ -3713,20 +3753,6 @@ if test "$enable_winex11_Vulkan_support" -eq 1; then patch_apply winex11-Vulkan_support/0001-winex11-Specify-a-default-vulkan-driver-if-one-not-f.patch 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/win32u/driver.c, dlls/win32u/input.c, dlls/winex11.drv/event.c, dlls/winex11.drv/init.c, dlls/winex11.drv/window.c, -# | dlls/winex11.drv/x11drv.h, dlls/winex11.drv/x11drv_main.c, include/wine/gdi_driver.h -# | -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 -fi - # Patchset winex11-WM_WINDOWPOSCHANGING # | # | This patchset has the following (direct or indirect) dependencies: diff --git a/patches/user32-alttab-focus/0001-Send-WM_NCPOINTERUP-on-focus-regain.patch b/patches/user32-alttab-focus/0001-Send-WM_NCPOINTERUP-on-focus-regain.patch new file mode 100644 index 00000000..23965c85 --- /dev/null +++ b/patches/user32-alttab-focus/0001-Send-WM_NCPOINTERUP-on-focus-regain.patch @@ -0,0 +1,26 @@ +From 068536823c008835d9d96af2ae2cb030e753dd7f Mon Sep 17 00:00:00 2001 +From: David Torok +Date: Sun, 17 Nov 2019 19:08:12 +0100 +Subject: [PATCH] Send WM_NCPOINTERUP on focus regain + +--- + dlls/win32u/input.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c +index dda2a750275..05efec915b2 100644 +--- a/dlls/win32u/input.c ++++ b/dlls/win32u/input.c +@@ -1375,6 +1375,9 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus ) + send_message( hwnd, WM_ACTIVATE, + MAKEWPARAM( mouse ? WA_CLICKACTIVE : WA_ACTIVE, is_iconic(hwnd) ), + (LPARAM)previous ); ++ ++ send_message( hwnd, WM_NCPOINTERUP, 0, 0); ++ + if (NtUserGetAncestor( hwnd, GA_PARENT ) == get_desktop_window()) + NtUserPostMessage( get_desktop_window(), WM_PARENTNOTIFY, WM_NCACTIVATE, (LPARAM)hwnd ); + +-- +2.35.1 + diff --git a/patches/user32-alttab-focus/definition b/patches/user32-alttab-focus/definition new file mode 100644 index 00000000..b6269641 --- /dev/null +++ b/patches/user32-alttab-focus/definition @@ -0,0 +1,5 @@ +Fixes: [48121] Improve Alt+tab for unity games. +Depends: winex11-_NET_ACTIVE_WINDOW +# The other patches on this bug are other solutions but +# might cause errors if they dont recieve the HTCAPTION +# message.