From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/vulkan.c | 2 +- dlls/win32u/window.c | 11 +++++------ dlls/winewayland.drv/opengl.c | 2 +- dlls/winex11.drv/opengl.c | 10 ++++------ include/wine/gdi_driver.h | 2 +- 5 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/dlls/win32u/vulkan.c b/dlls/win32u/vulkan.c index 5b78e0a0f61..6d6e5f81f54 100644 --- a/dlls/win32u/vulkan.c +++ b/dlls/win32u/vulkan.c @@ -430,7 +430,7 @@ static VkResult win32u_vkQueuePresentKHR( VkQueue client_queue, const VkPresentI struct surface *surface = swapchain->surface; RECT client_rect;
- client_surface_present( surface->client, NULL ); + client_surface_present( surface->client );
if (swapchain_res < VK_SUCCESS) continue; if (!NtUserGetClientRect( surface->hwnd, &client_rect, NtUserGetDpiForWindow( surface->hwnd ) )) diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 58bb27d75e4..4345c7b7ff4 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -324,18 +324,17 @@ void client_surface_release( struct client_surface *surface ) } }
-void client_surface_present( struct client_surface *surface, HDC hdc ) +void client_surface_present( struct client_surface *surface ) { + HDC hdc = 0; HWND hwnd; - HDC tmp;
pthread_mutex_lock( &surfaces_lock ); if ((hwnd = surface->hwnd)) { - if (hdc || !surface->offscreen) tmp = hdc; - else tmp = NtUserGetDCEx( hwnd, 0, DCX_CACHE | DCX_USESTYLE ); - surface->funcs->present( surface, surface->offscreen ? tmp : NULL ); - if (tmp && tmp != hdc) NtUserReleaseDC( hwnd, tmp ); + if (surface->offscreen) hdc = NtUserGetDCEx( hwnd, 0, DCX_CACHE | DCX_USESTYLE ); + surface->funcs->present( surface, hdc ); + if (hdc) NtUserReleaseDC( hwnd, hdc ); } pthread_mutex_unlock( &surfaces_lock ); } diff --git a/dlls/winewayland.drv/opengl.c b/dlls/winewayland.drv/opengl.c index c3ccfc93202..41cb8463fb1 100644 --- a/dlls/winewayland.drv/opengl.c +++ b/dlls/winewayland.drv/opengl.c @@ -154,7 +154,7 @@ static BOOL wayland_drawable_swap(struct opengl_drawable *base) { struct wayland_gl_drawable *gl = impl_from_opengl_drawable(base);
- client_surface_present(base->client, NULL); + client_surface_present(base->client); funcs->p_eglSwapBuffers(egl->display, gl->base.surface);
return TRUE; diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 6c4a1b1ae6a..188b04ea449 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -1199,7 +1199,7 @@ static void x11drv_surface_flush( struct opengl_drawable *base, UINT flags ) { if (!(flags & GL_FLUSH_FINISHED)) funcs->p_glFinish(); XFlush( gdi_display ); - client_surface_present( base->client, gl->hdc ); + client_surface_present( base->client ); } }
@@ -1465,7 +1465,7 @@ static BOOL x11drv_surface_swap( struct opengl_drawable *base ) if (InterlockedCompareExchange( &base->client->offscreen, 0, 0 )) { if (!pglXWaitForSbcOML) XFlush( gdi_display ); - client_surface_present( base->client, gl->hdc ); + client_surface_present( base->client ); }
return TRUE; @@ -1478,8 +1478,6 @@ static void x11drv_egl_surface_destroy( struct opengl_drawable *base )
static void x11drv_egl_surface_flush( struct opengl_drawable *base, UINT flags ) { - struct gl_drawable *gl = impl_from_opengl_drawable( base ); - TRACE( "%s\n", debugstr_opengl_drawable( base ) );
if (flags & GL_FLUSH_INTERVAL) funcs->p_eglSwapInterval( egl->display, abs( base->interval ) ); @@ -1488,7 +1486,7 @@ static void x11drv_egl_surface_flush( struct opengl_drawable *base, UINT flags ) { if (!(flags & GL_FLUSH_FINISHED)) funcs->p_glFinish(); XFlush( gdi_display ); - client_surface_present( base->client, gl->hdc ); + client_surface_present( base->client ); } }
@@ -1503,7 +1501,7 @@ static BOOL x11drv_egl_surface_swap( struct opengl_drawable *base ) if (InterlockedCompareExchange( &base->client->offscreen, 0, 0 )) { XFlush( gdi_display ); - client_surface_present( base->client, gl->hdc ); + client_surface_present( base->client ); }
return TRUE; diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index 78c93168132..9ecfa197f0f 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -272,7 +272,7 @@ struct client_surface W32KAPI void *client_surface_create( UINT size, const struct client_surface_funcs *funcs, HWND hwnd ); W32KAPI void client_surface_add_ref( struct client_surface *surface ); W32KAPI void client_surface_release( struct client_surface *surface ); -W32KAPI void client_surface_present( struct client_surface *surface, HDC hdc ); +W32KAPI void client_surface_present( struct client_surface *surface );
static inline const char *debugstr_client_surface( struct client_surface *surface ) {