From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/dce.c | 17 +++++--------- dlls/win32u/driver.c | 2 +- dlls/win32u/win32u_private.h | 2 +- dlls/win32u/window.c | 30 ++++++++++++++++++++--- dlls/wineandroid.drv/android.h | 2 +- dlls/wineandroid.drv/window.c | 34 ++++----------------------- dlls/winemac.drv/macdrv.h | 3 +-- dlls/winemac.drv/surface.c | 32 ++++--------------------- dlls/winemac.drv/window.c | 2 -- dlls/winewayland.drv/waylanddrv.h | 3 +-- dlls/winewayland.drv/window.c | 2 -- dlls/winewayland.drv/window_surface.c | 32 ++++--------------------- dlls/winex11.drv/bitblt.c | 32 ++++--------------------- dlls/winex11.drv/window.c | 2 -- dlls/winex11.drv/x11drv.h | 3 +-- 15 files changed, 55 insertions(+), 143 deletions(-)
diff --git a/dlls/win32u/dce.c b/dlls/win32u/dce.c index cfa3510c60b..145bf2c5237 100644 --- a/dlls/win32u/dce.c +++ b/dlls/win32u/dce.c @@ -154,32 +154,27 @@ static const struct window_surface_funcs offscreen_window_surface_funcs = offscreen_window_surface_destroy };
-void create_offscreen_window_surface( HWND hwnd, const RECT *visible_rect, struct window_surface **surface ) +void create_offscreen_window_surface( HWND hwnd, const RECT *surface_rect, struct window_surface **surface ) { char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )]; BITMAPINFO *info = (BITMAPINFO *)buffer; struct offscreen_window_surface *impl; - RECT surface_rect = *visible_rect;
- TRACE( "hwnd %p, visible_rect %s, surface %p.\n", hwnd, wine_dbgstr_rect( visible_rect ), surface ); - - OffsetRect( &surface_rect, -surface_rect.left, -surface_rect.top ); - surface_rect.right = (surface_rect.right + 0x1f) & ~0x1f; - surface_rect.bottom = (surface_rect.bottom + 0x1f) & ~0x1f; + TRACE( "hwnd %p, surface_rect %s, surface %p.\n", hwnd, wine_dbgstr_rect( surface_rect ), surface );
/* check that old surface is an offscreen_window_surface, or release it */ if ((impl = impl_from_window_surface( *surface ))) { /* if the rect didn't change, keep the same surface */ - if (EqualRect( &surface_rect, &impl->header.rect )) return; + if (EqualRect( surface_rect, &impl->header.rect )) return; window_surface_release( &impl->header ); } else if (*surface) window_surface_release( *surface );
memset( info, 0, sizeof(*info) ); info->bmiHeader.biSize = sizeof(info->bmiHeader); - info->bmiHeader.biWidth = surface_rect.right; - info->bmiHeader.biHeight = -surface_rect.bottom; /* top-down */ + info->bmiHeader.biWidth = surface_rect->right; + info->bmiHeader.biHeight = -surface_rect->bottom; /* top-down */ info->bmiHeader.biPlanes = 1; info->bmiHeader.biBitCount = 32; info->bmiHeader.biSizeImage = get_dib_image_size( info ); @@ -188,7 +183,7 @@ void create_offscreen_window_surface( HWND hwnd, const RECT *visible_rect, struc /* create a new window surface */ *surface = NULL; if (!(impl = calloc(1, sizeof(*impl)))) return; - window_surface_init( &impl->header, &offscreen_window_surface_funcs, hwnd, &surface_rect, info, 0 ); + window_surface_init( &impl->header, &offscreen_window_surface_funcs, hwnd, surface_rect, info, 0 ); impl->info = *info;
TRACE( "created window surface %p\n", &impl->header ); diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c index 723270f1453..25ed2af1a17 100644 --- a/dlls/win32u/driver.c +++ b/dlls/win32u/driver.c @@ -889,7 +889,7 @@ static BOOL nulldrv_WindowPosChanging( HWND hwnd, UINT swp_flags, const RECT *wi return TRUE; }
-static BOOL nulldrv_CreateWindowSurface( HWND hwnd, UINT swp_flags, const RECT *visible_rect, struct window_surface **surface ) +static BOOL nulldrv_CreateWindowSurface( HWND hwnd, UINT swp_flags, const RECT *surface_rect, struct window_surface **surface ) { return FALSE; } diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index e2e35d6c40d..6abccafd8e2 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -45,7 +45,7 @@ extern ULONG_PTR set_icon_param( HICON handle, ULONG_PTR param );
/* dce.c */ extern struct window_surface dummy_surface; -extern void create_offscreen_window_surface( HWND hwnd, const RECT *visible_rect, +extern void create_offscreen_window_surface( HWND hwnd, const RECT *surface_rect, struct window_surface **surface ); extern void erase_now( HWND hwnd, UINT rdw_flags ); extern void flush_window_surfaces( BOOL idle ); diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index caa3b3aa323..2c78eaf1d98 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -1780,6 +1780,29 @@ done: release_win_ptr( win ); }
+ +static BOOL get_surface_rect( const RECT *visible_rect, RECT *surface_rect ) +{ + RECT virtual_rect = NtUserGetVirtualScreenRect(); + + *surface_rect = *visible_rect; + + /* crop surfaces which are larger than the virtual screen rect, some applications create huge windows */ + if ((surface_rect->right - surface_rect->left > virtual_rect.right - virtual_rect.left || + surface_rect->bottom - surface_rect->top > virtual_rect.bottom - virtual_rect.top) && + !intersect_rect( surface_rect, surface_rect, &virtual_rect )) + return FALSE; + OffsetRect( surface_rect, -visible_rect->left, -visible_rect->top ); + + /* round the surface coordinates to avoid re-creating them too often on resize */ + surface_rect->left &= ~127; + surface_rect->top &= ~127; + surface_rect->right = max( surface_rect->left + 128, (surface_rect->right + 127) & ~127 ); + surface_rect->bottom = max( surface_rect->top + 128, (surface_rect->bottom + 127) & ~127 ); + return TRUE; +} + + /*********************************************************************** * apply_window_pos * @@ -1791,11 +1814,12 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, WND *win; HWND surface_win = 0, parent = NtUserGetAncestor( hwnd, GA_PARENT ); BOOL ret, needs_surface, needs_update = FALSE; - RECT visible_rect = *window_rect, old_visible_rect, old_window_rect, old_client_rect, extra_rects[3]; + RECT surface_rect, visible_rect = *window_rect, old_visible_rect, old_window_rect, old_client_rect, extra_rects[3]; struct window_surface *old_surface, *new_surface = NULL;
needs_surface = user_driver->pWindowPosChanging( hwnd, swp_flags, window_rect, client_rect, &visible_rect );
+ if (!get_surface_rect( &visible_rect, &surface_rect )) needs_surface = FALSE; if (!parent || parent == get_desktop_window()) { new_surface = &dummy_surface; /* provide a default surface for top-level windows */ @@ -1803,7 +1827,7 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, }
if (!needs_surface || IsRectEmpty( &visible_rect )) needs_surface = FALSE; /* use default surface */ - else needs_surface = !user_driver->pCreateWindowSurface( hwnd, swp_flags, &visible_rect, &new_surface ); + else needs_surface = !user_driver->pCreateWindowSurface( hwnd, swp_flags, &surface_rect, &new_surface );
get_window_rects( hwnd, COORDS_SCREEN, &old_window_rect, NULL, get_thread_dpi() ); if (IsRectEmpty( &valid_rects[0] )) valid_rects = NULL; @@ -1820,7 +1844,7 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, { window_surface_release( new_surface ); if ((new_surface = win->surface)) window_surface_add_ref( new_surface ); - create_offscreen_window_surface( hwnd, &visible_rect, &new_surface ); + create_offscreen_window_surface( hwnd, &surface_rect, &new_surface ); }
old_visible_rect = win->visible_rect; diff --git a/dlls/wineandroid.drv/android.h b/dlls/wineandroid.drv/android.h index 72be3c4f5a8..d63f0ee37ec 100644 --- a/dlls/wineandroid.drv/android.h +++ b/dlls/wineandroid.drv/android.h @@ -102,7 +102,7 @@ extern BOOL ANDROID_CreateLayeredWindow( HWND hwnd, const RECT *window_rect, COL struct window_surface **surface ); extern LRESULT ANDROID_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ); extern BOOL ANDROID_WindowPosChanging( HWND hwnd, UINT swp_flags, const RECT *window_rect, const RECT *client_rect, RECT *visible_rect ); -extern BOOL ANDROID_CreateWindowSurface( HWND hwnd, UINT swp_flags, const RECT *visible_rect, struct window_surface **surface ); +extern BOOL ANDROID_CreateWindowSurface( HWND hwnd, UINT swp_flags, const RECT *surface_rect, struct window_surface **surface ); extern void ANDROID_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, const RECT *window_rect, const RECT *client_rect, const RECT *visible_rect, const RECT *valid_rects, diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c index 59f10adb60a..706f050534a 100644 --- a/dlls/wineandroid.drv/window.c +++ b/dlls/wineandroid.drv/window.c @@ -1121,35 +1121,12 @@ static struct android_win_data *create_win_data( HWND hwnd, const RECT *window_r }
-static BOOL get_surface_rect( const RECT *visible_rect, RECT *surface_rect ) -{ - RECT virtual_rect = NtUserGetVirtualScreenRect(); - - *surface_rect = *visible_rect; - - /* crop surfaces which are larger than the virtual screen rect, some applications create huge windows */ - if ((surface_rect->right - surface_rect->left > virtual_rect.right - virtual_rect.left || - surface_rect->bottom - surface_rect->top > virtual_rect.bottom - virtual_rect.top) && - !intersect_rect( surface_rect, surface_rect, &virtual_rect )) - return FALSE; - OffsetRect( surface_rect, -visible_rect->left, -visible_rect->top ); - - /* round the surface coordinates to avoid re-creating them too often on resize */ - surface_rect->left &= ~31; - surface_rect->top &= ~31; - surface_rect->right = max( surface_rect->left + 32, (surface_rect->right + 31) & ~31 ); - surface_rect->bottom = max( surface_rect->top + 32, (surface_rect->bottom + 31) & ~31 ); - return TRUE; -} - - /*********************************************************************** * ANDROID_WindowPosChanging */ BOOL ANDROID_WindowPosChanging( HWND hwnd, UINT swp_flags, const RECT *window_rect, const RECT *client_rect, RECT *visible_rect ) { struct android_win_data *data = get_win_data( hwnd ); - RECT surface_rect; BOOL ret = FALSE;
TRACE( "win %p window %s client %s style %08x flags %08x\n", @@ -1161,7 +1138,6 @@ BOOL ANDROID_WindowPosChanging( HWND hwnd, UINT swp_flags, const RECT *window_re if (data->parent) goto done; /* use default surface */ if (swp_flags & SWP_HIDEWINDOW) goto done; /* use default surface */ if (is_argb_surface( data->surface )) goto done; /* use default surface */ - if (!get_surface_rect( visible_rect, &surface_rect )) goto done; /* use default surface */
ret = TRUE;
@@ -1174,23 +1150,21 @@ done: /*********************************************************************** * ANDROID_CreateWindowSurface */ -BOOL ANDROID_CreateWindowSurface( HWND hwnd, UINT swp_flags, const RECT *visible_rect, struct window_surface **surface ) +BOOL ANDROID_CreateWindowSurface( HWND hwnd, UINT swp_flags, const RECT *surface_rect, struct window_surface **surface ) { struct android_win_data *data; - RECT surface_rect; DWORD flags; COLORREF key; BYTE alpha; BOOL layered = NtUserGetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_LAYERED;
- TRACE( "hwnd %p, swp_flags %08x, visible %s, surface %p\n", hwnd, swp_flags, wine_dbgstr_rect( visible_rect ), surface ); + TRACE( "hwnd %p, swp_flags %08x, surface_rect %s, surface %p\n", hwnd, swp_flags, wine_dbgstr_rect( surface_rect ), surface );
if (!(data = get_win_data( hwnd ))) return TRUE; /* use default surface */ - if (!get_surface_rect( visible_rect, &surface_rect )) goto done; /* use default surface */
if (data->surface) { - if (!memcmp( &data->surface->rect, &surface_rect, sizeof(surface_rect) )) + if (EqualRect( &data->surface->rect, surface_rect )) { /* existing surface is good enough */ window_surface_add_ref( data->surface ); @@ -1207,7 +1181,7 @@ BOOL ANDROID_CreateWindowSurface( HWND hwnd, UINT swp_flags, const RECT *visible if (!(flags & LWA_COLORKEY)) key = CLR_INVALID;
if (*surface) window_surface_release( *surface ); - *surface = create_surface( data->hwnd, &surface_rect, alpha, key, FALSE ); + *surface = create_surface( data->hwnd, surface_rect, alpha, key, FALSE );
done: release_win_data( data ); diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index 6863232b65a..4a92847dba2 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -151,7 +151,7 @@ extern void macdrv_UpdateLayeredWindow(HWND hwnd, const RECT *window_rect, COLOR BYTE alpha, UINT flags); extern LRESULT macdrv_WindowMessage(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp); extern BOOL macdrv_WindowPosChanging(HWND hwnd, UINT swp_flags, const RECT *window_rect, const RECT *client_rect, RECT *visible_rect); -extern BOOL macdrv_CreateWindowSurface(HWND hwnd, UINT swp_flags, const RECT *visible_rect, struct window_surface **surface); +extern BOOL macdrv_CreateWindowSurface(HWND hwnd, UINT swp_flags, const RECT *surface_rect, struct window_surface **surface); extern void macdrv_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags, const RECT *window_rect, const RECT *client_rect, const RECT *visible_rect, const RECT *valid_rects, @@ -208,7 +208,6 @@ extern BOOL macdrv_SystemParametersInfo(UINT action, UINT int_param, void *ptr_p extern RGNDATA *get_region_data(HRGN hrgn, HDC hdc_lptodp); extern void activate_on_following_focus(void); extern void set_surface_use_alpha(struct window_surface *window_surface, BOOL use_alpha); -extern BOOL get_surface_rect(const RECT *visible_rect, RECT *surface_rect);
extern void macdrv_handle_event(const macdrv_event *event);
diff --git a/dlls/winemac.drv/surface.c b/dlls/winemac.drv/surface.c index 7b4f744edba..d7c76998995 100644 --- a/dlls/winemac.drv/surface.c +++ b/dlls/winemac.drv/surface.c @@ -225,48 +225,24 @@ void set_surface_use_alpha(struct window_surface *window_surface, BOOL use_alpha }
-BOOL get_surface_rect(const RECT *visible_rect, RECT *surface_rect) -{ - RECT virtual_rect = NtUserGetVirtualScreenRect(); - - *surface_rect = *visible_rect; - - /* crop surfaces which are larger than the virtual screen rect, some applications create huge windows */ - if ((surface_rect->right - surface_rect->left > virtual_rect.right - virtual_rect.left || - surface_rect->bottom - surface_rect->top > virtual_rect.bottom - virtual_rect.top) && - !intersect_rect( surface_rect, surface_rect, &virtual_rect )) - return FALSE; - OffsetRect(surface_rect, -visible_rect->left, -visible_rect->top); - - /* round the surface coordinates to avoid re-creating them too often on resize */ - surface_rect->left &= ~127; - surface_rect->top &= ~127; - surface_rect->right = max(surface_rect->left + 128, (surface_rect->right + 127) & ~127); - surface_rect->bottom = max(surface_rect->top + 128, (surface_rect->bottom + 127) & ~127); - return TRUE; -} - - /*********************************************************************** * CreateWindowSurface (MACDRV.@) */ -BOOL macdrv_CreateWindowSurface(HWND hwnd, UINT swp_flags, const RECT *visible_rect, struct window_surface **surface) +BOOL macdrv_CreateWindowSurface(HWND hwnd, UINT swp_flags, const RECT *surface_rect, struct window_surface **surface) { struct macdrv_win_data *data; DWORD style = NtUserGetWindowLongW(hwnd, GWL_STYLE); - RECT surface_rect;
- TRACE("hwnd %p, swp_flags %08x, visible %s, surface %p\n", hwnd, swp_flags, wine_dbgstr_rect(visible_rect), surface); + TRACE("hwnd %p, swp_flags %08x, surface_rect %s, surface %p\n", hwnd, swp_flags, wine_dbgstr_rect(surface_rect), surface);
if (!(data = get_win_data(hwnd))) return TRUE; /* use default surface */ - if (!get_surface_rect( visible_rect, &surface_rect )) goto done; /* use default surface */
if (*surface) window_surface_release(*surface); *surface = NULL;
if (data->surface) { - if (EqualRect(&data->surface->rect, &surface_rect)) + if (EqualRect(&data->surface->rect, surface_rect)) { /* existing surface is good enough */ window_surface_add_ref(data->surface); @@ -276,7 +252,7 @@ BOOL macdrv_CreateWindowSurface(HWND hwnd, UINT swp_flags, const RECT *visible_r } else if (!(swp_flags & SWP_SHOWWINDOW) && !(style & WS_VISIBLE)) goto done;
- *surface = create_surface(data->hwnd, data->cocoa_window, &surface_rect, data->surface, FALSE); + *surface = create_surface(data->hwnd, data->cocoa_window, surface_rect, data->surface, FALSE);
done: release_win_data(data); diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index 0f38d96523e..36f3e3053d6 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -1951,7 +1951,6 @@ BOOL macdrv_WindowPosChanging(HWND hwnd, UINT swp_flags, const RECT *window_rect { struct macdrv_win_data *data = get_win_data(hwnd); DWORD style = NtUserGetWindowLongW(hwnd, GWL_STYLE); - RECT surface_rect; BOOL ret = FALSE;
TRACE("%p swp %04x window %s client %s visible %s\n", hwnd, @@ -1967,7 +1966,6 @@ BOOL macdrv_WindowPosChanging(HWND hwnd, UINT swp_flags, const RECT *window_rect if (!data->cocoa_window) goto done; /* use default surface */ if (swp_flags & SWP_HIDEWINDOW) goto done; /* use default surface */ if (data->ulw_layered) goto done; /* use default surface */ - if (!get_surface_rect( visible_rect, &surface_rect )) goto done; /* use default surface */
ret = TRUE;
diff --git a/dlls/winewayland.drv/waylanddrv.h b/dlls/winewayland.drv/waylanddrv.h index 28e754b6562..9cce608ce85 100644 --- a/dlls/winewayland.drv/waylanddrv.h +++ b/dlls/winewayland.drv/waylanddrv.h @@ -236,7 +236,6 @@ void wayland_output_use_xdg_extension(struct wayland_output *output); * Wayland surface */
-BOOL get_surface_rect(const RECT *visible_rect, RECT *surface_rect); struct wayland_surface *wayland_surface_create(HWND hwnd); void wayland_surface_destroy(struct wayland_surface *surface); void wayland_surface_make_toplevel(struct wayland_surface *surface); @@ -362,7 +361,7 @@ void WAYLAND_WindowPosChanged(HWND hwnd, HWND insert_after, UINT swp_flags, const RECT *visible_rect, const RECT *valid_rects, struct window_surface *surface); BOOL WAYLAND_WindowPosChanging(HWND hwnd, UINT swp_flags, const RECT *window_rect, const RECT *client_rect, RECT *visible_rect); -BOOL WAYLAND_CreateWindowSurface(HWND hwnd, UINT swp_flags, const RECT *visible_rect, struct window_surface **surface); +BOOL WAYLAND_CreateWindowSurface(HWND hwnd, UINT swp_flags, const RECT *surface_rect, struct window_surface **surface); UINT WAYLAND_VulkanInit(UINT version, void *vulkan_handle, const struct vulkan_driver_funcs **driver_funcs); struct opengl_funcs *WAYLAND_wine_get_wgl_driver(UINT version);
diff --git a/dlls/winewayland.drv/window.c b/dlls/winewayland.drv/window.c index 9d2432262b8..9a77d8cf47e 100644 --- a/dlls/winewayland.drv/window.c +++ b/dlls/winewayland.drv/window.c @@ -432,7 +432,6 @@ BOOL WAYLAND_WindowPosChanging(HWND hwnd, UINT swp_flags, const RECT *window_rec struct wayland_win_data *data = wayland_win_data_get(hwnd); HWND parent; BOOL visible, ret = FALSE; - RECT surface_rect;
TRACE("hwnd %p window %s client %s visible %s flags %08x\n", hwnd, wine_dbgstr_rect(window_rect), wine_dbgstr_rect(client_rect), @@ -446,7 +445,6 @@ BOOL WAYLAND_WindowPosChanging(HWND hwnd, UINT swp_flags, const RECT *window_rec !(swp_flags & SWP_HIDEWINDOW);
if ((parent && parent != NtUserGetDesktopWindow()) || !visible) goto done; /* use default surface */ - if (!get_surface_rect( visible_rect, &surface_rect )) goto done; /* use default surface */
ret = TRUE;
diff --git a/dlls/winewayland.drv/window_surface.c b/dlls/winewayland.drv/window_surface.c index c557bd30fe4..fa4a69d5490 100644 --- a/dlls/winewayland.drv/window_surface.c +++ b/dlls/winewayland.drv/window_surface.c @@ -521,40 +521,16 @@ void wayland_window_surface_update_wayland_surface(struct window_surface *window }
-BOOL get_surface_rect(const RECT *visible_rect, RECT *surface_rect) -{ - RECT virtual_rect = NtUserGetVirtualScreenRect(); - - *surface_rect = *visible_rect; - - /* crop surfaces which are larger than the virtual screen rect, some applications create huge windows */ - if ((surface_rect->right - surface_rect->left > virtual_rect.right - virtual_rect.left || - surface_rect->bottom - surface_rect->top > virtual_rect.bottom - virtual_rect.top) && - !intersect_rect( surface_rect, surface_rect, &virtual_rect )) - return FALSE; - OffsetRect(surface_rect, -visible_rect->left, -visible_rect->top); - - /* round the surface coordinates to avoid re-creating them too often on resize */ - surface_rect->left &= ~127; - surface_rect->top &= ~127; - surface_rect->right = max(surface_rect->left + 128, (surface_rect->right + 127) & ~127); - surface_rect->bottom = max(surface_rect->top + 128, (surface_rect->bottom + 127) & ~127); - return TRUE; -} - - /*********************************************************************** * WAYLAND_CreateWindowSurface */ -BOOL WAYLAND_CreateWindowSurface(HWND hwnd, UINT swp_flags, const RECT *visible_rect, struct window_surface **surface) +BOOL WAYLAND_CreateWindowSurface(HWND hwnd, UINT swp_flags, const RECT *surface_rect, struct window_surface **surface) { struct wayland_win_data *data; - RECT surface_rect;
- TRACE("hwnd %p, swp_flags %08x, visible %s, surface %p\n", hwnd, swp_flags, wine_dbgstr_rect(visible_rect), surface); + TRACE("hwnd %p, swp_flags %08x, surface_rect %s, surface %p\n", hwnd, swp_flags, wine_dbgstr_rect(surface_rect), surface);
if (!(data = wayland_win_data_get(hwnd))) return TRUE; /* use default surface */ - if (!get_surface_rect( visible_rect, &surface_rect )) goto done; /* use default surface */
/* Release the dummy surface wine provides for toplevels. */ if (*surface) window_surface_release(*surface); @@ -562,7 +538,7 @@ BOOL WAYLAND_CreateWindowSurface(HWND hwnd, UINT swp_flags, const RECT *visible_
/* Check if we can reuse our current window surface. */ if (data->window_surface && - EqualRect(&data->window_surface->rect, &surface_rect)) + EqualRect(&data->window_surface->rect, surface_rect)) { window_surface_add_ref(data->window_surface); *surface = data->window_surface; @@ -570,7 +546,7 @@ BOOL WAYLAND_CreateWindowSurface(HWND hwnd, UINT swp_flags, const RECT *visible_ goto done; }
- *surface = wayland_window_surface_create(data->hwnd, &surface_rect); + *surface = wayland_window_surface_create(data->hwnd, surface_rect);
done: wayland_win_data_release(data); diff --git a/dlls/winex11.drv/bitblt.c b/dlls/winex11.drv/bitblt.c index 715d263028f..11d37f6bb15 100644 --- a/dlls/winex11.drv/bitblt.c +++ b/dlls/winex11.drv/bitblt.c @@ -2184,40 +2184,17 @@ HRGN expose_surface( struct window_surface *window_surface, const RECT *rect ) }
-BOOL get_surface_rect( const RECT *visible_rect, RECT *surface_rect ) -{ - RECT virtual_rect = NtUserGetVirtualScreenRect(); - - *surface_rect = *visible_rect; - - /* crop surfaces which are larger than the virtual screen rect, some applications create huge windows */ - if ((surface_rect->right - surface_rect->left > virtual_rect.right - virtual_rect.left || - surface_rect->bottom - surface_rect->top > virtual_rect.bottom - virtual_rect.top) && - !intersect_rect( surface_rect, surface_rect, &virtual_rect )) - return FALSE; - OffsetRect( surface_rect, -visible_rect->left, -visible_rect->top ); - - /* round the surface coordinates to avoid re-creating them too often on resize */ - surface_rect->left &= ~31; - surface_rect->top &= ~31; - surface_rect->right = max( surface_rect->left + 32, (surface_rect->right + 31) & ~31 ); - surface_rect->bottom = max( surface_rect->top + 32, (surface_rect->bottom + 31) & ~31 ); - return TRUE; -} - - /*********************************************************************** * CreateWindowSurface (X11DRV.@) */ -BOOL X11DRV_CreateWindowSurface( HWND hwnd, UINT swp_flags, const RECT *visible_rect, struct window_surface **surface ) +BOOL X11DRV_CreateWindowSurface( HWND hwnd, UINT swp_flags, const RECT *surface_rect, struct window_surface **surface ) { struct x11drv_win_data *data; - RECT surface_rect; DWORD flags; COLORREF key; BOOL layered = NtUserGetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_LAYERED;
- TRACE( "hwnd %p, swp_flags %08x, visible %s, surface %p\n", hwnd, swp_flags, wine_dbgstr_rect( visible_rect ), surface ); + TRACE( "hwnd %p, swp_flags %08x, surface_rect %s, surface %p\n", hwnd, swp_flags, wine_dbgstr_rect( surface_rect ), surface );
if (!(data = get_win_data( hwnd ))) return TRUE; /* use default surface */
@@ -2229,10 +2206,9 @@ BOOL X11DRV_CreateWindowSurface( HWND hwnd, UINT swp_flags, const RECT *visible_ if (data->client_window) goto done; /* draw directly to the window */ if (!client_side_graphics && !layered) goto done; /* draw directly to the window */
- if (!get_surface_rect( visible_rect, &surface_rect )) goto done; if (data->surface) { - if (EqualRect( &data->surface->rect, &surface_rect )) + if (EqualRect( &data->surface->rect, surface_rect )) { /* existing surface is good enough */ window_surface_add_ref( data->surface ); @@ -2245,7 +2221,7 @@ BOOL X11DRV_CreateWindowSurface( HWND hwnd, UINT swp_flags, const RECT *visible_ if (!layered || !NtUserGetLayeredWindowAttributes( hwnd, &key, NULL, &flags ) || !(flags & LWA_COLORKEY)) key = CLR_INVALID;
- *surface = create_surface( data->hwnd, data->whole_window, &data->vis, &surface_rect, key, FALSE ); + *surface = create_surface( data->hwnd, data->whole_window, &data->vis, surface_rect, key, FALSE );
done: release_win_data( data ); diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index bdf5d2a3b7b..9564f05f8e9 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2582,7 +2582,6 @@ done: BOOL X11DRV_WindowPosChanging( HWND hwnd, UINT swp_flags, const RECT *window_rect, const RECT *client_rect, RECT *visible_rect ) { struct x11drv_win_data *data = get_win_data( hwnd ); - RECT surface_rect; BOOL ret = FALSE;
if (!data && !(data = X11DRV_create_win_data( hwnd, window_rect, client_rect ))) return FALSE; /* use default surface */ @@ -2602,7 +2601,6 @@ BOOL X11DRV_WindowPosChanging( HWND hwnd, UINT swp_flags, const RECT *window_rec if (!data->whole_window && !data->embedded) goto done; /* use default surface */ if (swp_flags & SWP_HIDEWINDOW) goto done; /* use default surface */ if (data->use_alpha) goto done; /* use default surface */ - if (!get_surface_rect( visible_rect, &surface_rect )) goto done; /* use default surface */
ret = TRUE;
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 3ac86d32669..8b78f9648b2 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -246,7 +246,7 @@ extern void X11DRV_UpdateLayeredWindow( HWND hwnd, const RECT *window_rect, COLO BYTE alpha, UINT flags ); extern LRESULT X11DRV_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ); extern BOOL X11DRV_WindowPosChanging( HWND hwnd, UINT swp_flags, const RECT *window_rect, const RECT *client_rect, RECT *visible_rect ); -extern BOOL X11DRV_CreateWindowSurface( HWND hwnd, UINT swp_flags, const RECT *visible_rect, struct window_surface **surface ); +extern BOOL X11DRV_CreateWindowSurface( HWND hwnd, UINT swp_flags, const RECT *surface_rect, struct window_surface **surface ); extern void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, const RECT *rectWindow, const RECT *rectClient, const RECT *visible_rect, const RECT *valid_rects, @@ -685,7 +685,6 @@ typedef int (*x11drv_error_callback)( Display *display, XErrorEvent *event, void
extern void X11DRV_expect_error( Display *display, x11drv_error_callback callback, void *arg ); extern int X11DRV_check_error(void); -extern BOOL get_surface_rect( const RECT *visible_rect, RECT *surface_rect ); extern void X11DRV_X_to_window_rect( struct x11drv_win_data *data, RECT *rect, int x, int y, int cx, int cy ); extern POINT virtual_screen_to_root( INT x, INT y ); extern POINT root_to_virtual_screen( INT x, INT y );