From 310f4c498b1bd8554906ec8428546e1ab2271db1 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Fri, 12 Nov 2021 01:08:55 -0600 Subject: [PATCH] winex11-_NET_ACTIVE_WINDOW, winex11-WM_WINDOWPOSCHANGING: Rebase and re-enable. --- patches/patchinstall.sh | 44 +++++ .../winex11-WM_WINDOWPOSCHANGING/definition | 1 - ...v-Add-support-for-_NET_ACTIVE_WINDOW.patch | 165 ++++++++++-------- patches/winex11-_NET_ACTIVE_WINDOW/definition | 1 - 4 files changed, 139 insertions(+), 72 deletions(-) diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index acd3c578..75a2b2e6 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -254,8 +254,10 @@ patch_enable_all () enable_winex11_MWM_Decorations="$1" enable_winex11_UpdateLayeredWindow="$1" enable_winex11_Vulkan_support="$1" + enable_winex11_WM_WINDOWPOSCHANGING="$1" enable_winex11_Window_Style="$1" enable_winex11_XEMBED="$1" + enable_winex11__NET_ACTIVE_WINDOW="$1" enable_winex11_ime_check_thread_data="$1" enable_winex11_key_translation="$1" enable_winex11_wglShareLists="$1" @@ -790,12 +792,18 @@ patch_enable () winex11-Vulkan_support) enable_winex11_Vulkan_support="$2" ;; + winex11-WM_WINDOWPOSCHANGING) + enable_winex11_WM_WINDOWPOSCHANGING="$2" + ;; winex11-Window_Style) enable_winex11_Window_Style="$2" ;; winex11-XEMBED) enable_winex11_XEMBED="$2" ;; + winex11-_NET_ACTIVE_WINDOW) + enable_winex11__NET_ACTIVE_WINDOW="$2" + ;; winex11-ime-check-thread-data) enable_winex11_ime_check_thread_data="$2" ;; @@ -1179,6 +1187,13 @@ patch_apply() } +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_Indexed_Vertex_Blending" -eq 1; then if test "$enable_wined3d_SWVP_shaders" -gt 1; then abort "Patchset wined3d-SWVP-shaders disabled, but wined3d-Indexed_Vertex_Blending depends on that." @@ -3801,6 +3816,35 @@ 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/user32/driver.c, dlls/user32/focus.c, dlls/win32u/driver.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: +# | * 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 +fi + # Patchset winex11-Window_Style # | # | This patchset fixes the following Wine bugs: diff --git a/patches/winex11-WM_WINDOWPOSCHANGING/definition b/patches/winex11-WM_WINDOWPOSCHANGING/definition index 07c2054c..ba4c8c5e 100644 --- a/patches/winex11-WM_WINDOWPOSCHANGING/definition +++ b/patches/winex11-WM_WINDOWPOSCHANGING/definition @@ -1,3 +1,2 @@ Fixes: [34594] Fix handling of WM_WINDOWPOS{CHANGING,CHANGED} for deactivated topmost window Depends: winex11-_NET_ACTIVE_WINDOW -Disabled: True diff --git a/patches/winex11-_NET_ACTIVE_WINDOW/0001-winex11.drv-Add-support-for-_NET_ACTIVE_WINDOW.patch b/patches/winex11-_NET_ACTIVE_WINDOW/0001-winex11.drv-Add-support-for-_NET_ACTIVE_WINDOW.patch index b4656712..3c691473 100644 --- a/patches/winex11-_NET_ACTIVE_WINDOW/0001-winex11.drv-Add-support-for-_NET_ACTIVE_WINDOW.patch +++ b/patches/winex11-_NET_ACTIVE_WINDOW/0001-winex11.drv-Add-support-for-_NET_ACTIVE_WINDOW.patch @@ -1,35 +1,28 @@ -From 552ce43d924c0959cd8f093d677e9ce968f251a0 Mon Sep 17 00:00:00 2001 +From 2fe6229038238f33b7fbbc400ca38cb1f53c59f1 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Wed, 10 Feb 2016 15:09:29 +0800 -Subject: winex11.drv: Add support for _NET_ACTIVE_WINDOW. (v2) +Subject: [PATCH] winex11.drv: Add support for _NET_ACTIVE_WINDOW. (v2) And use it as a backend in user32.SetActiveWindow(). For bug #2155. --- - dlls/user32/driver.c | 7 ++++++ - dlls/user32/focus.c | 2 ++ - dlls/user32/user_private.h | 1 + - dlls/winex11.drv/event.c | 5 ++++ - dlls/winex11.drv/window.c | 48 +++++++++++++++++++++++++++++++++++++++ - dlls/winex11.drv/winex11.drv.spec | 1 + - dlls/winex11.drv/x11drv.h | 2 ++ - dlls/winex11.drv/x11drv_main.c | 1 + - 8 files changed, 67 insertions(+) + dlls/user32/driver.c | 5 ++++ + dlls/user32/focus.c | 2 ++ + dlls/win32u/driver.c | 5 ++++ + dlls/winex11.drv/event.c | 5 ++++ + dlls/winex11.drv/init.c | 1 + + dlls/winex11.drv/window.c | 48 ++++++++++++++++++++++++++++++++++ + dlls/winex11.drv/x11drv.h | 3 +++ + dlls/winex11.drv/x11drv_main.c | 1 + + include/wine/gdi_driver.h | 3 ++- + 9 files changed, 72 insertions(+), 1 deletion(-) diff --git a/dlls/user32/driver.c b/dlls/user32/driver.c -index d4d9486..a9ef3ad 100644 +index f979630c707..420922076f1 100644 --- a/dlls/user32/driver.c +++ b/dlls/user32/driver.c -@@ -134,6 +134,7 @@ static const USER_DRIVER *load_driver(void) - GET_USER_FUNC(MsgWaitForMultipleObjectsEx); - GET_USER_FUNC(ReleaseDC); - GET_USER_FUNC(ScrollDC); -+ GET_USER_FUNC(SetActiveWindow); - GET_USER_FUNC(SetCapture); - GET_USER_FUNC(SetFocus); - GET_USER_FUNC(SetLayeredWindowAttributes); -@@ -408,6 +409,10 @@ static BOOL CDECL nulldrv_ScrollDC( HDC hdc, INT dx, INT dy, HRGN update ) +@@ -163,6 +163,10 @@ static BOOL CDECL nulldrv_ScrollDC( HDC hdc, INT dx, INT dy, HRGN update ) hdc, rect.left - dx, rect.top - dy, SRCCOPY ); } @@ -40,15 +33,7 @@ index d4d9486..a9ef3ad 100644 static void CDECL nulldrv_SetCapture( HWND hwnd, UINT flags ) { } -@@ -526,6 +531,7 @@ static USER_DRIVER null_driver = - nulldrv_MsgWaitForMultipleObjectsEx, - nulldrv_ReleaseDC, - nulldrv_ScrollDC, -+ nulldrv_SetActiveWindow, - nulldrv_SetCapture, - nulldrv_SetFocus, - nulldrv_SetLayeredWindowAttributes, -@@ -754,6 +760,7 @@ static USER_DRIVER lazy_load_driver = +@@ -402,6 +406,7 @@ static struct user_driver_funcs lazy_load_driver = nulldrv_MsgWaitForMultipleObjectsEx, nulldrv_ReleaseDC, nulldrv_ScrollDC, @@ -57,10 +42,10 @@ index d4d9486..a9ef3ad 100644 nulldrv_SetFocus, loaderdrv_SetLayeredWindowAttributes, diff --git a/dlls/user32/focus.c b/dlls/user32/focus.c -index 3fe0431..dbde668 100644 +index 34cc3880cc9..0805e1704c9 100644 --- a/dlls/user32/focus.c +++ b/dlls/user32/focus.c -@@ -158,6 +158,8 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus ) +@@ -166,6 +166,8 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus ) PostMessageW( GetDesktopWindow(), WM_PARENTNOTIFY, WM_NCACTIVATE, (LPARAM)hwnd ); } @@ -69,23 +54,34 @@ index 3fe0431..dbde668 100644 /* now change focus if necessary */ if (focus) { -diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h -index e36457d..161085d 100644 ---- a/dlls/user32/user_private.h -+++ b/dlls/user32/user_private.h -@@ -95,6 +95,7 @@ typedef struct tagUSER_DRIVER { - DWORD (CDECL *pMsgWaitForMultipleObjectsEx)(DWORD,const HANDLE*,DWORD,DWORD,DWORD); - void (CDECL *pReleaseDC)(HWND,HDC); - BOOL (CDECL *pScrollDC)(HDC,INT,INT,HRGN); -+ void (CDECL *pSetActiveWindow)(HWND); - void (CDECL *pSetCapture)(HWND,UINT); - void (CDECL *pSetFocus)(HWND); - void (CDECL *pSetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD); +diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c +index bcca0c30353..26cce1edbea 100644 +--- a/dlls/win32u/driver.c ++++ b/dlls/win32u/driver.c +@@ -914,6 +914,10 @@ static BOOL CDECL nulldrv_ScrollDC( HDC hdc, INT dx, INT dy, HRGN update ) + hdc, rect.left - dx, rect.top - dy, SRCCOPY, 0, 0 ); + } + ++static void CDECL nulldrv_SetActiveWindow( HWND hwnd ) ++{ ++} ++ + static void CDECL nulldrv_SetCapture( HWND hwnd, UINT flags ) + { + } +@@ -1061,6 +1065,7 @@ void CDECL __wine_set_display_driver( struct user_driver_funcs *driver, UINT ver + SET_USER_FUNC(MsgWaitForMultipleObjectsEx); + SET_USER_FUNC(ReleaseDC); + SET_USER_FUNC(ScrollDC); ++ SET_USER_FUNC(SetActiveWindow); + SET_USER_FUNC(SetCapture); + SET_USER_FUNC(SetFocus); + SET_USER_FUNC(SetLayeredWindowAttributes); diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c -index 5ac4bd7..bf2cbb0 100644 +index 170111e9c28..e437132a763 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c -@@ -597,6 +597,9 @@ static void set_focus( Display *display, HWND hwnd, Time time ) +@@ -596,6 +596,9 @@ static void set_focus( Display *display, HWND hwnd, Time time ) Window win; GUITHREADINFO threadinfo; @@ -95,7 +91,7 @@ index 5ac4bd7..bf2cbb0 100644 TRACE( "setting foreground window to %p\n", hwnd ); SetForegroundWindow( hwnd ); -@@ -818,6 +821,8 @@ static BOOL X11DRV_FocusIn( HWND hwnd, XEvent *xev ) +@@ -843,6 +846,8 @@ static void focus_out( Display *display , HWND hwnd ) if (!focus_win) { @@ -104,14 +100,27 @@ index 5ac4bd7..bf2cbb0 100644 /* Abey : 6-Oct-99. Check again if the focus out window is the Foreground window, because in most cases the messages sent above must have already changed the foreground window, in which +diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c +index c9bef8d46d2..f6fd11c43ac 100644 +--- a/dlls/winex11.drv/init.c ++++ b/dlls/winex11.drv/init.c +@@ -409,6 +409,7 @@ static const struct user_driver_funcs x11drv_funcs = + .pMsgWaitForMultipleObjectsEx = X11DRV_MsgWaitForMultipleObjectsEx, + .pReleaseDC = X11DRV_ReleaseDC, + .pScrollDC = X11DRV_ScrollDC, ++ .pSetActiveWindow = X11DRV_SetActiveWindow, + .pSetCapture = X11DRV_SetCapture, + .pSetFocus = X11DRV_SetFocus, + .pSetLayeredWindowAttributes = X11DRV_SetLayeredWindowAttributes, diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c -index 3bcc268..a7062a2 100644 +index bcb0b8044bc..5143ea6840b 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c -@@ -2117,6 +2117,54 @@ BOOL CDECL X11DRV_ScrollDC( HDC hdc, INT dx, INT dy, HRGN update ) +@@ -2232,6 +2232,54 @@ BOOL CDECL X11DRV_ScrollDC( HDC hdc, INT dx, INT dy, HRGN update ) + } - /*********************************************************************** ++/*********************************************************************** + * SetActiveWindow (X11DRV.@) + */ +void CDECL X11DRV_SetActiveWindow( HWND hwnd ) @@ -159,27 +168,22 @@ index 3bcc268..a7062a2 100644 + release_win_data( data ); +} + -+/*********************************************************************** + /*********************************************************************** * SetCapture (X11DRV.@) */ - void CDECL X11DRV_SetCapture( HWND hwnd, UINT flags ) -diff --git a/dlls/winex11.drv/winex11.drv.spec b/dlls/winex11.drv/winex11.drv.spec -index 82d25e5..145ba64 100644 ---- a/dlls/winex11.drv/winex11.drv.spec -+++ b/dlls/winex11.drv/winex11.drv.spec -@@ -31,6 +31,7 @@ - @ cdecl MsgWaitForMultipleObjectsEx(long ptr long long long) X11DRV_MsgWaitForMultipleObjectsEx - @ cdecl ReleaseDC(long long) X11DRV_ReleaseDC - @ cdecl ScrollDC(long long long long) X11DRV_ScrollDC -+@ cdecl SetActiveWindow(long) X11DRV_SetActiveWindow - @ cdecl SetCapture(long long) X11DRV_SetCapture - @ cdecl SetFocus(long) X11DRV_SetFocus - @ cdecl SetLayeredWindowAttributes(long long long long) X11DRV_SetLayeredWindowAttributes diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h -index f5585b1..19cc852 100644 +index 182ca4dd857..d857f9a961a 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h -@@ -315,6 +315,7 @@ struct x11drv_thread_data +@@ -217,6 +217,7 @@ extern void CDECL X11DRV_GetDC( HDC hdc, HWND hwnd, HWND top, const RECT *win_re + const RECT *top_rect, DWORD flags ) DECLSPEC_HIDDEN; + extern void CDECL X11DRV_ReleaseDC( HWND hwnd, HDC hdc ) DECLSPEC_HIDDEN; + extern BOOL CDECL X11DRV_ScrollDC( HDC hdc, INT dx, INT dy, HRGN update ) DECLSPEC_HIDDEN; ++extern void CDECL X11DRV_SetActiveWindow( HWND hwnd ) DECLSPEC_HIDDEN; + extern void CDECL X11DRV_SetCapture( HWND hwnd, UINT flags ) DECLSPEC_HIDDEN; + extern void CDECL X11DRV_SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha, + DWORD flags ) DECLSPEC_HIDDEN; +@@ -372,6 +373,7 @@ struct x11drv_thread_data Display *display; XEvent *current_event; /* event currently being processed */ HWND grab_hwnd; /* window that currently grabs the mouse */ @@ -187,7 +191,7 @@ index f5585b1..19cc852 100644 HWND last_focus; /* last window that had focus */ XIM xim; /* input method */ HWND last_xic_hwnd; /* last xic window */ -@@ -416,6 +417,7 @@ enum x11drv_atoms +@@ -483,6 +485,7 @@ enum x11drv_atoms XATOM_DndSelection, XATOM__ICC_PROFILE, XATOM__MOTIF_WM_HINTS, @@ -196,10 +200,10 @@ index f5585b1..19cc852 100644 XATOM__NET_STARTUP_INFO, XATOM__NET_SUPPORTED, diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c -index c6421a3..2ed5ea9 100644 +index 4a8605fc668..0699e1199e4 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c -@@ -126,6 +126,7 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] = +@@ -160,6 +160,7 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] = "DndSelection", "_ICC_PROFILE", "_MOTIF_WM_HINTS", @@ -207,6 +211,27 @@ index c6421a3..2ed5ea9 100644 "_NET_STARTUP_INFO_BEGIN", "_NET_STARTUP_INFO", "_NET_SUPPORTED", +diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h +index e65b1873926..e0b37095a4c 100644 +--- a/include/wine/gdi_driver.h ++++ b/include/wine/gdi_driver.h +@@ -167,7 +167,7 @@ struct gdi_dc_funcs + }; + + /* increment this when you change the DC function table */ +-#define WINE_GDI_DRIVER_VERSION 71 ++#define WINE_GDI_DRIVER_VERSION 72 + + #define GDI_PRIORITY_NULL_DRV 0 /* null driver */ + #define GDI_PRIORITY_FONT_DRV 100 /* any font driver */ +@@ -267,6 +267,7 @@ struct user_driver_funcs + DWORD (CDECL *pMsgWaitForMultipleObjectsEx)(DWORD,const HANDLE*,DWORD,DWORD,DWORD); + void (CDECL *pReleaseDC)(HWND,HDC); + BOOL (CDECL *pScrollDC)(HDC,INT,INT,HRGN); ++ void (CDECL *pSetActiveWindow)(HWND); + void (CDECL *pSetCapture)(HWND,UINT); + void (CDECL *pSetFocus)(HWND); + void (CDECL *pSetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD); -- -2.9.0 +2.33.0 diff --git a/patches/winex11-_NET_ACTIVE_WINDOW/definition b/patches/winex11-_NET_ACTIVE_WINDOW/definition index a793c26f..e9edd04f 100644 --- a/patches/winex11-_NET_ACTIVE_WINDOW/definition +++ b/patches/winex11-_NET_ACTIVE_WINDOW/definition @@ -1,2 +1 @@ Fixes: [2155] Forward activate window requests to WM using _NET_ACTIVE_WINDOW -Disabled: True