From: Rémi Bernon rbernon@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58491 --- dlls/win32u/opengl.c | 4 +--- dlls/win32u/win32u_private.h | 1 + dlls/win32u/window.c | 12 ++++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/dlls/win32u/opengl.c b/dlls/win32u/opengl.c index 57e0aa0e27c..e0c584f0dbf 100644 --- a/dlls/win32u/opengl.c +++ b/dlls/win32u/opengl.c @@ -1356,7 +1356,6 @@ static BOOL context_unset_current( struct wgl_context *context ) /* return an updated drawable, recreating one if the window drawables have been invalidated (mostly wineandroid) */ static struct opengl_drawable *get_updated_drawable( HDC hdc, int format, struct opengl_drawable *drawable ) { - struct opengl_drawable *current; HWND hwnd = NULL;
if (hdc && !(hwnd = NtUserWindowFromDC( hdc ))) return get_dc_opengl_drawable( hdc ); @@ -1364,9 +1363,8 @@ static struct opengl_drawable *get_updated_drawable( HDC hdc, int format, struct if (!hwnd) return NULL;
/* if the window still has a drawable, keep using the one we have */ - if (drawable && (current = get_window_current_drawable( hwnd ))) + if (drawable && is_client_surface_window( drawable->client, hwnd )) { - opengl_drawable_release( current ); opengl_drawable_add_ref( drawable ); return drawable; } diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 5db351836de..69d7b5b5257 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -286,6 +286,7 @@ extern HWND window_from_point( HWND hwnd, POINT pt, INT *hittest ); extern HWND get_shell_window(void); extern HWND get_progman_window(void); extern HWND get_taskman_window(void); +extern BOOL is_client_surface_window( struct client_surface *surface, HWND hwnd );
/* to release pointers retrieved by win_get_ptr */ static inline void release_win_ptr( struct tagWND *ptr ) diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index f91ab2bfcef..ad9526c6ebd 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -339,6 +339,18 @@ void client_surface_present( struct client_surface *surface ) pthread_mutex_unlock( &surfaces_lock ); }
+BOOL is_client_surface_window( struct client_surface *surface, HWND hwnd ) +{ + BOOL ret; + + if (!surface) return FALSE; + pthread_mutex_lock( &surfaces_lock ); + ret = surface->hwnd == hwnd; + pthread_mutex_unlock( &surfaces_lock ); + + return ret; +} + /******************************************************************* * get_hwnd_message_parent *