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
pixmaps[SRC] = src_pixmap;
pixmaps[TMP] = 0;
wine_tsx11_lock();
pixmaps[DST] = XCreatePixmap( gdi_display, root_window, width, height, physdev->depth );
wine_tsx11_unlock();
if (use_dst) BITBLT_GetDstArea( physdev, pixmaps[DST], gc, visrect );
null_brush = use_pat && !X11DRV_SetupGCForPatBlt( physdev, gc, TRUE );
......@@ -908,10 +906,8 @@ BOOL X11DRV_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
execute_rop( physDevDst, src_pixmap, gc, &dst->visrect, rop );
wine_tsx11_lock();
XFreePixmap( gdi_display, src_pixmap );
XFreeGC( gdi_display, gc );
wine_tsx11_unlock();
return TRUE;
}
......@@ -923,9 +919,7 @@ static void free_heap_bits( struct gdi_image_bits *bits )
static void free_ximage_bits( struct gdi_image_bits *bits )
{
wine_tsx11_lock();
XFree( bits->ptr );
wine_tsx11_unlock();
}
/* only for use on sanitized BITMAPINFO structures */
......@@ -1219,10 +1213,8 @@ DWORD X11DRV_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info,
if (!bits) return ERROR_SUCCESS; /* just querying the format */
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,
info->bmiHeader.biWidth, src->visrect.bottom - src->visrect.top, 32, 0 );
wine_tsx11_unlock();
if (!image) return ERROR_OUTOFMEMORY;
if (image->bits_per_pixel == 4 || image->bits_per_pixel == 8)
......@@ -1244,32 +1236,24 @@ DWORD X11DRV_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info,
/* optimization for single-op ROPs */
if (!opcode[1] && OP_SRCDST(opcode[0]) == OP_ARGS(SRC,DST))
{
wine_tsx11_lock();
XSetFunction( gdi_display, physdev->gc, OP_ROP(*opcode) );
XPutImage( gdi_display, physdev->drawable, physdev->gc, image, src->visrect.left, 0,
physdev->dc_rect.left + dst->visrect.left,
physdev->dc_rect.top + dst->visrect.top, width, height );
wine_tsx11_unlock();
}
else
{
Pixmap src_pixmap;
GC gc;
GC gc = XCreateGC( gdi_display, physdev->drawable, 0, NULL );
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 );
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 );
wine_tsx11_unlock();
execute_rop( physdev, src_pixmap, gc, &dst->visrect, rop );
wine_tsx11_lock();
XFreePixmap( gdi_display, src_pixmap );
XFreeGC( gdi_display, gc );
wine_tsx11_unlock();
}
if (restore_region) restore_clipping_region( physdev );
......@@ -1277,9 +1261,7 @@ DWORD X11DRV_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info,
image->data = NULL;
}
wine_tsx11_lock();
XDestroyImage( image );
wine_tsx11_unlock();
if (dst_bits.free) dst_bits.free( &dst_bits );
return ret;
......@@ -1356,19 +1338,15 @@ DWORD X11DRV_GetImage( PHYSDEV dev, BITMAPINFO *info,
if (X11DRV_check_error())
{
/* use a temporary pixmap to avoid the BadMatch error */
GC gc;
Pixmap pixmap;
Pixmap pixmap = XCreatePixmap( gdi_display, root_window, width, height, vis.depth );
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 );
XCopyArea( gdi_display, physdev->drawable, pixmap, gc,
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 );
XFreePixmap( gdi_display, pixmap );
XFreeGC( gdi_display, gc );
wine_tsx11_unlock();
}
if (!image) return ERROR_OUTOFMEMORY;
......@@ -1387,9 +1365,7 @@ DWORD X11DRV_GetImage( PHYSDEV dev, BITMAPINFO *info,
bits->free = free_ximage_bits;
image->data = NULL;
}
wine_tsx11_lock();
XDestroyImage( image );
wine_tsx11_unlock();
return ret;
}
......@@ -1423,10 +1399,8 @@ static DWORD put_pixmap_image( Pixmap pixmap, const XVisualInfo *vis,
coords.height = abs( info->bmiHeader.biHeight );
SetRect( &coords.visrect, 0, 0, coords.width, coords.height );
wine_tsx11_lock();
image = XCreateImage( gdi_display, visual, vis->depth, ZPixmap, 0, NULL,
coords.width, coords.height, 32, 0 );
wine_tsx11_unlock();
if (!image) return ERROR_OUTOFMEMORY;
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,
if (!(ret = copy_image_bits( info, is_r8g8b8(vis), image, bits, &dst_bits, &coords, mapping, ~0u )))
{
image->data = dst_bits.ptr;
wine_tsx11_lock();
gc = XCreateGC( gdi_display, pixmap, 0, NULL );
XPutImage( gdi_display, pixmap, gc, image, 0, 0, 0, 0, coords.width, coords.height );
XFreeGC( gdi_display, gc );
wine_tsx11_unlock();
image->data = NULL;
}
wine_tsx11_lock();
XDestroyImage( image );
wine_tsx11_unlock();
if (dst_bits.free) dst_bits.free( &dst_bits );
return ret;
......@@ -1474,10 +1444,8 @@ Pixmap create_pixmap_from_image( HDC hdc, const XVisualInfo *vis, const BITMAPIN
DWORD err;
HBITMAP dib;
wine_tsx11_lock();
pixmap = XCreatePixmap( gdi_display, root_window,
info->bmiHeader.biWidth, abs(info->bmiHeader.biHeight), vis->depth );
wine_tsx11_unlock();
if (!pixmap) return 0;
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
if (!err) return pixmap;
wine_tsx11_lock();
XFreePixmap( gdi_display, pixmap );
wine_tsx11_unlock();
return 0;
}
......@@ -1547,9 +1513,7 @@ DWORD get_pixmap_image( Pixmap pixmap, int width, int height, const XVisualInfo
coords.height = height;
SetRect( &coords.visrect, 0, 0, width, height );
wine_tsx11_lock();
image = XGetImage( gdi_display, pixmap, 0, 0, width, height, AllPlanes, ZPixmap );
wine_tsx11_unlock();
if (!image) return ERROR_OUTOFMEMORY;
info->bmiHeader.biSizeImage = height * image->bytes_per_line;
......@@ -1564,8 +1528,6 @@ DWORD get_pixmap_image( Pixmap pixmap, int width, int height, const XVisualInfo
bits->free = free_ximage_bits;
image->data = NULL;
}
wine_tsx11_lock();
XDestroyImage( image );
wine_tsx11_unlock();
return ret;
}
......@@ -171,16 +171,9 @@ static Pixmap BRUSH_DitherMono( COLORREF color )
};
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;
Pixmap pixmap;
TRACE("color=%06x -> gray=%x\n", color, gray);
wine_tsx11_lock();
pixmap = XCreateBitmapFromData( gdi_display, root_window,
gray_dither[idx],
2, 2 );
wine_tsx11_unlock();
return pixmap;
return XCreateBitmapFromData( gdi_display, root_window, gray_dither[idx], 2, 2 );
}
/***********************************************************************
......@@ -273,9 +266,7 @@ HBRUSH X11DRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct brush_patter
if (physDev->brush.pixmap)
{
wine_tsx11_lock();
XFreePixmap( gdi_display, physDev->brush.pixmap );
wine_tsx11_unlock();
physDev->brush.pixmap = 0;
}
physDev->brush.style = logbrush.lbStyle;
......@@ -296,10 +287,8 @@ HBRUSH X11DRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct brush_patter
case BS_HATCHED:
TRACE("BS_HATCHED\n" );
physDev->brush.pixel = X11DRV_PALETTE_ToPhysical( physDev, logbrush.lbColor );
wine_tsx11_lock();
physDev->brush.pixmap = XCreateBitmapFromData( gdi_display, root_window,
HatchBrushes[logbrush.lbHatch], 8, 8 );
wine_tsx11_unlock();
physDev->brush.fillStyle = FillStippled;
break;
}
......
......@@ -264,11 +264,8 @@ static Window thread_selection_wnd(void)
attr.event_mask = (ExposureMask | KeyPressMask | KeyReleaseMask | PointerMotionMask |
ButtonPressMask | ButtonReleaseMask | EnterWindowMask | PropertyChangeMask);
wine_tsx11_lock();
w = XCreateWindow(thread_data->display, root_window, 0, 0, 1, 1, 0, screen_depth,
InputOutput, CopyFromParent, CWEventMask, &attr);
wine_tsx11_unlock();
if (w)
thread_data->selection_wnd = w;
else
......@@ -379,9 +376,7 @@ static void intern_atoms(void)
WideCharToMultiByte(CP_UNIXCP, 0, buffer, -1, names[i++], len, NULL, NULL);
}
wine_tsx11_lock();
XInternAtoms( display, names, count, False, atoms );
wine_tsx11_unlock();
i = 0;
LIST_FOR_EACH_ENTRY( format, &format_list, WINE_CLIPFORMAT, entry )
......@@ -1267,9 +1262,7 @@ static HANDLE X11DRV_CLIPBOARD_ImportCompoundText(Display *display, Window w, At
txtprop.encoding = x11drv_atom(COMPOUND_TEXT);
txtprop.format = 8;
wine_tsx11_lock();
ret = XmbTextPropertyToTextList(display, &txtprop, &srcstr, &count);
wine_tsx11_unlock();
HeapFree(GetProcessHeap(), 0, txtprop.value);
if (ret != Success || !count) return 0;
......@@ -1306,9 +1299,7 @@ static HANDLE X11DRV_CLIPBOARD_ImportCompoundText(Display *display, Window w, At
GlobalUnlock(hUnicodeText);
}
wine_tsx11_lock();
XFreeStringList(srcstr);
wine_tsx11_unlock();
return hUnicodeText;
}
......@@ -1340,10 +1331,8 @@ static HANDLE X11DRV_CLIPBOARD_ImportXAPIXMAP(Display *display, Window w, Atom p
pPixmap = (Pixmap *) lpdata;
/* Get the Pixmap dimensions and bit depth */
wine_tsx11_lock();
if (!XGetGeometry(gdi_display, *pPixmap, &root, &x, &y, &width, &height,
&border_width, &depth)) depth = 0;
wine_tsx11_unlock();
if (!pixmap_formats[depth]) return 0;
TRACE("\tPixmap properties: width=%d, height=%d, depth=%d\n",
......@@ -1709,13 +1698,11 @@ static HANDLE X11DRV_CLIPBOARD_ExportCompoundText(Display *display, Window reque
style = XStdICCTextStyle;
/* Update the X property */
wine_tsx11_lock();
if (XmbTextListToTextProperty(display, &lpstr, 1, style, &prop) == Success)
{
XSetTextProperty(display, requestor, &prop, rprop);
XFree(prop.value);
}
wine_tsx11_unlock();
HeapFree(GetProcessHeap(), 0, lpstr);
......@@ -2020,21 +2007,15 @@ static BOOL X11DRV_CLIPBOARD_QueryTargets(Display *display, Window w, Atom selec
Atom target, XEvent *xe)
{
INT i;
Bool res;
wine_tsx11_lock();
XConvertSelection(display, selection, target,
x11drv_atom(SELECTION_DATA), w, CurrentTime);
wine_tsx11_unlock();
XConvertSelection(display, selection, target, x11drv_atom(SELECTION_DATA), w, CurrentTime);
/*
* Wait until SelectionNotify is received
*/
for (i = 0; i < SELECTION_RETRIES; i++)
{
wine_tsx11_lock();
res = XCheckTypedWindowEvent(display, w, SelectionNotify, xe);
wine_tsx11_unlock();
Bool res = XCheckTypedWindowEvent(display, w, SelectionNotify, xe);
if (res && xe->xselection.selection == selection) break;
usleep(SELECTION_WAIT);
......@@ -2134,9 +2115,7 @@ static VOID X11DRV_CLIPBOARD_InsertSelectionProperties(Display *display, Atom* p
i, lpFormat->drvData, debugstr_format(lpFormat->wFormatID));
X11DRV_CLIPBOARD_InsertClipboardData(lpFormat->wFormatID, 0, 0, lpFormat, FALSE);
}
wine_tsx11_lock();
for (i = 0; i < nb_atoms; i++) XFree( names[i] );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, names );
}
HeapFree( GetProcessHeap(), 0, atoms );
......@@ -2253,9 +2232,7 @@ static int X11DRV_CLIPBOARD_QueryAvailableData(Display *display, LPCLIPBOARDINFO
}
/* Free the list of targets */
wine_tsx11_lock();
XFree(targetList);
wine_tsx11_unlock();
}
return cSelectionTargets;
......@@ -2299,17 +2276,13 @@ static BOOL X11DRV_CLIPBOARD_ReadSelectionData(Display *display, LPWINE_CLIPDATA
debugstr_format(lpData->lpFormat->wFormatID), lpData->lpFormat->drvData,
(UINT)selectionCacheSrc);
wine_tsx11_lock();
XConvertSelection(display, selectionCacheSrc, lpData->lpFormat->drvData,
x11drv_atom(SELECTION_DATA), w, CurrentTime);
wine_tsx11_unlock();
x11drv_atom(SELECTION_DATA), w, CurrentTime);
/* wait until SelectionNotify is received */
for (i = 0; i < SELECTION_RETRIES; i++)
{
wine_tsx11_lock();
res = XCheckTypedWindowEvent(display, w, SelectionNotify, &xe);
wine_tsx11_unlock();
if (res && xe.xselection.selection == selectionCacheSrc) break;
usleep(SELECTION_WAIT);
......@@ -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
* This will send a PropertyNotify event to the selection owner. */
wine_tsx11_lock();
XDeleteProperty(display, w, prop);
wine_tsx11_unlock();
return TRUE;
}
......@@ -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))
return FALSE;
wine_tsx11_lock();
while (XCheckTypedWindowEvent(display, w, PropertyNotify, &xe))
;
wine_tsx11_unlock();
if (atype == x11drv_atom(INCR))
{
......@@ -2446,9 +2415,7 @@ static BOOL X11DRV_CLIPBOARD_ReadProperty(Display *display, Window w, Atom prop,
{
Bool res;
wine_tsx11_lock();
res = XCheckTypedWindowEvent(display, w, PropertyNotify, &xe);
wine_tsx11_unlock();
if (res && xe.xproperty.atom == prop &&
xe.xproperty.state == PropertyNewValue)
break;
......@@ -3177,14 +3144,12 @@ static Atom X11DRV_SelectionRequest_MULTIPLE( HWND hWnd, XSelectionRequestEvent
if (TRACE_ON(clipboard))
{
char *targetName, *propName;
wine_tsx11_lock();
targetName = XGetAtomName(display, targetPropList[i]);
propName = XGetAtomName(display, targetPropList[i+1]);
TRACE("MULTIPLE(%d): Target='%s' Prop='%s'\n",
i/2, targetName, propName);
XFree(targetName);
XFree(propName);
wine_tsx11_unlock();
}
/* 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
}
/* Free the list of targets/properties */
wine_tsx11_lock();
XFree(targetPropList);
wine_tsx11_unlock();
}
return rprop;
......@@ -3316,9 +3279,7 @@ END:
result.target = event->target;
result.time = event->time;
TRACE("Sending SelectionNotify event...\n");
wine_tsx11_lock();
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
{
XWindowChanges changes;
wine_tsx11_lock();
changes.x = data->whole_rect.left - virtual_screen_rect.left;
changes.y = data->whole_rect.top - virtual_screen_rect.top;
XReconfigureWMWindow( display, data->whole_window,
DefaultScreen(display), mask, &changes );
wine_tsx11_unlock();
}
if (hwnd == GetForegroundWindow()) clip_fullscreen_window( hwnd, TRUE );
return TRUE;
......
......@@ -555,9 +555,7 @@ static void set_focus( Display *display, HWND hwnd, Time time )
if (win)
{
TRACE( "setting focus to %p (%lx) time=%ld\n", focus, win, time );
wine_tsx11_lock();
XSetInputFocus( display, win, RevertToParent, time );
wine_tsx11_unlock();
}
}
......@@ -678,12 +676,8 @@ static void handle_wm_protocols( HWND hwnd, XClientMessageEvent *event )
xev = *event;
TRACE("NET_WM Ping\n");
wine_tsx11_lock();
xev.window = DefaultRootWindow(xev.display);
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 )
if (event->detail == NotifyPointer) return;
if (hwnd == GetDesktopWindow()) return;
if ((xic = X11DRV_get_ic( hwnd )))
{
wine_tsx11_lock();
XSetICFocus( xic );
wine_tsx11_unlock();
}
if ((xic = X11DRV_get_ic( hwnd ))) XSetICFocus( xic );
if (use_take_focus)
{
if (hwnd == GetForegroundWindow()) clip_fullscreen_window( hwnd, FALSE );
......@@ -763,12 +752,8 @@ static void X11DRV_FocusOut( HWND hwnd, XEvent *xev )
if (ximInComposeMode) return;
x11drv_thread_data()->last_focus = hwnd;
if ((xic = X11DRV_get_ic( hwnd )))
{
wine_tsx11_lock();
XUnsetICFocus( xic );
wine_tsx11_unlock();
}
if ((xic = X11DRV_get_ic( hwnd ))) XUnsetICFocus( xic );
if (root_window != DefaultRootWindow(event->display))
{
if (hwnd == GetDesktopWindow()) reset_clipping_window();
......@@ -780,14 +765,12 @@ static void X11DRV_FocusOut( HWND hwnd, XEvent *xev )
/* don't reset the foreground window, if the window which is
getting the focus is a Wine window */
wine_tsx11_lock();
XGetInputFocus( event->display, &focus_win, &revert );
if (focus_win)
{
if (XFindContext( event->display, focus_win, winContext, (char **)&hwnd_tmp ) != 0)
focus_win = 0;
}
wine_tsx11_unlock();
if (!focus_win)
{
......@@ -1004,10 +987,8 @@ void X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev )
if (!root_coords && parent == GetDesktopWindow()) /* normal event, map coordinates to the root */
{
Window child;
wine_tsx11_lock();
XTranslateCoordinates( event->display, event->window, root_window,
0, 0, &x, &y, &child );
wine_tsx11_unlock();
root_coords = TRUE;
}
rect.left = x;
......@@ -1326,12 +1307,10 @@ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event )
Window win, w_aux_root, w_aux_child;
win = X11DRV_get_whole_window(hWnd);
wine_tsx11_lock();
XQueryPointer( event->display, win, &w_aux_root, &w_aux_child,
&x, &y, &dummy, &dummy, (unsigned int*)&aux_long);
x += virtual_screen_rect.left;
y += virtual_screen_rect.top;
wine_tsx11_unlock();
if (!(data = X11DRV_get_win_data( hWnd ))) return;
......@@ -1362,12 +1341,10 @@ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event )
if (!bAccept) return;
wine_tsx11_lock();
XGetWindowProperty( event->display, DefaultRootWindow(event->display),
x11drv_atom(DndSelection), 0, 65535, FALSE,
AnyPropertyType, &atom_aux, &dummy,
&data_length, &aux_long, &p_data);
wine_tsx11_unlock();
if( !aux_long && p_data) /* don't bother if > 64K */
{
......@@ -1410,9 +1387,7 @@ static void EVENT_DropFromOffiX( HWND hWnd, XClientMessageEvent *event )
}
}
}
wine_tsx11_lock();
if( p_data ) XFree(p_data);
wine_tsx11_unlock();
}
/**********************************************************************
......@@ -1443,12 +1418,10 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event )
if (!(GetWindowLongW( hWnd, GWL_EXSTYLE ) & WS_EX_ACCEPTFILES)) return;
wine_tsx11_lock();
XGetWindowProperty( event->display, DefaultRootWindow(event->display),
x11drv_atom(DndSelection), 0, 65535, FALSE,
AnyPropertyType, &u.atom_aux, &u.i,
&data_length, &aux_long, &p_data);
wine_tsx11_unlock();
if (aux_long)
WARN("property too large, truncated!\n");
TRACE("urls=%s\n", p_data);
......@@ -1473,12 +1446,10 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event )
}
if( drop_len && drop_len < 65535 ) {
wine_tsx11_lock();
XQueryPointer( event->display, root_window, &u.w_aux, &u.w_aux,
&x, &y, &u.i, &u.i, &u.u);
x += virtual_screen_rect.left;
y += virtual_screen_rect.top;
wine_tsx11_unlock();
drop_len += sizeof(DROPFILES) + 1;
hDrop = GlobalAlloc( GMEM_SHARE, drop_len );
......@@ -1529,9 +1500,7 @@ static void EVENT_DropURLs( HWND hWnd, XClientMessageEvent *event )
PostMessageA( hWnd, WM_DROPFILES, (WPARAM)hDrop, 0L );
}
}
wine_tsx11_lock();
if( p_data ) XFree(p_data);
wine_tsx11_unlock();
}
}
......@@ -1569,11 +1538,9 @@ static void handle_dnd_protocol( HWND hwnd, XClientMessageEvent *event )
unsigned int u;
/* query window (drag&drop event contains only drag window) */
wine_tsx11_lock();
XQueryPointer( event->display, root_window, &root, &child,
&root_x, &root_y, &child_x, &child_y, &u);
if (XFindContext( event->display, child, winContext, (char **)&hwnd ) != 0) hwnd = 0;
wine_tsx11_unlock();
if (!hwnd) return;
if (event->data.l[0] == DndFile || event->data.l[0] == DndFiles)
EVENT_DropFromOffiX(hwnd, event);
......
......@@ -92,9 +92,7 @@ static void device_init(void)
palette_size = X11DRV_PALETTE_Init();
wine_tsx11_lock();
stock_bitmap_pixmap = XCreatePixmap( gdi_display, root_window, 1, 1, 1 );
wine_tsx11_unlock();
/* Initialize device caps */
log_pixels_x = log_pixels_y = get_dpi();
......@@ -121,13 +119,11 @@ static X11DRV_PDEVICE *create_x11_physdev( Drawable drawable )
if (!(physDev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*physDev) ))) return NULL;
wine_tsx11_lock();
physDev->drawable = drawable;
physDev->gc = XCreateGC( gdi_display, drawable, 0, NULL );
XSetGraphicsExposures( gdi_display, physDev->gc, False );
XSetSubwindowMode( gdi_display, physDev->gc, IncludeInferiors );
XFlush( gdi_display );
wine_tsx11_unlock();
return physDev;
}
......@@ -180,9 +176,7 @@ static BOOL X11DRV_DeleteDC( PHYSDEV dev )
{
X11DRV_PDEVICE *physDev = get_x11drv_dev( dev );
wine_tsx11_lock();
XFreeGC( gdi_display, physDev->gc );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, physDev );
return TRUE;
}
......@@ -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;
physDev->dc_rect = data->dc_rect;
physDev->drawable = data->drawable;
wine_tsx11_lock();
XSetSubwindowMode( gdi_display, physDev->gc, data->mode );
wine_tsx11_unlock();
TRACE( "SET_DRAWABLE hdc %p drawable %lx dc_rect %s\n",
dev->hdc, physDev->drawable, wine_dbgstr_rect(&physDev->dc_rect) );
return TRUE;
......@@ -367,9 +359,7 @@ static INT X11DRV_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID in_d
}
break;
case X11DRV_START_EXPOSURES:
wine_tsx11_lock();
XSetGraphicsExposures( gdi_display, physDev->gc, True );
wine_tsx11_unlock();
physDev->exposures = 0;
return TRUE;
case X11DRV_END_EXPOSURES:
......@@ -377,18 +367,14 @@ static INT X11DRV_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID in_d
{
HRGN hrgn = 0, tmp = 0;
wine_tsx11_lock();
XSetGraphicsExposures( gdi_display, physDev->gc, False );
wine_tsx11_unlock();
if (physDev->exposures)
{
for (;;)
{
XEvent event;
wine_tsx11_lock();
XWindowEvent( gdi_display, physDev->drawable, ~0, &event );
wine_tsx11_unlock();
if (event.type == NoExpose) break;
if (event.type == GraphicsExpose)
{
......
......@@ -1388,9 +1388,7 @@ void X11DRV_KeyEvent( HWND hwnd, XEvent *xev )
if (TRACE_ON(key)){
const char *ksname;
wine_tsx11_lock();
ksname = XKeysymToString(keysym);
wine_tsx11_unlock();
if (!ksname)
ksname = "No Name";
TRACE_(key)("%s : keysym=%lx (%s), # of chars=%d / %s\n",
......@@ -1994,9 +1992,7 @@ void X11DRV_MappingNotify( HWND dummy, XEvent *event )
{
HWND hwnd;
wine_tsx11_lock();
XRefreshKeyboardMapping(&event->xmapping);
wine_tsx11_unlock();
X11DRV_InitKeyboard( event->xmapping.display );
hwnd = GetFocus();
......@@ -2606,9 +2602,7 @@ INT CDECL X11DRV_ToUnicodeEx(UINT virtKey, UINT scanCode, const BYTE *lpKeyState
{
const char *ksname;
wine_tsx11_lock();
ksname = XKeysymToString(keysym);
wine_tsx11_unlock();
if (!ksname) ksname = "No Name";
TRACE_(key)("%s : keysym=%lx (%s), # of chars=%d / %s\n",
(e.type == KeyPress) ? "KeyPress" : "KeyRelease",
......@@ -2662,9 +2656,7 @@ INT CDECL X11DRV_ToUnicodeEx(UINT virtKey, UINT scanCode, const BYTE *lpKeyState
{
const char *ksname;
wine_tsx11_lock();
ksname = XKeysymToString(keysym);
wine_tsx11_unlock();
if (!ksname)
ksname = "No Name";
if ((keysym >> 8) != 0xff)
......@@ -2753,7 +2745,5 @@ found:
*/
void CDECL X11DRV_Beep(void)
{
wine_tsx11_lock();
XBell(gdi_display, 0);
wine_tsx11_unlock();
}
......@@ -266,14 +266,12 @@ static void enable_xinput2(void)
if (data->xi2_state == xi_unknown)
{
int major = 2, minor = 0;
wine_tsx11_lock();
if (!pXIQueryVersion( data->display, &major, &minor )) data->xi2_state = xi_disabled;
else
{
data->xi2_state = xi_unavailable;
WARN( "X Input 2 not available\n" );
}
wine_tsx11_unlock();
}
if (data->xi2_state == xi_unavailable) return;
......@@ -441,9 +439,7 @@ void ungrab_clipping_window(void)
if (!clip_window) return;
TRACE( "no longer clipping\n" );
wine_tsx11_lock();
XUnmapWindow( display, clip_window );
wine_tsx11_unlock();
clipping_cursor = 0;
SendMessageW( GetDesktopWindow(), WM_X11DRV_CLIP_CURSOR, 0, 0 );
}
......@@ -637,13 +633,11 @@ static XcursorImage *create_xcursor_frame( HDC hdc, const ICONINFOEXW *iinfo, HA
int x, y, i, has_alpha = FALSE;
XcursorPixel *ptr;
wine_tsx11_lock();
image = pXcursorImageCreate( width, height );
wine_tsx11_unlock();
if (!image)
{
ERR("X11 failed to produce a cursor frame!\n");
goto cleanup;
return NULL;
}
image->xhot = iinfo->xHotspot;
......@@ -768,9 +762,7 @@ static Cursor create_xcursor_cursor( HDC hdc, const ICONINFOEXW *iinfo, HANDLE i
if (!(images = pXcursorImagesCreate( nFrames ))) goto cleanup;
for (images->nimage = 0; images->nimage < nFrames; images->nimage++)
images->images[images->nimage] = imgs[images->nimage];
wine_tsx11_lock();
cursor = pXcursorImagesLoadCursor( gdi_display, images );
wine_tsx11_unlock();
pXcursorImagesDestroy( images ); /* Note: this frees each individual frame (calls XcursorImageDestroy) */
HeapFree( GetProcessHeap(), 0, imgs );
imgs = NULL;
......@@ -922,9 +914,7 @@ static Cursor create_xcursor_system_cursor( const ICONINFOEXW *info )
done:
if (valueA[0])
{
wine_tsx11_lock();
cursor = pXcursorLibraryLoadCursor( gdi_display, valueA );
wine_tsx11_unlock();
if (!cursor) WARN( "no system cursor found for %s mapped to %s\n",
debugstr_w(name), debugstr_a(valueA) );
}
......@@ -1255,13 +1245,11 @@ BOOL CDECL X11DRV_SetCursorPos( INT x, INT y )
{
struct x11drv_thread_data *data = x11drv_init_thread_data();
wine_tsx11_lock();
XWarpPointer( data->display, root_window, root_window, 0, 0, 0, 0,
x - virtual_screen_rect.left, y - virtual_screen_rect.top );
data->warp_serial = NextRequest( data->display );
XNoOp( data->display );
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 );
return TRUE;
}
......@@ -1344,7 +1332,7 @@ BOOL CDECL X11DRV_ClipCursor( LPCRECT clip )
void move_resize_window( Display *display, struct x11drv_win_data *data, int dir )
{
DWORD pt;
int x, y, rootX, rootY, ret, button = 0;
int x, y, rootX, rootY, button = 0;
XEvent xev;
Window root, child;
unsigned int xstate;
......@@ -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
* with a ButtonPress event */
wine_tsx11_lock();
XUngrabPointer( display, CurrentTime );
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 */
/* (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
MSG msg;
INPUT input;
wine_tsx11_lock();
ret = XQueryPointer( display, root_window, &root, &child, &rootX, &rootY, &x, &y, &xstate );
wine_tsx11_unlock();
if (!ret) break;
if (!XQueryPointer( display, root_window, &root, &child, &rootX, &rootY, &x, &y, &xstate )) break;
if (!(xstate & (Button1Mask << (button - 1))))
{
......@@ -1620,9 +1603,7 @@ void X11DRV_XInput2_Init(void)
LOAD_FUNCPTR(XISelectEvents);
#undef LOAD_FUNCPTR
wine_tsx11_lock();
xinput2_available = XQueryExtension( gdi_display, "XInputExtension", &xinput2_opcode, &event, &error );
wine_tsx11_unlock();
#else
TRACE( "X Input 2 support not compiled in.\n" );
#endif
......
......@@ -1368,9 +1368,7 @@ static BOOL glxdrv_wglSetPixelFormat( HDC hdc, int iPixelFormat, const PIXELFORM
return FALSE;
}
wine_tsx11_lock();
pglXGetFBConfigAttrib(gdi_display, fmt->fbconfig, GLX_DRAWABLE_TYPE, &value);
wine_tsx11_unlock();
hwnd = WindowFromDC( hdc );
if(hwnd) {
......@@ -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);
wine_tsx11_lock();
pglXCopyContext(gdi_display, src->ctx, dst->ctx, mask);
wine_tsx11_unlock();
/* As opposed to wglCopyContext, glXCopyContext doesn't return anything, so hopefully we passed */
return TRUE;
......@@ -1504,9 +1500,7 @@ static BOOL glxdrv_wglMakeCurrent(HDC hdc, struct wgl_context *ctx)
if (!ctx)
{
wine_tsx11_lock();
ret = pglXMakeCurrent(gdi_display, None, NULL);
wine_tsx11_unlock();
pglXMakeCurrent(gdi_display, None, NULL);
NtCurrentTeb()->glContext = NULL;
return TRUE;
}
......@@ -1573,9 +1567,7 @@ static BOOL X11DRV_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, struct
if (!ctx)
{
wine_tsx11_lock();
ret = pglXMakeCurrent(gdi_display, None, NULL);
wine_tsx11_unlock();
pglXMakeCurrent(gdi_display, None, NULL);
NtCurrentTeb()->glContext = NULL;
return TRUE;
}
......@@ -1651,14 +1643,12 @@ static BOOL glxdrv_wglShareLists(struct wgl_context *org, struct wgl_context *de
}
else
{
wine_tsx11_lock();
describeContext(org);
describeContext(dest);
/* Re-create the GLX context and share display lists */
pglXDestroyContext(gdi_display, dest->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);
org->sharing = TRUE;
......@@ -1685,12 +1675,10 @@ static void flush_gl_drawable( struct glx_physdev *physdev )
case DC_GL_CHILD_WIN:
/* 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 */
wine_tsx11_lock();
XFlush(gdi_display);
XSetFunction(gdi_display, physdev->x11dev->gc, GXcopy);
XCopyArea(gdi_display, src, physdev->x11dev->drawable, physdev->x11dev->gc, 0, 0, w, h,
physdev->x11dev->dc_rect.left, physdev->x11dev->dc_rect.top);
wine_tsx11_unlock();
SetRect( &rect, 0, 0, w, h );
add_device_bounds( physdev->x11dev, &rect );
default:
......@@ -1997,9 +1985,7 @@ static struct wgl_pbuffer *X11DRV_wglCreatePbufferARB( HDC hdc, int iPixelFormat
}
PUSH1(attribs, None);
wine_tsx11_lock();
object->drawable = pglXCreatePbuffer(gdi_display, fmt->fbconfig, attribs);
wine_tsx11_unlock();
TRACE("new Pbuffer drawable as %lx\n", object->drawable);
if (!object->drawable) {
SetLastError(ERROR_NO_SYSTEM_RESOURCES);
......@@ -2023,9 +2009,7 @@ static BOOL X11DRV_wglDestroyPbufferARB( struct wgl_pbuffer *object )
{
TRACE("(%p)\n", object);
wine_tsx11_lock();
pglXDestroyPbuffer(gdi_display, object->drawable);
wine_tsx11_unlock();
HeapFree(GetProcessHeap(), 0, object);
return GL_TRUE;
}
......@@ -2068,14 +2052,10 @@ static BOOL X11DRV_wglQueryPbufferARB( struct wgl_pbuffer *object, int iAttribut
switch (iAttribute) {
case WGL_PBUFFER_WIDTH_ARB:
wine_tsx11_lock();
pglXQueryDrawable(gdi_display, object->drawable, GLX_WIDTH, (unsigned int*) piValue);
wine_tsx11_unlock();
break;
case WGL_PBUFFER_HEIGHT_ARB:
wine_tsx11_lock();
pglXQueryDrawable(gdi_display, object->drawable, GLX_HEIGHT, (unsigned int*) piValue);
wine_tsx11_unlock();
break;
case WGL_PBUFFER_LOST_ARB:
......@@ -2706,11 +2686,7 @@ static BOOL X11DRV_wglSwapIntervalEXT(int interval)
else
{
if (pglXSwapIntervalSGI)
{
wine_tsx11_lock();
ret = !pglXSwapIntervalSGI(interval);
wine_tsx11_unlock();
}
else
WARN("GLX_SGI_swap_control extension is not available\n");
......@@ -2751,10 +2727,7 @@ static BOOL X11DRV_wglSetPixelFormatWINE(HDC hdc, int format)
return FALSE;
}
wine_tsx11_lock();
pglXGetFBConfigAttrib(gdi_display, fmt->fbconfig, GLX_DRAWABLE_TYPE, &value);
wine_tsx11_unlock();
if (!(value & GLX_WINDOW_BIT))
{
WARN( "Pixel format %d is not compatible for window rendering\n", format );
......@@ -2900,9 +2873,7 @@ static void X11DRV_WineGL_LoadExtensions(void)
BOOL destroy_glxpixmap(Display *display, XID glxpixmap)
{
wine_tsx11_lock();
pglXDestroyGLXPixmap(display, glxpixmap);
wine_tsx11_unlock();
return TRUE;
}
......@@ -2983,16 +2954,12 @@ static BOOL glxdrv_SwapBuffers(PHYSDEV dev)
XVisualInfo *visual_from_fbconfig_id( XID fbconfig_id )
{
WineGLPixelFormat *fmt;
XVisualInfo *ret;
fmt = ConvertPixelFormatGLXtoWGL(gdi_display, fbconfig_id, 0 /* no flags */);
if(fmt == NULL)
return NULL;
wine_tsx11_lock();
ret = pglXGetVisualFromFBConfig(gdi_display, fmt->fbconfig);
wine_tsx11_unlock();
return ret;
return pglXGetVisualFromFBConfig(gdi_display, fmt->fbconfig);
}
static BOOL create_glx_dc( PHYSDEV *pdev )
......
......@@ -114,9 +114,7 @@ static int *palette_get_mapping( HPALETTE hpal )
{
int *mapping;
wine_tsx11_lock();
if (XFindContext( gdi_display, (XID)hpal, palette_context, (char **)&mapping )) mapping = NULL;
wine_tsx11_unlock();
return mapping;
}
......@@ -126,9 +124,7 @@ static int *palette_get_mapping( HPALETTE hpal )
*/
static void palette_set_mapping( HPALETTE hpal, int *mapping )
{
wine_tsx11_lock();
XSaveContext( gdi_display, (XID)hpal, palette_context, (char *)mapping );
wine_tsx11_unlock();
}
......@@ -146,9 +142,7 @@ int X11DRV_PALETTE_Init(void)
TRACE("initializing palette manager...\n");
wine_tsx11_lock();
palette_context = XUniqueContext();
wine_tsx11_unlock();
white = WhitePixel( gdi_display, DefaultScreen(gdi_display) );
black = BlackPixel( gdi_display, DefaultScreen(gdi_display) );
monoPlane = 1;
......@@ -192,12 +186,10 @@ int X11DRV_PALETTE_Init(void)
break;
case StaticGray:
wine_tsx11_lock();
X11DRV_PALETTE_PaletteXColormap = XCreateColormap(gdi_display, root_window,
visual, AllocNone);
X11DRV_PALETTE_PaletteFlags |= X11DRV_PALETTE_FIXED;
X11DRV_PALETTE_Graymax = (1 << screen_depth)-1;
wine_tsx11_unlock();
break;
case TrueColor:
......@@ -269,11 +261,9 @@ void X11DRV_PALETTE_Cleanup(void)
{
if( COLOR_gapFilled )
{
wine_tsx11_lock();
XFreeColors(gdi_display, X11DRV_PALETTE_PaletteXColormap,
(unsigned long*)(X11DRV_PALETTE_PaletteToXPixel + COLOR_gapStart),
COLOR_gapFilled, 0);
wine_tsx11_unlock();
}
DeleteCriticalSection(&palette_cs);
}
......@@ -834,10 +824,8 @@ COLORREF X11DRV_PALETTE_ToLogical(X11DRV_PDEVICE *physDev, int pixel)
return ret;
}
wine_tsx11_lock();
color.pixel = pixel;
XQueryColor(gdi_display, X11DRV_PALETTE_PaletteXColormap, &color);
wine_tsx11_unlock();
return RGB(color.red >> 8, color.green >> 8, color.blue >> 8);
}
......@@ -1251,9 +1239,7 @@ UINT X11DRV_RealizePalette( PHYSDEV dev, HPALETTE hpal, BOOL primary )
color.green = entries[i].peGreen << 8;
color.blue = entries[i].peBlue << 8;
color.flags = DoRed | DoGreen | DoBlue;
wine_tsx11_lock();
XStoreColor(gdi_display, X11DRV_PALETTE_PaletteXColormap, &color);
wine_tsx11_unlock();
COLOR_sysPal[index] = entries[i];
COLOR_sysPal[index].peFlags = flag;
......@@ -1295,9 +1281,7 @@ BOOL X11DRV_UnrealizePalette( HPALETTE hpal )
if (mapping)
{
wine_tsx11_lock();
XDeleteContext( gdi_display, (XID)hpal, palette_context );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, mapping );
}
return TRUE;
......
......@@ -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 */
static Window get_systray_selection_owner( Display *display )
{
Window ret;
wine_tsx11_lock();
ret = XGetSelectionOwner( display, systray_atom );
wine_tsx11_unlock();
return ret;
return XGetSelectionOwner( display, systray_atom );
}
static BOOL init_systray(void)
......@@ -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[3] = 0;
ev.xclient.data.l[4] = 0;
wine_tsx11_lock();
XSendEvent( display, systray_window, False, NoEventMask, &ev );
attr.background_pixmap = ParentRelative;
attr.bit_gravity = ForgetGravity;
XChangeWindowAttributes( display, data->whole_window, CWBackPixmap | CWBitGravity, &attr );
XChangeWindowAttributes( display, data->client_window, CWBackPixmap | CWBitGravity, &attr );
wine_tsx11_unlock();
}
/* dock systray windows again with the new owner */
......
......@@ -603,11 +603,9 @@ static void thread_detach(void)
if (data)
{
X11DRV_ResetSelectionOwner();
wine_tsx11_lock();
if (data->xim) XCloseIM( data->xim );
if (data->font_set) XFreeFontSet( data->display, data->font_set );
XCloseDisplay( data->display );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, data );
}
}
......@@ -730,9 +728,7 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
BOOL CDECL X11DRV_GetScreenSaveActive(void)
{
int timeout, temp;
wine_tsx11_lock();
XGetScreenSaver(gdi_display, &timeout, &temp, &temp, &temp);
wine_tsx11_unlock();
return timeout != 0;
}
......
......@@ -230,11 +230,9 @@ void X11DRV_XDND_EnterEvent( HWND hWnd, XClientMessageEvent *event )
unsigned long bytesret;
/* Request supported formats from source window */
wine_tsx11_lock();
XGetWindowProperty(event->display, event->data.l[0], x11drv_atom(XdndTypeList),
0, 65535, FALSE, AnyPropertyType, &acttype, &actfmt, &count,
&bytesret, (unsigned char**)&xdndtypes);
wine_tsx11_unlock();
}
else
{
......@@ -374,9 +372,7 @@ void X11DRV_XDND_PositionEvent( HWND hWnd, XClientMessageEvent *event )
e.data.l[4] = X11DRV_XDND_DROPEFFECTToXdndAction(effect);
else
e.data.l[4] = None;
wine_tsx11_lock();
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 )
e.message_type = x11drv_atom(XdndFinished);
e.format = 32;
e.data.l[0] = event->window;
wine_tsx11_lock();
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,
if (types[i] == 0)
continue;
wine_tsx11_lock();
XConvertSelection(display, x11drv_atom(XdndSelection), types[i],
x11drv_atom(XdndTarget), xwin, /*tm*/CurrentTime);
wine_tsx11_unlock();
/*
* Wait for SelectionNotify
*/
for (j = 0; j < SELECTION_RETRIES; j++)
{
wine_tsx11_lock();
res = XCheckTypedWindowEvent(display, xwin, SelectionNotify, &xe);
wine_tsx11_unlock();
if (res && xe.xselection.selection == x11drv_atom(XdndSelection)) break;
usleep(SELECTION_WAIT);
......@@ -510,15 +500,11 @@ static void X11DRV_XDND_ResolveProperty(Display *display, Window xwin, Time tm,
if (xe.xselection.property == None)
continue;
wine_tsx11_lock();
XGetWindowProperty(display, xwin, x11drv_atom(XdndTarget), 0, 65535, FALSE,
AnyPropertyType, &acttype, &actfmt, &icount, &bytesret, &data);
wine_tsx11_unlock();
entries += X11DRV_XDND_MapFormat(types[i], data, get_property_size( actfmt, icount ));
wine_tsx11_lock();
XFree(data);
wine_tsx11_unlock();
}
/* On Windows when there is a CF_HDROP, there are no other CF_ formats.
......
......@@ -116,9 +116,7 @@ static int X11DRV_XF86VM_GetCurrentMode(void)
DWORD dwBpp = screen_bpp;
TRACE("Querying XVidMode current mode\n");
wine_tsx11_lock();
pXF86VidModeGetModeLine(gdi_display, DefaultScreen(gdi_display), &dotclock, &line);
wine_tsx11_unlock();
convert_modeline(dotclock, &line, &cmode, dwBpp);
for (i=0; i<dd_mode_count; i++)
if (memcmp(&dd_modes[i], &cmode, sizeof(cmode)) == 0) {
......@@ -194,10 +192,7 @@ void X11DRV_XF86VM_Init(void)
#undef LOAD_FUNCPTR
/* see if XVidMode is available */
wine_tsx11_lock();
ok = pXF86VidModeQueryExtension(gdi_display, &xf86vm_event, &xf86vm_error);
wine_tsx11_unlock();
if (!ok) return;
if (!pXF86VidModeQueryExtension(gdi_display, &xf86vm_event, &xf86vm_error)) return;
X11DRV_expect_error(gdi_display, XVidModeErrorHandler, NULL);
ok = pXF86VidModeQueryVersion(gdi_display, &xf86vm_major, &xf86vm_minor);
......@@ -255,9 +250,7 @@ sym_not_found:
void X11DRV_XF86VM_Cleanup(void)
{
wine_tsx11_lock();
if (real_xf86vm_modes) XFree(real_xf86vm_modes);
wine_tsx11_unlock();
}
/***** GAMMA CONTROL *****/
......@@ -353,31 +346,19 @@ static BOOL X11DRV_XF86VM_GetGammaRamp(LPDDGAMMARAMP ramp)
{
#ifdef X_XF86VidModeSetGamma
XF86VidModeGamma gamma;
Bool ret;
if (xf86vm_major < 2) return FALSE; /* no gamma control */
#ifdef X_XF86VidModeSetGammaRamp
else if (xf86vm_use_gammaramp)
{
Bool ret;
wine_tsx11_lock();
ret = pXF86VidModeGetGammaRamp(gdi_display, DefaultScreen(gdi_display), 256,
ramp->red, ramp->green, ramp->blue);
wine_tsx11_unlock();
return ret;
}
if (xf86vm_use_gammaramp)
return pXF86VidModeGetGammaRamp(gdi_display, DefaultScreen(gdi_display), 256,
ramp->red, ramp->green, ramp->blue);
#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->green, gamma.green);
GenerateRampFromGamma(ramp->blue, gamma.blue);
return TRUE;
}
GenerateRampFromGamma(ramp->red, gamma.red);
GenerateRampFromGamma(ramp->green, gamma.green);
GenerateRampFromGamma(ramp->blue, gamma.blue);
return TRUE;
}
#endif /* X_XF86VidModeSetGamma */
return FALSE;
......@@ -385,7 +366,6 @@ static BOOL X11DRV_XF86VM_GetGammaRamp(LPDDGAMMARAMP ramp)
static BOOL X11DRV_XF86VM_SetGammaRamp(LPDDGAMMARAMP ramp)
{
Bool ret = FALSE;
#ifdef X_XF86VidModeSetGamma
XF86VidModeGamma gamma;
......@@ -393,17 +373,15 @@ static BOOL X11DRV_XF86VM_SetGammaRamp(LPDDGAMMARAMP ramp)
if (!ComputeGammaFromRamp(ramp->red, &gamma.red) || /* ramp validation */
!ComputeGammaFromRamp(ramp->green, &gamma.green) ||
!ComputeGammaFromRamp(ramp->blue, &gamma.blue)) return FALSE;
wine_tsx11_lock();
#ifdef X_XF86VidModeSetGammaRamp
if (xf86vm_use_gammaramp)
ret = pXF86VidModeSetGammaRamp(gdi_display, DefaultScreen(gdi_display), 256,
ramp->red, ramp->green, ramp->blue);
else
return pXF86VidModeSetGammaRamp(gdi_display, DefaultScreen(gdi_display), 256,
ramp->red, ramp->green, ramp->blue);
#endif
ret = pXF86VidModeSetGamma(gdi_display, DefaultScreen(gdi_display), &gamma);
wine_tsx11_unlock();
return pXF86VidModeSetGamma(gdi_display, DefaultScreen(gdi_display), &gamma);
#else
return FALSE;
#endif /* X_XF86VidModeSetGamma */
return ret;
}
#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