Commit d38c7b94 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winex11: Introduce a new destroy_client_window helper.

parent ead27799
......@@ -221,6 +221,7 @@ struct gl_drawable
{
LONG ref; /* reference count */
enum dc_gl_type type; /* type of GL surface */
HWND hwnd;
GLXDrawable drawable; /* drawable for rendering with GL */
Window window; /* window if drawable is a GLXWindow */
Colormap colormap; /* colormap for the client window */
......@@ -1158,7 +1159,7 @@ static void release_gl_drawable( struct gl_drawable *gl )
case DC_GL_CHILD_WIN:
TRACE( "destroying %lx drawable %lx\n", gl->window, gl->drawable );
pglXDestroyWindow( gdi_display, gl->drawable );
XDestroyWindow( gdi_display, gl->window );
destroy_client_window( gl->hwnd, gl->window );
XFreeColormap( gdi_display, gl->colormap );
break;
case DC_GL_PIXMAP_WIN:
......@@ -1328,6 +1329,7 @@ static struct gl_drawable *create_gl_drawable( HWND hwnd, const struct wgl_pixel
gl->refresh_swap_interval = TRUE;
gl->format = format;
gl->ref = 1;
gl->hwnd = hwnd;
gl->mutable_pf = mutable_pf;
if (!known_child && !NtUserGetWindowRelative( hwnd, GW_CHILD ) &&
......
......@@ -101,9 +101,7 @@ static void wine_vk_surface_release( struct wine_vk_surface *surface )
pthread_mutex_unlock(&vulkan_mutex);
}
if (surface->window)
XDestroyWindow(gdi_display, surface->window);
destroy_client_window( surface->hwnd, surface->window );
free(surface);
}
......@@ -193,8 +191,8 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance,
ERR("Failed to allocate client window for hwnd=%p\n", create_info->hwnd);
/* VK_KHR_win32_surface only allows out of host and device memory as errors. */
res = VK_ERROR_OUT_OF_HOST_MEMORY;
goto err;
free(x11_surface);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
create_info_host.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR;
......@@ -207,7 +205,9 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance,
if (res != VK_SUCCESS)
{
ERR("Failed to create Xlib surface, res=%d\n", res);
goto err;
destroy_client_window( x11_surface->hwnd, x11_surface->window );
free(x11_surface);
return res;
}
pthread_mutex_lock(&vulkan_mutex);
......@@ -218,10 +218,6 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance,
TRACE("Created surface=0x%s\n", wine_dbgstr_longlong(*surface));
return VK_SUCCESS;
err:
wine_vk_surface_release(x11_surface);
return res;
}
static void X11DRV_vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface,
......
......@@ -1614,6 +1614,29 @@ static void detach_client_window( struct x11drv_win_data *data, Window client_wi
/**********************************************************************
* destroy_client_window
*/
void destroy_client_window( HWND hwnd, Window client_window )
{
struct x11drv_win_data *data;
TRACE( "%p destroying client window %lx\n", hwnd, client_window );
if ((data = get_win_data( hwnd )))
{
if (data->client_window == client_window)
{
if (data->whole_window) client_window_events_disable( data, client_window );
data->client_window = 0;
}
release_win_data( data );
}
XDestroyWindow( gdi_display, client_window );
}
/**********************************************************************
* create_client_window
*/
Window create_client_window( HWND hwnd, const XVisualInfo *visual, Colormap colormap )
......
......@@ -650,6 +650,7 @@ extern void read_net_wm_states( Display *display, struct x11drv_win_data *data )
extern void update_net_wm_states( struct x11drv_win_data *data );
extern void make_window_embedded( struct x11drv_win_data *data );
extern Window create_client_window( HWND hwnd, const XVisualInfo *visual, Colormap colormap );
extern void destroy_client_window( HWND hwnd, Window client_window );
extern void set_window_visual( struct x11drv_win_data *data, const XVisualInfo *vis, BOOL use_alpha );
extern void change_systray_owner( Display *display, Window systray_window );
extern HWND create_foreign_window( Display *display, Window window );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment