Make the win data pointer only available in the thread that owns the

window.
oldstable
Alexandre Julliard 2005-02-09 14:01:40 +00:00
parent c67a307b8f
commit e551555d4e
2 changed files with 8 additions and 10 deletions

View File

@ -848,7 +848,7 @@ BOOL X11DRV_DestroyWindow( HWND hwnd )
if (data->hWMIconBitmap) DeleteObject( data->hWMIconBitmap );
if (data->hWMIconMask) DeleteObject( data->hWMIconMask);
wine_tsx11_lock();
XDeleteContext( gdi_display, (XID)hwnd, win_data_context );
XDeleteContext( display, (XID)hwnd, win_data_context );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, data );
@ -902,10 +902,9 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
data->hWMIconBitmap = 0;
data->hWMIconMask = 0;
/* use gdi_display so that it's available from all threads (FIXME) */
wine_tsx11_lock();
if (!win_data_context) win_data_context = XUniqueContext();
XSaveContext( gdi_display, (XID)hwnd, win_data_context, (char *)data );
XSaveContext( display, (XID)hwnd, win_data_context, (char *)data );
wine_tsx11_unlock();
/* initialize the dimensions before sending WM_GETMINMAXINFO */
@ -1058,7 +1057,8 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
struct x11drv_win_data *X11DRV_get_win_data( HWND hwnd )
{
char *data;
if (XFindContext( gdi_display, (XID)hwnd, win_data_context, &data )) data = NULL;
if (!hwnd || XFindContext( thread_display(), (XID)hwnd, win_data_context, &data )) data = NULL;
return (struct x11drv_win_data *)data;
}

View File

@ -176,12 +176,13 @@ BOOL X11DRV_GetDC( HWND hwnd, HDC hdc, HRGN hrgn, DWORD flags )
{
HWND top = get_top_clipping_window( hwnd );
struct x11drv_escape_set_drawable escape;
struct x11drv_win_data *data;
escape.mode = IncludeInferiors;
/* don't clip siblings if using parent clip region */
if (flags & DCX_PARENTCLIP) flags &= ~DCX_CLIPSIBLINGS;
if (top != hwnd)
if (top != hwnd || !(data = X11DRV_get_win_data( hwnd )))
{
POINT client_offset;
@ -213,16 +214,13 @@ BOOL X11DRV_GetDC( HWND hwnd, HDC hdc, HRGN hrgn, DWORD flags )
}
else
{
struct x11drv_win_data *data;
if (!(data = X11DRV_get_win_data( hwnd ))) return FALSE;
if (IsIconic( hwnd ))
{
escape.drawable = data->icon_window ? data->icon_window : data->whole_window;
escape.org.x = 0;
escape.org.y = 0;
escape.drawable_org = escape.org;
MapWindowPoints( hwnd, 0, &escape.drawable_org, 1 );
}
else
{
@ -1521,7 +1519,7 @@ int X11DRV_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw )
if (!(data = X11DRV_get_win_data( hwnd )))
{
if (IsWindow( hwnd ))
FIXME( "not supported on other process window %p\n", hwnd );
FIXME( "not supported on other thread window %p\n", hwnd );
SetLastError( ERROR_INVALID_WINDOW_HANDLE );
return FALSE;
}