diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 80638a38..537830bf 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -356,6 +356,7 @@ patch_enable_all () enable_winex11_key_translation="$1" enable_winex11_mouse_movements="$1" enable_winex11_wglShareLists="$1" + enable_winex11_drv_Query_server_position="$1" enable_winex11_drv_mouse_coorrds="$1" enable_winhttp_System_Proxy_Autoconfig="$1" enable_wininet_Cleanup="$1" @@ -1204,6 +1205,9 @@ patch_enable () winex11-wglShareLists) enable_winex11_wglShareLists="$2" ;; + winex11.drv-Query_server_position) + enable_winex11_drv_Query_server_position="$2" + ;; winex11.drv-mouse-coorrds) enable_winex11_drv_mouse_coorrds="$2" ;; @@ -7188,6 +7192,21 @@ if test "$enable_winex11_wglShareLists" -eq 1; then ) >> "$patchlist" fi +# Patchset winex11.drv-Query_server_position +# | +# | This patchset fixes the following Wine bugs: +# | * [#15346] winex11.drv: Query the X server for the actual rect of the window before unmapping it +# | +# | Modified files: +# | * dlls/winex11.drv/window.c +# | +if test "$enable_winex11_drv_Query_server_position" -eq 1; then + patch_apply winex11.drv-Query_server_position/0001-winex11.drv-window-Query-the-X-server-for-the-actual.patch + ( + printf '%s\n' '+ { "Gabriel Ivăncescu", "winex11.drv/window: Query the X server for the actual rect of the window before unmapping it.", 1 },'; + ) >> "$patchlist" +fi + # Patchset winex11.drv-mouse-coorrds # | # | This patchset fixes the following Wine bugs: diff --git a/patches/winex11.drv-Query_server_position/0001-winex11.drv-window-Query-the-X-server-for-the-actual.patch b/patches/winex11.drv-Query_server_position/0001-winex11.drv-window-Query-the-X-server-for-the-actual.patch new file mode 100644 index 00000000..b25db876 --- /dev/null +++ b/patches/winex11.drv-Query_server_position/0001-winex11.drv-window-Query-the-X-server-for-the-actual.patch @@ -0,0 +1,66 @@ +From 38d9b194e83b02f56d734da88396ac06ddb7af1f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= +Date: Mon, 24 Dec 2018 14:26:57 +0200 +Subject: [PATCH] winex11.drv/window: Query the X server for the actual rect of + the window before unmapping it +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Some applications control their own position when they are being moved. This +can become out of sync with the X server because certain WMs interfere with +this on purpose. + +Thus we shouldn't just rely on our window rect when deciding whether to unmap +a window (if it's out of the screen), but query the X server in this case +as the last resort to make sure it really is outside and should be unmapped. + +Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=15346 +Signed-off-by: Gabriel Ivăncescu +--- + dlls/winex11.drv/window.c | 22 +++++++++++++++++++++- + 1 file changed, 21 insertions(+), 1 deletion(-) + +diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c +index 97dee52..7f436ac 100644 +--- a/dlls/winex11.drv/window.c ++++ b/dlls/winex11.drv/window.c +@@ -196,6 +196,25 @@ static BOOL has_owned_popups( HWND hwnd ) + return result.found; + } + ++static BOOL is_actual_window_rect_mapped(const struct x11drv_win_data *data) ++{ ++ XWindowAttributes attr; ++ Window child; ++ RECT rect; ++ POINT pt; ++ int x, y; ++ ++ /* Query the X server for the actual position of the window, ++ as some WMs tend to mess with it, so we need to make sure ++ we aren't unmapping the window wrongly with a bogus rect */ ++ XTranslateCoordinates(data->display, data->whole_window, root_window, 0, 0, &x, &y, &child); ++ XGetWindowAttributes(data->display, data->whole_window, &attr); ++ ++ pt = root_to_virtual_screen(x - attr.x, y - attr.y); ++ SetRect(&rect, pt.x, pt.y, pt.x + attr.width, pt.y + attr.height); ++ return is_window_rect_mapped(&rect); ++} ++ + + /*********************************************************************** + * alloc_win_data +@@ -2400,7 +2419,8 @@ void CDECL X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags + { + if (((swp_flags & SWP_HIDEWINDOW) && !(new_style & WS_VISIBLE)) || + (!event_type && !(new_style & WS_MINIMIZE) && +- !is_window_rect_mapped( rectWindow ) && is_window_rect_mapped( &old_window_rect ))) ++ !is_window_rect_mapped( rectWindow ) && is_window_rect_mapped( &old_window_rect ) && ++ !is_actual_window_rect_mapped( data ))) + { + release_win_data( data ); + unmap_window( hwnd ); +-- +1.9.1 + diff --git a/patches/winex11.drv-Query_server_position/definition b/patches/winex11.drv-Query_server_position/definition new file mode 100644 index 00000000..022969e7 --- /dev/null +++ b/patches/winex11.drv-Query_server_position/definition @@ -0,0 +1 @@ +Fixes: [15346] winex11.drv: Query the X server for the actual rect of the window before unmapping it