From: "Chao Long" Subject: 0001-winex11.drv-Fix-the-Layer-window-is-associated-with- Message-Id: <202008241417264683052@uniontech.com> Date: Mon, 24 Aug 2020 14:17:26 +0800 hi wine! The Layer window did not reassociate TransientForHint after  repainting  . -------------- Chao Long From e2a3c5d36ec5e55a3c67241f3d37765dd6c53364 Mon Sep 17 00:00:00 2001 From: Chao Long Date: Mon, 24 Aug 2020 13:29:21 +0800 Subject: [PATCH] winex11.drv: Fix the Layer window is associated with other Windows during destroy redraw and needs to be re-associated Signed-off-by: Chao Long --- dlls/winex11.drv/window.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index f4920b802e..5d62cd69f8 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -169,6 +169,12 @@ struct has_popup_result BOOL found; }; +struct has_x11hints +{ + Window old_whole; + struct x11drv_win_data *data; +}; + static BOOL is_managed( HWND hwnd ) { struct x11drv_win_data *data = get_win_data( hwnd ); @@ -1623,7 +1629,35 @@ static void destroy_whole_window( struct x11drv_win_data *data, BOOL already_des RemovePropA( data->hwnd, whole_window_prop ); } +static BOOL CALLBACK set_from_hints( HWND hwnd, LPARAM lparam ) +{ + struct has_x11hints *owner_hints = (struct has_x11hints *)lparam; + if (IsWindow(hwnd) && owner_hints) + { + Window whole, old_whole = 0; + if ((whole=X11DRV_get_whole_window(hwnd)) && + XGetTransientForHint(owner_hints->data->display,whole,&old_whole) && + old_whole==owner_hints->old_whole) + { + XSetTransientForHint(owner_hints->data->display,whole,owner_hints->data->whole_window); + XWMHints* hits = NULL; + if ((hits=XGetWMHints(owner_hints->data->display,whole))) + { + hits->window_group = owner_hints->data->whole_window; + XSetWMHints(owner_hints->data->display,whole,hits); + } + } + } + return (owner_hints!=NULL); +} +static void append_from_hints(Window old_whole,struct x11drv_win_data *data) +{ + struct has_x11hints trans; + trans.old_whole = old_whole; + trans.data = data; + EnumWindows(set_from_hints,(LPARAM)&trans); +} /********************************************************************** * set_window_visual * @@ -1640,10 +1674,12 @@ void set_window_visual( struct x11drv_win_data *data, const XVisualInfo *vis, BO data->use_alpha = use_alpha; if (data->vis.visualid == vis->visualid) return; + Window oldwhole = data->whole_window; data->client_window = 0; destroy_whole_window( data, client_window != 0 /* don't destroy whole_window until reparented */ ); data->vis = *vis; create_whole_window( data ); + append_from_hints(oldwhole,data); if (!client_window) return; /* move the client to the new parent */ XReparentWindow( data->display, client_window, data->whole_window, -- 2.20.1