Commit 96dccad3 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Vitaly Lipatov

winex11.drv/window: Query the X server for the actual rect of the window before unmapping it

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=15346Signed-off-by: 's avatarGabriel Ivăncescu <gabrielopcode@gmail.com>
parent a27100b8
......@@ -213,6 +213,25 @@ static BOOL has_owned_popups( HWND hwnd )
return ret;
}
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
......@@ -2685,7 +2704,8 @@ void 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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment