From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/ntuser_private.h | 1 + dlls/win32u/vulkan.c | 3 +++ dlls/win32u/window.c | 12 ++++++++++++ 3 files changed, 16 insertions(+)
diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index fd594488c08..31e847f4537 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -262,5 +262,6 @@ static inline UINT win_get_flags( HWND hwnd ) WND *get_win_ptr( HWND hwnd ); BOOL is_child( HWND parent, HWND child ); BOOL is_window( HWND hwnd ); +BOOL window_has_pixel_format( HWND hwnd );
#endif /* __WINE_NTUSER_PRIVATE_H */ diff --git a/dlls/win32u/vulkan.c b/dlls/win32u/vulkan.c index d285b07b951..986d669ddb2 100644 --- a/dlls/win32u/vulkan.c +++ b/dlls/win32u/vulkan.c @@ -87,6 +87,9 @@ static VkResult win32u_vkCreateWin32SurfaceKHR( VkInstance instance, const VkWin return res; }
+ /* make sure the window has a pixel format selected to get consistent window surface updates */ + if (!window_has_pixel_format( info->hwnd )) win32u_set_window_pixel_format( info->hwnd, 1, TRUE ); + if (!(win = get_win_ptr( info->hwnd )) || win == WND_DESKTOP || win == WND_OTHER_PROCESS) list_init( &surface->entry ); else diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index dc59ce1e9fd..10ecf4b8c60 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -1466,6 +1466,18 @@ BOOL win32u_set_window_pixel_format( HWND hwnd, int format, BOOL internal ) return TRUE; }
+int window_has_pixel_format( HWND hwnd ) +{ + WND *win = get_win_ptr( hwnd ); + BOOL ret; + + if (!win || win == WND_DESKTOP || win == WND_OTHER_PROCESS) return FALSE; + ret = win->pixel_format || win->internal_pixel_format; + release_win_ptr( win ); + + return ret; +} + int win32u_get_window_pixel_format( HWND hwnd ) { WND *win = get_win_ptr( hwnd );