Commit 6bfcb347 authored by Alexandre Julliard's avatar Alexandre Julliard

winex11: Remove X11 locking around simple X calls.

parent 8fdb55cf
...@@ -702,9 +702,7 @@ void execute_rop( X11DRV_PDEVICE *physdev, Pixmap src_pixmap, GC gc, const RECT ...@@ -702,9 +702,7 @@ void execute_rop( X11DRV_PDEVICE *physdev, Pixmap src_pixmap, GC gc, const RECT
pixmaps[SRC] = src_pixmap; pixmaps[SRC] = src_pixmap;
pixmaps[TMP] = 0; pixmaps[TMP] = 0;
wine_tsx11_lock();
pixmaps[DST] = XCreatePixmap( gdi_display, root_window, width, height, physdev->depth ); pixmaps[DST] = XCreatePixmap( gdi_display, root_window, width, height, physdev->depth );
wine_tsx11_unlock();
if (use_dst) BITBLT_GetDstArea( physdev, pixmaps[DST], gc, visrect ); if (use_dst) BITBLT_GetDstArea( physdev, pixmaps[DST], gc, visrect );
null_brush = use_pat && !X11DRV_SetupGCForPatBlt( physdev, gc, TRUE ); null_brush = use_pat && !X11DRV_SetupGCForPatBlt( physdev, gc, TRUE );
...@@ -908,10 +906,8 @@ BOOL X11DRV_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst, ...@@ -908,10 +906,8 @@ BOOL X11DRV_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
execute_rop( physDevDst, src_pixmap, gc, &dst->visrect, rop ); execute_rop( physDevDst, src_pixmap, gc, &dst->visrect, rop );
wine_tsx11_lock();
XFreePixmap( gdi_display, src_pixmap ); XFreePixmap( gdi_display, src_pixmap );
XFreeGC( gdi_display, gc ); XFreeGC( gdi_display, gc );
wine_tsx11_unlock();
return TRUE; return TRUE;
} }
...@@ -923,9 +919,7 @@ static void free_heap_bits( struct gdi_image_bits *bits ) ...@@ -923,9 +919,7 @@ static void free_heap_bits( struct gdi_image_bits *bits )
static void free_ximage_bits( struct gdi_image_bits *bits ) static void free_ximage_bits( struct gdi_image_bits *bits )
{ {
wine_tsx11_lock();
XFree( bits->ptr ); XFree( bits->ptr );
wine_tsx11_unlock();
} }
/* only for use on sanitized BITMAPINFO structures */ /* only for use on sanitized BITMAPINFO structures */
...@@ -1219,10 +1213,8 @@ DWORD X11DRV_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info, ...@@ -1219,10 +1213,8 @@ DWORD X11DRV_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info,
if (!bits) return ERROR_SUCCESS; /* just querying the format */ if (!bits) return ERROR_SUCCESS; /* just querying the format */
if ((src->width != dst->width) || (src->height != dst->height)) return ERROR_TRANSFORM_NOT_SUPPORTED; if ((src->width != dst->width) || (src->height != dst->height)) return ERROR_TRANSFORM_NOT_SUPPORTED;
wine_tsx11_lock();
image = XCreateImage( gdi_display, visual, vis.depth, ZPixmap, 0, NULL, image = XCreateImage( gdi_display, visual, vis.depth, ZPixmap, 0, NULL,
info->bmiHeader.biWidth, src->visrect.bottom - src->visrect.top, 32, 0 ); info->bmiHeader.biWidth, src->visrect.bottom - src->visrect.top, 32, 0 );
wine_tsx11_unlock();
if (!image) return ERROR_OUTOFMEMORY; if (!image) return ERROR_OUTOFMEMORY;
if (image->bits_per_pixel == 4 || image->bits_per_pixel == 8) if (image->bits_per_pixel == 4 || image->bits_per_pixel == 8)
...@@ -1244,32 +1236,24 @@ DWORD X11DRV_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info, ...@@ -1244,32 +1236,24 @@ DWORD X11DRV_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info,
/* optimization for single-op ROPs */ /* optimization for single-op ROPs */
if (!opcode[1] && OP_SRCDST(opcode[0]) == OP_ARGS(SRC,DST)) if (!opcode[1] && OP_SRCDST(opcode[0]) == OP_ARGS(SRC,DST))
{ {
wine_tsx11_lock();
XSetFunction( gdi_display, physdev->gc, OP_ROP(*opcode) ); XSetFunction( gdi_display, physdev->gc, OP_ROP(*opcode) );
XPutImage( gdi_display, physdev->drawable, physdev->gc, image, src->visrect.left, 0, XPutImage( gdi_display, physdev->drawable, physdev->gc, image, src->visrect.left, 0,
physdev->dc_rect.left + dst->visrect.left, physdev->dc_rect.left + dst->visrect.left,
physdev->dc_rect.top + dst->visrect.top, width, height ); physdev->dc_rect.top + dst->visrect.top, width, height );
wine_tsx11_unlock();
} }
else else
{ {
Pixmap src_pixmap; GC gc = XCreateGC( gdi_display, physdev->drawable, 0, NULL );
GC gc; Pixmap src_pixmap = XCreatePixmap( gdi_display, root_window, width, height, vis.depth );
wine_tsx11_lock();
gc = XCreateGC( gdi_display, physdev->drawable, 0, NULL );
XSetSubwindowMode( gdi_display, gc, IncludeInferiors ); XSetSubwindowMode( gdi_display, gc, IncludeInferiors );
XSetGraphicsExposures( gdi_display, gc, False ); XSetGraphicsExposures( gdi_display, gc, False );
src_pixmap = XCreatePixmap( gdi_display, root_window, width, height, vis.depth );
XPutImage( gdi_display, src_pixmap, gc, image, src->visrect.left, 0, 0, 0, width, height ); XPutImage( gdi_display, src_pixmap, gc, image, src->visrect.left, 0, 0, 0, width, height );
wine_tsx11_unlock();
execute_rop( physdev, src_pixmap, gc, &dst->visrect, rop ); execute_rop( physdev, src_pixmap, gc, &dst->visrect, rop );
wine_tsx11_lock();
XFreePixmap( gdi_display, src_pixmap ); XFreePixmap( gdi_display, src_pixmap );
XFreeGC( gdi_display, gc ); XFreeGC( gdi_display, gc );
wine_tsx11_unlock();
} }
if (restore_region) restore_clipping_region( physdev ); if (restore_region) restore_clipping_region( physdev );
...@@ -1277,9 +1261,7 @@ DWORD X11DRV_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info, ...@@ -1277,9 +1261,7 @@ DWORD X11DRV_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info,
image->data = NULL; image->data = NULL;
} }
wine_tsx11_lock();
XDestroyImage( image ); XDestroyImage( image );
wine_tsx11_unlock();
if (dst_bits.free) dst_bits.free( &dst_bits ); if (dst_bits.free) dst_bits.free( &dst_bits );
return ret; return ret;
...@@ -1356,19 +1338,15 @@ DWORD X11DRV_GetImage( PHYSDEV dev, BITMAPINFO *info, ...@@ -1356,19 +1338,15 @@ DWORD X11DRV_GetImage( PHYSDEV dev, BITMAPINFO *info,
if (X11DRV_check_error()) if (X11DRV_check_error())
{ {
/* use a temporary pixmap to avoid the BadMatch error */ /* use a temporary pixmap to avoid the BadMatch error */
GC gc; Pixmap pixmap = XCreatePixmap( gdi_display, root_window, width, height, vis.depth );
Pixmap pixmap; GC gc = XCreateGC( gdi_display, pixmap, 0, NULL );
wine_tsx11_lock();
pixmap = XCreatePixmap( gdi_display, root_window, width, height, vis.depth );
gc = XCreateGC( gdi_display, pixmap, 0, NULL );
XSetGraphicsExposures( gdi_display, gc, False ); XSetGraphicsExposures( gdi_display, gc, False );
XCopyArea( gdi_display, physdev->drawable, pixmap, gc, XCopyArea( gdi_display, physdev->drawable, pixmap, gc,
physdev->dc_rect.left + x, physdev->dc_rect.top + y, width, height, 0, 0 ); physdev->dc_rect.left + x, physdev->dc_rect.top + y, width, height, 0, 0 );
image = XGetImage( gdi_display, pixmap, 0, 0, width, height, AllPlanes, ZPixmap ); image = XGetImage( gdi_display, pixmap, 0, 0, width, height, AllPlanes, ZPixmap );
XFreePixmap( gdi_display, pixmap ); XFreePixmap( gdi_display, pixmap );
XFreeGC( gdi_display, gc ); XFreeGC( gdi_display, gc );
wine_tsx11_unlock();
} }
if (!image) return ERROR_OUTOFMEMORY; if (!image) return ERROR_OUTOFMEMORY;
...@@ -1387,9 +1365,7 @@ DWORD X11DRV_GetImage( PHYSDEV dev, BITMAPINFO *info, ...@@ -1387,9 +1365,7 @@ DWORD X11DRV_GetImage( PHYSDEV dev, BITMAPINFO *info,
bits->free = free_ximage_bits; bits->free = free_ximage_bits;
image->data = NULL; image->data = NULL;
} }
wine_tsx11_lock();
XDestroyImage( image ); XDestroyImage( image );
wine_tsx11_unlock();
return ret; return ret;
} }
...@@ -1423,10 +1399,8 @@ static DWORD put_pixmap_image( Pixmap pixmap, const XVisualInfo *vis, ...@@ -1423,10 +1399,8 @@ static DWORD put_pixmap_image( Pixmap pixmap, const XVisualInfo *vis,
coords.height = abs( info->bmiHeader.biHeight ); coords.height = abs( info->bmiHeader.biHeight );
SetRect( &coords.visrect, 0, 0, coords.width, coords.height ); SetRect( &coords.visrect, 0, 0, coords.width, coords.height );
wine_tsx11_lock();
image = XCreateImage( gdi_display, visual, vis->depth, ZPixmap, 0, NULL, image = XCreateImage( gdi_display, visual, vis->depth, ZPixmap, 0, NULL,
coords.width, coords.height, 32, 0 ); coords.width, coords.height, 32, 0 );
wine_tsx11_unlock();
if (!image) return ERROR_OUTOFMEMORY; if (!image) return ERROR_OUTOFMEMORY;
if (image->bits_per_pixel == 4 || image->bits_per_pixel == 8) if (image->bits_per_pixel == 4 || image->bits_per_pixel == 8)
...@@ -1435,17 +1409,13 @@ static DWORD put_pixmap_image( Pixmap pixmap, const XVisualInfo *vis, ...@@ -1435,17 +1409,13 @@ static DWORD put_pixmap_image( Pixmap pixmap, const XVisualInfo *vis,
if (!(ret = copy_image_bits( info, is_r8g8b8(vis), image, bits, &dst_bits, &coords, mapping, ~0u ))) if (!(ret = copy_image_bits( info, is_r8g8b8(vis), image, bits, &dst_bits, &coords, mapping, ~0u )))
{ {
image->data = dst_bits.ptr; image->data = dst_bits.ptr;
wine_tsx11_lock();
gc = XCreateGC( gdi_display, pixmap, 0, NULL ); gc = XCreateGC( gdi_display, pixmap, 0, NULL );
XPutImage( gdi_display, pixmap, gc, image, 0, 0, 0, 0, coords.width, coords.height ); XPutImage( gdi_display, pixmap, gc, image, 0, 0, 0, 0, coords.width, coords.height );
XFreeGC( gdi_display, gc ); XFreeGC( gdi_display, gc );
wine_tsx11_unlock();
image->data = NULL; image->data = NULL;
} }
wine_tsx11_lock();
XDestroyImage( image ); XDestroyImage( image );
wine_tsx11_unlock();
if (dst_bits.free) dst_bits.free( &dst_bits ); if (dst_bits.free) dst_bits.free( &dst_bits );
return ret; return ret;
...@@ -1474,10 +1444,8 @@ Pixmap create_pixmap_from_image( HDC hdc, const XVisualInfo *vis, const BITMAPIN ...@@ -1474,10 +1444,8 @@ Pixmap create_pixmap_from_image( HDC hdc, const XVisualInfo *vis, const BITMAPIN
DWORD err; DWORD err;
HBITMAP dib; HBITMAP dib;
wine_tsx11_lock();
pixmap = XCreatePixmap( gdi_display, root_window, pixmap = XCreatePixmap( gdi_display, root_window,
info->bmiHeader.biWidth, abs(info->bmiHeader.biHeight), vis->depth ); info->bmiHeader.biWidth, abs(info->bmiHeader.biHeight), vis->depth );
wine_tsx11_unlock();
if (!pixmap) return 0; if (!pixmap) return 0;
memcpy( src_info, info, get_dib_info_size( info, coloruse )); memcpy( src_info, info, get_dib_info_size( info, coloruse ));
...@@ -1504,9 +1472,7 @@ Pixmap create_pixmap_from_image( HDC hdc, const XVisualInfo *vis, const BITMAPIN ...@@ -1504,9 +1472,7 @@ Pixmap create_pixmap_from_image( HDC hdc, const XVisualInfo *vis, const BITMAPIN
if (!err) return pixmap; if (!err) return pixmap;
wine_tsx11_lock();
XFreePixmap( gdi_display, pixmap ); XFreePixmap( gdi_display, pixmap );
wine_tsx11_unlock();
return 0; return 0;
} }
...@@ -1547,9 +1513,7 @@ DWORD get_pixmap_image( Pixmap pixmap, int width, int height, const XVisualInfo ...@@ -1547,9 +1513,7 @@ DWORD get_pixmap_image( Pixmap pixmap, int width, int height, const XVisualInfo
coords.height = height; coords.height = height;
SetRect( &coords.visrect, 0, 0, width, height ); SetRect( &coords.visrect, 0, 0, width, height );
wine_tsx11_lock();
image = XGetImage( gdi_display, pixmap, 0, 0, width, height, AllPlanes, ZPixmap ); image = XGetImage( gdi_display, pixmap, 0, 0, width, height, AllPlanes, ZPixmap );
wine_tsx11_unlock();
if (!image) return ERROR_OUTOFMEMORY; if (!image) return ERROR_OUTOFMEMORY;
info->bmiHeader.biSizeImage = height * image->bytes_per_line; info->bmiHeader.biSizeImage = height * image->bytes_per_line;
...@@ -1564,8 +1528,6 @@ DWORD get_pixmap_image( Pixmap pixmap, int width, int height, const XVisualInfo ...@@ -1564,8 +1528,6 @@ DWORD get_pixmap_image( Pixmap pixmap, int width, int height, const XVisualInfo
bits->free = free_ximage_bits; bits->free = free_ximage_bits;
image->data = NULL; image->data = NULL;
} }
wine_tsx11_lock();
XDestroyImage( image ); XDestroyImage( image );
wine_tsx11_unlock();
return ret; return ret;
} }
...@@ -171,16 +171,9 @@ static Pixmap BRUSH_DitherMono( COLORREF color ) ...@@ -171,16 +171,9 @@ static Pixmap BRUSH_DitherMono( COLORREF color )
}; };
int gray = (30 * GetRValue(color) + 59 * GetGValue(color) + 11 * GetBValue(color)) / 100; int gray = (30 * GetRValue(color) + 59 * GetGValue(color) + 11 * GetBValue(color)) / 100;
int idx = gray * (sizeof gray_dither/sizeof gray_dither[0] + 1)/256 - 1; int idx = gray * (sizeof gray_dither/sizeof gray_dither[0] + 1)/256 - 1;
Pixmap pixmap;
TRACE("color=%06x -> gray=%x\n", color, gray); TRACE("color=%06x -> gray=%x\n", color, gray);
return XCreateBitmapFromData( gdi_display, root_window, gray_dither[idx], 2, 2 );
wine_tsx11_lock();
pixmap = XCreateBitmapFromData( gdi_display, root_window,
gray_dither[idx],
2, 2 );
wine_tsx11_unlock();
return pixmap;
} }
/*********************************************************************** /***********************************************************************
...@@ -273,9 +266,7 @@ HBRUSH X11DRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct brush_patter ...@@ -273,9 +266,7 @@ HBRUSH X11DRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct brush_patter
if (physDev->brush.pixmap) if (physDev->brush.pixmap)
{ {
wine_tsx11_lock();
XFreePixmap( gdi_display, physDev->brush.pixmap ); XFreePixmap( gdi_display, physDev->brush.pixmap );
wine_tsx11_unlock();
physDev->brush.pixmap = 0; physDev->brush.pixmap = 0;
} }
physDev->brush.style = logbrush.lbStyle; physDev->brush.style = logbrush.lbStyle;
...@@ -296,10 +287,8 @@ HBRUSH X11DRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct brush_patter ...@@ -296,10 +287,8 @@ HBRUSH X11DRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct brush_patter
case BS_HATCHED: case BS_HATCHED:
TRACE("BS_HATCHED\n" ); TRACE("BS_HATCHED\n" );
physDev->brush.pixel = X11DRV_PALETTE_ToPhysical( physDev, logbrush.lbColor ); physDev->brush.pixel = X11DRV_PALETTE_ToPhysical( physDev, logbrush.lbColor );
wine_tsx11_lock();
physDev->brush.pixmap = XCreateBitmapFromData( gdi_display, root_window, physDev->brush.pixmap = XCreateBitmapFromData( gdi_display, root_window,
HatchBrushes[logbrush.lbHatch], 8, 8 ); HatchBrushes[logbrush.lbHatch], 8, 8 );
wine_tsx11_unlock();
physDev->brush.fillStyle = FillStippled; physDev->brush.fillStyle = FillStippled;
break; break;
} }
......
...@@ -264,11 +264,8 @@ static Window thread_selection_wnd(void) ...@@ -264,11 +264,8 @@ static Window thread_selection_wnd(void)
attr.event_mask = (ExposureMask | KeyPressMask | KeyReleaseMask | PointerMotionMask | attr.event_mask = (ExposureMask | KeyPressMask | KeyReleaseMask | PointerMotionMask |
ButtonPressMask | ButtonReleaseMask | EnterWindowMask | PropertyChangeMask); ButtonPressMask | ButtonReleaseMask | EnterWindowMask | PropertyChangeMask);
wine_tsx11_lock();
w = XCreateWindow(thread_data->display, root_window, 0, 0, 1, 1, 0, screen_depth, w = XCreateWindow(thread_data->display, root_window, 0, 0, 1, 1, 0, screen_depth,
InputOutput, CopyFromParent, CWEventMask, &attr); InputOutput, CopyFromParent, CWEventMask, &attr);
wine_tsx11_unlock();
if (w) if (w)
thread_data->selection_wnd = w; thread_data->selection_wnd = w;
else else
...@@ -379,9 +376,7 @@ static void intern_atoms(void) ...@@ -379,9 +376,7 @@ static void intern_atoms(void)
WideCharToMultiByte(CP_UNIXCP, 0, buffer, -1, names[i++], len, NULL, NULL); WideCharToMultiByte(CP_UNIXCP, 0, buffer, -1, names[i++], len, NULL, NULL);
} }
wine_tsx11_lock();
XInternAtoms( display, names, count, False, atoms ); XInternAtoms( display, names, count, False, atoms );
wine_tsx11_unlock();
i = 0; i = 0;
LIST_FOR_EACH_ENTRY( format, &format_list, WINE_CLIPFORMAT, entry ) LIST_FOR_EACH_ENTRY( format, &format_list, WINE_CLIPFORMAT, entry )
...@@ -1267,9 +1262,7 @@ static HANDLE X11DRV_CLIPBOARD_ImportCompoundText(Display *display, Window w, At ...@@ -1267,9 +1262,7 @@ static HANDLE X11DRV_CLIPBOARD_ImportCompoundText(Display *display, Window w, At
txtprop.encoding = x11drv_atom(COMPOUND_TEXT); txtprop.encoding = x11drv_atom(COMPOUND_TEXT);
txtprop.format = 8; txtprop.format = 8;
wine_tsx11_lock();
ret = XmbTextPropertyToTextList(display, &txtprop, &srcstr, &count); ret = XmbTextPropertyToTextList(display, &txtprop, &srcstr, &count);
wine_tsx11_unlock();
HeapFree(GetProcessHeap(), 0, txtprop.value); HeapFree(GetProcessHeap(), 0, txtprop.value);
if (ret != Success || !count) return 0; if (ret != Success || !count) return 0;
...@@ -1306,9 +1299,7 @@ static HANDLE X11DRV_CLIPBOARD_ImportCompoundText(Display *display, Window w, At ...@@ -1306,9 +1299,7 @@ static HANDLE X11DRV_CLIPBOARD_ImportCompoundText(Display *display, Window w, At
GlobalUnlock(hUnicodeText); GlobalUnlock(hUnicodeText);
} }
wine_tsx11_lock();
XFreeStringList(srcstr); XFreeStringList(srcstr);
wine_tsx11_unlock();
return hUnicodeText; return hUnicodeText;
} }
...@@ -1340,10 +1331,8 @@ static HANDLE X11DRV_CLIPBOARD_ImportXAPIXMAP(Display *display, Window w, Atom p ...@@ -1340,10 +1331,8 @@ static HANDLE X11DRV_CLIPBOARD_ImportXAPIXMAP(Display *display, Window w, Atom p
pPixmap = (Pixmap *) lpdata; pPixmap = (Pixmap *) lpdata;
/* Get the Pixmap dimensions and bit depth */ /* Get the Pixmap dimensions and bit depth */
wine_tsx11_lock();
if (!XGetGeometry(gdi_display, *pPixmap, &root, &x, &y, &width, &height, if (!XGetGeometry(gdi_display, *pPixmap, &root, &x, &y, &width, &height,
&border_width, &depth)) depth = 0; &border_width, &depth)) depth = 0;
wine_tsx11_unlock();
if (!pixmap_formats[depth]) return 0; if (!pixmap_formats[depth]) return 0;
TRACE("\tPixmap properties: width=%d, height=%d, depth=%d\n", TRACE("\tPixmap properties: width=%d, height=%d, depth=%d\n",
...@@ -1709,13 +1698,11 @@ static HANDLE X11DRV_CLIPBOARD_ExportCompoundText(Display *display, Window reque ...@@ -1709,13 +1698,11 @@ static HANDLE X11DRV_CLIPBOARD_ExportCompoundText(Display *display, Window reque
style = XStdICCTextStyle; style = XStdICCTextStyle;
/* Update the X property */ /* Update the X property */
wine_tsx11_lock();
if (XmbTextListToTextProperty(display, &lpstr, 1, style, &prop) == Success) if (XmbTextListToTextProperty(display, &lpstr, 1, style, &prop) == Success)
{ {
XSetTextProperty(display, requestor, &prop, rprop); XSetTextProperty(display, requestor, &prop, rprop);
XFree(prop.value); XFree(prop.value);
} }
wine_tsx11_unlock();
HeapFree(GetProcessHeap(), 0, lpstr); HeapFree(GetProcessHeap(), 0, lpstr);
...@@ -2020,21 +2007,15 @@ static BOOL X11DRV_CLIPBOARD_QueryTargets(Display *display, Window w, Atom selec ...@@ -2020,21 +2007,15 @@ static BOOL X11DRV_CLIPBOARD_QueryTargets(Display *display, Window w, Atom selec
Atom target, XEvent *xe) Atom target, XEvent *xe)
{ {
INT i; INT i;
Bool res;
wine_tsx11_lock(); XConvertSelection(display, selection, target, x11drv_atom(SELECTION_DATA), w, CurrentTime);
XConvertSelection(display, selection, target,
x11drv_atom(SELECTION_DATA), w, CurrentTime);
wine_tsx11_unlock();
/* /*
* Wait until SelectionNotify is received * Wait until SelectionNotify is received
*/ */
for (i = 0; i < SELECTION_RETRIES; i++) for (i = 0; i < SELECTION_RETRIES; i++)
{ {
wine_tsx11_lock(); Bool res = XCheckTypedWindowEvent(display, w, SelectionNotify, xe);
res = XCheckTypedWindowEvent(display, w, SelectionNotify, xe);
wine_tsx11_unlock();
if (res && xe->xselection.selection == selection) break; if (res && xe->xselection.selection == selection) break;
usleep(SELECTION_WAIT); usleep(SELECTION_WAIT);
...@@ -2134,9 +2115,7 @@ static VOID X11DRV_CLIPBOARD_InsertSelectionProperties(Display *display, Atom* p ...@@ -2134,9 +2115,7 @@ static VOID X11DRV_CLIPBOARD_InsertSelectionProperties(Display *display, Atom* p
i, lpFormat->drvData, debugstr_format(lpFormat->wFormatID)); i, lpFormat->drvData, debugstr_format(lpFormat->wFormatID));
X11DRV_CLIPBOARD_InsertClipboardData(lpFormat->wFormatID, 0, 0, lpFormat, FALSE); X11DRV_CLIPBOARD_InsertClipboardData(lpFormat->wFormatID, 0, 0, lpFormat, FALSE);
} }
wine_tsx11_lock();
for (i = 0; i < nb_atoms; i++) XFree( names[i] ); for (i = 0; i < nb_atoms; i++) XFree( names[i] );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, names ); HeapFree( GetProcessHeap(), 0, names );
} }
HeapFree( GetProcessHeap(), 0, atoms ); HeapFree( GetProcessHeap(), 0, atoms );
...@@ -2253,9 +2232,7 @@ static int X11DRV_CLIPBOARD_QueryAvailableData(Display *display, LPCLIPBOARDINFO ...@@ -2253,9 +2232,7 @@ static int X11DRV_CLIPBOARD_QueryAvailableData(Display *display, LPCLIPBOARDINFO
} }
/* Free the list of targets */ /* Free the list of targets */
wine_tsx11_lock();
XFree(targetList); XFree(targetList);
wine_tsx11_unlock();
} }
return cSelectionTargets; return cSelectionTargets;
...@@ -2299,17 +2276,13 @@ static BOOL X11DRV_CLIPBOARD_ReadSelectionData(Display *display, LPWINE_CLIPDATA ...@@ -2299,17 +2276,13 @@ static BOOL X11DRV_CLIPBOARD_ReadSelectionData(Display *display, LPWINE_CLIPDATA
debugstr_format(lpData->lpFormat->wFormatID), lpData->lpFormat->drvData, debugstr_format(lpData->lpFormat->wFormatID), lpData->lpFormat->drvData,
(UINT)selectionCacheSrc); (UINT)selectionCacheSrc);
wine_tsx11_lock();
XConvertSelection(display, selectionCacheSrc, lpData->lpFormat->drvData, XConvertSelection(display, selectionCacheSrc, lpData->lpFormat->drvData,
x11drv_atom(SELECTION_DATA), w, CurrentTime); x11drv_atom(SELECTION_DATA), w, CurrentTime);
wine_tsx11_unlock();
/* wait until SelectionNotify is received */ /* wait until SelectionNotify is received */
for (i = 0; i < SELECTION_RETRIES; i++) for (i = 0; i < SELECTION_RETRIES; i++)
{ {
wine_tsx11_lock();
res = XCheckTypedWindowEvent(display, w, SelectionNotify, &xe); res = XCheckTypedWindowEvent(display, w, SelectionNotify, &xe);
wine_tsx11_unlock();
if (res && xe.xselection.selection == selectionCacheSrc) break; if (res && xe.xselection.selection == selectionCacheSrc) break;
usleep(SELECTION_WAIT); usleep(SELECTION_WAIT);
...@@ -2402,9 +2375,7 @@ static BOOL X11DRV_CLIPBOARD_GetProperty(Display *display, Window w, Atom prop, ...@@ -2402,9 +2375,7 @@ static BOOL X11DRV_CLIPBOARD_GetProperty(Display *display, Window w, Atom prop,
/* Delete the property on the window now that we are done /* Delete the property on the window now that we are done
* This will send a PropertyNotify event to the selection owner. */ * This will send a PropertyNotify event to the selection owner. */
wine_tsx11_lock();
XDeleteProperty(display, w, prop); XDeleteProperty(display, w, prop);
wine_tsx11_unlock();
return TRUE; return TRUE;
} }
...@@ -2425,10 +2396,8 @@ static BOOL X11DRV_CLIPBOARD_ReadProperty(Display *display, Window w, Atom prop, ...@@ -2425,10 +2396,8 @@ static BOOL X11DRV_CLIPBOARD_ReadProperty(Display *display, Window w, Atom prop,
if (!X11DRV_CLIPBOARD_GetProperty(display, w, prop, &atype, data, datasize)) if (!X11DRV_CLIPBOARD_GetProperty(display, w, prop, &atype, data, datasize))
return FALSE; return FALSE;
wine_tsx11_lock();
while (XCheckTypedWindowEvent(display, w, PropertyNotify, &xe)) while (XCheckTypedWindowEvent(display, w, PropertyNotify, &xe))
; ;
wine_tsx11_unlock();
if (atype == x11drv_atom(INCR)) if (atype == x11drv_atom(INCR))
{ {
...@@ -2446,9 +2415,7 @@ static BOOL X11DRV_CLIPBOARD_ReadProperty(Display *display, Window w, Atom prop, ...@@ -2446,9 +2415,7 @@ static BOOL X11DRV_CLIPBOARD_ReadProperty(Display *display, Window w, Atom prop,
{ {
Bool res; Bool res;
wine_tsx11_lock();
res = XCheckTypedWindowEvent(display, w, PropertyNotify, &xe); res = XCheckTypedWindowEvent(display, w, PropertyNotify, &xe);
wine_tsx11_unlock();
if (res && xe.xproperty.atom == prop && if (res && xe.xproperty.atom == prop &&
xe.xproperty.state == PropertyNewValue) xe.xproperty.state == PropertyNewValue)
break; break;
...@@ -3177,14 +3144,12 @@ static Atom X11DRV_SelectionRequest_MULTIPLE( HWND hWnd, XSelectionRequestEvent ...@@ -3177,14 +3144,12 @@ static Atom X11DRV_SelectionRequest_MULTIPLE( HWND hWnd, XSelectionRequestEvent
if (TRACE_ON(clipboard)) if (TRACE_ON(clipboard))
{ {
char *targetName, *propName; char *targetName, *propName;
wine_tsx11_lock();
targetName = XGetAtomName(display, targetPropList[i]); targetName = XGetAtomName(display, targetPropList[i]);
propName = XGetAtomName(display, targetPropList[i+1]); propName = XGetAtomName(display, targetPropList[i+1]);
TRACE("MULTIPLE(%d): Target='%s' Prop='%s'\n", TRACE("MULTIPLE(%d): Target='%s' Prop='%s'\n",
i/2, targetName, propName); i/2, targetName, propName);
XFree(targetName); XFree(targetName);
XFree(propName); XFree(propName);
wine_tsx11_unlock();
} }
/* We must have a non "None" property to service a MULTIPLE target atom */ /* We must have a non "None" property to service a MULTIPLE target atom */
...@@ -3207,9 +3172,7 @@ static Atom X11DRV_SelectionRequest_MULTIPLE( HWND hWnd, XSelectionRequestEvent ...@@ -3207,9 +3172,7 @@ static Atom X11DRV_SelectionRequest_MULTIPLE( HWND hWnd, XSelectionRequestEvent
} }
/* Free the list of targets/properties */ /* Free the list of targets/properties */
wine_tsx11_lock();
XFree(targetPropList); XFree(targetPropList);
wine_tsx11_unlock();
} }
return rprop; return rprop;
...@@ -3316,9 +3279,7 @@ END: ...@@ -3316,9 +3279,7 @@ END:
result.target = event->target; result.target = event->target;
result.time = event->time; result.time = event->time;
TRACE("Sending SelectionNotify event...\n"); TRACE("Sending SelectionNotify event...\n");
wine_tsx11_lock();
XSendEvent(display,event->requestor,False,NoEventMask,(XEvent*)&result); XSendEvent(display,event->requestor,False,NoEventMask,(XEvent*)&result);
wine_tsx11_unlock();
} }
} }
......
...@@ -192,12 +192,10 @@ static BOOL CALLBACK update_windows_on_desktop_resize( HWND hwnd, LPARAM lparam ...@@ -192,12 +192,10 @@ static BOOL CALLBACK update_windows_on_desktop_resize( HWND hwnd, LPARAM lparam
{ {
XWindowChanges changes; XWindowChanges changes;
wine_tsx11_lock();
changes.x = data->whole_rect.left - virtual_screen_rect.left; changes.x = data->whole_rect.left - virtual_screen_rect.left;
changes.y = data->whole_rect.top - virtual_screen_rect.top; changes.y = data->whole_rect.top - virtual_screen_rect.top;
XReconfigureWMWindow( display, data->whole_window, XReconfigureWMWindow( display, data->whole_window,
DefaultScreen(display), mask, &changes ); DefaultScreen(display), mask, &changes );
wine_tsx11_unlock();
} }
if (hwnd == GetForegroundWindow()) clip_fullscreen_window( hwnd, TRUE ); if (hwnd == GetForegroundWindow()) clip_fullscreen_window( hwnd, TRUE );
return TRUE; return TRUE;
......
...@@ -555,9 +555,7 @@ static void set_focus( Display *display, HWND hwnd, Time time ) ...@@ -555,9 +555,7 @@ static void set_focus( Display *display, HWND hwnd, Time time )
if (win) if (win)
{ {
TRACE( "setting focus to %p (%lx) time=%ld\n", focus, win, time ); TRACE( "setting focus to %p (%lx) time=%ld\n", focus, win, time );
wine_tsx11_lock();
XSetInputFocus( display, win, RevertToParent, time ); XSetInputFocus( display, win, RevertToParent, time );
wine_tsx11_unlock();
} }
} }
...@@ -678,12 +676,8 @@ static void handle_wm_protocols( HWND hwnd, XClientMessageEvent *event ) ...@@ -678,12 +676,8 @@ static void handle_wm_protocols( HWND hwnd, XClientMessageEvent *event )
xev = *event; xev = *event;
TRACE("NET_WM Ping\n"); TRACE("NET_WM Ping\n");
wine_tsx11_lock();
xev.window = DefaultRootWindow(xev.display); xev.window = DefaultRootWindow(xev.display);
XSendEvent(xev.display, xev.window, False, SubstructureRedirectMask | SubstructureNotifyMask, (XEvent*)&xev); XSendEvent(xev.display, xev.window, False, SubstructureRedirectMask | SubstructureNotifyMask, (XEvent*)&xev);
wine_tsx11_unlock();
/* this line is semi-stolen from gtk2 */
TRACE("NET_WM Pong\n");
} }
} }
...@@ -715,12 +709,7 @@ static void X11DRV_FocusIn( HWND hwnd, XEvent *xev ) ...@@ -715,12 +709,7 @@ static void X11DRV_FocusIn( HWND hwnd, XEvent *xev )
if (event->detail == NotifyPointer) return; if (event->detail == NotifyPointer) return;
if (hwnd == GetDesktopWindow()) return; if (hwnd == GetDesktopWindow()) return;
if ((xic = X11DRV_get_ic( hwnd ))) if ((xic = X11DRV_get_ic( hwnd ))) XSetICFocus( xic );
{
wine_tsx11_lock();
XSetICFocus( xic );
wine_tsx11_unlock();
}
if (use_take_focus) if (use_take_focus)
{ {
if (hwnd == GetForegroundWindow()) clip_fullscreen_window( hwnd, FALSE ); if (hwnd == GetForegroundWindow()) clip_fullscreen_window( hwnd, FALSE );
...@@ -763,12 +752,8 @@ static void X11DRV_FocusOut( HWND hwnd, XEvent *xev ) ...@@ -763,12 +752,8 @@ static void X11DRV_FocusOut( HWND hwnd, XEvent *xev )
if (ximInComposeMode) return; if (ximInComposeMode) return;
x11drv_thread_data()->last_focus = hwnd; x11drv_thread_data()->last_focus = hwnd;
if ((xic = X11DRV_get_ic( hwnd ))) if ((xic = X11DRV_get_ic( hwnd ))) XUnsetICFocus( xic );
{
wine_tsx11_lock();
XUnsetICFocus( xic );
wine_tsx11_unlock();
}
if (root_window != DefaultRootWindow(event->display)) if (root_window != DefaultRootWindow(event->display))
{ {
if (hwnd == GetDesktopWindow()) reset_clipping_window(); if (hwnd == GetDesktopWindow()) reset_clipping_window();
...@@ -780,14 +765,12 @@ static void X11DRV_FocusOut( HWND hwnd, XEvent *xev ) ...@@ -780,14 +765,12 @@ static void X11DRV_FocusOut( HWND hwnd, XEvent *xev )
/* don't reset the foreground window, if the window which is /* don't reset the foreground window, if the window which is
getting the focus is a Wine window */ getting the focus is a Wine window */
wine_tsx11_lock();
XGetInputFocus( event->display, &focus_win, &revert ); XGetInputFocus( event->display, &focus_win, &revert );
if (focus_win) if (focus_win)
{ {
if (XFindContext( event->display, focus_win, winContext, (char **)&hwnd_tmp ) != 0) if (XFindContext( event->display, focus_win, winContext, (char **)&hwnd_tmp ) != 0)
focus_win = 0; focus_win = 0;
} }
wine_tsx11_unlock();
if (!focus_win) if (!focus_win)
{ {
...@@ -1004,10 +987,8 @@ void X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev ) ...@@ -1004,10 +987,8 @@ void X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev )
if (!root_coords && parent == GetDesktopWindow()) /* normal event, map coordinates to the root */ if (!root_coords && parent == GetDesktopWindow()) /* normal event, map coordinates to the root */
{ {
Window child; Window child;
wine_tsx11_lock();
XTranslateCoordinates( event->display, event->window, root_window, XTranslateCoordinates( event->display, event->window, root_window,
0, 0, &x, &y, &child ); 0, 0, &x, &y, &child );
wine_tsx11_unlock();
root_coords = TRUE; root_coords = TRUE;
} }
rect.left = x; rect.left = x;
...@@ -1326,12 +1307,10 @@ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event ) ...@@ -1326,12 +1307,10 @@ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event )
Window win, w_aux_root, w_aux_child; Window win, w_aux_root, w_aux_child;
win = X11DRV_get_whole_window(hWnd); win = X11DRV_get_whole_window(hWnd);
wine_tsx11_lock();
XQueryPointer( event->display, win, &w_aux_root, &w_aux_child, XQueryPointer( event->display, win, &w_aux_root, &w_aux_child,
&x, &y, &dummy, &dummy, (unsigned int*)&aux_long); &x, &y, &dummy, &dummy, (unsigned int*)&aux_long);
x += virtual_screen_rect.left; x += virtual_screen_rect.left;
y += virtual_screen_rect.top; y += virtual_screen_rect.top;
wine_tsx11_unlock();
if (!(data = X11DRV_get_win_data( hWnd ))) return; if (!(data = X11DRV_get_win_data( hWnd ))) return;
...@@ -1362,12 +1341,10 @@ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event ) ...@@ -1362,12 +1341,10 @@ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event )
if (!bAccept) return; if (!bAccept) return;
wine_tsx11_lock();
XGetWindowProperty( event->display, DefaultRootWindow(event->display), XGetWindowProperty( event->display, DefaultRootWindow(event->display),
x11drv_atom(DndSelection), 0, 65535, FALSE, x11drv_atom(DndSelection), 0, 65535, FALSE,
AnyPropertyType, &atom_aux, &dummy, AnyPropertyType, &atom_aux, &dummy,
&data_length, &aux_long, &p_data); &data_length, &aux_long, &p_data);
wine_tsx11_unlock();
if( !aux_long && p_data) /* don't bother if > 64K */ if( !aux_long && p_data) /* don't bother if > 64K */
{ {
...@@ -1410,9 +1387,7 @@ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event ) ...@@ -1410,9 +1387,7 @@ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event )
} }
} }
} }
wine_tsx11_lock();
if( p_data ) XFree(p_data); if( p_data ) XFree(p_data);
wine_tsx11_unlock();
} }
/********************************************************************** /**********************************************************************
...@@ -1443,12 +1418,10 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event ) ...@@ -1443,12 +1418,10 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event )
if (!(GetWindowLongW( hWnd, GWL_EXSTYLE ) & WS_EX_ACCEPTFILES)) return; if (!(GetWindowLongW( hWnd, GWL_EXSTYLE ) & WS_EX_ACCEPTFILES)) return;
wine_tsx11_lock();
XGetWindowProperty( event->display, DefaultRootWindow(event->display), XGetWindowProperty( event->display, DefaultRootWindow(event->display),
x11drv_atom(DndSelection), 0, 65535, FALSE, x11drv_atom(DndSelection), 0, 65535, FALSE,
AnyPropertyType, &u.atom_aux, &u.i, AnyPropertyType, &u.atom_aux, &u.i,
&data_length, &aux_long, &p_data); &data_length, &aux_long, &p_data);
wine_tsx11_unlock();
if (aux_long) if (aux_long)
WARN("property too large, truncated!\n"); WARN("property too large, truncated!\n");
TRACE("urls=%s\n", p_data); TRACE("urls=%s\n", p_data);
...@@ -1473,12 +1446,10 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event ) ...@@ -1473,12 +1446,10 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event )
} }
if( drop_len && drop_len < 65535 ) { if( drop_len && drop_len < 65535 ) {
wine_tsx11_lock();
XQueryPointer( event->display, root_window, &u.w_aux, &u.w_aux, XQueryPointer( event->display, root_window, &u.w_aux, &u.w_aux,
&x, &y, &u.i, &u.i, &u.u); &x, &y, &u.i, &u.i, &u.u);
x += virtual_screen_rect.left; x += virtual_screen_rect.left;
y += virtual_screen_rect.top; y += virtual_screen_rect.top;
wine_tsx11_unlock();
drop_len += sizeof(DROPFILES) + 1; drop_len += sizeof(DROPFILES) + 1;
hDrop = GlobalAlloc( GMEM_SHARE, drop_len ); hDrop = GlobalAlloc( GMEM_SHARE, drop_len );
...@@ -1529,9 +1500,7 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event ) ...@@ -1529,9 +1500,7 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event )
PostMessageA( hWnd, WM_DROPFILES, (WPARAM)hDrop, 0L ); PostMessageA( hWnd, WM_DROPFILES, (WPARAM)hDrop, 0L );
} }
} }
wine_tsx11_lock();
if( p_data ) XFree(p_data); if( p_data ) XFree(p_data);
wine_tsx11_unlock();
} }
} }
...@@ -1569,11 +1538,9 @@ static void handle_dnd_protocol( HWND hwnd, XClientMessageEvent *event ) ...@@ -1569,11 +1538,9 @@ static void handle_dnd_protocol( HWND hwnd, XClientMessageEvent *event )
unsigned int u; unsigned int u;
/* query window (drag&drop event contains only drag window) */ /* query window (drag&drop event contains only drag window) */
wine_tsx11_lock();
XQueryPointer( event->display, root_window, &root, &child, XQueryPointer( event->display, root_window, &root, &child,
&root_x, &root_y, &child_x, &child_y, &u); &root_x, &root_y, &child_x, &child_y, &u);
if (XFindContext( event->display, child, winContext, (char **)&hwnd ) != 0) hwnd = 0; if (XFindContext( event->display, child, winContext, (char **)&hwnd ) != 0) hwnd = 0;
wine_tsx11_unlock();
if (!hwnd) return; if (!hwnd) return;
if (event->data.l[0] == DndFile || event->data.l[0] == DndFiles) if (event->data.l[0] == DndFile || event->data.l[0] == DndFiles)
EVENT_DropFromOffiX(hwnd, event); EVENT_DropFromOffiX(hwnd, event);
......
...@@ -247,16 +247,12 @@ static void update_x11_clipping( X11DRV_PDEVICE *physDev, HRGN rgn ) ...@@ -247,16 +247,12 @@ static void update_x11_clipping( X11DRV_PDEVICE *physDev, HRGN rgn )
if (!rgn) if (!rgn)
{ {
wine_tsx11_lock();
XSetClipMask( gdi_display, physDev->gc, None ); XSetClipMask( gdi_display, physDev->gc, None );
wine_tsx11_unlock();
} }
else if ((data = X11DRV_GetRegionData( rgn, 0 ))) else if ((data = X11DRV_GetRegionData( rgn, 0 )))
{ {
wine_tsx11_lock();
XSetClipRectangles( gdi_display, physDev->gc, physDev->dc_rect.left, physDev->dc_rect.top, XSetClipRectangles( gdi_display, physDev->gc, physDev->dc_rect.left, physDev->dc_rect.top,
(XRectangle *)data->Buffer, data->rdh.nCount, YXBanded ); (XRectangle *)data->Buffer, data->rdh.nCount, YXBanded );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, data ); HeapFree( GetProcessHeap(), 0, data );
} }
} }
...@@ -393,13 +389,11 @@ BOOL X11DRV_SetupGCForPatBlt( X11DRV_PDEVICE *physDev, GC gc, BOOL fMapColors ) ...@@ -393,13 +389,11 @@ BOOL X11DRV_SetupGCForPatBlt( X11DRV_PDEVICE *physDev, GC gc, BOOL fMapColors )
val.ts_x_origin = physDev->dc_rect.left + pt.x; val.ts_x_origin = physDev->dc_rect.left + pt.x;
val.ts_y_origin = physDev->dc_rect.top + pt.y; val.ts_y_origin = physDev->dc_rect.top + pt.y;
val.fill_rule = (GetPolyFillMode(physDev->dev.hdc) == WINDING) ? WindingRule : EvenOddRule; val.fill_rule = (GetPolyFillMode(physDev->dev.hdc) == WINDING) ? WindingRule : EvenOddRule;
wine_tsx11_lock();
XChangeGC( gdi_display, gc, XChangeGC( gdi_display, gc,
GCFunction | GCForeground | GCBackground | GCFillStyle | GCFunction | GCForeground | GCBackground | GCFillStyle |
GCFillRule | GCTileStipXOrigin | GCTileStipYOrigin | mask, GCFillRule | GCTileStipXOrigin | GCTileStipYOrigin | mask,
&val ); &val );
if (pixmap) XFreePixmap( gdi_display, pixmap ); if (pixmap) XFreePixmap( gdi_display, pixmap );
wine_tsx11_unlock();
return TRUE; return TRUE;
} }
...@@ -490,13 +484,11 @@ static BOOL X11DRV_SetupGCForPen( X11DRV_PDEVICE *physDev ) ...@@ -490,13 +484,11 @@ static BOOL X11DRV_SetupGCForPen( X11DRV_PDEVICE *physDev )
else else
val.line_style = LineSolid; val.line_style = LineSolid;
wine_tsx11_lock();
if (physDev->pen.dash_len) if (physDev->pen.dash_len)
XSetDashes( gdi_display, physDev->gc, 0, physDev->pen.dashes, physDev->pen.dash_len ); XSetDashes( gdi_display, physDev->gc, 0, physDev->pen.dashes, physDev->pen.dash_len );
XChangeGC( gdi_display, physDev->gc, XChangeGC( gdi_display, physDev->gc,
GCFunction | GCForeground | GCBackground | GCLineWidth | GCFunction | GCForeground | GCBackground | GCLineWidth |
GCLineStyle | GCCapStyle | GCJoinStyle | GCFillStyle, &val ); GCLineStyle | GCCapStyle | GCJoinStyle | GCFillStyle, &val );
wine_tsx11_unlock();
return TRUE; return TRUE;
} }
...@@ -550,13 +542,9 @@ BOOL X11DRV_LineTo( PHYSDEV dev, INT x, INT y ) ...@@ -550,13 +542,9 @@ BOOL X11DRV_LineTo( PHYSDEV dev, INT x, INT y )
add_pen_device_bounds( physDev, pt, 2 ); add_pen_device_bounds( physDev, pt, 2 );
if (X11DRV_SetupGCForPen( physDev )) if (X11DRV_SetupGCForPen( physDev ))
{
wine_tsx11_lock();
XDrawLine(gdi_display, physDev->drawable, physDev->gc, XDrawLine(gdi_display, physDev->drawable, physDev->gc,
physDev->dc_rect.left + pt[0].x, physDev->dc_rect.top + pt[0].y, physDev->dc_rect.left + pt[0].x, physDev->dc_rect.top + pt[0].y,
physDev->dc_rect.left + pt[1].x, physDev->dc_rect.top + pt[1].y ); physDev->dc_rect.left + pt[1].x, physDev->dc_rect.top + pt[1].y );
wine_tsx11_unlock();
}
return TRUE; return TRUE;
} }
...@@ -633,12 +621,10 @@ static BOOL X11DRV_DrawArc( PHYSDEV dev, INT left, INT top, INT right, INT botto ...@@ -633,12 +621,10 @@ static BOOL X11DRV_DrawArc( PHYSDEV dev, INT left, INT top, INT right, INT botto
/* Fill arc with brush if Chord() or Pie() */ /* Fill arc with brush if Chord() or Pie() */
if ((lines > 0) && X11DRV_SetupGCForBrush( physDev )) { if ((lines > 0) && X11DRV_SetupGCForBrush( physDev )) {
wine_tsx11_lock();
XSetArcMode( gdi_display, physDev->gc, (lines==1) ? ArcChord : ArcPieSlice); XSetArcMode( gdi_display, physDev->gc, (lines==1) ? ArcChord : ArcPieSlice);
XFillArc( gdi_display, physDev->drawable, physDev->gc, XFillArc( gdi_display, physDev->drawable, physDev->gc,
physDev->dc_rect.left + rc.left, physDev->dc_rect.top + rc.top, physDev->dc_rect.left + rc.left, physDev->dc_rect.top + rc.top,
rc.right-rc.left-1, rc.bottom-rc.top-1, istart_angle, idiff_angle ); rc.right-rc.left-1, rc.bottom-rc.top-1, istart_angle, idiff_angle );
wine_tsx11_unlock();
} }
/* Draw arc and lines */ /* Draw arc and lines */
...@@ -771,21 +757,14 @@ BOOL X11DRV_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) ...@@ -771,21 +757,14 @@ BOOL X11DRV_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
physDev->pen.width = width; physDev->pen.width = width;
if (X11DRV_SetupGCForBrush( physDev )) if (X11DRV_SetupGCForBrush( physDev ))
{
wine_tsx11_lock();
XFillArc( gdi_display, physDev->drawable, physDev->gc, XFillArc( gdi_display, physDev->drawable, physDev->gc,
physDev->dc_rect.left + rc.left, physDev->dc_rect.top + rc.top, physDev->dc_rect.left + rc.left, physDev->dc_rect.top + rc.top,
rc.right-rc.left-1, rc.bottom-rc.top-1, 0, 360*64 ); rc.right-rc.left-1, rc.bottom-rc.top-1, 0, 360*64 );
wine_tsx11_unlock();
}
if (X11DRV_SetupGCForPen( physDev )) if (X11DRV_SetupGCForPen( physDev ))
{
wine_tsx11_lock();
XDrawArc( gdi_display, physDev->drawable, physDev->gc, XDrawArc( gdi_display, physDev->drawable, physDev->gc,
physDev->dc_rect.left + rc.left, physDev->dc_rect.top + rc.top, physDev->dc_rect.left + rc.left, physDev->dc_rect.top + rc.top,
rc.right-rc.left-1, rc.bottom-rc.top-1, 0, 360*64 ); rc.right-rc.left-1, rc.bottom-rc.top-1, 0, 360*64 );
wine_tsx11_unlock();
}
physDev->pen.width = oldwidth; physDev->pen.width = oldwidth;
add_pen_device_bounds( physDev, (POINT *)&rc, 2 ); add_pen_device_bounds( physDev, (POINT *)&rc, 2 );
...@@ -830,23 +809,15 @@ BOOL X11DRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT bottom) ...@@ -830,23 +809,15 @@ BOOL X11DRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT bottom)
if ((rc.right >= rc.left + width) && (rc.bottom >= rc.top + width)) if ((rc.right >= rc.left + width) && (rc.bottom >= rc.top + width))
{ {
if (X11DRV_SetupGCForBrush( physDev )) if (X11DRV_SetupGCForBrush( physDev ))
{
wine_tsx11_lock();
XFillRectangle( gdi_display, physDev->drawable, physDev->gc, XFillRectangle( gdi_display, physDev->drawable, physDev->gc,
physDev->dc_rect.left + rc.left + (width + 1) / 2, physDev->dc_rect.left + rc.left + (width + 1) / 2,
physDev->dc_rect.top + rc.top + (width + 1) / 2, physDev->dc_rect.top + rc.top + (width + 1) / 2,
rc.right-rc.left-width, rc.bottom-rc.top-width); rc.right-rc.left-width, rc.bottom-rc.top-width);
wine_tsx11_unlock();
}
} }
if (X11DRV_SetupGCForPen( physDev )) if (X11DRV_SetupGCForPen( physDev ))
{
wine_tsx11_lock();
XDrawRectangle( gdi_display, physDev->drawable, physDev->gc, XDrawRectangle( gdi_display, physDev->drawable, physDev->gc,
physDev->dc_rect.left + rc.left, physDev->dc_rect.top + rc.top, physDev->dc_rect.left + rc.left, physDev->dc_rect.top + rc.top,
rc.right-rc.left, rc.bottom-rc.top ); rc.right-rc.left, rc.bottom-rc.top );
wine_tsx11_unlock();
}
physDev->pen.width = oldwidth; physDev->pen.width = oldwidth;
physDev->pen.linejoin = oldjoinstyle; physDev->pen.linejoin = oldjoinstyle;
...@@ -1064,12 +1035,10 @@ COLORREF X11DRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color ) ...@@ -1064,12 +1035,10 @@ COLORREF X11DRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color )
LPtoDP( dev->hdc, &pt, 1 ); LPtoDP( dev->hdc, &pt, 1 );
pixel = X11DRV_PALETTE_ToPhysical( physDev, color ); pixel = X11DRV_PALETTE_ToPhysical( physDev, color );
wine_tsx11_lock();
XSetForeground( gdi_display, physDev->gc, pixel ); XSetForeground( gdi_display, physDev->gc, pixel );
XSetFunction( gdi_display, physDev->gc, GXcopy ); XSetFunction( gdi_display, physDev->gc, GXcopy );
XDrawPoint( gdi_display, physDev->drawable, physDev->gc, XDrawPoint( gdi_display, physDev->drawable, physDev->gc,
physDev->dc_rect.left + pt.x, physDev->dc_rect.top + pt.y ); physDev->dc_rect.left + pt.x, physDev->dc_rect.top + pt.y );
wine_tsx11_unlock();
SetRect( &rect, pt.x, pt.y, pt.x + 1, pt.y + 1 ); SetRect( &rect, pt.x, pt.y, pt.x + 1, pt.y + 1 );
add_device_bounds( physDev, &rect ); add_device_bounds( physDev, &rect );
...@@ -1099,9 +1068,7 @@ BOOL X11DRV_PaintRgn( PHYSDEV dev, HRGN hrgn ) ...@@ -1099,9 +1068,7 @@ BOOL X11DRV_PaintRgn( PHYSDEV dev, HRGN hrgn )
rect[i].y += physDev->dc_rect.top; rect[i].y += physDev->dc_rect.top;
} }
wine_tsx11_lock();
XFillRectangles( gdi_display, physDev->drawable, physDev->gc, rect, data->rdh.nCount ); XFillRectangles( gdi_display, physDev->drawable, physDev->gc, rect, data->rdh.nCount );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, data ); HeapFree( GetProcessHeap(), 0, data );
} }
if (GetRgnBox( hrgn, &rc )) if (GetRgnBox( hrgn, &rc ))
...@@ -1141,19 +1108,12 @@ BOOL X11DRV_Polygon( PHYSDEV dev, const POINT* pt, INT count ) ...@@ -1141,19 +1108,12 @@ BOOL X11DRV_Polygon( PHYSDEV dev, const POINT* pt, INT count )
xpoints[count] = xpoints[0]; xpoints[count] = xpoints[0];
if (X11DRV_SetupGCForBrush( physDev )) if (X11DRV_SetupGCForBrush( physDev ))
{
wine_tsx11_lock();
XFillPolygon( gdi_display, physDev->drawable, physDev->gc, XFillPolygon( gdi_display, physDev->drawable, physDev->gc,
xpoints, count+1, Complex, CoordModeOrigin); xpoints, count+1, Complex, CoordModeOrigin);
wine_tsx11_unlock();
}
if (X11DRV_SetupGCForPen ( physDev )) if (X11DRV_SetupGCForPen ( physDev ))
{
wine_tsx11_lock();
XDrawLines( gdi_display, physDev->drawable, physDev->gc, XDrawLines( gdi_display, physDev->drawable, physDev->gc,
xpoints, count+1, CoordModeOrigin ); xpoints, count+1, CoordModeOrigin );
wine_tsx11_unlock();
}
HeapFree( GetProcessHeap(), 0, xpoints ); HeapFree( GetProcessHeap(), 0, xpoints );
HeapFree( GetProcessHeap(), 0, points ); HeapFree( GetProcessHeap(), 0, points );
...@@ -1199,9 +1159,7 @@ BOOL X11DRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts, UINT p ...@@ -1199,9 +1159,7 @@ BOOL X11DRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts, UINT p
rect[i].y += physDev->dc_rect.top; rect[i].y += physDev->dc_rect.top;
} }
wine_tsx11_lock();
XFillRectangles( gdi_display, physDev->drawable, physDev->gc, rect, data->rdh.nCount ); XFillRectangles( gdi_display, physDev->drawable, physDev->gc, rect, data->rdh.nCount );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, data ); HeapFree( GetProcessHeap(), 0, data );
} }
...@@ -1219,9 +1177,7 @@ BOOL X11DRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts, UINT p ...@@ -1219,9 +1177,7 @@ BOOL X11DRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts, UINT p
xpoints[j].y = physDev->dc_rect.top + points[pos + j].y; xpoints[j].y = physDev->dc_rect.top + points[pos + j].y;
} }
xpoints[j] = xpoints[0]; xpoints[j] = xpoints[0];
wine_tsx11_lock();
XDrawLines( gdi_display, physDev->drawable, physDev->gc, xpoints, j + 1, CoordModeOrigin ); XDrawLines( gdi_display, physDev->drawable, physDev->gc, xpoints, j + 1, CoordModeOrigin );
wine_tsx11_unlock();
} }
HeapFree( GetProcessHeap(), 0, xpoints ); HeapFree( GetProcessHeap(), 0, xpoints );
} }
...@@ -1271,9 +1227,7 @@ BOOL X11DRV_PolyPolyline( PHYSDEV dev, const POINT* pt, const DWORD* counts, DWO ...@@ -1271,9 +1227,7 @@ BOOL X11DRV_PolyPolyline( PHYSDEV dev, const POINT* pt, const DWORD* counts, DWO
xpoints[j].x = physDev->dc_rect.left + points[pos + j].x; xpoints[j].x = physDev->dc_rect.left + points[pos + j].x;
xpoints[j].y = physDev->dc_rect.top + points[pos + j].y; xpoints[j].y = physDev->dc_rect.top + points[pos + j].y;
} }
wine_tsx11_lock();
XDrawLines( gdi_display, physDev->drawable, physDev->gc, xpoints, j, CoordModeOrigin ); XDrawLines( gdi_display, physDev->drawable, physDev->gc, xpoints, j, CoordModeOrigin );
wine_tsx11_unlock();
} }
HeapFree( GetProcessHeap(), 0, xpoints ); HeapFree( GetProcessHeap(), 0, xpoints );
} }
...@@ -1408,22 +1362,18 @@ BOOL X11DRV_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT fillTy ...@@ -1408,22 +1362,18 @@ BOOL X11DRV_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT fillTy
reset_bounds( &bounds ); reset_bounds( &bounds );
wine_tsx11_lock();
X11DRV_InternalFloodFill(image, physDev, X11DRV_InternalFloodFill(image, physDev,
pt.x - rect.left, pt.x - rect.left,
pt.y - rect.top, pt.y - rect.top,
physDev->dc_rect.left + rect.left, physDev->dc_rect.left + rect.left,
physDev->dc_rect.top + rect.top, physDev->dc_rect.top + rect.top,
pixel, fillType, &bounds ); pixel, fillType, &bounds );
wine_tsx11_unlock();
OffsetRect( &bounds, rect.left, rect.top ); OffsetRect( &bounds, rect.left, rect.top );
add_device_bounds( physDev, &bounds ); add_device_bounds( physDev, &bounds );
} }
wine_tsx11_lock();
XDestroyImage( image ); XDestroyImage( image );
wine_tsx11_unlock();
return TRUE; return TRUE;
} }
...@@ -1452,10 +1402,8 @@ BOOL X11DRV_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert, ...@@ -1452,10 +1402,8 @@ BOOL X11DRV_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
val.line_width = 1; val.line_width = 1;
val.cap_style = CapNotLast; val.cap_style = CapNotLast;
val.line_style = LineSolid; val.line_style = LineSolid;
wine_tsx11_lock();
XChangeGC( gdi_display, physdev->gc, XChangeGC( gdi_display, physdev->gc,
GCFunction | GCLineWidth | GCLineStyle | GCCapStyle | GCFillStyle, &val ); GCFunction | GCLineWidth | GCLineStyle | GCCapStyle | GCFillStyle, &val );
wine_tsx11_unlock();
reset_bounds( &bounds ); reset_bounds( &bounds );
for (i = 0; i < ngrad; i++, rect++) for (i = 0; i < ngrad; i++, rect++)
...@@ -1489,12 +1437,10 @@ BOOL X11DRV_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert, ...@@ -1489,12 +1437,10 @@ BOOL X11DRV_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
(v[0].Green * (dx - x) + v[1].Green * x) / dx / 256, (v[0].Green * (dx - x) + v[1].Green * x) / dx / 256,
(v[0].Blue * (dx - x) + v[1].Blue * x) / dx / 256) ); (v[0].Blue * (dx - x) + v[1].Blue * x) / dx / 256) );
wine_tsx11_lock();
XSetForeground( gdi_display, physdev->gc, color ); XSetForeground( gdi_display, physdev->gc, color );
XDrawLine( gdi_display, physdev->drawable, physdev->gc, XDrawLine( gdi_display, physdev->drawable, physdev->gc,
physdev->dc_rect.left + rc.left + x, physdev->dc_rect.top + rc.top, physdev->dc_rect.left + rc.left + x, physdev->dc_rect.top + rc.top,
physdev->dc_rect.left + rc.left + x, physdev->dc_rect.top + rc.bottom ); physdev->dc_rect.left + rc.left + x, physdev->dc_rect.top + rc.bottom );
wine_tsx11_unlock();
} }
} }
add_device_bounds( physdev, &bounds ); add_device_bounds( physdev, &bounds );
...@@ -1506,10 +1452,8 @@ BOOL X11DRV_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert, ...@@ -1506,10 +1452,8 @@ BOOL X11DRV_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
val.line_width = 1; val.line_width = 1;
val.cap_style = CapNotLast; val.cap_style = CapNotLast;
val.line_style = LineSolid; val.line_style = LineSolid;
wine_tsx11_lock();
XChangeGC( gdi_display, physdev->gc, XChangeGC( gdi_display, physdev->gc,
GCFunction | GCLineWidth | GCLineStyle | GCCapStyle | GCFillStyle, &val ); GCFunction | GCLineWidth | GCLineStyle | GCCapStyle | GCFillStyle, &val );
wine_tsx11_unlock();
reset_bounds( &bounds ); reset_bounds( &bounds );
for (i = 0; i < ngrad; i++, rect++) for (i = 0; i < ngrad; i++, rect++)
...@@ -1543,12 +1487,10 @@ BOOL X11DRV_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert, ...@@ -1543,12 +1487,10 @@ BOOL X11DRV_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
(v[0].Green * (dy - y) + v[1].Green * y) / dy / 256, (v[0].Green * (dy - y) + v[1].Green * y) / dy / 256,
(v[0].Blue * (dy - y) + v[1].Blue * y) / dy / 256) ); (v[0].Blue * (dy - y) + v[1].Blue * y) / dy / 256) );
wine_tsx11_lock();
XSetForeground( gdi_display, physdev->gc, color ); XSetForeground( gdi_display, physdev->gc, color );
XDrawLine( gdi_display, physdev->drawable, physdev->gc, XDrawLine( gdi_display, physdev->drawable, physdev->gc,
physdev->dc_rect.left + rc.left, physdev->dc_rect.top + rc.top + y, physdev->dc_rect.left + rc.left, physdev->dc_rect.top + rc.top + y,
physdev->dc_rect.left + rc.right, physdev->dc_rect.top + rc.top + y ); physdev->dc_rect.left + rc.right, physdev->dc_rect.top + rc.top + y );
wine_tsx11_unlock();
} }
} }
add_device_bounds( physdev, &bounds ); add_device_bounds( physdev, &bounds );
......
...@@ -92,9 +92,7 @@ static void device_init(void) ...@@ -92,9 +92,7 @@ static void device_init(void)
palette_size = X11DRV_PALETTE_Init(); palette_size = X11DRV_PALETTE_Init();
wine_tsx11_lock();
stock_bitmap_pixmap = XCreatePixmap( gdi_display, root_window, 1, 1, 1 ); stock_bitmap_pixmap = XCreatePixmap( gdi_display, root_window, 1, 1, 1 );
wine_tsx11_unlock();
/* Initialize device caps */ /* Initialize device caps */
log_pixels_x = log_pixels_y = get_dpi(); log_pixels_x = log_pixels_y = get_dpi();
...@@ -121,13 +119,11 @@ static X11DRV_PDEVICE *create_x11_physdev( Drawable drawable ) ...@@ -121,13 +119,11 @@ static X11DRV_PDEVICE *create_x11_physdev( Drawable drawable )
if (!(physDev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*physDev) ))) return NULL; if (!(physDev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*physDev) ))) return NULL;
wine_tsx11_lock();
physDev->drawable = drawable; physDev->drawable = drawable;
physDev->gc = XCreateGC( gdi_display, drawable, 0, NULL ); physDev->gc = XCreateGC( gdi_display, drawable, 0, NULL );
XSetGraphicsExposures( gdi_display, physDev->gc, False ); XSetGraphicsExposures( gdi_display, physDev->gc, False );
XSetSubwindowMode( gdi_display, physDev->gc, IncludeInferiors ); XSetSubwindowMode( gdi_display, physDev->gc, IncludeInferiors );
XFlush( gdi_display ); XFlush( gdi_display );
wine_tsx11_unlock();
return physDev; return physDev;
} }
...@@ -180,9 +176,7 @@ static BOOL X11DRV_DeleteDC( PHYSDEV dev ) ...@@ -180,9 +176,7 @@ static BOOL X11DRV_DeleteDC( PHYSDEV dev )
{ {
X11DRV_PDEVICE *physDev = get_x11drv_dev( dev ); X11DRV_PDEVICE *physDev = get_x11drv_dev( dev );
wine_tsx11_lock();
XFreeGC( gdi_display, physDev->gc ); XFreeGC( gdi_display, physDev->gc );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, physDev ); HeapFree( GetProcessHeap(), 0, physDev );
return TRUE; return TRUE;
} }
...@@ -350,9 +344,7 @@ static INT X11DRV_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID in_d ...@@ -350,9 +344,7 @@ static INT X11DRV_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID in_d
const struct x11drv_escape_set_drawable *data = in_data; const struct x11drv_escape_set_drawable *data = in_data;
physDev->dc_rect = data->dc_rect; physDev->dc_rect = data->dc_rect;
physDev->drawable = data->drawable; physDev->drawable = data->drawable;
wine_tsx11_lock();
XSetSubwindowMode( gdi_display, physDev->gc, data->mode ); XSetSubwindowMode( gdi_display, physDev->gc, data->mode );
wine_tsx11_unlock();
TRACE( "SET_DRAWABLE hdc %p drawable %lx dc_rect %s\n", TRACE( "SET_DRAWABLE hdc %p drawable %lx dc_rect %s\n",
dev->hdc, physDev->drawable, wine_dbgstr_rect(&physDev->dc_rect) ); dev->hdc, physDev->drawable, wine_dbgstr_rect(&physDev->dc_rect) );
return TRUE; return TRUE;
...@@ -367,9 +359,7 @@ static INT X11DRV_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID in_d ...@@ -367,9 +359,7 @@ static INT X11DRV_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID in_d
} }
break; break;
case X11DRV_START_EXPOSURES: case X11DRV_START_EXPOSURES:
wine_tsx11_lock();
XSetGraphicsExposures( gdi_display, physDev->gc, True ); XSetGraphicsExposures( gdi_display, physDev->gc, True );
wine_tsx11_unlock();
physDev->exposures = 0; physDev->exposures = 0;
return TRUE; return TRUE;
case X11DRV_END_EXPOSURES: case X11DRV_END_EXPOSURES:
...@@ -377,18 +367,14 @@ static INT X11DRV_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID in_d ...@@ -377,18 +367,14 @@ static INT X11DRV_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID in_d
{ {
HRGN hrgn = 0, tmp = 0; HRGN hrgn = 0, tmp = 0;
wine_tsx11_lock();
XSetGraphicsExposures( gdi_display, physDev->gc, False ); XSetGraphicsExposures( gdi_display, physDev->gc, False );
wine_tsx11_unlock();
if (physDev->exposures) if (physDev->exposures)
{ {
for (;;) for (;;)
{ {
XEvent event; XEvent event;
wine_tsx11_lock();
XWindowEvent( gdi_display, physDev->drawable, ~0, &event ); XWindowEvent( gdi_display, physDev->drawable, ~0, &event );
wine_tsx11_unlock();
if (event.type == NoExpose) break; if (event.type == NoExpose) break;
if (event.type == GraphicsExpose) if (event.type == GraphicsExpose)
{ {
......
...@@ -1388,9 +1388,7 @@ void X11DRV_KeyEvent( HWND hwnd, XEvent *xev ) ...@@ -1388,9 +1388,7 @@ void X11DRV_KeyEvent( HWND hwnd, XEvent *xev )
if (TRACE_ON(key)){ if (TRACE_ON(key)){
const char *ksname; const char *ksname;
wine_tsx11_lock();
ksname = XKeysymToString(keysym); ksname = XKeysymToString(keysym);
wine_tsx11_unlock();
if (!ksname) if (!ksname)
ksname = "No Name"; ksname = "No Name";
TRACE_(key)("%s : keysym=%lx (%s), # of chars=%d / %s\n", TRACE_(key)("%s : keysym=%lx (%s), # of chars=%d / %s\n",
...@@ -1994,9 +1992,7 @@ void X11DRV_MappingNotify( HWND dummy, XEvent *event ) ...@@ -1994,9 +1992,7 @@ void X11DRV_MappingNotify( HWND dummy, XEvent *event )
{ {
HWND hwnd; HWND hwnd;
wine_tsx11_lock();
XRefreshKeyboardMapping(&event->xmapping); XRefreshKeyboardMapping(&event->xmapping);
wine_tsx11_unlock();
X11DRV_InitKeyboard( event->xmapping.display ); X11DRV_InitKeyboard( event->xmapping.display );
hwnd = GetFocus(); hwnd = GetFocus();
...@@ -2606,9 +2602,7 @@ INT CDECL X11DRV_ToUnicodeEx(UINT virtKey, UINT scanCode, const BYTE *lpKeyState ...@@ -2606,9 +2602,7 @@ INT CDECL X11DRV_ToUnicodeEx(UINT virtKey, UINT scanCode, const BYTE *lpKeyState
{ {
const char *ksname; const char *ksname;
wine_tsx11_lock();
ksname = XKeysymToString(keysym); ksname = XKeysymToString(keysym);
wine_tsx11_unlock();
if (!ksname) ksname = "No Name"; if (!ksname) ksname = "No Name";
TRACE_(key)("%s : keysym=%lx (%s), # of chars=%d / %s\n", TRACE_(key)("%s : keysym=%lx (%s), # of chars=%d / %s\n",
(e.type == KeyPress) ? "KeyPress" : "KeyRelease", (e.type == KeyPress) ? "KeyPress" : "KeyRelease",
...@@ -2662,9 +2656,7 @@ INT CDECL X11DRV_ToUnicodeEx(UINT virtKey, UINT scanCode, const BYTE *lpKeyState ...@@ -2662,9 +2656,7 @@ INT CDECL X11DRV_ToUnicodeEx(UINT virtKey, UINT scanCode, const BYTE *lpKeyState
{ {
const char *ksname; const char *ksname;
wine_tsx11_lock();
ksname = XKeysymToString(keysym); ksname = XKeysymToString(keysym);
wine_tsx11_unlock();
if (!ksname) if (!ksname)
ksname = "No Name"; ksname = "No Name";
if ((keysym >> 8) != 0xff) if ((keysym >> 8) != 0xff)
...@@ -2753,7 +2745,5 @@ found: ...@@ -2753,7 +2745,5 @@ found:
*/ */
void CDECL X11DRV_Beep(void) void CDECL X11DRV_Beep(void)
{ {
wine_tsx11_lock();
XBell(gdi_display, 0); XBell(gdi_display, 0);
wine_tsx11_unlock();
} }
...@@ -266,14 +266,12 @@ static void enable_xinput2(void) ...@@ -266,14 +266,12 @@ static void enable_xinput2(void)
if (data->xi2_state == xi_unknown) if (data->xi2_state == xi_unknown)
{ {
int major = 2, minor = 0; int major = 2, minor = 0;
wine_tsx11_lock();
if (!pXIQueryVersion( data->display, &major, &minor )) data->xi2_state = xi_disabled; if (!pXIQueryVersion( data->display, &major, &minor )) data->xi2_state = xi_disabled;
else else
{ {
data->xi2_state = xi_unavailable; data->xi2_state = xi_unavailable;
WARN( "X Input 2 not available\n" ); WARN( "X Input 2 not available\n" );
} }
wine_tsx11_unlock();
} }
if (data->xi2_state == xi_unavailable) return; if (data->xi2_state == xi_unavailable) return;
...@@ -441,9 +439,7 @@ void ungrab_clipping_window(void) ...@@ -441,9 +439,7 @@ void ungrab_clipping_window(void)
if (!clip_window) return; if (!clip_window) return;
TRACE( "no longer clipping\n" ); TRACE( "no longer clipping\n" );
wine_tsx11_lock();
XUnmapWindow( display, clip_window ); XUnmapWindow( display, clip_window );
wine_tsx11_unlock();
clipping_cursor = 0; clipping_cursor = 0;
SendMessageW( GetDesktopWindow(), WM_X11DRV_CLIP_CURSOR, 0, 0 ); SendMessageW( GetDesktopWindow(), WM_X11DRV_CLIP_CURSOR, 0, 0 );
} }
...@@ -637,13 +633,11 @@ static XcursorImage *create_xcursor_frame( HDC hdc, const ICONINFOEXW *iinfo, HA ...@@ -637,13 +633,11 @@ static XcursorImage *create_xcursor_frame( HDC hdc, const ICONINFOEXW *iinfo, HA
int x, y, i, has_alpha = FALSE; int x, y, i, has_alpha = FALSE;
XcursorPixel *ptr; XcursorPixel *ptr;
wine_tsx11_lock();
image = pXcursorImageCreate( width, height ); image = pXcursorImageCreate( width, height );
wine_tsx11_unlock();
if (!image) if (!image)
{ {
ERR("X11 failed to produce a cursor frame!\n"); ERR("X11 failed to produce a cursor frame!\n");
goto cleanup; return NULL;
} }
image->xhot = iinfo->xHotspot; image->xhot = iinfo->xHotspot;
...@@ -768,9 +762,7 @@ static Cursor create_xcursor_cursor( HDC hdc, const ICONINFOEXW *iinfo, HANDLE i ...@@ -768,9 +762,7 @@ static Cursor create_xcursor_cursor( HDC hdc, const ICONINFOEXW *iinfo, HANDLE i
if (!(images = pXcursorImagesCreate( nFrames ))) goto cleanup; if (!(images = pXcursorImagesCreate( nFrames ))) goto cleanup;
for (images->nimage = 0; images->nimage < nFrames; images->nimage++) for (images->nimage = 0; images->nimage < nFrames; images->nimage++)
images->images[images->nimage] = imgs[images->nimage]; images->images[images->nimage] = imgs[images->nimage];
wine_tsx11_lock();
cursor = pXcursorImagesLoadCursor( gdi_display, images ); cursor = pXcursorImagesLoadCursor( gdi_display, images );
wine_tsx11_unlock();
pXcursorImagesDestroy( images ); /* Note: this frees each individual frame (calls XcursorImageDestroy) */ pXcursorImagesDestroy( images ); /* Note: this frees each individual frame (calls XcursorImageDestroy) */
HeapFree( GetProcessHeap(), 0, imgs ); HeapFree( GetProcessHeap(), 0, imgs );
imgs = NULL; imgs = NULL;
...@@ -922,9 +914,7 @@ static Cursor create_xcursor_system_cursor( const ICONINFOEXW *info ) ...@@ -922,9 +914,7 @@ static Cursor create_xcursor_system_cursor( const ICONINFOEXW *info )
done: done:
if (valueA[0]) if (valueA[0])
{ {
wine_tsx11_lock();
cursor = pXcursorLibraryLoadCursor( gdi_display, valueA ); cursor = pXcursorLibraryLoadCursor( gdi_display, valueA );
wine_tsx11_unlock();
if (!cursor) WARN( "no system cursor found for %s mapped to %s\n", if (!cursor) WARN( "no system cursor found for %s mapped to %s\n",
debugstr_w(name), debugstr_a(valueA) ); debugstr_w(name), debugstr_a(valueA) );
} }
...@@ -1255,13 +1245,11 @@ BOOL CDECL X11DRV_SetCursorPos( INT x, INT y ) ...@@ -1255,13 +1245,11 @@ BOOL CDECL X11DRV_SetCursorPos( INT x, INT y )
{ {
struct x11drv_thread_data *data = x11drv_init_thread_data(); struct x11drv_thread_data *data = x11drv_init_thread_data();
wine_tsx11_lock();
XWarpPointer( data->display, root_window, root_window, 0, 0, 0, 0, XWarpPointer( data->display, root_window, root_window, 0, 0, 0, 0,
x - virtual_screen_rect.left, y - virtual_screen_rect.top ); x - virtual_screen_rect.left, y - virtual_screen_rect.top );
data->warp_serial = NextRequest( data->display ); data->warp_serial = NextRequest( data->display );
XNoOp( data->display ); XNoOp( data->display );
XFlush( data->display ); /* avoids bad mouse lag in games that do their own mouse warping */ XFlush( data->display ); /* avoids bad mouse lag in games that do their own mouse warping */
wine_tsx11_unlock();
TRACE( "warped to %d,%d serial %lu\n", x, y, data->warp_serial ); TRACE( "warped to %d,%d serial %lu\n", x, y, data->warp_serial );
return TRUE; return TRUE;
} }
...@@ -1344,7 +1332,7 @@ BOOL CDECL X11DRV_ClipCursor( LPCRECT clip ) ...@@ -1344,7 +1332,7 @@ BOOL CDECL X11DRV_ClipCursor( LPCRECT clip )
void move_resize_window( Display *display, struct x11drv_win_data *data, int dir ) void move_resize_window( Display *display, struct x11drv_win_data *data, int dir )
{ {
DWORD pt; DWORD pt;
int x, y, rootX, rootY, ret, button = 0; int x, y, rootX, rootY, button = 0;
XEvent xev; XEvent xev;
Window root, child; Window root, child;
unsigned int xstate; unsigned int xstate;
...@@ -1375,10 +1363,8 @@ void move_resize_window( Display *display, struct x11drv_win_data *data, int dir ...@@ -1375,10 +1363,8 @@ void move_resize_window( Display *display, struct x11drv_win_data *data, int dir
/* need to ungrab the pointer that may have been automatically grabbed /* need to ungrab the pointer that may have been automatically grabbed
* with a ButtonPress event */ * with a ButtonPress event */
wine_tsx11_lock();
XUngrabPointer( display, CurrentTime ); XUngrabPointer( display, CurrentTime );
XSendEvent(display, root_window, False, SubstructureNotifyMask | SubstructureRedirectMask, &xev); XSendEvent(display, root_window, False, SubstructureNotifyMask | SubstructureRedirectMask, &xev);
wine_tsx11_unlock();
/* try to detect the end of the size/move by polling for the mouse button to be released */ /* try to detect the end of the size/move by polling for the mouse button to be released */
/* (some apps don't like it if we return before the size/move is done) */ /* (some apps don't like it if we return before the size/move is done) */
...@@ -1389,10 +1375,7 @@ void move_resize_window( Display *display, struct x11drv_win_data *data, int dir ...@@ -1389,10 +1375,7 @@ void move_resize_window( Display *display, struct x11drv_win_data *data, int dir
MSG msg; MSG msg;
INPUT input; INPUT input;
wine_tsx11_lock(); if (!XQueryPointer( display, root_window, &root, &child, &rootX, &rootY, &x, &y, &xstate )) break;
ret = XQueryPointer( display, root_window, &root, &child, &rootX, &rootY, &x, &y, &xstate );
wine_tsx11_unlock();
if (!ret) break;
if (!(xstate & (Button1Mask << (button - 1)))) if (!(xstate & (Button1Mask << (button - 1))))
{ {
...@@ -1620,9 +1603,7 @@ void X11DRV_XInput2_Init(void) ...@@ -1620,9 +1603,7 @@ void X11DRV_XInput2_Init(void)
LOAD_FUNCPTR(XISelectEvents); LOAD_FUNCPTR(XISelectEvents);
#undef LOAD_FUNCPTR #undef LOAD_FUNCPTR
wine_tsx11_lock();
xinput2_available = XQueryExtension( gdi_display, "XInputExtension", &xinput2_opcode, &event, &error ); xinput2_available = XQueryExtension( gdi_display, "XInputExtension", &xinput2_opcode, &event, &error );
wine_tsx11_unlock();
#else #else
TRACE( "X Input 2 support not compiled in.\n" ); TRACE( "X Input 2 support not compiled in.\n" );
#endif #endif
......
...@@ -1368,9 +1368,7 @@ static BOOL glxdrv_wglSetPixelFormat( HDC hdc, int iPixelFormat, const PIXELFORM ...@@ -1368,9 +1368,7 @@ static BOOL glxdrv_wglSetPixelFormat( HDC hdc, int iPixelFormat, const PIXELFORM
return FALSE; return FALSE;
} }
wine_tsx11_lock();
pglXGetFBConfigAttrib(gdi_display, fmt->fbconfig, GLX_DRAWABLE_TYPE, &value); pglXGetFBConfigAttrib(gdi_display, fmt->fbconfig, GLX_DRAWABLE_TYPE, &value);
wine_tsx11_unlock();
hwnd = WindowFromDC( hdc ); hwnd = WindowFromDC( hdc );
if(hwnd) { if(hwnd) {
...@@ -1414,9 +1412,7 @@ static BOOL glxdrv_wglCopyContext(struct wgl_context *src, struct wgl_context *d ...@@ -1414,9 +1412,7 @@ static BOOL glxdrv_wglCopyContext(struct wgl_context *src, struct wgl_context *d
{ {
TRACE("%p -> %p mask %#x\n", src, dst, mask); TRACE("%p -> %p mask %#x\n", src, dst, mask);
wine_tsx11_lock();
pglXCopyContext(gdi_display, src->ctx, dst->ctx, mask); pglXCopyContext(gdi_display, src->ctx, dst->ctx, mask);
wine_tsx11_unlock();
/* As opposed to wglCopyContext, glXCopyContext doesn't return anything, so hopefully we passed */ /* As opposed to wglCopyContext, glXCopyContext doesn't return anything, so hopefully we passed */
return TRUE; return TRUE;
...@@ -1504,9 +1500,7 @@ static BOOL glxdrv_wglMakeCurrent(HDC hdc, struct wgl_context *ctx) ...@@ -1504,9 +1500,7 @@ static BOOL glxdrv_wglMakeCurrent(HDC hdc, struct wgl_context *ctx)
if (!ctx) if (!ctx)
{ {
wine_tsx11_lock(); pglXMakeCurrent(gdi_display, None, NULL);
ret = pglXMakeCurrent(gdi_display, None, NULL);
wine_tsx11_unlock();
NtCurrentTeb()->glContext = NULL; NtCurrentTeb()->glContext = NULL;
return TRUE; return TRUE;
} }
...@@ -1573,9 +1567,7 @@ static BOOL X11DRV_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, struct ...@@ -1573,9 +1567,7 @@ static BOOL X11DRV_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, struct
if (!ctx) if (!ctx)
{ {
wine_tsx11_lock(); pglXMakeCurrent(gdi_display, None, NULL);
ret = pglXMakeCurrent(gdi_display, None, NULL);
wine_tsx11_unlock();
NtCurrentTeb()->glContext = NULL; NtCurrentTeb()->glContext = NULL;
return TRUE; return TRUE;
} }
...@@ -1651,14 +1643,12 @@ static BOOL glxdrv_wglShareLists(struct wgl_context *org, struct wgl_context *de ...@@ -1651,14 +1643,12 @@ static BOOL glxdrv_wglShareLists(struct wgl_context *org, struct wgl_context *de
} }
else else
{ {
wine_tsx11_lock();
describeContext(org); describeContext(org);
describeContext(dest); describeContext(dest);
/* Re-create the GLX context and share display lists */ /* Re-create the GLX context and share display lists */
pglXDestroyContext(gdi_display, dest->ctx); pglXDestroyContext(gdi_display, dest->ctx);
dest->ctx = create_glxcontext(gdi_display, dest, org->ctx); dest->ctx = create_glxcontext(gdi_display, dest, org->ctx);
wine_tsx11_unlock();
TRACE(" re-created an OpenGL context (%p) for Wine context %p sharing lists with OpenGL ctx %p\n", dest->ctx, dest, org->ctx); TRACE(" re-created an OpenGL context (%p) for Wine context %p sharing lists with OpenGL ctx %p\n", dest->ctx, dest, org->ctx);
org->sharing = TRUE; org->sharing = TRUE;
...@@ -1685,12 +1675,10 @@ static void flush_gl_drawable( struct glx_physdev *physdev ) ...@@ -1685,12 +1675,10 @@ static void flush_gl_drawable( struct glx_physdev *physdev )
case DC_GL_CHILD_WIN: case DC_GL_CHILD_WIN:
/* The GL drawable may be lagged behind if we don't flush first, so /* The GL drawable may be lagged behind if we don't flush first, so
* flush the display make sure we copy up-to-date data */ * flush the display make sure we copy up-to-date data */
wine_tsx11_lock();
XFlush(gdi_display); XFlush(gdi_display);
XSetFunction(gdi_display, physdev->x11dev->gc, GXcopy); XSetFunction(gdi_display, physdev->x11dev->gc, GXcopy);
XCopyArea(gdi_display, src, physdev->x11dev->drawable, physdev->x11dev->gc, 0, 0, w, h, XCopyArea(gdi_display, src, physdev->x11dev->drawable, physdev->x11dev->gc, 0, 0, w, h,
physdev->x11dev->dc_rect.left, physdev->x11dev->dc_rect.top); physdev->x11dev->dc_rect.left, physdev->x11dev->dc_rect.top);
wine_tsx11_unlock();
SetRect( &rect, 0, 0, w, h ); SetRect( &rect, 0, 0, w, h );
add_device_bounds( physdev->x11dev, &rect ); add_device_bounds( physdev->x11dev, &rect );
default: default:
...@@ -1997,9 +1985,7 @@ static struct wgl_pbuffer *X11DRV_wglCreatePbufferARB( HDC hdc, int iPixelFormat ...@@ -1997,9 +1985,7 @@ static struct wgl_pbuffer *X11DRV_wglCreatePbufferARB( HDC hdc, int iPixelFormat
} }
PUSH1(attribs, None); PUSH1(attribs, None);
wine_tsx11_lock();
object->drawable = pglXCreatePbuffer(gdi_display, fmt->fbconfig, attribs); object->drawable = pglXCreatePbuffer(gdi_display, fmt->fbconfig, attribs);
wine_tsx11_unlock();
TRACE("new Pbuffer drawable as %lx\n", object->drawable); TRACE("new Pbuffer drawable as %lx\n", object->drawable);
if (!object->drawable) { if (!object->drawable) {
SetLastError(ERROR_NO_SYSTEM_RESOURCES); SetLastError(ERROR_NO_SYSTEM_RESOURCES);
...@@ -2023,9 +2009,7 @@ static BOOL X11DRV_wglDestroyPbufferARB( struct wgl_pbuffer *object ) ...@@ -2023,9 +2009,7 @@ static BOOL X11DRV_wglDestroyPbufferARB( struct wgl_pbuffer *object )
{ {
TRACE("(%p)\n", object); TRACE("(%p)\n", object);
wine_tsx11_lock();
pglXDestroyPbuffer(gdi_display, object->drawable); pglXDestroyPbuffer(gdi_display, object->drawable);
wine_tsx11_unlock();
HeapFree(GetProcessHeap(), 0, object); HeapFree(GetProcessHeap(), 0, object);
return GL_TRUE; return GL_TRUE;
} }
...@@ -2068,14 +2052,10 @@ static BOOL X11DRV_wglQueryPbufferARB( struct wgl_pbuffer *object, int iAttribut ...@@ -2068,14 +2052,10 @@ static BOOL X11DRV_wglQueryPbufferARB( struct wgl_pbuffer *object, int iAttribut
switch (iAttribute) { switch (iAttribute) {
case WGL_PBUFFER_WIDTH_ARB: case WGL_PBUFFER_WIDTH_ARB:
wine_tsx11_lock();
pglXQueryDrawable(gdi_display, object->drawable, GLX_WIDTH, (unsigned int*) piValue); pglXQueryDrawable(gdi_display, object->drawable, GLX_WIDTH, (unsigned int*) piValue);
wine_tsx11_unlock();
break; break;
case WGL_PBUFFER_HEIGHT_ARB: case WGL_PBUFFER_HEIGHT_ARB:
wine_tsx11_lock();
pglXQueryDrawable(gdi_display, object->drawable, GLX_HEIGHT, (unsigned int*) piValue); pglXQueryDrawable(gdi_display, object->drawable, GLX_HEIGHT, (unsigned int*) piValue);
wine_tsx11_unlock();
break; break;
case WGL_PBUFFER_LOST_ARB: case WGL_PBUFFER_LOST_ARB:
...@@ -2706,11 +2686,7 @@ static BOOL X11DRV_wglSwapIntervalEXT(int interval) ...@@ -2706,11 +2686,7 @@ static BOOL X11DRV_wglSwapIntervalEXT(int interval)
else else
{ {
if (pglXSwapIntervalSGI) if (pglXSwapIntervalSGI)
{
wine_tsx11_lock();
ret = !pglXSwapIntervalSGI(interval); ret = !pglXSwapIntervalSGI(interval);
wine_tsx11_unlock();
}
else else
WARN("GLX_SGI_swap_control extension is not available\n"); WARN("GLX_SGI_swap_control extension is not available\n");
...@@ -2751,10 +2727,7 @@ static BOOL X11DRV_wglSetPixelFormatWINE(HDC hdc, int format) ...@@ -2751,10 +2727,7 @@ static BOOL X11DRV_wglSetPixelFormatWINE(HDC hdc, int format)
return FALSE; return FALSE;
} }
wine_tsx11_lock();
pglXGetFBConfigAttrib(gdi_display, fmt->fbconfig, GLX_DRAWABLE_TYPE, &value); pglXGetFBConfigAttrib(gdi_display, fmt->fbconfig, GLX_DRAWABLE_TYPE, &value);
wine_tsx11_unlock();
if (!(value & GLX_WINDOW_BIT)) if (!(value & GLX_WINDOW_BIT))
{ {
WARN( "Pixel format %d is not compatible for window rendering\n", format ); WARN( "Pixel format %d is not compatible for window rendering\n", format );
...@@ -2900,9 +2873,7 @@ static void X11DRV_WineGL_LoadExtensions(void) ...@@ -2900,9 +2873,7 @@ static void X11DRV_WineGL_LoadExtensions(void)
BOOL destroy_glxpixmap(Display *display, XID glxpixmap) BOOL destroy_glxpixmap(Display *display, XID glxpixmap)
{ {
wine_tsx11_lock();
pglXDestroyGLXPixmap(display, glxpixmap); pglXDestroyGLXPixmap(display, glxpixmap);
wine_tsx11_unlock();
return TRUE; return TRUE;
} }
...@@ -2983,16 +2954,12 @@ static BOOL glxdrv_SwapBuffers(PHYSDEV dev) ...@@ -2983,16 +2954,12 @@ static BOOL glxdrv_SwapBuffers(PHYSDEV dev)
XVisualInfo *visual_from_fbconfig_id( XID fbconfig_id ) XVisualInfo *visual_from_fbconfig_id( XID fbconfig_id )
{ {
WineGLPixelFormat *fmt; WineGLPixelFormat *fmt;
XVisualInfo *ret;
fmt = ConvertPixelFormatGLXtoWGL(gdi_display, fbconfig_id, 0 /* no flags */); fmt = ConvertPixelFormatGLXtoWGL(gdi_display, fbconfig_id, 0 /* no flags */);
if(fmt == NULL) if(fmt == NULL)
return NULL; return NULL;
wine_tsx11_lock(); return pglXGetVisualFromFBConfig(gdi_display, fmt->fbconfig);
ret = pglXGetVisualFromFBConfig(gdi_display, fmt->fbconfig);
wine_tsx11_unlock();
return ret;
} }
static BOOL create_glx_dc( PHYSDEV *pdev ) static BOOL create_glx_dc( PHYSDEV *pdev )
......
...@@ -114,9 +114,7 @@ static int *palette_get_mapping( HPALETTE hpal ) ...@@ -114,9 +114,7 @@ static int *palette_get_mapping( HPALETTE hpal )
{ {
int *mapping; int *mapping;
wine_tsx11_lock();
if (XFindContext( gdi_display, (XID)hpal, palette_context, (char **)&mapping )) mapping = NULL; if (XFindContext( gdi_display, (XID)hpal, palette_context, (char **)&mapping )) mapping = NULL;
wine_tsx11_unlock();
return mapping; return mapping;
} }
...@@ -126,9 +124,7 @@ static int *palette_get_mapping( HPALETTE hpal ) ...@@ -126,9 +124,7 @@ static int *palette_get_mapping( HPALETTE hpal )
*/ */
static void palette_set_mapping( HPALETTE hpal, int *mapping ) static void palette_set_mapping( HPALETTE hpal, int *mapping )
{ {
wine_tsx11_lock();
XSaveContext( gdi_display, (XID)hpal, palette_context, (char *)mapping ); XSaveContext( gdi_display, (XID)hpal, palette_context, (char *)mapping );
wine_tsx11_unlock();
} }
...@@ -146,9 +142,7 @@ int X11DRV_PALETTE_Init(void) ...@@ -146,9 +142,7 @@ int X11DRV_PALETTE_Init(void)
TRACE("initializing palette manager...\n"); TRACE("initializing palette manager...\n");
wine_tsx11_lock();
palette_context = XUniqueContext(); palette_context = XUniqueContext();
wine_tsx11_unlock();
white = WhitePixel( gdi_display, DefaultScreen(gdi_display) ); white = WhitePixel( gdi_display, DefaultScreen(gdi_display) );
black = BlackPixel( gdi_display, DefaultScreen(gdi_display) ); black = BlackPixel( gdi_display, DefaultScreen(gdi_display) );
monoPlane = 1; monoPlane = 1;
...@@ -192,12 +186,10 @@ int X11DRV_PALETTE_Init(void) ...@@ -192,12 +186,10 @@ int X11DRV_PALETTE_Init(void)
break; break;
case StaticGray: case StaticGray:
wine_tsx11_lock();
X11DRV_PALETTE_PaletteXColormap = XCreateColormap(gdi_display, root_window, X11DRV_PALETTE_PaletteXColormap = XCreateColormap(gdi_display, root_window,
visual, AllocNone); visual, AllocNone);
X11DRV_PALETTE_PaletteFlags |= X11DRV_PALETTE_FIXED; X11DRV_PALETTE_PaletteFlags |= X11DRV_PALETTE_FIXED;
X11DRV_PALETTE_Graymax = (1 << screen_depth)-1; X11DRV_PALETTE_Graymax = (1 << screen_depth)-1;
wine_tsx11_unlock();
break; break;
case TrueColor: case TrueColor:
...@@ -269,11 +261,9 @@ void X11DRV_PALETTE_Cleanup(void) ...@@ -269,11 +261,9 @@ void X11DRV_PALETTE_Cleanup(void)
{ {
if( COLOR_gapFilled ) if( COLOR_gapFilled )
{ {
wine_tsx11_lock();
XFreeColors(gdi_display, X11DRV_PALETTE_PaletteXColormap, XFreeColors(gdi_display, X11DRV_PALETTE_PaletteXColormap,
(unsigned long*)(X11DRV_PALETTE_PaletteToXPixel + COLOR_gapStart), (unsigned long*)(X11DRV_PALETTE_PaletteToXPixel + COLOR_gapStart),
COLOR_gapFilled, 0); COLOR_gapFilled, 0);
wine_tsx11_unlock();
} }
DeleteCriticalSection(&palette_cs); DeleteCriticalSection(&palette_cs);
} }
...@@ -834,10 +824,8 @@ COLORREF X11DRV_PALETTE_ToLogical(X11DRV_PDEVICE *physDev, int pixel) ...@@ -834,10 +824,8 @@ COLORREF X11DRV_PALETTE_ToLogical(X11DRV_PDEVICE *physDev, int pixel)
return ret; return ret;
} }
wine_tsx11_lock();
color.pixel = pixel; color.pixel = pixel;
XQueryColor(gdi_display, X11DRV_PALETTE_PaletteXColormap, &color); XQueryColor(gdi_display, X11DRV_PALETTE_PaletteXColormap, &color);
wine_tsx11_unlock();
return RGB(color.red >> 8, color.green >> 8, color.blue >> 8); return RGB(color.red >> 8, color.green >> 8, color.blue >> 8);
} }
...@@ -1251,9 +1239,7 @@ UINT X11DRV_RealizePalette( PHYSDEV dev, HPALETTE hpal, BOOL primary ) ...@@ -1251,9 +1239,7 @@ UINT X11DRV_RealizePalette( PHYSDEV dev, HPALETTE hpal, BOOL primary )
color.green = entries[i].peGreen << 8; color.green = entries[i].peGreen << 8;
color.blue = entries[i].peBlue << 8; color.blue = entries[i].peBlue << 8;
color.flags = DoRed | DoGreen | DoBlue; color.flags = DoRed | DoGreen | DoBlue;
wine_tsx11_lock();
XStoreColor(gdi_display, X11DRV_PALETTE_PaletteXColormap, &color); XStoreColor(gdi_display, X11DRV_PALETTE_PaletteXColormap, &color);
wine_tsx11_unlock();
COLOR_sysPal[index] = entries[i]; COLOR_sysPal[index] = entries[i];
COLOR_sysPal[index].peFlags = flag; COLOR_sysPal[index].peFlags = flag;
...@@ -1295,9 +1281,7 @@ BOOL X11DRV_UnrealizePalette( HPALETTE hpal ) ...@@ -1295,9 +1281,7 @@ BOOL X11DRV_UnrealizePalette( HPALETTE hpal )
if (mapping) if (mapping)
{ {
wine_tsx11_lock();
XDeleteContext( gdi_display, (XID)hpal, palette_context ); XDeleteContext( gdi_display, (XID)hpal, palette_context );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, mapping ); HeapFree( GetProcessHeap(), 0, mapping );
} }
return TRUE; return TRUE;
......
...@@ -452,12 +452,7 @@ static LRESULT WINAPI tray_icon_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPAR ...@@ -452,12 +452,7 @@ static LRESULT WINAPI tray_icon_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPAR
/* find the X11 window owner the system tray selection */ /* find the X11 window owner the system tray selection */
static Window get_systray_selection_owner( Display *display ) static Window get_systray_selection_owner( Display *display )
{ {
Window ret; return XGetSelectionOwner( display, systray_atom );
wine_tsx11_lock();
ret = XGetSelectionOwner( display, systray_atom );
wine_tsx11_unlock();
return ret;
} }
static BOOL init_systray(void) static BOOL init_systray(void)
...@@ -545,13 +540,11 @@ static void dock_systray_icon( Display *display, struct tray_icon *icon, Window ...@@ -545,13 +540,11 @@ static void dock_systray_icon( Display *display, struct tray_icon *icon, Window
ev.xclient.data.l[2] = data->whole_window; ev.xclient.data.l[2] = data->whole_window;
ev.xclient.data.l[3] = 0; ev.xclient.data.l[3] = 0;
ev.xclient.data.l[4] = 0; ev.xclient.data.l[4] = 0;
wine_tsx11_lock();
XSendEvent( display, systray_window, False, NoEventMask, &ev ); XSendEvent( display, systray_window, False, NoEventMask, &ev );
attr.background_pixmap = ParentRelative; attr.background_pixmap = ParentRelative;
attr.bit_gravity = ForgetGravity; attr.bit_gravity = ForgetGravity;
XChangeWindowAttributes( display, data->whole_window, CWBackPixmap | CWBitGravity, &attr ); XChangeWindowAttributes( display, data->whole_window, CWBackPixmap | CWBitGravity, &attr );
XChangeWindowAttributes( display, data->client_window, CWBackPixmap | CWBitGravity, &attr ); XChangeWindowAttributes( display, data->client_window, CWBackPixmap | CWBitGravity, &attr );
wine_tsx11_unlock();
} }
/* dock systray windows again with the new owner */ /* dock systray windows again with the new owner */
......
...@@ -396,9 +396,7 @@ static void sync_window_style( Display *display, struct x11drv_win_data *data ) ...@@ -396,9 +396,7 @@ static void sync_window_style( Display *display, struct x11drv_win_data *data )
XSetWindowAttributes attr; XSetWindowAttributes attr;
int mask = get_window_attributes( display, data, &attr ); int mask = get_window_attributes( display, data, &attr );
wine_tsx11_lock();
XChangeWindowAttributes( display, data->whole_window, mask, &attr ); XChangeWindowAttributes( display, data->whole_window, mask, &attr );
wine_tsx11_unlock();
} }
} }
...@@ -419,10 +417,8 @@ static void sync_window_region( Display *display, struct x11drv_win_data *data, ...@@ -419,10 +417,8 @@ static void sync_window_region( Display *display, struct x11drv_win_data *data,
if (IsRectEmpty( &data->window_rect )) /* set an empty shape */ if (IsRectEmpty( &data->window_rect )) /* set an empty shape */
{ {
static XRectangle empty_rect; static XRectangle empty_rect;
wine_tsx11_lock();
XShapeCombineRectangles( display, data->whole_window, ShapeBounding, 0, 0, XShapeCombineRectangles( display, data->whole_window, ShapeBounding, 0, 0,
&empty_rect, 1, ShapeSet, YXBanded ); &empty_rect, 1, ShapeSet, YXBanded );
wine_tsx11_unlock();
return; return;
} }
...@@ -438,9 +434,7 @@ static void sync_window_region( Display *display, struct x11drv_win_data *data, ...@@ -438,9 +434,7 @@ static void sync_window_region( Display *display, struct x11drv_win_data *data,
if (!hrgn) if (!hrgn)
{ {
wine_tsx11_lock();
XShapeCombineMask( display, data->whole_window, ShapeBounding, 0, 0, None, ShapeSet ); XShapeCombineMask( display, data->whole_window, ShapeBounding, 0, 0, None, ShapeSet );
wine_tsx11_unlock();
} }
else else
{ {
...@@ -449,13 +443,11 @@ static void sync_window_region( Display *display, struct x11drv_win_data *data, ...@@ -449,13 +443,11 @@ static void sync_window_region( Display *display, struct x11drv_win_data *data,
if (GetWindowLongW( data->hwnd, GWL_EXSTYLE ) & WS_EX_LAYOUTRTL) MirrorRgn( data->hwnd, hrgn ); if (GetWindowLongW( data->hwnd, GWL_EXSTYLE ) & WS_EX_LAYOUTRTL) MirrorRgn( data->hwnd, hrgn );
if ((pRegionData = X11DRV_GetRegionData( hrgn, 0 ))) if ((pRegionData = X11DRV_GetRegionData( hrgn, 0 )))
{ {
wine_tsx11_lock();
XShapeCombineRectangles( display, data->whole_window, ShapeBounding, XShapeCombineRectangles( display, data->whole_window, ShapeBounding,
data->window_rect.left - data->whole_rect.left, data->window_rect.left - data->whole_rect.left,
data->window_rect.top - data->whole_rect.top, data->window_rect.top - data->whole_rect.top,
(XRectangle *)pRegionData->Buffer, (XRectangle *)pRegionData->Buffer,
pRegionData->rdh.nCount, ShapeSet, YXBanded ); pRegionData->rdh.nCount, ShapeSet, YXBanded );
wine_tsx11_unlock();
HeapFree(GetProcessHeap(), 0, pRegionData); HeapFree(GetProcessHeap(), 0, pRegionData);
data->shaped = TRUE; data->shaped = TRUE;
} }
...@@ -477,13 +469,11 @@ static void sync_window_opacity( Display *display, Window win, ...@@ -477,13 +469,11 @@ static void sync_window_opacity( Display *display, Window win,
if (flags & LWA_COLORKEY) FIXME("LWA_COLORKEY not supported\n"); if (flags & LWA_COLORKEY) FIXME("LWA_COLORKEY not supported\n");
wine_tsx11_lock();
if (opacity == 0xffffffff) if (opacity == 0xffffffff)
XDeleteProperty( display, win, x11drv_atom(_NET_WM_WINDOW_OPACITY) ); XDeleteProperty( display, win, x11drv_atom(_NET_WM_WINDOW_OPACITY) );
else else
XChangeProperty( display, win, x11drv_atom(_NET_WM_WINDOW_OPACITY), XChangeProperty( display, win, x11drv_atom(_NET_WM_WINDOW_OPACITY),
XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&opacity, 1 ); XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&opacity, 1 );
wine_tsx11_unlock();
} }
...@@ -554,10 +544,8 @@ static BOOL set_win_format( HWND hwnd, XID fbconfig_id ) ...@@ -554,10 +544,8 @@ static BOOL set_win_format( HWND hwnd, XID fbconfig_id )
client = create_client_window( display, data, vis ); client = create_client_window( display, data, vis );
TRACE( "re-created client window %lx for %p fbconfig %lx\n", client, data->hwnd, fbconfig_id ); TRACE( "re-created client window %lx for %p fbconfig %lx\n", client, data->hwnd, fbconfig_id );
} }
wine_tsx11_lock();
XFree(vis); XFree(vis);
XFlush( display ); XFlush( display );
wine_tsx11_unlock();
if (client) goto done; if (client) goto done;
return FALSE; return FALSE;
} }
...@@ -668,9 +656,7 @@ static void sync_gl_drawable(struct x11drv_win_data *data) ...@@ -668,9 +656,7 @@ static void sync_gl_drawable(struct x11drv_win_data *data)
#ifdef SONAME_LIBXCOMPOSITE #ifdef SONAME_LIBXCOMPOSITE
if(usexcomposite) if(usexcomposite)
{ {
wine_tsx11_lock();
XMoveResizeWindow(gdi_display, data->gl_drawable, 0, 0, w, h); XMoveResizeWindow(gdi_display, data->gl_drawable, 0, 0, w, h);
wine_tsx11_unlock();
return; return;
} }
#endif #endif
...@@ -788,11 +774,9 @@ static Window create_icon_window( Display *display, struct x11drv_win_data *data ...@@ -788,11 +774,9 @@ static Window create_icon_window( Display *display, struct x11drv_win_data *data
static void destroy_icon_window( Display *display, struct x11drv_win_data *data ) static void destroy_icon_window( Display *display, struct x11drv_win_data *data )
{ {
if (!data->icon_window) return; if (!data->icon_window) return;
wine_tsx11_lock();
XDeleteContext( display, data->icon_window, winContext ); XDeleteContext( display, data->icon_window, winContext );
XDestroyWindow( display, data->icon_window ); XDestroyWindow( display, data->icon_window );
data->icon_window = 0; data->icon_window = 0;
wine_tsx11_unlock();
RemovePropA( data->hwnd, icon_window_prop ); RemovePropA( data->hwnd, icon_window_prop );
} }
...@@ -915,10 +899,8 @@ static BOOL create_icon_pixmaps( HDC hdc, const ICONINFO *icon, struct x11drv_wi ...@@ -915,10 +899,8 @@ static BOOL create_icon_pixmaps( HDC hdc, const ICONINFO *icon, struct x11drv_wi
return TRUE; return TRUE;
failed: failed:
wine_tsx11_lock();
if (color_pixmap) XFreePixmap( gdi_display, color_pixmap ); if (color_pixmap) XFreePixmap( gdi_display, color_pixmap );
if (mask_pixmap) XFreePixmap( gdi_display, mask_pixmap ); if (mask_pixmap) XFreePixmap( gdi_display, mask_pixmap );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, bits.ptr ); HeapFree( GetProcessHeap(), 0, bits.ptr );
return FALSE; return FALSE;
} }
...@@ -945,11 +927,9 @@ static void set_icon_hints( Display *display, struct x11drv_win_data *data, ...@@ -945,11 +927,9 @@ static void set_icon_hints( Display *display, struct x11drv_win_data *data,
if (!icon_small) icon_small = (HICON)GetClassLongPtrW( data->hwnd, GCLP_HICONSM ); if (!icon_small) icon_small = (HICON)GetClassLongPtrW( data->hwnd, GCLP_HICONSM );
} }
wine_tsx11_lock();
if (data->icon_pixmap) XFreePixmap( gdi_display, data->icon_pixmap ); if (data->icon_pixmap) XFreePixmap( gdi_display, data->icon_pixmap );
if (data->icon_mask) XFreePixmap( gdi_display, data->icon_mask ); if (data->icon_mask) XFreePixmap( gdi_display, data->icon_mask );
data->icon_pixmap = data->icon_mask = 0; data->icon_pixmap = data->icon_mask = 0;
wine_tsx11_unlock();
if (!icon_big) if (!icon_big)
{ {
...@@ -988,13 +968,11 @@ static void set_icon_hints( Display *display, struct x11drv_win_data *data, ...@@ -988,13 +968,11 @@ static void set_icon_hints( Display *display, struct x11drv_win_data *data,
DeleteObject( ii_small.hbmColor ); DeleteObject( ii_small.hbmColor );
DeleteObject( ii_small.hbmMask ); DeleteObject( ii_small.hbmMask );
} }
wine_tsx11_lock();
if (bits) if (bits)
XChangeProperty( display, data->whole_window, x11drv_atom(_NET_WM_ICON), XChangeProperty( display, data->whole_window, x11drv_atom(_NET_WM_ICON),
XA_CARDINAL, 32, PropModeReplace, (unsigned char *)bits, size ); XA_CARDINAL, 32, PropModeReplace, (unsigned char *)bits, size );
else else
XDeleteProperty( display, data->whole_window, x11drv_atom(_NET_WM_ICON) ); XDeleteProperty( display, data->whole_window, x11drv_atom(_NET_WM_ICON) );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, bits ); HeapFree( GetProcessHeap(), 0, bits );
if (create_icon_pixmaps( hDC, &ii, data )) if (create_icon_pixmaps( hDC, &ii, data ))
...@@ -1279,9 +1257,7 @@ Window init_clip_window(void) ...@@ -1279,9 +1257,7 @@ Window init_clip_window(void)
if (!data->clip_window && if (!data->clip_window &&
(data->clip_window = (Window)GetPropA( GetDesktopWindow(), clip_window_prop ))) (data->clip_window = (Window)GetPropA( GetDesktopWindow(), clip_window_prop )))
{ {
wine_tsx11_lock();
XSelectInput( data->display, data->clip_window, StructureNotifyMask ); XSelectInput( data->display, data->clip_window, StructureNotifyMask );
wine_tsx11_unlock();
} }
return data->clip_window; return data->clip_window;
} }
...@@ -1360,10 +1336,8 @@ void update_net_wm_states( Display *display, struct x11drv_win_data *data ) ...@@ -1360,10 +1336,8 @@ void update_net_wm_states( Display *display, struct x11drv_win_data *data )
if (state_atoms[i] == XATOM__NET_WM_STATE_MAXIMIZED_VERT) if (state_atoms[i] == XATOM__NET_WM_STATE_MAXIMIZED_VERT)
atoms[count++] = x11drv_atom(_NET_WM_STATE_MAXIMIZED_HORZ); atoms[count++] = x11drv_atom(_NET_WM_STATE_MAXIMIZED_HORZ);
} }
wine_tsx11_lock();
XChangeProperty( display, data->whole_window, x11drv_atom(_NET_WM_STATE), XA_ATOM, XChangeProperty( display, data->whole_window, x11drv_atom(_NET_WM_STATE), XA_ATOM,
32, PropModeReplace, (unsigned char *)atoms, count ); 32, PropModeReplace, (unsigned char *)atoms, count );
wine_tsx11_unlock();
} }
else /* ask the window manager to do it for us */ else /* ask the window manager to do it for us */
{ {
...@@ -1390,10 +1364,8 @@ void update_net_wm_states( Display *display, struct x11drv_win_data *data ) ...@@ -1390,10 +1364,8 @@ void update_net_wm_states( Display *display, struct x11drv_win_data *data )
xev.xclient.data.l[1] = X11DRV_Atoms[state_atoms[i] - FIRST_XATOM]; xev.xclient.data.l[1] = X11DRV_Atoms[state_atoms[i] - FIRST_XATOM];
xev.xclient.data.l[2] = ((state_atoms[i] == XATOM__NET_WM_STATE_MAXIMIZED_VERT) ? xev.xclient.data.l[2] = ((state_atoms[i] == XATOM__NET_WM_STATE_MAXIMIZED_VERT) ?
x11drv_atom(_NET_WM_STATE_MAXIMIZED_HORZ) : 0); x11drv_atom(_NET_WM_STATE_MAXIMIZED_HORZ) : 0);
wine_tsx11_lock();
XSendEvent( display, root_window, False, XSendEvent( display, root_window, False,
SubstructureRedirectMask | SubstructureNotifyMask, &xev ); SubstructureRedirectMask | SubstructureNotifyMask, &xev );
wine_tsx11_unlock();
} }
} }
data->net_wm_state = new_state; data->net_wm_state = new_state;
...@@ -1411,10 +1383,8 @@ static void set_xembed_flags( Display *display, struct x11drv_win_data *data, un ...@@ -1411,10 +1383,8 @@ static void set_xembed_flags( Display *display, struct x11drv_win_data *data, un
info[0] = 0; /* protocol version */ info[0] = 0; /* protocol version */
info[1] = flags; info[1] = flags;
wine_tsx11_lock();
XChangeProperty( display, data->whole_window, x11drv_atom(_XEMBED_INFO), XChangeProperty( display, data->whole_window, x11drv_atom(_XEMBED_INFO),
x11drv_atom(_XEMBED_INFO), 32, PropModeReplace, (unsigned char*)info, 2 ); x11drv_atom(_XEMBED_INFO), 32, PropModeReplace, (unsigned char*)info, 2 );
wine_tsx11_unlock();
} }
...@@ -1433,9 +1403,7 @@ static void map_window( Display *display, struct x11drv_win_data *data, DWORD ne ...@@ -1433,9 +1403,7 @@ static void map_window( Display *display, struct x11drv_win_data *data, DWORD ne
{ {
update_net_wm_states( display, data ); update_net_wm_states( display, data );
sync_window_style( display, data ); sync_window_style( display, data );
wine_tsx11_lock();
XMapWindow( display, data->whole_window ); XMapWindow( display, data->whole_window );
wine_tsx11_unlock();
} }
else set_xembed_flags( display, data, XEMBED_MAPPED ); else set_xembed_flags( display, data, XEMBED_MAPPED );
...@@ -1454,10 +1422,8 @@ static void unmap_window( Display *display, struct x11drv_win_data *data ) ...@@ -1454,10 +1422,8 @@ static void unmap_window( Display *display, struct x11drv_win_data *data )
if (!data->embedded) if (!data->embedded)
{ {
wait_for_withdrawn_state( display, data, FALSE ); wait_for_withdrawn_state( display, data, FALSE );
wine_tsx11_lock();
if (data->managed) XWithdrawWindow( display, data->whole_window, DefaultScreen(display) ); if (data->managed) XWithdrawWindow( display, data->whole_window, DefaultScreen(display) );
else XUnmapWindow( display, data->whole_window ); else XUnmapWindow( display, data->whole_window );
wine_tsx11_unlock();
} }
else set_xembed_flags( display, data, 0 ); else set_xembed_flags( display, data, 0 );
...@@ -1584,13 +1550,11 @@ static void sync_window_position( Display *display, struct x11drv_win_data *data ...@@ -1584,13 +1550,11 @@ static void sync_window_position( Display *display, struct x11drv_win_data *data
/* and Above with a sibling doesn't work so well either, so we ignore it */ /* and Above with a sibling doesn't work so well either, so we ignore it */
} }
wine_tsx11_lock();
set_size_hints( display, data, style ); set_size_hints( display, data, style );
set_mwm_hints( display, data, style, ex_style ); set_mwm_hints( display, data, style, ex_style );
data->configure_serial = NextRequest( display ); data->configure_serial = NextRequest( display );
XReconfigureWMWindow( display, data->whole_window, XReconfigureWMWindow( display, data->whole_window,
DefaultScreen(display), mask, &changes ); DefaultScreen(display), mask, &changes );
wine_tsx11_unlock();
#ifdef HAVE_LIBXSHAPE #ifdef HAVE_LIBXSHAPE
if (IsRectEmpty( old_window_rect ) != IsRectEmpty( &data->window_rect )) if (IsRectEmpty( old_window_rect ) != IsRectEmpty( &data->window_rect ))
sync_window_region( display, data, (HRGN)1 ); sync_window_region( display, data, (HRGN)1 );
...@@ -1601,12 +1565,8 @@ static void sync_window_position( Display *display, struct x11drv_win_data *data ...@@ -1601,12 +1565,8 @@ static void sync_window_position( Display *display, struct x11drv_win_data *data
int new_x_offset = data->window_rect.left - data->whole_rect.left; int new_x_offset = data->window_rect.left - data->whole_rect.left;
int new_y_offset = data->window_rect.top - data->whole_rect.top; int new_y_offset = data->window_rect.top - data->whole_rect.top;
if (old_x_offset != new_x_offset || old_y_offset != new_y_offset) if (old_x_offset != new_x_offset || old_y_offset != new_y_offset)
{
wine_tsx11_lock();
XShapeOffsetShape( display, data->whole_window, ShapeBounding, XShapeOffsetShape( display, data->whole_window, ShapeBounding,
new_x_offset - old_x_offset, new_y_offset - old_y_offset ); new_x_offset - old_x_offset, new_y_offset - old_y_offset );
wine_tsx11_unlock();
}
} }
#endif #endif
...@@ -1641,9 +1601,7 @@ static void sync_client_position( Display *display, struct x11drv_win_data *data ...@@ -1641,9 +1601,7 @@ static void sync_client_position( Display *display, struct x11drv_win_data *data
TRACE( "setting client win %lx pos %d,%d,%dx%d changes=%x\n", TRACE( "setting client win %lx pos %d,%d,%dx%d changes=%x\n",
data->client_window, new.left, new.top, data->client_window, new.left, new.top,
new.right - new.left, new.bottom - new.top, mask ); new.right - new.left, new.bottom - new.top, mask );
wine_tsx11_lock();
XConfigureWindow( display, data->client_window, mask, &changes ); XConfigureWindow( display, data->client_window, mask, &changes );
wine_tsx11_unlock();
} }
if (data->gl_drawable && (mask & (CWWidth|CWHeight))) sync_gl_drawable( data ); if (data->gl_drawable && (mask & (CWWidth|CWHeight))) sync_gl_drawable( data );
...@@ -1758,31 +1716,24 @@ static Window create_whole_window( Display *display, struct x11drv_win_data *dat ...@@ -1758,31 +1716,24 @@ static Window create_whole_window( Display *display, struct x11drv_win_data *dat
if (!(cy = data->whole_rect.bottom - data->whole_rect.top)) cy = 1; if (!(cy = data->whole_rect.bottom - data->whole_rect.top)) cy = 1;
else if (cy > 65535) cy = 65535; else if (cy > 65535) cy = 65535;
wine_tsx11_lock();
data->whole_window = XCreateWindow( display, root_window, data->whole_window = XCreateWindow( display, root_window,
data->whole_rect.left - virtual_screen_rect.left, data->whole_rect.left - virtual_screen_rect.left,
data->whole_rect.top - virtual_screen_rect.top, data->whole_rect.top - virtual_screen_rect.top,
cx, cy, 0, screen_depth, InputOutput, cx, cy, 0, screen_depth, InputOutput,
visual, mask, &attr ); visual, mask, &attr );
if (data->whole_window) XSaveContext( display, data->whole_window, winContext, (char *)data->hwnd );
wine_tsx11_unlock();
if (!data->whole_window) goto done; if (!data->whole_window) goto done;
if (!create_client_window( display, data, NULL )) if (!create_client_window( display, data, NULL ))
{ {
wine_tsx11_lock();
XDeleteContext( display, data->whole_window, winContext );
XDestroyWindow( display, data->whole_window ); XDestroyWindow( display, data->whole_window );
data->whole_window = 0; data->whole_window = 0;
wine_tsx11_unlock();
goto done; goto done;
} }
set_initial_wm_hints( display, data ); set_initial_wm_hints( display, data );
set_wm_hints( display, data ); set_wm_hints( display, data );
XSaveContext( display, data->whole_window, winContext, (char *)data->hwnd );
SetPropA( data->hwnd, whole_window_prop, (HANDLE)data->whole_window ); SetPropA( data->hwnd, whole_window_prop, (HANDLE)data->whole_window );
/* set the window text */ /* set the window text */
...@@ -1798,9 +1749,7 @@ static Window create_whole_window( Display *display, struct x11drv_win_data *dat ...@@ -1798,9 +1749,7 @@ static Window create_whole_window( Display *display, struct x11drv_win_data *dat
init_clip_window(); /* make sure the clip window is initialized in this thread */ init_clip_window(); /* make sure the clip window is initialized in this thread */
wine_tsx11_lock();
XFlush( display ); /* make sure the window exists before we start painting to it */ XFlush( display ); /* make sure the window exists before we start painting to it */
wine_tsx11_unlock();
sync_window_cursor( data->whole_window ); sync_window_cursor( data->whole_window );
...@@ -1824,10 +1773,8 @@ static void destroy_whole_window( Display *display, struct x11drv_win_data *data ...@@ -1824,10 +1773,8 @@ static void destroy_whole_window( Display *display, struct x11drv_win_data *data
Window xwin = (Window)GetPropA( data->hwnd, foreign_window_prop ); Window xwin = (Window)GetPropA( data->hwnd, foreign_window_prop );
if (xwin) if (xwin)
{ {
wine_tsx11_lock();
if (!already_destroyed) XSelectInput( display, xwin, 0 ); if (!already_destroyed) XSelectInput( display, xwin, 0 );
XDeleteContext( display, xwin, winContext ); XDeleteContext( display, xwin, winContext );
wine_tsx11_unlock();
RemovePropA( data->hwnd, foreign_window_prop ); RemovePropA( data->hwnd, foreign_window_prop );
} }
} }
...@@ -1922,35 +1869,24 @@ void CDECL X11DRV_DestroyWindow( HWND hwnd ) ...@@ -1922,35 +1869,24 @@ void CDECL X11DRV_DestroyWindow( HWND hwnd )
if (data->pixmap) if (data->pixmap)
{ {
wine_tsx11_lock();
destroy_glxpixmap(gdi_display, data->gl_drawable); destroy_glxpixmap(gdi_display, data->gl_drawable);
XFreePixmap(gdi_display, data->pixmap); XFreePixmap(gdi_display, data->pixmap);
wine_tsx11_unlock();
} }
else if (data->gl_drawable) else if (data->gl_drawable)
{ {
wine_tsx11_lock();
XDestroyWindow(gdi_display, data->gl_drawable); XDestroyWindow(gdi_display, data->gl_drawable);
wine_tsx11_unlock();
} }
destroy_whole_window( thread_data->display, data, FALSE ); destroy_whole_window( thread_data->display, data, FALSE );
destroy_icon_window( thread_data->display, data ); destroy_icon_window( thread_data->display, data );
if (data->colormap) if (data->colormap) XFreeColormap( thread_data->display, data->colormap );
{
wine_tsx11_lock();
XFreeColormap( thread_data->display, data->colormap );
wine_tsx11_unlock();
}
if (thread_data->last_focus == hwnd) thread_data->last_focus = 0; if (thread_data->last_focus == hwnd) thread_data->last_focus = 0;
if (thread_data->last_xic_hwnd == hwnd) thread_data->last_xic_hwnd = 0; if (thread_data->last_xic_hwnd == hwnd) thread_data->last_xic_hwnd = 0;
wine_tsx11_lock();
if (data->icon_pixmap) XFreePixmap( gdi_display, data->icon_pixmap ); if (data->icon_pixmap) XFreePixmap( gdi_display, data->icon_pixmap );
if (data->icon_mask) XFreePixmap( gdi_display, data->icon_mask ); if (data->icon_mask) XFreePixmap( gdi_display, data->icon_mask );
XDeleteContext( thread_data->display, (XID)hwnd, win_data_context ); XDeleteContext( thread_data->display, (XID)hwnd, win_data_context );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, data ); HeapFree( GetProcessHeap(), 0, data );
} }
...@@ -2065,11 +2001,9 @@ BOOL CDECL X11DRV_CreateWindow( HWND hwnd ) ...@@ -2065,11 +2001,9 @@ BOOL CDECL X11DRV_CreateWindow( HWND hwnd )
/* create the cursor clipping window */ /* create the cursor clipping window */
attr.override_redirect = TRUE; attr.override_redirect = TRUE;
attr.event_mask = StructureNotifyMask | FocusChangeMask; attr.event_mask = StructureNotifyMask | FocusChangeMask;
wine_tsx11_lock();
data->clip_window = XCreateWindow( data->display, root_window, 0, 0, 1, 1, 0, 0, data->clip_window = XCreateWindow( data->display, root_window, 0, 0, 1, 1, 0, 0,
InputOnly, visual, CWOverrideRedirect | CWEventMask, &attr ); InputOnly, visual, CWOverrideRedirect | CWEventMask, &attr );
XFlush( data->display ); XFlush( data->display );
wine_tsx11_unlock();
SetPropA( hwnd, clip_window_prop, (HANDLE)data->clip_window ); SetPropA( hwnd, clip_window_prop, (HANDLE)data->clip_window );
} }
return TRUE; return TRUE;
...@@ -2189,24 +2123,17 @@ HWND create_foreign_window( Display *display, Window xwin ) ...@@ -2189,24 +2123,17 @@ HWND create_foreign_window( Display *display, Window xwin )
class_registered = TRUE; class_registered = TRUE;
} }
wine_tsx11_lock();
if (XFindContext( display, xwin, winContext, (char **)&hwnd )) hwnd = 0; if (XFindContext( display, xwin, winContext, (char **)&hwnd )) hwnd = 0;
if (hwnd) /* already created */ if (hwnd) return hwnd; /* already created */
{
wine_tsx11_unlock();
return hwnd;
}
XSelectInput( display, xwin, StructureNotifyMask ); XSelectInput( display, xwin, StructureNotifyMask );
if (!XGetWindowAttributes( display, xwin, &attr ) || if (!XGetWindowAttributes( display, xwin, &attr ) ||
!XQueryTree( display, xwin, &xroot, &xparent, &xchildren, &nchildren )) !XQueryTree( display, xwin, &xroot, &xparent, &xchildren, &nchildren ))
{ {
XSelectInput( display, xwin, 0 ); XSelectInput( display, xwin, 0 );
wine_tsx11_unlock();
return 0; return 0;
} }
XFree( xchildren ); XFree( xchildren );
wine_tsx11_unlock();
if (xparent == xroot) if (xparent == xroot)
{ {
...@@ -2236,9 +2163,7 @@ HWND create_foreign_window( Display *display, Window xwin ) ...@@ -2236,9 +2163,7 @@ HWND create_foreign_window( Display *display, Window xwin )
data->mapped = TRUE; data->mapped = TRUE;
SetPropA( hwnd, foreign_window_prop, (HANDLE)xwin ); SetPropA( hwnd, foreign_window_prop, (HANDLE)xwin );
wine_tsx11_lock();
XSaveContext( display, xwin, winContext, (char *)data->hwnd ); XSaveContext( display, xwin, winContext, (char *)data->hwnd );
wine_tsx11_unlock();
ShowWindow( hwnd, SW_SHOW ); ShowWindow( hwnd, SW_SHOW );
...@@ -2405,21 +2330,17 @@ void CDECL X11DRV_SetCapture( HWND hwnd, UINT flags ) ...@@ -2405,21 +2330,17 @@ void CDECL X11DRV_SetCapture( HWND hwnd, UINT flags )
Window grab_win = X11DRV_get_client_window( GetAncestor( hwnd, GA_ROOT ) ); Window grab_win = X11DRV_get_client_window( GetAncestor( hwnd, GA_ROOT ) );
if (!grab_win) return; if (!grab_win) return;
wine_tsx11_lock();
XFlush( gdi_display ); XFlush( gdi_display );
XGrabPointer( thread_data->display, grab_win, False, XGrabPointer( thread_data->display, grab_win, False,
PointerMotionMask | ButtonPressMask | ButtonReleaseMask, PointerMotionMask | ButtonPressMask | ButtonReleaseMask,
GrabModeAsync, GrabModeAsync, None, None, CurrentTime ); GrabModeAsync, GrabModeAsync, None, None, CurrentTime );
wine_tsx11_unlock();
thread_data->grab_window = grab_win; thread_data->grab_window = grab_win;
} }
else /* release capture */ else /* release capture */
{ {
wine_tsx11_lock();
XFlush( gdi_display ); XFlush( gdi_display );
XUngrabPointer( thread_data->display, CurrentTime ); XUngrabPointer( thread_data->display, CurrentTime );
XFlush( thread_data->display ); XFlush( thread_data->display );
wine_tsx11_unlock();
thread_data->grab_window = None; thread_data->grab_window = None;
} }
} }
...@@ -2483,11 +2404,9 @@ void CDECL X11DRV_SetFocus( HWND hwnd ) ...@@ -2483,11 +2404,9 @@ void CDECL X11DRV_SetFocus( HWND hwnd )
timestamp = CurrentTime; timestamp = CurrentTime;
/* Set X focus and install colormap */ /* Set X focus and install colormap */
wine_tsx11_lock();
changes.stack_mode = Above; changes.stack_mode = Above;
XConfigureWindow( display, data->whole_window, CWStackMode, &changes ); XConfigureWindow( display, data->whole_window, CWStackMode, &changes );
XSetInputFocus( display, data->whole_window, RevertToParent, timestamp ); XSetInputFocus( display, data->whole_window, RevertToParent, timestamp );
wine_tsx11_unlock();
} }
...@@ -2573,9 +2492,7 @@ void CDECL X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags ...@@ -2573,9 +2492,7 @@ void CDECL X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags
move_window_bits( data, &valid_rects[1], &valid_rects[0], &old_client_rect ); move_window_bits( data, &valid_rects[1], &valid_rects[0], &old_client_rect );
} }
wine_tsx11_lock();
XFlush( gdi_display ); /* make sure painting is done before we move the window */ XFlush( gdi_display ); /* make sure painting is done before we move the window */
wine_tsx11_unlock();
sync_client_position( display, data, swp_flags, &old_client_rect, &old_whole_rect ); sync_client_position( display, data, swp_flags, &old_client_rect, &old_whole_rect );
...@@ -2621,12 +2538,10 @@ void CDECL X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags ...@@ -2621,12 +2538,10 @@ void CDECL X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags
{ {
data->iconic = (new_style & WS_MINIMIZE) != 0; data->iconic = (new_style & WS_MINIMIZE) != 0;
TRACE( "changing win %p iconic state to %u\n", data->hwnd, data->iconic ); TRACE( "changing win %p iconic state to %u\n", data->hwnd, data->iconic );
wine_tsx11_lock();
if (data->iconic) if (data->iconic)
XIconifyWindow( display, data->whole_window, DefaultScreen(display) ); XIconifyWindow( display, data->whole_window, DefaultScreen(display) );
else if (is_window_rect_mapped( rectWindow )) else if (is_window_rect_mapped( rectWindow ))
XMapWindow( display, data->whole_window ); XMapWindow( display, data->whole_window );
wine_tsx11_unlock();
update_net_wm_states( display, data ); update_net_wm_states( display, data );
} }
else if (!event_type) else if (!event_type)
...@@ -2635,9 +2550,7 @@ void CDECL X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags ...@@ -2635,9 +2550,7 @@ void CDECL X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags
} }
} }
wine_tsx11_lock();
XFlush( display ); /* make sure changes are done before we start painting again */ XFlush( display ); /* make sure changes are done before we start painting again */
wine_tsx11_unlock();
} }
...@@ -2669,11 +2582,9 @@ UINT CDECL X11DRV_ShowWindow( HWND hwnd, INT cmd, RECT *rect, UINT swp ) ...@@ -2669,11 +2582,9 @@ UINT CDECL X11DRV_ShowWindow( HWND hwnd, INT cmd, RECT *rect, UINT swp )
TRACE( "win %p/%lx cmd %d at %s flags %08x\n", TRACE( "win %p/%lx cmd %d at %s flags %08x\n",
hwnd, data->whole_window, cmd, wine_dbgstr_rect(rect), swp ); hwnd, data->whole_window, cmd, wine_dbgstr_rect(rect), swp );
wine_tsx11_lock();
XGetGeometry( thread_data->display, data->whole_window, XGetGeometry( thread_data->display, data->whole_window,
&root, &x, &y, &width, &height, &border, &depth ); &root, &x, &y, &width, &height, &border, &depth );
XTranslateCoordinates( thread_data->display, data->whole_window, root, 0, 0, &x, &y, &top ); XTranslateCoordinates( thread_data->display, data->whole_window, root, 0, 0, &x, &y, &top );
wine_tsx11_unlock();
rect->left = x; rect->left = x;
rect->top = y; rect->top = y;
rect->right = x + width; rect->right = x + width;
...@@ -2708,9 +2619,7 @@ void CDECL X11DRV_SetWindowIcon( HWND hwnd, UINT type, HICON icon ) ...@@ -2708,9 +2619,7 @@ void CDECL X11DRV_SetWindowIcon( HWND hwnd, UINT type, HICON icon )
{ {
if (type == ICON_BIG) set_icon_hints( display, data, icon, 0 ); if (type == ICON_BIG) set_icon_hints( display, data, icon, 0 );
else set_icon_hints( display, data, 0, icon ); else set_icon_hints( display, data, 0, icon );
wine_tsx11_lock();
XSetWMHints( display, data->whole_window, data->wm_hints ); XSetWMHints( display, data->whole_window, data->wm_hints );
wine_tsx11_unlock();
} }
} }
......
...@@ -603,11 +603,9 @@ static void thread_detach(void) ...@@ -603,11 +603,9 @@ static void thread_detach(void)
if (data) if (data)
{ {
X11DRV_ResetSelectionOwner(); X11DRV_ResetSelectionOwner();
wine_tsx11_lock();
if (data->xim) XCloseIM( data->xim ); if (data->xim) XCloseIM( data->xim );
if (data->font_set) XFreeFontSet( data->display, data->font_set ); if (data->font_set) XFreeFontSet( data->display, data->font_set );
XCloseDisplay( data->display ); XCloseDisplay( data->display );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, data ); HeapFree( GetProcessHeap(), 0, data );
} }
} }
...@@ -730,9 +728,7 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) ...@@ -730,9 +728,7 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
BOOL CDECL X11DRV_GetScreenSaveActive(void) BOOL CDECL X11DRV_GetScreenSaveActive(void)
{ {
int timeout, temp; int timeout, temp;
wine_tsx11_lock();
XGetScreenSaver(gdi_display, &timeout, &temp, &temp, &temp); XGetScreenSaver(gdi_display, &timeout, &temp, &temp, &temp);
wine_tsx11_unlock();
return timeout != 0; return timeout != 0;
} }
......
...@@ -230,11 +230,9 @@ void X11DRV_XDND_EnterEvent( HWND hWnd, XClientMessageEvent *event ) ...@@ -230,11 +230,9 @@ void X11DRV_XDND_EnterEvent( HWND hWnd, XClientMessageEvent *event )
unsigned long bytesret; unsigned long bytesret;
/* Request supported formats from source window */ /* Request supported formats from source window */
wine_tsx11_lock();
XGetWindowProperty(event->display, event->data.l[0], x11drv_atom(XdndTypeList), XGetWindowProperty(event->display, event->data.l[0], x11drv_atom(XdndTypeList),
0, 65535, FALSE, AnyPropertyType, &acttype, &actfmt, &count, 0, 65535, FALSE, AnyPropertyType, &acttype, &actfmt, &count,
&bytesret, (unsigned char**)&xdndtypes); &bytesret, (unsigned char**)&xdndtypes);
wine_tsx11_unlock();
} }
else else
{ {
...@@ -374,9 +372,7 @@ void X11DRV_XDND_PositionEvent( HWND hWnd, XClientMessageEvent *event ) ...@@ -374,9 +372,7 @@ void X11DRV_XDND_PositionEvent( HWND hWnd, XClientMessageEvent *event )
e.data.l[4] = X11DRV_XDND_DROPEFFECTToXdndAction(effect); e.data.l[4] = X11DRV_XDND_DROPEFFECTToXdndAction(effect);
else else
e.data.l[4] = None; e.data.l[4] = None;
wine_tsx11_lock();
XSendEvent(event->display, event->data.l[0], False, NoEventMask, (XEvent*)&e); XSendEvent(event->display, event->data.l[0], False, NoEventMask, (XEvent*)&e);
wine_tsx11_unlock();
} }
/************************************************************************** /**************************************************************************
...@@ -429,9 +425,7 @@ void X11DRV_XDND_DropEvent( HWND hWnd, XClientMessageEvent *event ) ...@@ -429,9 +425,7 @@ void X11DRV_XDND_DropEvent( HWND hWnd, XClientMessageEvent *event )
e.message_type = x11drv_atom(XdndFinished); e.message_type = x11drv_atom(XdndFinished);
e.format = 32; e.format = 32;
e.data.l[0] = event->window; e.data.l[0] = event->window;
wine_tsx11_lock();
XSendEvent(event->display, event->data.l[0], False, NoEventMask, (XEvent*)&e); XSendEvent(event->display, event->data.l[0], False, NoEventMask, (XEvent*)&e);
wine_tsx11_unlock();
} }
/************************************************************************** /**************************************************************************
...@@ -489,19 +483,15 @@ static void X11DRV_XDND_ResolveProperty(Display *display, Window xwin, Time tm, ...@@ -489,19 +483,15 @@ static void X11DRV_XDND_ResolveProperty(Display *display, Window xwin, Time tm,
if (types[i] == 0) if (types[i] == 0)
continue; continue;
wine_tsx11_lock();
XConvertSelection(display, x11drv_atom(XdndSelection), types[i], XConvertSelection(display, x11drv_atom(XdndSelection), types[i],
x11drv_atom(XdndTarget), xwin, /*tm*/CurrentTime); x11drv_atom(XdndTarget), xwin, /*tm*/CurrentTime);
wine_tsx11_unlock();
/* /*
* Wait for SelectionNotify * Wait for SelectionNotify
*/ */
for (j = 0; j < SELECTION_RETRIES; j++) for (j = 0; j < SELECTION_RETRIES; j++)
{ {
wine_tsx11_lock();
res = XCheckTypedWindowEvent(display, xwin, SelectionNotify, &xe); res = XCheckTypedWindowEvent(display, xwin, SelectionNotify, &xe);
wine_tsx11_unlock();
if (res && xe.xselection.selection == x11drv_atom(XdndSelection)) break; if (res && xe.xselection.selection == x11drv_atom(XdndSelection)) break;
usleep(SELECTION_WAIT); usleep(SELECTION_WAIT);
...@@ -510,15 +500,11 @@ static void X11DRV_XDND_ResolveProperty(Display *display, Window xwin, Time tm, ...@@ -510,15 +500,11 @@ static void X11DRV_XDND_ResolveProperty(Display *display, Window xwin, Time tm,
if (xe.xselection.property == None) if (xe.xselection.property == None)
continue; continue;
wine_tsx11_lock();
XGetWindowProperty(display, xwin, x11drv_atom(XdndTarget), 0, 65535, FALSE, XGetWindowProperty(display, xwin, x11drv_atom(XdndTarget), 0, 65535, FALSE,
AnyPropertyType, &acttype, &actfmt, &icount, &bytesret, &data); AnyPropertyType, &acttype, &actfmt, &icount, &bytesret, &data);
wine_tsx11_unlock();
entries += X11DRV_XDND_MapFormat(types[i], data, get_property_size( actfmt, icount )); entries += X11DRV_XDND_MapFormat(types[i], data, get_property_size( actfmt, icount ));
wine_tsx11_lock();
XFree(data); XFree(data);
wine_tsx11_unlock();
} }
/* On Windows when there is a CF_HDROP, there are no other CF_ formats. /* On Windows when there is a CF_HDROP, there are no other CF_ formats.
......
...@@ -338,10 +338,7 @@ static int load_xrender_formats(void) ...@@ -338,10 +338,7 @@ static int load_xrender_formats(void)
{ {
unsigned long mask = 0; unsigned long mask = 0;
get_xrender_template(&wxr_formats_template[i], &templ, &mask); get_xrender_template(&wxr_formats_template[i], &templ, &mask);
wine_tsx11_lock();
pict_formats[i] = pXRenderFindFormat(gdi_display, mask, &templ, 0); pict_formats[i] = pXRenderFindFormat(gdi_display, mask, &templ, 0);
wine_tsx11_unlock();
} }
if (pict_formats[i]) if (pict_formats[i])
{ {
...@@ -361,7 +358,6 @@ static int load_xrender_formats(void) ...@@ -361,7 +358,6 @@ static int load_xrender_formats(void)
const struct gdi_dc_funcs *X11DRV_XRender_Init(void) const struct gdi_dc_funcs *X11DRV_XRender_Init(void)
{ {
int event_base, i; int event_base, i;
BOOL ok;
if (!client_side_with_render) return NULL; if (!client_side_with_render) return NULL;
if (!(xrender_handle = wine_dlopen(SONAME_LIBXRENDER, RTLD_NOW, NULL, 0))) return NULL; if (!(xrender_handle = wine_dlopen(SONAME_LIBXRENDER, RTLD_NOW, NULL, 0))) return NULL;
...@@ -390,10 +386,7 @@ const struct gdi_dc_funcs *X11DRV_XRender_Init(void) ...@@ -390,10 +386,7 @@ const struct gdi_dc_funcs *X11DRV_XRender_Init(void)
#undef LOAD_OPTIONAL_FUNCPTR #undef LOAD_OPTIONAL_FUNCPTR
#undef LOAD_FUNCPTR #undef LOAD_FUNCPTR
wine_tsx11_lock(); if (!pXRenderQueryExtension(gdi_display, &event_base, &xrender_error_base)) return NULL;
ok = pXRenderQueryExtension(gdi_display, &event_base, &xrender_error_base);
wine_tsx11_unlock();
if (!ok) return NULL;
TRACE("Xrender is up and running error_base = %d\n", xrender_error_base); TRACE("Xrender is up and running error_base = %d\n", xrender_error_base);
if(!load_xrender_formats()) /* This fails in buggy versions of libXrender.so */ if(!load_xrender_formats()) /* This fails in buggy versions of libXrender.so */
...@@ -536,18 +529,14 @@ static void update_xrender_clipping( struct xrender_physdev *dev, HRGN rgn ) ...@@ -536,18 +529,14 @@ static void update_xrender_clipping( struct xrender_physdev *dev, HRGN rgn )
if (!rgn) if (!rgn)
{ {
wine_tsx11_lock();
pa.clip_mask = None; pa.clip_mask = None;
pXRenderChangePicture( gdi_display, dev->pict, CPClipMask, &pa ); pXRenderChangePicture( gdi_display, dev->pict, CPClipMask, &pa );
wine_tsx11_unlock();
} }
else if ((data = X11DRV_GetRegionData( rgn, 0 ))) else if ((data = X11DRV_GetRegionData( rgn, 0 )))
{ {
wine_tsx11_lock();
pXRenderSetPictureClipRectangles( gdi_display, dev->pict, pXRenderSetPictureClipRectangles( gdi_display, dev->pict,
dev->x11dev->dc_rect.left, dev->x11dev->dc_rect.top, dev->x11dev->dc_rect.left, dev->x11dev->dc_rect.top,
(XRectangle *)data->Buffer, data->rdh.nCount ); (XRectangle *)data->Buffer, data->rdh.nCount );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, data ); HeapFree( GetProcessHeap(), 0, data );
} }
} }
...@@ -559,11 +548,9 @@ static Picture get_xrender_picture( struct xrender_physdev *dev, HRGN clip_rgn, ...@@ -559,11 +548,9 @@ static Picture get_xrender_picture( struct xrender_physdev *dev, HRGN clip_rgn,
{ {
XRenderPictureAttributes pa; XRenderPictureAttributes pa;
wine_tsx11_lock();
pa.subwindow_mode = IncludeInferiors; pa.subwindow_mode = IncludeInferiors;
dev->pict = pXRenderCreatePicture( gdi_display, dev->x11dev->drawable, dev->pict = pXRenderCreatePicture( gdi_display, dev->x11dev->drawable,
dev->pict_format, CPSubwindowMode, &pa ); dev->pict_format, CPSubwindowMode, &pa );
wine_tsx11_unlock();
TRACE( "Allocing pict=%lx dc=%p drawable=%08lx\n", TRACE( "Allocing pict=%lx dc=%p drawable=%08lx\n",
dev->pict, dev->dev.hdc, dev->x11dev->drawable ); dev->pict, dev->dev.hdc, dev->x11dev->drawable );
dev->update_clip = (dev->region != 0); dev->update_clip = (dev->region != 0);
...@@ -600,12 +587,10 @@ static Picture get_xrender_picture_source( struct xrender_physdev *dev, BOOL rep ...@@ -600,12 +587,10 @@ static Picture get_xrender_picture_source( struct xrender_physdev *dev, BOOL rep
{ {
XRenderPictureAttributes pa; XRenderPictureAttributes pa;
wine_tsx11_lock();
pa.subwindow_mode = IncludeInferiors; pa.subwindow_mode = IncludeInferiors;
pa.repeat = repeat ? RepeatNormal : RepeatNone; pa.repeat = repeat ? RepeatNormal : RepeatNone;
dev->pict_src = pXRenderCreatePicture( gdi_display, dev->x11dev->drawable, dev->pict_src = pXRenderCreatePicture( gdi_display, dev->x11dev->drawable,
dev->pict_format, CPSubwindowMode|CPRepeat, &pa ); dev->pict_format, CPSubwindowMode|CPRepeat, &pa );
wine_tsx11_unlock();
TRACE("Allocing pict_src=%lx dc=%p drawable=%08lx repeat=%u\n", TRACE("Allocing pict_src=%lx dc=%p drawable=%08lx repeat=%u\n",
dev->pict_src, dev->dev.hdc, dev->x11dev->drawable, pa.repeat); dev->pict_src, dev->dev.hdc, dev->x11dev->drawable, pa.repeat);
...@@ -719,9 +704,7 @@ static void FreeEntry(int entry) ...@@ -719,9 +704,7 @@ static void FreeEntry(int entry)
formatEntry = glyphsetCache[entry].format[format]; formatEntry = glyphsetCache[entry].format[format];
if(formatEntry->glyphset) { if(formatEntry->glyphset) {
wine_tsx11_lock();
pXRenderFreeGlyphSet(gdi_display, formatEntry->glyphset); pXRenderFreeGlyphSet(gdi_display, formatEntry->glyphset);
wine_tsx11_unlock();
formatEntry->glyphset = 0; formatEntry->glyphset = 0;
} }
if(formatEntry->nrealized) { if(formatEntry->nrealized) {
...@@ -1357,10 +1340,8 @@ static void UploadGlyph(struct xrender_physdev *physDev, int glyph, AA_Type form ...@@ -1357,10 +1340,8 @@ static void UploadGlyph(struct xrender_physdev *physDev, int glyph, AA_Type form
break; break;
} }
wine_tsx11_lock();
formatEntry->font_format = pict_formats[wxr_format]; formatEntry->font_format = pict_formats[wxr_format];
formatEntry->glyphset = pXRenderCreateGlyphSet(gdi_display, formatEntry->font_format); formatEntry->glyphset = pXRenderCreateGlyphSet(gdi_display, formatEntry->font_format);
wine_tsx11_unlock();
} }
...@@ -1448,10 +1429,8 @@ static void UploadGlyph(struct xrender_physdev *physDev, int glyph, AA_Type form ...@@ -1448,10 +1429,8 @@ static void UploadGlyph(struct xrender_physdev *physDev, int glyph, AA_Type form
if(buflen == 0) if(buflen == 0)
gi.width = gi.height = 1; gi.width = gi.height = 1;
wine_tsx11_lock();
pXRenderAddGlyphs(gdi_display, formatEntry->glyphset, &gid, &gi, 1, pXRenderAddGlyphs(gdi_display, formatEntry->glyphset, &gid, &gi, 1,
buflen ? buf : zero, buflen ? buflen : sizeof(zero)); buflen ? buf : zero, buflen ? buflen : sizeof(zero));
wine_tsx11_unlock();
HeapFree(GetProcessHeap(), 0, buf); HeapFree(GetProcessHeap(), 0, buf);
} }
...@@ -1480,12 +1459,10 @@ static Picture get_tile_pict( enum wxr_format wxr_format, const XRenderColor *co ...@@ -1480,12 +1459,10 @@ static Picture get_tile_pict( enum wxr_format wxr_format, const XRenderColor *co
XRenderPictureAttributes pa; XRenderPictureAttributes pa;
XRenderPictFormat *pict_format = pict_formats[wxr_format]; XRenderPictFormat *pict_format = pict_formats[wxr_format];
wine_tsx11_lock();
tile->xpm = XCreatePixmap(gdi_display, root_window, 1, 1, pict_format->depth); tile->xpm = XCreatePixmap(gdi_display, root_window, 1, 1, pict_format->depth);
pa.repeat = RepeatNormal; pa.repeat = RepeatNormal;
tile->pict = pXRenderCreatePicture(gdi_display, tile->xpm, pict_format, CPRepeat, &pa); tile->pict = pXRenderCreatePicture(gdi_display, tile->xpm, pict_format, CPRepeat, &pa);
wine_tsx11_unlock();
/* init current_color to something different from text_pixel */ /* init current_color to something different from text_pixel */
tile->current_color = *color; tile->current_color = *color;
...@@ -1497,17 +1474,13 @@ static Picture get_tile_pict( enum wxr_format wxr_format, const XRenderColor *co ...@@ -1497,17 +1474,13 @@ static Picture get_tile_pict( enum wxr_format wxr_format, const XRenderColor *co
XRenderColor col; XRenderColor col;
col.red = col.green = col.blue = 0; col.red = col.green = col.blue = 0;
col.alpha = 0xffff; col.alpha = 0xffff;
wine_tsx11_lock();
pXRenderFillRectangle(gdi_display, PictOpSrc, tile->pict, &col, 0, 0, 1, 1); pXRenderFillRectangle(gdi_display, PictOpSrc, tile->pict, &col, 0, 0, 1, 1);
wine_tsx11_unlock();
} }
} }
if (memcmp( color, &tile->current_color, sizeof(*color) ) && wxr_format != WXR_FORMAT_MONO) if (memcmp( color, &tile->current_color, sizeof(*color) ) && wxr_format != WXR_FORMAT_MONO)
{ {
wine_tsx11_lock();
pXRenderFillRectangle(gdi_display, PictOpSrc, tile->pict, color, 0, 0, 1, 1); pXRenderFillRectangle(gdi_display, PictOpSrc, tile->pict, color, 0, 0, 1, 1);
wine_tsx11_unlock();
tile->current_color = *color; tile->current_color = *color;
} }
return tile->pict; return tile->pict;
...@@ -1531,12 +1504,10 @@ static Picture get_mask_pict( int alpha ) ...@@ -1531,12 +1504,10 @@ static Picture get_mask_pict( int alpha )
{ {
XRenderPictureAttributes pa; XRenderPictureAttributes pa;
wine_tsx11_lock();
pixmap = XCreatePixmap( gdi_display, root_window, 1, 1, 32 ); pixmap = XCreatePixmap( gdi_display, root_window, 1, 1, 32 );
pa.repeat = RepeatNormal; pa.repeat = RepeatNormal;
pict = pXRenderCreatePicture( gdi_display, pixmap, pict = pXRenderCreatePicture( gdi_display, pixmap,
pict_formats[WXR_FORMAT_A8R8G8B8], CPRepeat, &pa ); pict_formats[WXR_FORMAT_A8R8G8B8], CPRepeat, &pa );
wine_tsx11_unlock();
current_alpha = -1; current_alpha = -1;
} }
...@@ -1545,9 +1516,7 @@ static Picture get_mask_pict( int alpha ) ...@@ -1545,9 +1516,7 @@ static Picture get_mask_pict( int alpha )
XRenderColor col; XRenderColor col;
col.red = col.green = col.blue = 0; col.red = col.green = col.blue = 0;
col.alpha = current_alpha = alpha; col.alpha = current_alpha = alpha;
wine_tsx11_lock();
pXRenderFillRectangle( gdi_display, PictOpSrc, pict, &col, 0, 0, 1, 1 ); pXRenderFillRectangle( gdi_display, PictOpSrc, pict, &col, 0, 0, 1, 1 );
wine_tsx11_unlock();
} }
return pict; return pict;
} }
...@@ -1583,14 +1552,12 @@ static BOOL xrenderdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, ...@@ -1583,14 +1552,12 @@ static BOOL xrenderdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
else else
get_xrender_color( physdev, GetBkColor( physdev->dev.hdc ), &bg ); get_xrender_color( physdev, GetBkColor( physdev->dev.hdc ), &bg );
wine_tsx11_lock();
set_xrender_transformation( pict, 1, 1, 0, 0 ); set_xrender_transformation( pict, 1, 1, 0, 0 );
pXRenderFillRectangle( gdi_display, PictOpSrc, pict, &bg, pXRenderFillRectangle( gdi_display, PictOpSrc, pict, &bg,
physdev->x11dev->dc_rect.left + lprect->left, physdev->x11dev->dc_rect.left + lprect->left,
physdev->x11dev->dc_rect.top + lprect->top, physdev->x11dev->dc_rect.top + lprect->top,
lprect->right - lprect->left, lprect->right - lprect->left,
lprect->bottom - lprect->top ); lprect->bottom - lprect->top );
wine_tsx11_unlock();
add_device_bounds( physdev->x11dev, lprect ); add_device_bounds( physdev->x11dev, lprect );
} }
...@@ -1859,10 +1826,8 @@ static DWORD create_image_pixmap( BITMAPINFO *info, const struct gdi_image_bits ...@@ -1859,10 +1826,8 @@ static DWORD create_image_pixmap( BITMAPINFO *info, const struct gdi_image_bits
GC gc; GC gc;
XImage *image; XImage *image;
wine_tsx11_lock();
image = XCreateImage( gdi_display, visual, depth, ZPixmap, 0, NULL, image = XCreateImage( gdi_display, visual, depth, ZPixmap, 0, NULL,
info->bmiHeader.biWidth, height, 32, 0 ); info->bmiHeader.biWidth, height, 32, 0 );
wine_tsx11_unlock();
if (!image) return ERROR_OUTOFMEMORY; if (!image) return ERROR_OUTOFMEMORY;
ret = copy_image_bits( info, (format == WXR_FORMAT_R8G8B8), image, bits, &dst_bits, src, NULL, ~0u ); ret = copy_image_bits( info, (format == WXR_FORMAT_R8G8B8), image, bits, &dst_bits, src, NULL, ~0u );
...@@ -1873,13 +1838,11 @@ static DWORD create_image_pixmap( BITMAPINFO *info, const struct gdi_image_bits ...@@ -1873,13 +1838,11 @@ static DWORD create_image_pixmap( BITMAPINFO *info, const struct gdi_image_bits
*use_repeat = (width == 1 && height == 1); *use_repeat = (width == 1 && height == 1);
pa.repeat = *use_repeat ? RepeatNormal : RepeatNone; pa.repeat = *use_repeat ? RepeatNormal : RepeatNone;
wine_tsx11_lock();
*pixmap = XCreatePixmap( gdi_display, root_window, width, height, depth ); *pixmap = XCreatePixmap( gdi_display, root_window, width, height, depth );
gc = XCreateGC( gdi_display, *pixmap, 0, NULL ); gc = XCreateGC( gdi_display, *pixmap, 0, NULL );
XPutImage( gdi_display, *pixmap, gc, image, src->visrect.left, 0, 0, 0, width, height ); XPutImage( gdi_display, *pixmap, gc, image, src->visrect.left, 0, 0, 0, width, height );
*pict = pXRenderCreatePicture( gdi_display, *pixmap, pict_formats[format], CPRepeat, &pa ); *pict = pXRenderCreatePicture( gdi_display, *pixmap, pict_formats[format], CPRepeat, &pa );
XFreeGC( gdi_display, gc ); XFreeGC( gdi_display, gc );
wine_tsx11_unlock();
/* make coordinates relative to the pixmap */ /* make coordinates relative to the pixmap */
src->x -= src->visrect.left; src->x -= src->visrect.left;
...@@ -1887,9 +1850,7 @@ static DWORD create_image_pixmap( BITMAPINFO *info, const struct gdi_image_bits ...@@ -1887,9 +1850,7 @@ static DWORD create_image_pixmap( BITMAPINFO *info, const struct gdi_image_bits
OffsetRect( &src->visrect, -src->visrect.left, -src->visrect.top ); OffsetRect( &src->visrect, -src->visrect.left, -src->visrect.top );
image->data = NULL; image->data = NULL;
wine_tsx11_lock();
XDestroyImage( image ); XDestroyImage( image );
wine_tsx11_unlock();
if (dst_bits.free) dst_bits.free( &dst_bits ); if (dst_bits.free) dst_bits.free( &dst_bits );
return ret; return ret;
} }
...@@ -1907,9 +1868,7 @@ static void xrender_stretch_blit( struct xrender_physdev *physdev_src, struct xr ...@@ -1907,9 +1868,7 @@ static void xrender_stretch_blit( struct xrender_physdev *physdev_src, struct xr
{ {
x_dst = dst->x; x_dst = dst->x;
y_dst = dst->y; y_dst = dst->y;
wine_tsx11_lock();
dst_pict = pXRenderCreatePicture( gdi_display, drawable, physdev_dst->pict_format, 0, NULL ); dst_pict = pXRenderCreatePicture( gdi_display, drawable, physdev_dst->pict_format, 0, NULL );
wine_tsx11_unlock();
} }
else else
{ {
...@@ -1945,12 +1904,7 @@ static void xrender_stretch_blit( struct xrender_physdev *physdev_src, struct xr ...@@ -1945,12 +1904,7 @@ static void xrender_stretch_blit( struct xrender_physdev *physdev_src, struct xr
src->width, src->height, x_dst, y_dst, dst->width, dst->height, xscale, yscale ); src->width, src->height, x_dst, y_dst, dst->width, dst->height, xscale, yscale );
} }
if (drawable) if (drawable) pXRenderFreePicture( gdi_display, dst_pict );
{
wine_tsx11_lock();
pXRenderFreePicture( gdi_display, dst_pict );
wine_tsx11_unlock();
}
} }
...@@ -1970,12 +1924,10 @@ static void xrender_put_image( Pixmap src_pixmap, Picture src_pict, Picture mask ...@@ -1970,12 +1924,10 @@ static void xrender_put_image( Pixmap src_pixmap, Picture src_pict, Picture mask
if (clip) clip_data = X11DRV_GetRegionData( clip, 0 ); if (clip) clip_data = X11DRV_GetRegionData( clip, 0 );
x_dst = dst->x; x_dst = dst->x;
y_dst = dst->y; y_dst = dst->y;
wine_tsx11_lock();
dst_pict = pXRenderCreatePicture( gdi_display, drawable, dst_format, 0, NULL ); dst_pict = pXRenderCreatePicture( gdi_display, drawable, dst_format, 0, NULL );
if (clip_data) if (clip_data)
pXRenderSetPictureClipRectangles( gdi_display, dst_pict, 0, 0, pXRenderSetPictureClipRectangles( gdi_display, dst_pict, 0, 0,
(XRectangle *)clip_data->Buffer, clip_data->rdh.nCount ); (XRectangle *)clip_data->Buffer, clip_data->rdh.nCount );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, clip_data ); HeapFree( GetProcessHeap(), 0, clip_data );
} }
else else
...@@ -1995,12 +1947,7 @@ static void xrender_put_image( Pixmap src_pixmap, Picture src_pict, Picture mask ...@@ -1995,12 +1947,7 @@ static void xrender_put_image( Pixmap src_pixmap, Picture src_pict, Picture mask
xrender_blit( PictOpSrc, src_pict, mask_pict, dst_pict, src->x, src->y, src->width, src->height, xrender_blit( PictOpSrc, src_pict, mask_pict, dst_pict, src->x, src->y, src->width, src->height,
x_dst, y_dst, dst->width, dst->height, xscale, yscale ); x_dst, y_dst, dst->width, dst->height, xscale, yscale );
if (drawable) if (drawable) pXRenderFreePicture( gdi_display, dst_pict );
{
wine_tsx11_lock();
pXRenderFreePicture( gdi_display, dst_pict );
wine_tsx11_unlock();
}
} }
...@@ -2039,21 +1986,17 @@ static BOOL xrenderdrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst, ...@@ -2039,21 +1986,17 @@ static BOOL xrenderdrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
tmp.y -= tmp.visrect.top; tmp.y -= tmp.visrect.top;
OffsetRect( &tmp.visrect, -tmp.visrect.left, -tmp.visrect.top ); OffsetRect( &tmp.visrect, -tmp.visrect.left, -tmp.visrect.top );
wine_tsx11_lock();
tmpGC = XCreateGC( gdi_display, physdev_dst->x11dev->drawable, 0, NULL ); tmpGC = XCreateGC( gdi_display, physdev_dst->x11dev->drawable, 0, NULL );
XSetSubwindowMode( gdi_display, tmpGC, IncludeInferiors ); XSetSubwindowMode( gdi_display, tmpGC, IncludeInferiors );
XSetGraphicsExposures( gdi_display, tmpGC, False ); XSetGraphicsExposures( gdi_display, tmpGC, False );
tmp_pixmap = XCreatePixmap( gdi_display, root_window, tmp.visrect.right - tmp.visrect.left, tmp_pixmap = XCreatePixmap( gdi_display, root_window, tmp.visrect.right - tmp.visrect.left,
tmp.visrect.bottom - tmp.visrect.top, physdev_dst->pict_format->depth ); tmp.visrect.bottom - tmp.visrect.top, physdev_dst->pict_format->depth );
wine_tsx11_unlock();
xrender_stretch_blit( physdev_src, physdev_dst, tmp_pixmap, src, &tmp ); xrender_stretch_blit( physdev_src, physdev_dst, tmp_pixmap, src, &tmp );
execute_rop( physdev_dst->x11dev, tmp_pixmap, tmpGC, &dst->visrect, rop ); execute_rop( physdev_dst->x11dev, tmp_pixmap, tmpGC, &dst->visrect, rop );
wine_tsx11_lock();
XFreePixmap( gdi_display, tmp_pixmap ); XFreePixmap( gdi_display, tmp_pixmap );
XFreeGC( gdi_display, tmpGC ); XFreeGC( gdi_display, tmpGC );
wine_tsx11_unlock();
} }
else xrender_stretch_blit( physdev_src, physdev_dst, 0, src, dst ); else xrender_stretch_blit( physdev_src, physdev_dst, 0, src, dst );
...@@ -2127,11 +2070,8 @@ static DWORD xrenderdrv_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info, ...@@ -2127,11 +2070,8 @@ static DWORD xrenderdrv_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info,
NULL, tmp_pixmap, src, &tmp, use_repeat ); NULL, tmp_pixmap, src, &tmp, use_repeat );
execute_rop( physdev->x11dev, tmp_pixmap, gc, &dst->visrect, rop ); execute_rop( physdev->x11dev, tmp_pixmap, gc, &dst->visrect, rop );
wine_tsx11_lock();
XFreePixmap( gdi_display, tmp_pixmap ); XFreePixmap( gdi_display, tmp_pixmap );
XFreeGC( gdi_display, gc ); XFreeGC( gdi_display, gc );
wine_tsx11_unlock();
if (restore_region) restore_clipping_region( physdev->x11dev ); if (restore_region) restore_clipping_region( physdev->x11dev );
} }
else xrender_put_image( src_pixmap, src_pict, mask_pict, clip, else xrender_put_image( src_pixmap, src_pict, mask_pict, clip,
...@@ -2139,10 +2079,8 @@ static DWORD xrenderdrv_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info, ...@@ -2139,10 +2079,8 @@ static DWORD xrenderdrv_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info,
add_device_bounds( physdev->x11dev, &dst->visrect ); add_device_bounds( physdev->x11dev, &dst->visrect );
wine_tsx11_lock();
pXRenderFreePicture( gdi_display, src_pict ); pXRenderFreePicture( gdi_display, src_pict );
XFreePixmap( gdi_display, src_pixmap ); XFreePixmap( gdi_display, src_pixmap );
wine_tsx11_unlock();
} }
return ret; return ret;
...@@ -2212,10 +2150,8 @@ static DWORD xrenderdrv_BlendImage( PHYSDEV dev, BITMAPINFO *info, const struct ...@@ -2212,10 +2150,8 @@ static DWORD xrenderdrv_BlendImage( PHYSDEV dev, BITMAPINFO *info, const struct
physdev->x11dev->dc_rect.top + dst->y, physdev->x11dev->dc_rect.top + dst->y,
dst->width, dst->height, xscale, yscale ); dst->width, dst->height, xscale, yscale );
wine_tsx11_lock();
pXRenderFreePicture( gdi_display, src_pict ); pXRenderFreePicture( gdi_display, src_pict );
XFreePixmap( gdi_display, src_pixmap ); XFreePixmap( gdi_display, src_pixmap );
wine_tsx11_unlock();
LeaveCriticalSection( &xrender_cs ); LeaveCriticalSection( &xrender_cs );
add_device_bounds( physdev->x11dev, &dst->visrect ); add_device_bounds( physdev->x11dev, &dst->visrect );
...@@ -2273,11 +2209,9 @@ static BOOL xrenderdrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst, ...@@ -2273,11 +2209,9 @@ static BOOL xrenderdrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst,
bg.red = bg.green = bg.blue = 0xffff; bg.red = bg.green = bg.blue = 0xffff;
fg.alpha = bg.alpha = 0xffff; fg.alpha = bg.alpha = 0xffff;
wine_tsx11_lock();
tmp_pixmap = XCreatePixmap( gdi_display, root_window, width, height, tmp_pixmap = XCreatePixmap( gdi_display, root_window, width, height,
physdev_dst->pict_format->depth ); physdev_dst->pict_format->depth );
tmp_pict = pXRenderCreatePicture( gdi_display, tmp_pixmap, physdev_dst->pict_format, 0, NULL ); tmp_pict = pXRenderCreatePicture( gdi_display, tmp_pixmap, physdev_dst->pict_format, 0, NULL );
wine_tsx11_unlock();
xrender_mono_blit( src_pict, tmp_pict, physdev_dst->format, &fg, &bg, xrender_mono_blit( src_pict, tmp_pict, physdev_dst->format, &fg, &bg,
src->visrect.left, src->visrect.top, width, height, 0, 0, width, height, 1, 1 ); src->visrect.left, src->visrect.top, width, height, 0, 0, width, height, 1, 1 );
...@@ -2288,11 +2222,9 @@ static BOOL xrenderdrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst, ...@@ -2288,11 +2222,9 @@ static BOOL xrenderdrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst,
enum wxr_format format = get_format_without_alpha( physdev_src->format ); enum wxr_format format = get_format_without_alpha( physdev_src->format );
if (format != physdev_src->format) if (format != physdev_src->format)
{ {
wine_tsx11_lock();
pa.subwindow_mode = IncludeInferiors; pa.subwindow_mode = IncludeInferiors;
tmp_pict = pXRenderCreatePicture( gdi_display, physdev_src->x11dev->drawable, tmp_pict = pXRenderCreatePicture( gdi_display, physdev_src->x11dev->drawable,
pict_formats[format], CPSubwindowMode, &pa ); pict_formats[format], CPSubwindowMode, &pa );
wine_tsx11_unlock();
} }
} }
...@@ -2309,10 +2241,8 @@ static BOOL xrenderdrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst, ...@@ -2309,10 +2241,8 @@ static BOOL xrenderdrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst,
physdev_dst->x11dev->dc_rect.top + dst->y, physdev_dst->x11dev->dc_rect.top + dst->y,
dst->width, dst->height, xscale, yscale ); dst->width, dst->height, xscale, yscale );
wine_tsx11_lock();
if (tmp_pict) pXRenderFreePicture( gdi_display, tmp_pict ); if (tmp_pict) pXRenderFreePicture( gdi_display, tmp_pict );
if (tmp_pixmap) XFreePixmap( gdi_display, tmp_pixmap ); if (tmp_pixmap) XFreePixmap( gdi_display, tmp_pixmap );
wine_tsx11_unlock();
LeaveCriticalSection( &xrender_cs ); LeaveCriticalSection( &xrender_cs );
add_device_bounds( physdev_dst->x11dev, &dst->visrect ); add_device_bounds( physdev_dst->x11dev, &dst->visrect );
...@@ -2449,13 +2379,11 @@ static HBRUSH xrenderdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct b ...@@ -2449,13 +2379,11 @@ static HBRUSH xrenderdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct b
&pattern->bits, pattern->usage ); &pattern->bits, pattern->usage );
if (!pixmap) return 0; if (!pixmap) return 0;
wine_tsx11_lock();
if (physdev->x11dev->brush.pixmap) XFreePixmap( gdi_display, physdev->x11dev->brush.pixmap ); if (physdev->x11dev->brush.pixmap) XFreePixmap( gdi_display, physdev->x11dev->brush.pixmap );
physdev->x11dev->brush.pixmap = pixmap; physdev->x11dev->brush.pixmap = pixmap;
physdev->x11dev->brush.fillStyle = FillTiled; physdev->x11dev->brush.fillStyle = FillTiled;
physdev->x11dev->brush.pixel = 0; /* ignored */ physdev->x11dev->brush.pixel = 0; /* ignored */
physdev->x11dev->brush.style = BS_PATTERN; physdev->x11dev->brush.style = BS_PATTERN;
wine_tsx11_unlock();
return hbrush; return hbrush;
x11drv_fallback: x11drv_fallback:
......
...@@ -116,9 +116,7 @@ static int X11DRV_XF86VM_GetCurrentMode(void) ...@@ -116,9 +116,7 @@ static int X11DRV_XF86VM_GetCurrentMode(void)
DWORD dwBpp = screen_bpp; DWORD dwBpp = screen_bpp;
TRACE("Querying XVidMode current mode\n"); TRACE("Querying XVidMode current mode\n");
wine_tsx11_lock();
pXF86VidModeGetModeLine(gdi_display, DefaultScreen(gdi_display), &dotclock, &line); pXF86VidModeGetModeLine(gdi_display, DefaultScreen(gdi_display), &dotclock, &line);
wine_tsx11_unlock();
convert_modeline(dotclock, &line, &cmode, dwBpp); convert_modeline(dotclock, &line, &cmode, dwBpp);
for (i=0; i<dd_mode_count; i++) for (i=0; i<dd_mode_count; i++)
if (memcmp(&dd_modes[i], &cmode, sizeof(cmode)) == 0) { if (memcmp(&dd_modes[i], &cmode, sizeof(cmode)) == 0) {
...@@ -194,10 +192,7 @@ void X11DRV_XF86VM_Init(void) ...@@ -194,10 +192,7 @@ void X11DRV_XF86VM_Init(void)
#undef LOAD_FUNCPTR #undef LOAD_FUNCPTR
/* see if XVidMode is available */ /* see if XVidMode is available */
wine_tsx11_lock(); if (!pXF86VidModeQueryExtension(gdi_display, &xf86vm_event, &xf86vm_error)) return;
ok = pXF86VidModeQueryExtension(gdi_display, &xf86vm_event, &xf86vm_error);
wine_tsx11_unlock();
if (!ok) return;
X11DRV_expect_error(gdi_display, XVidModeErrorHandler, NULL); X11DRV_expect_error(gdi_display, XVidModeErrorHandler, NULL);
ok = pXF86VidModeQueryVersion(gdi_display, &xf86vm_major, &xf86vm_minor); ok = pXF86VidModeQueryVersion(gdi_display, &xf86vm_major, &xf86vm_minor);
...@@ -255,9 +250,7 @@ sym_not_found: ...@@ -255,9 +250,7 @@ sym_not_found:
void X11DRV_XF86VM_Cleanup(void) void X11DRV_XF86VM_Cleanup(void)
{ {
wine_tsx11_lock();
if (real_xf86vm_modes) XFree(real_xf86vm_modes); if (real_xf86vm_modes) XFree(real_xf86vm_modes);
wine_tsx11_unlock();
} }
/***** GAMMA CONTROL *****/ /***** GAMMA CONTROL *****/
...@@ -353,39 +346,26 @@ static BOOL X11DRV_XF86VM_GetGammaRamp(LPDDGAMMARAMP ramp) ...@@ -353,39 +346,26 @@ static BOOL X11DRV_XF86VM_GetGammaRamp(LPDDGAMMARAMP ramp)
{ {
#ifdef X_XF86VidModeSetGamma #ifdef X_XF86VidModeSetGamma
XF86VidModeGamma gamma; XF86VidModeGamma gamma;
Bool ret;
if (xf86vm_major < 2) return FALSE; /* no gamma control */ if (xf86vm_major < 2) return FALSE; /* no gamma control */
#ifdef X_XF86VidModeSetGammaRamp #ifdef X_XF86VidModeSetGammaRamp
else if (xf86vm_use_gammaramp) if (xf86vm_use_gammaramp)
{ return pXF86VidModeGetGammaRamp(gdi_display, DefaultScreen(gdi_display), 256,
Bool ret;
wine_tsx11_lock();
ret = pXF86VidModeGetGammaRamp(gdi_display, DefaultScreen(gdi_display), 256,
ramp->red, ramp->green, ramp->blue); ramp->red, ramp->green, ramp->blue);
wine_tsx11_unlock();
return ret;
}
#endif #endif
else if (pXF86VidModeGetGamma(gdi_display, DefaultScreen(gdi_display), &gamma))
{ {
wine_tsx11_lock();
ret = pXF86VidModeGetGamma(gdi_display, DefaultScreen(gdi_display), &gamma);
wine_tsx11_unlock();
if (ret) {
GenerateRampFromGamma(ramp->red, gamma.red); GenerateRampFromGamma(ramp->red, gamma.red);
GenerateRampFromGamma(ramp->green, gamma.green); GenerateRampFromGamma(ramp->green, gamma.green);
GenerateRampFromGamma(ramp->blue, gamma.blue); GenerateRampFromGamma(ramp->blue, gamma.blue);
return TRUE; return TRUE;
} }
}
#endif /* X_XF86VidModeSetGamma */ #endif /* X_XF86VidModeSetGamma */
return FALSE; return FALSE;
} }
static BOOL X11DRV_XF86VM_SetGammaRamp(LPDDGAMMARAMP ramp) static BOOL X11DRV_XF86VM_SetGammaRamp(LPDDGAMMARAMP ramp)
{ {
Bool ret = FALSE;
#ifdef X_XF86VidModeSetGamma #ifdef X_XF86VidModeSetGamma
XF86VidModeGamma gamma; XF86VidModeGamma gamma;
...@@ -393,17 +373,15 @@ static BOOL X11DRV_XF86VM_SetGammaRamp(LPDDGAMMARAMP ramp) ...@@ -393,17 +373,15 @@ static BOOL X11DRV_XF86VM_SetGammaRamp(LPDDGAMMARAMP ramp)
if (!ComputeGammaFromRamp(ramp->red, &gamma.red) || /* ramp validation */ if (!ComputeGammaFromRamp(ramp->red, &gamma.red) || /* ramp validation */
!ComputeGammaFromRamp(ramp->green, &gamma.green) || !ComputeGammaFromRamp(ramp->green, &gamma.green) ||
!ComputeGammaFromRamp(ramp->blue, &gamma.blue)) return FALSE; !ComputeGammaFromRamp(ramp->blue, &gamma.blue)) return FALSE;
wine_tsx11_lock();
#ifdef X_XF86VidModeSetGammaRamp #ifdef X_XF86VidModeSetGammaRamp
if (xf86vm_use_gammaramp) if (xf86vm_use_gammaramp)
ret = pXF86VidModeSetGammaRamp(gdi_display, DefaultScreen(gdi_display), 256, return pXF86VidModeSetGammaRamp(gdi_display, DefaultScreen(gdi_display), 256,
ramp->red, ramp->green, ramp->blue); ramp->red, ramp->green, ramp->blue);
else
#endif #endif
ret = pXF86VidModeSetGamma(gdi_display, DefaultScreen(gdi_display), &gamma); return pXF86VidModeSetGamma(gdi_display, DefaultScreen(gdi_display), &gamma);
wine_tsx11_unlock(); #else
return FALSE;
#endif /* X_XF86VidModeSetGamma */ #endif /* X_XF86VidModeSetGamma */
return ret;
} }
#else /* SONAME_LIBXXF86VM */ #else /* SONAME_LIBXXF86VM */
......
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