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);
......
...@@ -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 */
......
...@@ -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.
......
...@@ -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,31 +346,19 @@ static BOOL X11DRV_XF86VM_GetGammaRamp(LPDDGAMMARAMP ramp) ...@@ -353,31 +346,19 @@ 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; ramp->red, ramp->green, ramp->blue);
wine_tsx11_lock();
ret = pXF86VidModeGetGammaRamp(gdi_display, DefaultScreen(gdi_display), 256,
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(); GenerateRampFromGamma(ramp->red, gamma.red);
ret = pXF86VidModeGetGamma(gdi_display, DefaultScreen(gdi_display), &gamma); GenerateRampFromGamma(ramp->green, gamma.green);
wine_tsx11_unlock(); GenerateRampFromGamma(ramp->blue, gamma.blue);
if (ret) { return TRUE;
GenerateRampFromGamma(ramp->red, gamma.red);
GenerateRampFromGamma(ramp->green, gamma.green);
GenerateRampFromGamma(ramp->blue, gamma.blue);
return TRUE;
}
} }
#endif /* X_XF86VidModeSetGamma */ #endif /* X_XF86VidModeSetGamma */
return FALSE; return FALSE;
...@@ -385,7 +366,6 @@ static BOOL X11DRV_XF86VM_GetGammaRamp(LPDDGAMMARAMP ramp) ...@@ -385,7 +366,6 @@ static BOOL X11DRV_XF86VM_GetGammaRamp(LPDDGAMMARAMP ramp)
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