From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winex11.drv/bitblt.c | 100 +++++++++++++++++++++++++++++++++++++- dlls/winex11.drv/window.c | 82 ------------------------------- dlls/winex11.drv/x11drv.h | 2 - 3 files changed, 98 insertions(+), 86 deletions(-)
diff --git a/dlls/winex11.drv/bitblt.c b/dlls/winex11.drv/bitblt.c index 11ba34739c3..4fce6cbd363 100644 --- a/dlls/winex11.drv/bitblt.c +++ b/dlls/winex11.drv/bitblt.c @@ -2054,8 +2054,8 @@ static const struct window_surface_funcs x11drv_surface_funcs = /*********************************************************************** * create_surface */ -struct window_surface *create_surface( HWND hwnd, Window window, const XVisualInfo *vis, const RECT *rect, - COLORREF color_key, BOOL use_alpha ) +static struct window_surface *create_surface( HWND hwnd, Window window, const XVisualInfo *vis, const RECT *rect, + COLORREF color_key, BOOL use_alpha ) { const XPixmapFormatValues *format = pixmap_formats[vis->depth]; char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )]; @@ -2182,3 +2182,99 @@ HRGN expose_surface( struct window_surface *window_surface, const RECT *rect ) window_surface_unlock( window_surface ); return region; } + + +static BOOL get_surface_rect( const RECT *visible_rect, RECT *surface_rect ) +{ + *surface_rect = NtUserGetVirtualScreenRect(); + + if (!intersect_rect( surface_rect, surface_rect, visible_rect )) return FALSE; + OffsetRect( surface_rect, -visible_rect->left, -visible_rect->top ); + 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 ) +{ + 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 ); + + if (!(data = get_win_data( hwnd ))) return TRUE; /* use default surface */ + + if (*surface) window_surface_release( *surface ); + *surface = NULL; /* indicate that we want to draw directly to the window */ + + if (data->embedded) goto done; /* draw directly to the window */ + if (data->whole_window == root_window) goto done; /* draw directly to the window */ + 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 )) + { + /* existing surface is good enough */ + window_surface_add_ref( data->surface ); + *surface = data->surface; + goto done; + } + } + else if (!(swp_flags & SWP_SHOWWINDOW) && !(NtUserGetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE)) goto done; + + 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 ); + +done: + release_win_data( data ); + return TRUE; +} + + +/***************************************************************************** + * CreateLayeredWindow (X11DRV.@) + */ +BOOL X11DRV_CreateLayeredWindow( HWND hwnd, const RECT *window_rect, COLORREF color_key, + struct window_surface **window_surface ) +{ + struct window_surface *surface; + struct x11drv_win_data *data; + RECT rect; + + if (!(data = get_win_data( hwnd ))) return FALSE; + + data->layered = TRUE; + if (!data->embedded && argb_visual.visualid) set_window_visual( data, &argb_visual, TRUE ); + + rect = *window_rect; + OffsetRect( &rect, -window_rect->left, -window_rect->top ); + + surface = data->surface; + if (!surface || !EqualRect( &surface->rect, &rect )) + { + data->surface = create_surface( data->hwnd, data->whole_window, &data->vis, &rect, + color_key, data->use_alpha ); + if (surface) window_surface_release( surface ); + surface = data->surface; + } + else set_surface_color_key( surface, color_key ); + + if ((*window_surface = surface)) window_surface_add_ref( surface ); + release_win_data( data ); + + return TRUE; +} diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 74a9a4f6d68..c3455d5301f 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2626,53 +2626,6 @@ done: }
-/*********************************************************************** - * CreateWindowSurface (X11DRV.@) - */ -BOOL X11DRV_CreateWindowSurface( HWND hwnd, UINT swp_flags, const RECT *visible_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 ); - - if (!(data = get_win_data( hwnd ))) return TRUE; /* use default surface */ - - if (*surface) window_surface_release( *surface ); - *surface = NULL; /* indicate that we want to draw directly to the window */ - - if (data->embedded) goto done; /* draw directly to the window */ - if (data->whole_window == root_window) goto done; /* draw directly to the window */ - 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 )) - { - /* existing surface is good enough */ - window_surface_add_ref( data->surface ); - *surface = data->surface; - goto done; - } - } - else if (!(swp_flags & SWP_SHOWWINDOW) && !(NtUserGetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE)) goto done; - - 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 ); - -done: - release_win_data( data ); - return TRUE; -} - - /*********************************************************************** * WindowPosChanged (X11DRV.@) */ @@ -2983,41 +2936,6 @@ void X11DRV_SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha, DWO }
-/***************************************************************************** - * CreateLayeredWindow (X11DRV.@) - */ -BOOL X11DRV_CreateLayeredWindow( HWND hwnd, const RECT *window_rect, COLORREF color_key, - struct window_surface **window_surface ) -{ - struct window_surface *surface; - struct x11drv_win_data *data; - RECT rect; - - if (!(data = get_win_data( hwnd ))) return FALSE; - - data->layered = TRUE; - if (!data->embedded && argb_visual.visualid) set_window_visual( data, &argb_visual, TRUE ); - - rect = *window_rect; - OffsetRect( &rect, -window_rect->left, -window_rect->top ); - - surface = data->surface; - if (!surface || !EqualRect( &surface->rect, &rect )) - { - data->surface = create_surface( data->hwnd, data->whole_window, &data->vis, &rect, - color_key, data->use_alpha ); - if (surface) window_surface_release( surface ); - surface = data->surface; - } - else set_surface_color_key( surface, color_key ); - - if ((*window_surface = surface)) window_surface_add_ref( surface ); - release_win_data( data ); - - return TRUE; -} - - /*********************************************************************** * UpdateLayeredWindow (X11DRV.@) */ diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 49fb17fc7cd..523cdfc23dc 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -266,8 +266,6 @@ extern Pixmap create_pixmap_from_image( HDC hdc, const XVisualInfo *vis, const B const struct gdi_image_bits *bits, UINT coloruse ); extern DWORD get_pixmap_image( Pixmap pixmap, int width, int height, const XVisualInfo *vis, BITMAPINFO *info, struct gdi_image_bits *bits ); -extern struct window_surface *create_surface( HWND hwnd, Window window, const XVisualInfo *vis, const RECT *rect, - COLORREF color_key, BOOL use_alpha ); extern void set_surface_color_key( struct window_surface *window_surface, COLORREF color_key ); extern HRGN expose_surface( struct window_surface *window_surface, const RECT *rect );
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winemac.drv/macdrv.h | 3 -- dlls/winemac.drv/surface.c | 98 ++++++++++++++++++++++++++++++++++++-- dlls/winemac.drv/window.c | 96 ++----------------------------------- 3 files changed, 98 insertions(+), 99 deletions(-)
diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index 31835164e71..811947f723c 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -207,10 +207,7 @@ extern BOOL macdrv_SystemParametersInfo(UINT action, UINT int_param, void *ptr_p extern macdrv_window macdrv_get_cocoa_window(HWND hwnd, BOOL require_on_screen); extern RGNDATA *get_region_data(HRGN hrgn, HDC hdc_lptodp); extern void activate_on_following_focus(void); -extern struct window_surface *create_surface(HWND hwnd, macdrv_window window, const RECT *rect, - struct window_surface *old_surface, BOOL use_alpha); extern void set_surface_use_alpha(struct window_surface *window_surface, BOOL use_alpha); -extern void surface_clip_to_visible_rect(struct window_surface *window_surface, const RECT *visible_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 37e2c466926..02421904986 100644 --- a/dlls/winemac.drv/surface.c +++ b/dlls/winemac.drv/surface.c @@ -127,8 +127,8 @@ static struct macdrv_window_surface *get_mac_surface(struct window_surface *surf /*********************************************************************** * create_surface */ -struct window_surface *create_surface(HWND hwnd, macdrv_window window, const RECT *rect, - struct window_surface *old_surface, BOOL use_alpha) +static struct window_surface *create_surface(HWND hwnd, macdrv_window window, const RECT *rect, + struct window_surface *old_surface, BOOL use_alpha) { struct macdrv_window_surface *surface; int width = rect->right - rect->left, height = rect->bottom - rect->top; @@ -265,7 +265,7 @@ done: * Intersect the accumulated drawn region with a new visible rect, * effectively discarding stale drawing in the surface slack area. */ -void surface_clip_to_visible_rect(struct window_surface *window_surface, const RECT *visible_rect) +static void surface_clip_to_visible_rect(struct window_surface *window_surface, const RECT *visible_rect) { struct macdrv_window_surface *surface = get_mac_surface(window_surface); RECT rect = *visible_rect; @@ -277,3 +277,95 @@ void surface_clip_to_visible_rect(struct window_surface *window_surface, const R intersect_rect(&window_surface->bounds, &window_surface->bounds, &rect); window_surface_unlock(window_surface); } + + +static RECT get_surface_rect(const RECT *visible_rect) +{ + RECT rect = *visible_rect; + + OffsetRect(&rect, -visible_rect->left, -visible_rect->top); + rect.left &= ~127; + rect.top &= ~127; + rect.right = max(rect.left + 128, (rect.right + 127) & ~127); + rect.bottom = max(rect.top + 128, (rect.bottom + 127) & ~127); + return rect; +} + + +/*********************************************************************** + * CreateWindowSurface (MACDRV.@) + */ +BOOL macdrv_CreateWindowSurface(HWND hwnd, UINT swp_flags, const RECT *visible_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); + + if (!(data = get_win_data(hwnd))) return TRUE; /* use default surface */ + + if (*surface) window_surface_release(*surface); + *surface = NULL; + + surface_rect = get_surface_rect(visible_rect); + if (data->surface) + { + if (EqualRect(&data->surface->rect, &surface_rect)) + { + /* existing surface is good enough */ + surface_clip_to_visible_rect(data->surface, visible_rect); + window_surface_add_ref(data->surface); + *surface = data->surface; + goto done; + } + } + else if (!(swp_flags & SWP_SHOWWINDOW) && !(style & WS_VISIBLE)) goto done; + + *surface = create_surface(data->hwnd, data->cocoa_window, &surface_rect, data->surface, FALSE); + +done: + release_win_data(data); + return TRUE; +} + + +/*********************************************************************** + * CreateLayeredWindow (MACDRV.@) + */ +BOOL macdrv_CreateLayeredWindow(HWND hwnd, const RECT *window_rect, COLORREF color_key, + struct window_surface **window_surface) +{ + struct window_surface *surface; + struct macdrv_win_data *data; + RECT rect; + + if (!(data = get_win_data(hwnd))) return FALSE; + + data->layered = TRUE; + data->ulw_layered = TRUE; + + rect = *window_rect; + OffsetRect(&rect, -window_rect->left, -window_rect->top); + + surface = data->surface; + if (!surface || !EqualRect(&surface->rect, &rect)) + { + data->surface = create_surface(data->hwnd, data->cocoa_window, &rect, NULL, TRUE); + macdrv_set_window_surface(data->cocoa_window, data->surface); + if (surface) window_surface_release(surface); + surface = data->surface; + if (data->unminimized_surface) + { + window_surface_release(data->unminimized_surface); + data->unminimized_surface = NULL; + } + } + else set_surface_use_alpha(surface, TRUE); + + if ((*window_surface = surface)) window_surface_add_ref(surface); + + release_win_data(data); + + return TRUE; +} diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index 012189249a4..7c40af2ee28 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -1890,46 +1890,6 @@ done: }
-/*********************************************************************** - * CreateLayeredWindow (MACDRV.@) - */ -BOOL macdrv_CreateLayeredWindow(HWND hwnd, const RECT *window_rect, COLORREF color_key, - struct window_surface **window_surface) -{ - struct window_surface *surface; - struct macdrv_win_data *data; - RECT rect; - - if (!(data = get_win_data(hwnd))) return FALSE; - - data->layered = TRUE; - data->ulw_layered = TRUE; - - rect = *window_rect; - OffsetRect(&rect, -window_rect->left, -window_rect->top); - - surface = data->surface; - if (!surface || !EqualRect(&surface->rect, &rect)) - { - data->surface = create_surface(data->hwnd, data->cocoa_window, &rect, NULL, TRUE); - macdrv_set_window_surface(data->cocoa_window, data->surface); - if (surface) window_surface_release(surface); - surface = data->surface; - if (data->unminimized_surface) - { - window_surface_release(data->unminimized_surface); - data->unminimized_surface = NULL; - } - } - else set_surface_use_alpha(surface, TRUE); - - if ((*window_surface = surface)) window_surface_add_ref(surface); - - release_win_data(data); - - return TRUE; -} - /*********************************************************************** * UpdateLayeredWindow (MACDRV.@) */ @@ -1940,12 +1900,13 @@ void macdrv_UpdateLayeredWindow(HWND hwnd, const RECT *window_rect, COLORREF col
if ((data = get_win_data(hwnd))) { + /* The ULW flags are a superset of the LWA flags. */ + sync_window_opacity(data, color_key, 255, TRUE, flags); + /* Since layered attributes are now set, can now show the window */ if (data->cocoa_window && !data->on_screen && NtUserGetWindowLongW(hwnd, GWL_STYLE) & WS_VISIBLE) show_window(data);
- /* The ULW flags are a superset of the LWA flags. */ - sync_window_opacity(data, color_key, 255, TRUE, flags); release_win_data(data); } } @@ -1984,19 +1945,6 @@ LRESULT macdrv_WindowMessage(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) }
-static inline RECT get_surface_rect(const RECT *visible_rect) -{ - RECT rect = *visible_rect; - - OffsetRect(&rect, -visible_rect->left, -visible_rect->top); - rect.left &= ~127; - rect.top &= ~127; - rect.right = max(rect.left + 128, (rect.right + 127) & ~127); - rect.bottom = max(rect.top + 128, (rect.bottom + 127) & ~127); - return rect; -} - - /*********************************************************************** * WindowPosChanging (MACDRV.@) */ @@ -2028,44 +1976,6 @@ done: }
-/*********************************************************************** - * CreateWindowSurface (MACDRV.@) - */ -BOOL macdrv_CreateWindowSurface(HWND hwnd, UINT swp_flags, const RECT *visible_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); - - if (!(data = get_win_data(hwnd))) return TRUE; /* use default surface */ - - if (*surface) window_surface_release(*surface); - *surface = NULL; - - surface_rect = get_surface_rect(visible_rect); - if (data->surface) - { - if (EqualRect(&data->surface->rect, &surface_rect)) - { - /* existing surface is good enough */ - surface_clip_to_visible_rect(data->surface, visible_rect); - window_surface_add_ref(data->surface); - *surface = data->surface; - goto done; - } - } - else if (!(swp_flags & SWP_SHOWWINDOW) && !(style & WS_VISIBLE)) goto done; - - *surface = create_surface(data->hwnd, data->cocoa_window, &surface_rect, data->surface, FALSE); - -done: - release_win_data(data); - return TRUE; -} - - /*********************************************************************** * WindowPosChanged (MACDRV.@) */
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winewayland.drv/waylanddrv.h | 25 +++++++++++- dlls/winewayland.drv/window.c | 57 +-------------------------- dlls/winewayland.drv/window_surface.c | 39 +++++++++++++++++- 3 files changed, 64 insertions(+), 57 deletions(-)
diff --git a/dlls/winewayland.drv/waylanddrv.h b/dlls/winewayland.drv/waylanddrv.h index 4b92c9bf1ba..d0a8977f887 100644 --- a/dlls/winewayland.drv/waylanddrv.h +++ b/dlls/winewayland.drv/waylanddrv.h @@ -272,11 +272,34 @@ void wayland_shm_buffer_unref(struct wayland_shm_buffer *shm_buffer); * Wayland window surface */
-struct window_surface *wayland_window_surface_create(HWND hwnd, const RECT *rect); void wayland_window_surface_update_wayland_surface(struct window_surface *surface, struct wayland_surface *wayland_surface); void wayland_window_flush(HWND hwnd);
+/********************************************************************** + * Wayland Window + */ + +/* private window data */ +struct wayland_win_data +{ + struct rb_entry entry; + /* hwnd that this private data belongs to */ + HWND hwnd; + /* wayland surface (if any) for this window */ + struct wayland_surface *wayland_surface; + /* wine window_surface backing this window */ + struct window_surface *window_surface; + /* USER window rectangle relative to win32 parent window client area */ + RECT window_rect; + /* USER client rectangle relative to win32 parent window client area */ + RECT client_rect; + BOOL managed; +}; + +struct wayland_win_data *wayland_win_data_get(HWND hwnd); +void wayland_win_data_release(struct wayland_win_data *data); + /********************************************************************** * Wayland Keyboard */ diff --git a/dlls/winewayland.drv/window.c b/dlls/winewayland.drv/window.c index c006505bc90..060a25d50c6 100644 --- a/dlls/winewayland.drv/window.c +++ b/dlls/winewayland.drv/window.c @@ -56,23 +56,6 @@ static BOOL set_window_pos(HWND hwnd, HWND after, INT x, INT y, INT cx, INT cy, }
-/* private window data */ -struct wayland_win_data -{ - struct rb_entry entry; - /* hwnd that this private data belongs to */ - HWND hwnd; - /* wayland surface (if any) for this window */ - struct wayland_surface *wayland_surface; - /* wine window_surface backing this window */ - struct window_surface *window_surface; - /* USER window rectangle relative to win32 parent window client area */ - RECT window_rect; - /* USER client rectangle relative to win32 parent window client area */ - RECT client_rect; - BOOL managed; -}; - static int wayland_win_data_cmp_rb(const void *key, const struct rb_entry *entry) { @@ -153,7 +136,7 @@ static void wayland_win_data_destroy(struct wayland_win_data *data) * * Lock and return the data structure associated with a window. */ -static struct wayland_win_data *wayland_win_data_get(HWND hwnd) +struct wayland_win_data *wayland_win_data_get(HWND hwnd) { struct rb_entry *rb_entry;
@@ -172,7 +155,7 @@ static struct wayland_win_data *wayland_win_data_get(HWND hwnd) * * Release the data returned by wayland_win_data_get. */ -static void wayland_win_data_release(struct wayland_win_data *data) +void wayland_win_data_release(struct wayland_win_data *data) { assert(data); pthread_mutex_unlock(&win_data_mutex); @@ -471,42 +454,6 @@ done: }
-/*********************************************************************** - * WAYLAND_CreateWindowSurface - */ -BOOL WAYLAND_CreateWindowSurface(HWND hwnd, UINT swp_flags, const RECT *visible_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); - - if (!(data = wayland_win_data_get(hwnd))) return TRUE; /* use default surface */ - - /* Release the dummy surface wine provides for toplevels. */ - if (*surface) window_surface_release(*surface); - *surface = NULL; - - surface_rect = *visible_rect; - OffsetRect(&surface_rect, -surface_rect.left, -surface_rect.top); - - /* Check if we can reuse our current window surface. */ - if (data->window_surface && - EqualRect(&data->window_surface->rect, &surface_rect)) - { - window_surface_add_ref(data->window_surface); - *surface = data->window_surface; - TRACE("reusing surface %p\n", *surface); - goto done; - } - - *surface = wayland_window_surface_create(data->hwnd, &surface_rect); - -done: - wayland_win_data_release(data); - return TRUE; -} - /*********************************************************************** * WAYLAND_WindowPosChanged */ diff --git a/dlls/winewayland.drv/window_surface.c b/dlls/winewayland.drv/window_surface.c index 888fa74c085..9377b05b4ce 100644 --- a/dlls/winewayland.drv/window_surface.c +++ b/dlls/winewayland.drv/window_surface.c @@ -449,7 +449,7 @@ static const struct window_surface_funcs wayland_window_surface_funcs = /*********************************************************************** * wayland_window_surface_create */ -struct window_surface *wayland_window_surface_create(HWND hwnd, const RECT *rect) +static struct window_surface *wayland_window_surface_create(HWND hwnd, const RECT *rect) { char buffer[FIELD_OFFSET(BITMAPINFO, bmiColors[256])]; BITMAPINFO *info = (BITMAPINFO *)buffer; @@ -516,3 +516,40 @@ void wayland_window_surface_update_wayland_surface(struct window_surface *window
window_surface_unlock(window_surface); } + + +/*********************************************************************** + * WAYLAND_CreateWindowSurface + */ +BOOL WAYLAND_CreateWindowSurface(HWND hwnd, UINT swp_flags, const RECT *visible_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); + + if (!(data = wayland_win_data_get(hwnd))) return TRUE; /* use default surface */ + + /* Release the dummy surface wine provides for toplevels. */ + if (*surface) window_surface_release(*surface); + *surface = NULL; + + surface_rect = *visible_rect; + OffsetRect(&surface_rect, -surface_rect.left, -surface_rect.top); + + /* Check if we can reuse our current window surface. */ + if (data->window_surface && + EqualRect(&data->window_surface->rect, &surface_rect)) + { + window_surface_add_ref(data->window_surface); + *surface = data->window_surface; + TRACE("reusing surface %p\n", *surface); + goto done; + } + + *surface = wayland_window_surface_create(data->hwnd, &surface_rect); + +done: + wayland_win_data_release(data); + return TRUE; +}
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/driver.c | 2 +- dlls/win32u/window.c | 9 ++++++--- dlls/wineandroid.drv/android.h | 2 +- dlls/wineandroid.drv/window.c | 7 ++----- dlls/winemac.drv/macdrv.h | 2 +- dlls/winemac.drv/surface.c | 6 ++---- dlls/winemac.drv/window.c | 1 - dlls/winewayland.drv/waylanddrv.h | 2 +- dlls/winewayland.drv/window.c | 8 ++------ dlls/winewayland.drv/window_surface.c | 4 ++-- dlls/winex11.drv/bitblt.c | 5 ++--- dlls/winex11.drv/window.c | 1 - dlls/winex11.drv/x11drv.h | 2 +- include/wine/gdi_driver.h | 2 +- 14 files changed, 22 insertions(+), 31 deletions(-)
diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c index 723270f1453..f4d07697444 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, const RECT *visible_rect, struct window_surface **surface ) { return FALSE; } diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index caa3b3aa323..994ad204109 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -1794,7 +1794,11 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, 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 (!user_driver->pWindowPosChanging( hwnd, swp_flags, window_rect, client_rect, &visible_rect )) needs_surface = FALSE; + else if (IsRectEmpty( &visible_rect )) needs_surface = FALSE; + else if (swp_flags & SWP_HIDEWINDOW) needs_surface = FALSE; + else if (swp_flags & SWP_SHOWWINDOW) needs_surface = TRUE; + else needs_surface = !!(NtUserGetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE);
if (!parent || parent == get_desktop_window()) { @@ -1802,8 +1806,7 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, window_surface_add_ref( new_surface ); }
- 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 ); + if (needs_surface) needs_surface = !user_driver->pCreateWindowSurface( hwnd, &visible_rect, &new_surface );
get_window_rects( hwnd, COORDS_SCREEN, &old_window_rect, NULL, get_thread_dpi() ); if (IsRectEmpty( &valid_rects[0] )) valid_rects = NULL; diff --git a/dlls/wineandroid.drv/android.h b/dlls/wineandroid.drv/android.h index 72be3c4f5a8..9cdaf88f174 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, const RECT *visible_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 764b202d6e5..fed4d941c77 100644 --- a/dlls/wineandroid.drv/window.c +++ b/dlls/wineandroid.drv/window.c @@ -1149,7 +1149,6 @@ BOOL ANDROID_WindowPosChanging( HWND hwnd, UINT swp_flags, const RECT *window_re if (!data && !(data = create_win_data( hwnd, window_rect, client_rect ))) return FALSE; /* use default surface */
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 */
@@ -1164,7 +1163,7 @@ done: /*********************************************************************** * ANDROID_CreateWindowSurface */ -BOOL ANDROID_CreateWindowSurface( HWND hwnd, UINT swp_flags, const RECT *visible_rect, struct window_surface **surface ) +BOOL ANDROID_CreateWindowSurface( HWND hwnd, const RECT *visible_rect, struct window_surface **surface ) { struct android_win_data *data; RECT surface_rect; @@ -1173,7 +1172,7 @@ BOOL ANDROID_CreateWindowSurface( HWND hwnd, UINT swp_flags, const RECT *visible 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, visible %s, surface %p\n", hwnd, wine_dbgstr_rect( visible_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 */ @@ -1189,8 +1188,6 @@ BOOL ANDROID_CreateWindowSurface( HWND hwnd, UINT swp_flags, const RECT *visible goto done; } } - if (!(swp_flags & SWP_SHOWWINDOW) && !(NtUserGetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE)) - goto done;
if (!layered || !NtUserGetLayeredWindowAttributes( hwnd, &key, &alpha, &flags )) flags = 0; if (!(flags & LWA_ALPHA)) alpha = 255; diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index 811947f723c..93d549afd95 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, const RECT *visible_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, diff --git a/dlls/winemac.drv/surface.c b/dlls/winemac.drv/surface.c index 02421904986..8bc4d012f5f 100644 --- a/dlls/winemac.drv/surface.c +++ b/dlls/winemac.drv/surface.c @@ -295,13 +295,12 @@ static RECT get_surface_rect(const RECT *visible_rect) /*********************************************************************** * CreateWindowSurface (MACDRV.@) */ -BOOL macdrv_CreateWindowSurface(HWND hwnd, UINT swp_flags, const RECT *visible_rect, struct window_surface **surface) +BOOL macdrv_CreateWindowSurface(HWND hwnd, const RECT *visible_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, visible %s, surface %p\n", hwnd, wine_dbgstr_rect(visible_rect), surface);
if (!(data = get_win_data(hwnd))) return TRUE; /* use default surface */
@@ -320,7 +319,6 @@ BOOL macdrv_CreateWindowSurface(HWND hwnd, UINT swp_flags, const RECT *visible_r goto done; } } - else if (!(swp_flags & SWP_SHOWWINDOW) && !(style & WS_VISIBLE)) goto done;
*surface = create_surface(data->hwnd, data->cocoa_window, &surface_rect, data->surface, FALSE);
diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index 7c40af2ee28..9c35e76aff0 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -1965,7 +1965,6 @@ BOOL macdrv_WindowPosChanging(HWND hwnd, UINT swp_flags, const RECT *window_rect wine_dbgstr_rect(visible_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 */
ret = TRUE; diff --git a/dlls/winewayland.drv/waylanddrv.h b/dlls/winewayland.drv/waylanddrv.h index d0a8977f887..d8d56b0873c 100644 --- a/dlls/winewayland.drv/waylanddrv.h +++ b/dlls/winewayland.drv/waylanddrv.h @@ -361,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, const RECT *visible_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 060a25d50c6..71840eefa3b 100644 --- a/dlls/winewayland.drv/window.c +++ b/dlls/winewayland.drv/window.c @@ -431,7 +431,7 @@ 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; + BOOL ret = FALSE;
TRACE("hwnd %p window %s client %s visible %s flags %08x\n", hwnd, wine_dbgstr_rect(window_rect), wine_dbgstr_rect(client_rect), @@ -440,11 +440,7 @@ BOOL WAYLAND_WindowPosChanging(HWND hwnd, UINT swp_flags, const RECT *window_rec if (!data && !(data = wayland_win_data_create(hwnd, window_rect, client_rect))) return FALSE; /* use default surface */
parent = NtUserGetAncestor(hwnd, GA_PARENT); - visible = ((NtUserGetWindowLongW(hwnd, GWL_STYLE) & WS_VISIBLE) || - (swp_flags & SWP_SHOWWINDOW)) && - !(swp_flags & SWP_HIDEWINDOW); - - if ((parent && parent != NtUserGetDesktopWindow()) || !visible) goto done; /* use default surface */ + if ((parent && parent != NtUserGetDesktopWindow())) goto done; /* use default surface */
ret = TRUE;
diff --git a/dlls/winewayland.drv/window_surface.c b/dlls/winewayland.drv/window_surface.c index 9377b05b4ce..84dba7c1882 100644 --- a/dlls/winewayland.drv/window_surface.c +++ b/dlls/winewayland.drv/window_surface.c @@ -521,12 +521,12 @@ void wayland_window_surface_update_wayland_surface(struct window_surface *window /*********************************************************************** * WAYLAND_CreateWindowSurface */ -BOOL WAYLAND_CreateWindowSurface(HWND hwnd, UINT swp_flags, const RECT *visible_rect, struct window_surface **surface) +BOOL WAYLAND_CreateWindowSurface(HWND hwnd, const RECT *visible_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, visible %s, surface %p\n", hwnd, wine_dbgstr_rect(visible_rect), surface);
if (!(data = wayland_win_data_get(hwnd))) return TRUE; /* use default surface */
diff --git a/dlls/winex11.drv/bitblt.c b/dlls/winex11.drv/bitblt.c index 4fce6cbd363..79b62bb163f 100644 --- a/dlls/winex11.drv/bitblt.c +++ b/dlls/winex11.drv/bitblt.c @@ -2201,7 +2201,7 @@ static BOOL get_surface_rect( const RECT *visible_rect, RECT *surface_rect ) /*********************************************************************** * CreateWindowSurface (X11DRV.@) */ -BOOL X11DRV_CreateWindowSurface( HWND hwnd, UINT swp_flags, const RECT *visible_rect, struct window_surface **surface ) +BOOL X11DRV_CreateWindowSurface( HWND hwnd, const RECT *visible_rect, struct window_surface **surface ) { struct x11drv_win_data *data; RECT surface_rect; @@ -2209,7 +2209,7 @@ BOOL X11DRV_CreateWindowSurface( HWND hwnd, UINT swp_flags, const RECT *visible_ 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, visible %s, surface %p\n", hwnd, wine_dbgstr_rect( visible_rect ), surface );
if (!(data = get_win_data( hwnd ))) return TRUE; /* use default surface */
@@ -2232,7 +2232,6 @@ BOOL X11DRV_CreateWindowSurface( HWND hwnd, UINT swp_flags, const RECT *visible_ goto done; } } - else if (!(swp_flags & SWP_SHOWWINDOW) && !(NtUserGetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE)) goto done;
if (!layered || !NtUserGetLayeredWindowAttributes( hwnd, &key, NULL, &flags ) || !(flags & LWA_COLORKEY)) key = CLR_INVALID; diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index c3455d5301f..24a0aa8e523 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2614,7 +2614,6 @@ BOOL X11DRV_WindowPosChanging( HWND hwnd, UINT swp_flags, const RECT *window_rec X11DRV_window_to_X_rect( data, visible_rect, window_rect, client_rect );
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 */
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 523cdfc23dc..4fd62f7c219 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, const RECT *visible_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, diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index 5ee77e25f28..a71acb6965c 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -338,7 +338,7 @@ struct user_driver_funcs void (*pUpdateLayeredWindow)(HWND,const RECT *,COLORREF,BYTE,UINT); LRESULT (*pWindowMessage)(HWND,UINT,WPARAM,LPARAM); BOOL (*pWindowPosChanging)(HWND,UINT,const RECT *,const RECT *,RECT *); - BOOL (*pCreateWindowSurface)(HWND,UINT,const RECT *,struct window_surface**); + BOOL (*pCreateWindowSurface)(HWND,const RECT *,struct window_surface**); void (*pWindowPosChanged)(HWND,HWND,UINT,const RECT *,const RECT *,const RECT *, const RECT *,struct window_surface*); /* system parameters */
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/window.c | 7 ++++++- dlls/wineandroid.drv/window.c | 2 -- dlls/winex11.drv/window.c | 16 ---------------- 3 files changed, 6 insertions(+), 19 deletions(-)
diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 994ad204109..b66d3d4d00a 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -1798,7 +1798,12 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, else if (IsRectEmpty( &visible_rect )) needs_surface = FALSE; else if (swp_flags & SWP_HIDEWINDOW) needs_surface = FALSE; else if (swp_flags & SWP_SHOWWINDOW) needs_surface = TRUE; - else needs_surface = !!(NtUserGetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE); + else if (!(NtUserGetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE)) needs_surface = FALSE; + else + { + RECT virtual_rect = get_virtual_screen_rect( get_thread_dpi() ); + needs_surface = intersect_rect( &virtual_rect, &virtual_rect, &visible_rect ); + }
if (!parent || parent == get_desktop_window()) { diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c index fed4d941c77..3c5f4c50679 100644 --- a/dlls/wineandroid.drv/window.c +++ b/dlls/wineandroid.drv/window.c @@ -1139,7 +1139,6 @@ static inline BOOL get_surface_rect( const RECT *visible_rect, RECT *surface_rec 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", @@ -1150,7 +1149,6 @@ BOOL ANDROID_WindowPosChanging( HWND hwnd, UINT swp_flags, const RECT *window_re
if (data->parent) 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;
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 24a0aa8e523..2a84bc49620 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2576,27 +2576,12 @@ done: }
-static inline BOOL get_surface_rect( const RECT *visible_rect, RECT *surface_rect ) -{ - *surface_rect = NtUserGetVirtualScreenRect(); - - if (!intersect_rect( surface_rect, surface_rect, visible_rect )) return FALSE; - OffsetRect( surface_rect, -visible_rect->left, -visible_rect->top ); - 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; -} - - /*********************************************************************** * WindowPosChanging (X11DRV.@) */ 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 */ @@ -2615,7 +2600,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 (data->use_alpha) goto done; /* use default surface */ - if (!get_surface_rect( visible_rect, &surface_rect )) goto done; /* use default surface */
ret = TRUE;
Emil Velikov (@xexaxo) commented about dlls/wineandroid.drv/window.c:
goto done; } }
- if (!(swp_flags & SWP_SHOWWINDOW) && !(NtUserGetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE))
goto done;
AFAICT this (+ equivalent for the other drivers) changes the functionality, even though I'm not sure how much/if that matters. Perhaps it's worth moving these checks to the WindowPosChanging callback, as a prep commit just incase?
On unrelated note: the missing else + memcmp on Android seem a bit odd.
Emil Velikov (@xexaxo) commented about include/wine/gdi_driver.h:
void (*pUpdateLayeredWindow)(HWND,const RECT *,COLORREF,BYTE,UINT); LRESULT (*pWindowMessage)(HWND,UINT,WPARAM,LPARAM); BOOL (*pWindowPosChanging)(HWND,UINT,const RECT *,const RECT *,RECT *);
- BOOL (*pCreateWindowSurface)(HWND,UINT,const RECT *,struct window_surface**);
- BOOL (*pCreateWindowSurface)(HWND,const RECT *,struct window_surface**);
Out of curiosity: is there an equivalent of `WINE_GDI_DRIVER_VERSION` when `struct user_driver_funcs` gets changed?
Emil Velikov (@xexaxo) commented about dlls/winex11.drv/window.c:
X11DRV_window_to_X_rect( data, visible_rect, window_rect, client_rect ); if (!data->whole_window && !data->embedded) goto done; /* use default surface */
- if (swp_flags & SWP_HIDEWINDOW) goto done; /* use default surface */
With this moved, we no longer call the above window managed magic. That should not matter, right?
Emil Velikov (@xexaxo) commented about dlls/wineandroid.drv/window.c:
static inline BOOL get_surface_rect( const RECT *visible_rect, RECT *surface_rect ) { if (!intersect_rect( surface_rect, visible_rect, &virtual_screen_rect )) return FALSE;
Would it make sense to use `NtUserGetVirtualScreenRect` instead of the global variable? Not something that needs to be done here, just asking ☺️
On Tue Jun 18 13:24:00 2024 +0000, Emil Velikov wrote:
Out of curiosity: is there an equivalent of `WINE_GDI_DRIVER_VERSION` when `struct user_driver_funcs` gets changed?
No I'm just forgetting to change it when I should, thanks.
On Tue Jun 18 13:26:33 2024 +0000, Emil Velikov wrote:
With this moved, we no longer call the above window managed magic. That should not matter, right?
I don't understand? Why/what aren't we calling it any longer?
On Tue Jun 18 13:20:27 2024 +0000, Emil Velikov wrote:
AFAICT this (+ equivalent for the other drivers) changes the functionality, even though I'm not sure how much/if that matters. Perhaps it's worth moving these checks to the WindowPosChanging callback, as a prep commit just incase? On unrelated note: the missing else + memcmp on Android seem a bit odd.
Right, I had some code in win32u to get the previous surface if its rect was large enough, similarly to what the drivers are doing, but then re-ordered it later for some reason.
I'm not completely sure if hidden windows are supposed to have a surface, I suspect not but maybe they do once they had one. In any case the current behavior was only keeping a surface for hidden windows until it needed to be resized. Also, winewayland behaves differently and checked for visibility upfront.
On Tue Jun 18 13:33:25 2024 +0000, Emil Velikov wrote:
Would it make sense to use `NtUserGetVirtualScreenRect` instead of the global variable? Not something that needs to be done here, just asking ☺️
Yeah possibly, and that would ensure that it is not using a stale one, in case of display setting changes from a different process, though maybe that's not an issue with wineandroid.
Fwiw I want to drop it later, removing the virtual screen intersection and potential offset from surfaces, only winex11 / wineandroid are using it and I'm not sure it's very useful. It also requires a RECT on surfaces when width/height could be enough (and provided in the BITMAPINFO).
On Tue Jun 18 13:40:19 2024 +0000, Rémi Bernon wrote:
I don't understand? Why/what aren't we calling it any longer?
Err misread the function name 😔 Sorry for the noise.
Emil Velikov (@xexaxo) commented about dlls/winex11.drv/window.c:
}
-static inline BOOL get_surface_rect( const RECT *visible_rect, RECT *surface_rect ) -{
- *surface_rect = NtUserGetVirtualScreenRect();
- if (!intersect_rect( surface_rect, surface_rect, visible_rect )) return FALSE;
- OffsetRect( surface_rect, -visible_rect->left, -visible_rect->top );
- 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;
Would it make sense to add a comment where these alignment numbers come from - they seem to vary across platforms, sort of.
Again not something for this MR, just noticed while browsing.
On Tue Jun 18 14:05:57 2024 +0000, Emil Velikov wrote:
Would it make sense to add a comment where these alignment numbers come from - they seem to vary across platforms, sort of. Again not something for this MR, just noticed while browsing.
Sure, I'll keep that in mind. I believe it's just an optimization to avoid re-creating the surfaces too often when windows are resized.
I'm not completely sure if hidden windows are supposed to have a surface, I suspect not but maybe they do once they had one
Not sure either. Which is why if it were me, I would split the commit a bit. In the worst case it would make bisection/regression tracking easier.
This merge request was closed by Rémi Bernon.