winex11: Remove X11 locking around simple X calls.

This commit is contained in:
Alexandre Julliard 2012-08-14 13:38:03 +02:00
parent 8fdb55cf5c
commit 6bfcb347bf
17 changed files with 40 additions and 523 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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();
}
}

View File

@ -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;

View File

@ -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);

View File

@ -247,16 +247,12 @@ static void update_x11_clipping( X11DRV_PDEVICE *physDev, HRGN rgn )
if (!rgn)
{
wine_tsx11_lock();
XSetClipMask( gdi_display, physDev->gc, None );
wine_tsx11_unlock();
}
else if ((data = X11DRV_GetRegionData( rgn, 0 )))
{
wine_tsx11_lock();
XSetClipRectangles( gdi_display, physDev->gc, physDev->dc_rect.left, physDev->dc_rect.top,
(XRectangle *)data->Buffer, data->rdh.nCount, YXBanded );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, data );
}
}
@ -393,13 +389,11 @@ BOOL X11DRV_SetupGCForPatBlt( X11DRV_PDEVICE *physDev, GC gc, BOOL fMapColors )
val.ts_x_origin = physDev->dc_rect.left + pt.x;
val.ts_y_origin = physDev->dc_rect.top + pt.y;
val.fill_rule = (GetPolyFillMode(physDev->dev.hdc) == WINDING) ? WindingRule : EvenOddRule;
wine_tsx11_lock();
XChangeGC( gdi_display, gc,
GCFunction | GCForeground | GCBackground | GCFillStyle |
GCFillRule | GCTileStipXOrigin | GCTileStipYOrigin | mask,
&val );
if (pixmap) XFreePixmap( gdi_display, pixmap );
wine_tsx11_unlock();
return TRUE;
}
@ -490,13 +484,11 @@ static BOOL X11DRV_SetupGCForPen( X11DRV_PDEVICE *physDev )
else
val.line_style = LineSolid;
wine_tsx11_lock();
if (physDev->pen.dash_len)
XSetDashes( gdi_display, physDev->gc, 0, physDev->pen.dashes, physDev->pen.dash_len );
XChangeGC( gdi_display, physDev->gc,
GCFunction | GCForeground | GCBackground | GCLineWidth |
GCLineStyle | GCCapStyle | GCJoinStyle | GCFillStyle, &val );
wine_tsx11_unlock();
return TRUE;
}
@ -550,13 +542,9 @@ BOOL X11DRV_LineTo( PHYSDEV dev, INT x, INT y )
add_pen_device_bounds( physDev, pt, 2 );
if (X11DRV_SetupGCForPen( physDev ))
{
wine_tsx11_lock();
XDrawLine(gdi_display, physDev->drawable, physDev->gc,
physDev->dc_rect.left + pt[0].x, physDev->dc_rect.top + pt[0].y,
physDev->dc_rect.left + pt[1].x, physDev->dc_rect.top + pt[1].y );
wine_tsx11_unlock();
}
return TRUE;
}
@ -633,12 +621,10 @@ static BOOL X11DRV_DrawArc( PHYSDEV dev, INT left, INT top, INT right, INT botto
/* Fill arc with brush if Chord() or Pie() */
if ((lines > 0) && X11DRV_SetupGCForBrush( physDev )) {
wine_tsx11_lock();
XSetArcMode( gdi_display, physDev->gc, (lines==1) ? ArcChord : ArcPieSlice);
XFillArc( gdi_display, physDev->drawable, physDev->gc,
physDev->dc_rect.left + rc.left, physDev->dc_rect.top + rc.top,
rc.right-rc.left-1, rc.bottom-rc.top-1, istart_angle, idiff_angle );
wine_tsx11_unlock();
}
/* Draw arc and lines */
@ -771,21 +757,14 @@ BOOL X11DRV_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
physDev->pen.width = width;
if (X11DRV_SetupGCForBrush( physDev ))
{
wine_tsx11_lock();
XFillArc( gdi_display, physDev->drawable, physDev->gc,
physDev->dc_rect.left + rc.left, physDev->dc_rect.top + rc.top,
rc.right-rc.left-1, rc.bottom-rc.top-1, 0, 360*64 );
wine_tsx11_unlock();
}
if (X11DRV_SetupGCForPen( physDev ))
{
wine_tsx11_lock();
XDrawArc( gdi_display, physDev->drawable, physDev->gc,
physDev->dc_rect.left + rc.left, physDev->dc_rect.top + rc.top,
rc.right-rc.left-1, rc.bottom-rc.top-1, 0, 360*64 );
wine_tsx11_unlock();
}
physDev->pen.width = oldwidth;
add_pen_device_bounds( physDev, (POINT *)&rc, 2 );
@ -830,23 +809,15 @@ BOOL X11DRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT bottom)
if ((rc.right >= rc.left + width) && (rc.bottom >= rc.top + width))
{
if (X11DRV_SetupGCForBrush( physDev ))
{
wine_tsx11_lock();
XFillRectangle( gdi_display, physDev->drawable, physDev->gc,
physDev->dc_rect.left + rc.left + (width + 1) / 2,
physDev->dc_rect.top + rc.top + (width + 1) / 2,
rc.right-rc.left-width, rc.bottom-rc.top-width);
wine_tsx11_unlock();
}
}
if (X11DRV_SetupGCForPen( physDev ))
{
wine_tsx11_lock();
XDrawRectangle( gdi_display, physDev->drawable, physDev->gc,
physDev->dc_rect.left + rc.left, physDev->dc_rect.top + rc.top,
rc.right-rc.left, rc.bottom-rc.top );
wine_tsx11_unlock();
}
physDev->pen.width = oldwidth;
physDev->pen.linejoin = oldjoinstyle;
@ -1064,12 +1035,10 @@ COLORREF X11DRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color )
LPtoDP( dev->hdc, &pt, 1 );
pixel = X11DRV_PALETTE_ToPhysical( physDev, color );
wine_tsx11_lock();
XSetForeground( gdi_display, physDev->gc, pixel );
XSetFunction( gdi_display, physDev->gc, GXcopy );
XDrawPoint( gdi_display, physDev->drawable, physDev->gc,
physDev->dc_rect.left + pt.x, physDev->dc_rect.top + pt.y );
wine_tsx11_unlock();
SetRect( &rect, pt.x, pt.y, pt.x + 1, pt.y + 1 );
add_device_bounds( physDev, &rect );
@ -1099,9 +1068,7 @@ BOOL X11DRV_PaintRgn( PHYSDEV dev, HRGN hrgn )
rect[i].y += physDev->dc_rect.top;
}
wine_tsx11_lock();
XFillRectangles( gdi_display, physDev->drawable, physDev->gc, rect, data->rdh.nCount );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, data );
}
if (GetRgnBox( hrgn, &rc ))
@ -1141,19 +1108,12 @@ BOOL X11DRV_Polygon( PHYSDEV dev, const POINT* pt, INT count )
xpoints[count] = xpoints[0];
if (X11DRV_SetupGCForBrush( physDev ))
{
wine_tsx11_lock();
XFillPolygon( gdi_display, physDev->drawable, physDev->gc,
xpoints, count+1, Complex, CoordModeOrigin);
wine_tsx11_unlock();
}
if (X11DRV_SetupGCForPen ( physDev ))
{
wine_tsx11_lock();
XDrawLines( gdi_display, physDev->drawable, physDev->gc,
xpoints, count+1, CoordModeOrigin );
wine_tsx11_unlock();
}
HeapFree( GetProcessHeap(), 0, xpoints );
HeapFree( GetProcessHeap(), 0, points );
@ -1199,9 +1159,7 @@ BOOL X11DRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts, UINT p
rect[i].y += physDev->dc_rect.top;
}
wine_tsx11_lock();
XFillRectangles( gdi_display, physDev->drawable, physDev->gc, rect, data->rdh.nCount );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, data );
}
@ -1219,9 +1177,7 @@ BOOL X11DRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts, UINT p
xpoints[j].y = physDev->dc_rect.top + points[pos + j].y;
}
xpoints[j] = xpoints[0];
wine_tsx11_lock();
XDrawLines( gdi_display, physDev->drawable, physDev->gc, xpoints, j + 1, CoordModeOrigin );
wine_tsx11_unlock();
}
HeapFree( GetProcessHeap(), 0, xpoints );
}
@ -1271,9 +1227,7 @@ BOOL X11DRV_PolyPolyline( PHYSDEV dev, const POINT* pt, const DWORD* counts, DWO
xpoints[j].x = physDev->dc_rect.left + points[pos + j].x;
xpoints[j].y = physDev->dc_rect.top + points[pos + j].y;
}
wine_tsx11_lock();
XDrawLines( gdi_display, physDev->drawable, physDev->gc, xpoints, j, CoordModeOrigin );
wine_tsx11_unlock();
}
HeapFree( GetProcessHeap(), 0, xpoints );
}
@ -1408,22 +1362,18 @@ BOOL X11DRV_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT fillTy
reset_bounds( &bounds );
wine_tsx11_lock();
X11DRV_InternalFloodFill(image, physDev,
pt.x - rect.left,
pt.y - rect.top,
physDev->dc_rect.left + rect.left,
physDev->dc_rect.top + rect.top,
pixel, fillType, &bounds );
wine_tsx11_unlock();
OffsetRect( &bounds, rect.left, rect.top );
add_device_bounds( physDev, &bounds );
}
wine_tsx11_lock();
XDestroyImage( image );
wine_tsx11_unlock();
return TRUE;
}
@ -1452,10 +1402,8 @@ BOOL X11DRV_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
val.line_width = 1;
val.cap_style = CapNotLast;
val.line_style = LineSolid;
wine_tsx11_lock();
XChangeGC( gdi_display, physdev->gc,
GCFunction | GCLineWidth | GCLineStyle | GCCapStyle | GCFillStyle, &val );
wine_tsx11_unlock();
reset_bounds( &bounds );
for (i = 0; i < ngrad; i++, rect++)
@ -1489,12 +1437,10 @@ BOOL X11DRV_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
(v[0].Green * (dx - x) + v[1].Green * x) / dx / 256,
(v[0].Blue * (dx - x) + v[1].Blue * x) / dx / 256) );
wine_tsx11_lock();
XSetForeground( gdi_display, physdev->gc, color );
XDrawLine( gdi_display, physdev->drawable, physdev->gc,
physdev->dc_rect.left + rc.left + x, physdev->dc_rect.top + rc.top,
physdev->dc_rect.left + rc.left + x, physdev->dc_rect.top + rc.bottom );
wine_tsx11_unlock();
}
}
add_device_bounds( physdev, &bounds );
@ -1506,10 +1452,8 @@ BOOL X11DRV_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
val.line_width = 1;
val.cap_style = CapNotLast;
val.line_style = LineSolid;
wine_tsx11_lock();
XChangeGC( gdi_display, physdev->gc,
GCFunction | GCLineWidth | GCLineStyle | GCCapStyle | GCFillStyle, &val );
wine_tsx11_unlock();
reset_bounds( &bounds );
for (i = 0; i < ngrad; i++, rect++)
@ -1543,12 +1487,10 @@ BOOL X11DRV_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
(v[0].Green * (dy - y) + v[1].Green * y) / dy / 256,
(v[0].Blue * (dy - y) + v[1].Blue * y) / dy / 256) );
wine_tsx11_lock();
XSetForeground( gdi_display, physdev->gc, color );
XDrawLine( gdi_display, physdev->drawable, physdev->gc,
physdev->dc_rect.left + rc.left, physdev->dc_rect.top + rc.top + y,
physdev->dc_rect.left + rc.right, physdev->dc_rect.top + rc.top + y );
wine_tsx11_unlock();
}
}
add_device_bounds( physdev, &bounds );

View File

@ -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)
{

View File

@ -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();
}

View File

@ -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

View File

@ -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 )

View File

@ -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;

View File

@ -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 */

View File

@ -396,9 +396,7 @@ static void sync_window_style( Display *display, struct x11drv_win_data *data )
XSetWindowAttributes attr;
int mask = get_window_attributes( display, data, &attr );
wine_tsx11_lock();
XChangeWindowAttributes( display, data->whole_window, mask, &attr );
wine_tsx11_unlock();
}
}
@ -419,10 +417,8 @@ static void sync_window_region( Display *display, struct x11drv_win_data *data,
if (IsRectEmpty( &data->window_rect )) /* set an empty shape */
{
static XRectangle empty_rect;
wine_tsx11_lock();
XShapeCombineRectangles( display, data->whole_window, ShapeBounding, 0, 0,
&empty_rect, 1, ShapeSet, YXBanded );
wine_tsx11_unlock();
return;
}
@ -438,9 +434,7 @@ static void sync_window_region( Display *display, struct x11drv_win_data *data,
if (!hrgn)
{
wine_tsx11_lock();
XShapeCombineMask( display, data->whole_window, ShapeBounding, 0, 0, None, ShapeSet );
wine_tsx11_unlock();
}
else
{
@ -449,13 +443,11 @@ static void sync_window_region( Display *display, struct x11drv_win_data *data,
if (GetWindowLongW( data->hwnd, GWL_EXSTYLE ) & WS_EX_LAYOUTRTL) MirrorRgn( data->hwnd, hrgn );
if ((pRegionData = X11DRV_GetRegionData( hrgn, 0 )))
{
wine_tsx11_lock();
XShapeCombineRectangles( display, data->whole_window, ShapeBounding,
data->window_rect.left - data->whole_rect.left,
data->window_rect.top - data->whole_rect.top,
(XRectangle *)pRegionData->Buffer,
pRegionData->rdh.nCount, ShapeSet, YXBanded );
wine_tsx11_unlock();
HeapFree(GetProcessHeap(), 0, pRegionData);
data->shaped = TRUE;
}
@ -477,13 +469,11 @@ static void sync_window_opacity( Display *display, Window win,
if (flags & LWA_COLORKEY) FIXME("LWA_COLORKEY not supported\n");
wine_tsx11_lock();
if (opacity == 0xffffffff)
XDeleteProperty( display, win, x11drv_atom(_NET_WM_WINDOW_OPACITY) );
else
XChangeProperty( display, win, x11drv_atom(_NET_WM_WINDOW_OPACITY),
XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&opacity, 1 );
wine_tsx11_unlock();
}
@ -554,10 +544,8 @@ static BOOL set_win_format( HWND hwnd, XID fbconfig_id )
client = create_client_window( display, data, vis );
TRACE( "re-created client window %lx for %p fbconfig %lx\n", client, data->hwnd, fbconfig_id );
}
wine_tsx11_lock();
XFree(vis);
XFlush( display );
wine_tsx11_unlock();
if (client) goto done;
return FALSE;
}
@ -668,9 +656,7 @@ static void sync_gl_drawable(struct x11drv_win_data *data)
#ifdef SONAME_LIBXCOMPOSITE
if(usexcomposite)
{
wine_tsx11_lock();
XMoveResizeWindow(gdi_display, data->gl_drawable, 0, 0, w, h);
wine_tsx11_unlock();
return;
}
#endif
@ -788,11 +774,9 @@ static Window create_icon_window( Display *display, struct x11drv_win_data *data
static void destroy_icon_window( Display *display, struct x11drv_win_data *data )
{
if (!data->icon_window) return;
wine_tsx11_lock();
XDeleteContext( display, data->icon_window, winContext );
XDestroyWindow( display, data->icon_window );
data->icon_window = 0;
wine_tsx11_unlock();
RemovePropA( data->hwnd, icon_window_prop );
}
@ -915,10 +899,8 @@ static BOOL create_icon_pixmaps( HDC hdc, const ICONINFO *icon, struct x11drv_wi
return TRUE;
failed:
wine_tsx11_lock();
if (color_pixmap) XFreePixmap( gdi_display, color_pixmap );
if (mask_pixmap) XFreePixmap( gdi_display, mask_pixmap );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, bits.ptr );
return FALSE;
}
@ -945,11 +927,9 @@ static void set_icon_hints( Display *display, struct x11drv_win_data *data,
if (!icon_small) icon_small = (HICON)GetClassLongPtrW( data->hwnd, GCLP_HICONSM );
}
wine_tsx11_lock();
if (data->icon_pixmap) XFreePixmap( gdi_display, data->icon_pixmap );
if (data->icon_mask) XFreePixmap( gdi_display, data->icon_mask );
data->icon_pixmap = data->icon_mask = 0;
wine_tsx11_unlock();
if (!icon_big)
{
@ -988,13 +968,11 @@ static void set_icon_hints( Display *display, struct x11drv_win_data *data,
DeleteObject( ii_small.hbmColor );
DeleteObject( ii_small.hbmMask );
}
wine_tsx11_lock();
if (bits)
XChangeProperty( display, data->whole_window, x11drv_atom(_NET_WM_ICON),
XA_CARDINAL, 32, PropModeReplace, (unsigned char *)bits, size );
else
XDeleteProperty( display, data->whole_window, x11drv_atom(_NET_WM_ICON) );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, bits );
if (create_icon_pixmaps( hDC, &ii, data ))
@ -1279,9 +1257,7 @@ Window init_clip_window(void)
if (!data->clip_window &&
(data->clip_window = (Window)GetPropA( GetDesktopWindow(), clip_window_prop )))
{
wine_tsx11_lock();
XSelectInput( data->display, data->clip_window, StructureNotifyMask );
wine_tsx11_unlock();
}
return data->clip_window;
}
@ -1360,10 +1336,8 @@ void update_net_wm_states( Display *display, struct x11drv_win_data *data )
if (state_atoms[i] == XATOM__NET_WM_STATE_MAXIMIZED_VERT)
atoms[count++] = x11drv_atom(_NET_WM_STATE_MAXIMIZED_HORZ);
}
wine_tsx11_lock();
XChangeProperty( display, data->whole_window, x11drv_atom(_NET_WM_STATE), XA_ATOM,
32, PropModeReplace, (unsigned char *)atoms, count );
wine_tsx11_unlock();
}
else /* ask the window manager to do it for us */
{
@ -1390,10 +1364,8 @@ void update_net_wm_states( Display *display, struct x11drv_win_data *data )
xev.xclient.data.l[1] = X11DRV_Atoms[state_atoms[i] - FIRST_XATOM];
xev.xclient.data.l[2] = ((state_atoms[i] == XATOM__NET_WM_STATE_MAXIMIZED_VERT) ?
x11drv_atom(_NET_WM_STATE_MAXIMIZED_HORZ) : 0);
wine_tsx11_lock();
XSendEvent( display, root_window, False,
SubstructureRedirectMask | SubstructureNotifyMask, &xev );
wine_tsx11_unlock();
}
}
data->net_wm_state = new_state;
@ -1411,10 +1383,8 @@ static void set_xembed_flags( Display *display, struct x11drv_win_data *data, un
info[0] = 0; /* protocol version */
info[1] = flags;
wine_tsx11_lock();
XChangeProperty( display, data->whole_window, x11drv_atom(_XEMBED_INFO),
x11drv_atom(_XEMBED_INFO), 32, PropModeReplace, (unsigned char*)info, 2 );
wine_tsx11_unlock();
}
@ -1433,9 +1403,7 @@ static void map_window( Display *display, struct x11drv_win_data *data, DWORD ne
{
update_net_wm_states( display, data );
sync_window_style( display, data );
wine_tsx11_lock();
XMapWindow( display, data->whole_window );
wine_tsx11_unlock();
}
else set_xembed_flags( display, data, XEMBED_MAPPED );
@ -1454,10 +1422,8 @@ static void unmap_window( Display *display, struct x11drv_win_data *data )
if (!data->embedded)
{
wait_for_withdrawn_state( display, data, FALSE );
wine_tsx11_lock();
if (data->managed) XWithdrawWindow( display, data->whole_window, DefaultScreen(display) );
else XUnmapWindow( display, data->whole_window );
wine_tsx11_unlock();
}
else set_xembed_flags( display, data, 0 );
@ -1584,13 +1550,11 @@ static void sync_window_position( Display *display, struct x11drv_win_data *data
/* and Above with a sibling doesn't work so well either, so we ignore it */
}
wine_tsx11_lock();
set_size_hints( display, data, style );
set_mwm_hints( display, data, style, ex_style );
data->configure_serial = NextRequest( display );
XReconfigureWMWindow( display, data->whole_window,
DefaultScreen(display), mask, &changes );
wine_tsx11_unlock();
#ifdef HAVE_LIBXSHAPE
if (IsRectEmpty( old_window_rect ) != IsRectEmpty( &data->window_rect ))
sync_window_region( display, data, (HRGN)1 );
@ -1601,12 +1565,8 @@ static void sync_window_position( Display *display, struct x11drv_win_data *data
int new_x_offset = data->window_rect.left - data->whole_rect.left;
int new_y_offset = data->window_rect.top - data->whole_rect.top;
if (old_x_offset != new_x_offset || old_y_offset != new_y_offset)
{
wine_tsx11_lock();
XShapeOffsetShape( display, data->whole_window, ShapeBounding,
new_x_offset - old_x_offset, new_y_offset - old_y_offset );
wine_tsx11_unlock();
}
}
#endif
@ -1641,9 +1601,7 @@ static void sync_client_position( Display *display, struct x11drv_win_data *data
TRACE( "setting client win %lx pos %d,%d,%dx%d changes=%x\n",
data->client_window, new.left, new.top,
new.right - new.left, new.bottom - new.top, mask );
wine_tsx11_lock();
XConfigureWindow( display, data->client_window, mask, &changes );
wine_tsx11_unlock();
}
if (data->gl_drawable && (mask & (CWWidth|CWHeight))) sync_gl_drawable( data );
@ -1758,31 +1716,24 @@ static Window create_whole_window( Display *display, struct x11drv_win_data *dat
if (!(cy = data->whole_rect.bottom - data->whole_rect.top)) cy = 1;
else if (cy > 65535) cy = 65535;
wine_tsx11_lock();
data->whole_window = XCreateWindow( display, root_window,
data->whole_rect.left - virtual_screen_rect.left,
data->whole_rect.top - virtual_screen_rect.top,
cx, cy, 0, screen_depth, InputOutput,
visual, mask, &attr );
if (data->whole_window) XSaveContext( display, data->whole_window, winContext, (char *)data->hwnd );
wine_tsx11_unlock();
if (!data->whole_window) goto done;
if (!create_client_window( display, data, NULL ))
{
wine_tsx11_lock();
XDeleteContext( display, data->whole_window, winContext );
XDestroyWindow( display, data->whole_window );
data->whole_window = 0;
wine_tsx11_unlock();
goto done;
}
set_initial_wm_hints( display, data );
set_wm_hints( display, data );
XSaveContext( display, data->whole_window, winContext, (char *)data->hwnd );
SetPropA( data->hwnd, whole_window_prop, (HANDLE)data->whole_window );
/* set the window text */
@ -1798,9 +1749,7 @@ static Window create_whole_window( Display *display, struct x11drv_win_data *dat
init_clip_window(); /* make sure the clip window is initialized in this thread */
wine_tsx11_lock();
XFlush( display ); /* make sure the window exists before we start painting to it */
wine_tsx11_unlock();
sync_window_cursor( data->whole_window );
@ -1824,10 +1773,8 @@ static void destroy_whole_window( Display *display, struct x11drv_win_data *data
Window xwin = (Window)GetPropA( data->hwnd, foreign_window_prop );
if (xwin)
{
wine_tsx11_lock();
if (!already_destroyed) XSelectInput( display, xwin, 0 );
XDeleteContext( display, xwin, winContext );
wine_tsx11_unlock();
RemovePropA( data->hwnd, foreign_window_prop );
}
}
@ -1922,35 +1869,24 @@ void CDECL X11DRV_DestroyWindow( HWND hwnd )
if (data->pixmap)
{
wine_tsx11_lock();
destroy_glxpixmap(gdi_display, data->gl_drawable);
XFreePixmap(gdi_display, data->pixmap);
wine_tsx11_unlock();
}
else if (data->gl_drawable)
{
wine_tsx11_lock();
XDestroyWindow(gdi_display, data->gl_drawable);
wine_tsx11_unlock();
}
destroy_whole_window( thread_data->display, data, FALSE );
destroy_icon_window( thread_data->display, data );
if (data->colormap)
{
wine_tsx11_lock();
XFreeColormap( thread_data->display, data->colormap );
wine_tsx11_unlock();
}
if (data->colormap) XFreeColormap( thread_data->display, data->colormap );
if (thread_data->last_focus == hwnd) thread_data->last_focus = 0;
if (thread_data->last_xic_hwnd == hwnd) thread_data->last_xic_hwnd = 0;
wine_tsx11_lock();
if (data->icon_pixmap) XFreePixmap( gdi_display, data->icon_pixmap );
if (data->icon_mask) XFreePixmap( gdi_display, data->icon_mask );
XDeleteContext( thread_data->display, (XID)hwnd, win_data_context );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, data );
}
@ -2065,11 +2001,9 @@ BOOL CDECL X11DRV_CreateWindow( HWND hwnd )
/* create the cursor clipping window */
attr.override_redirect = TRUE;
attr.event_mask = StructureNotifyMask | FocusChangeMask;
wine_tsx11_lock();
data->clip_window = XCreateWindow( data->display, root_window, 0, 0, 1, 1, 0, 0,
InputOnly, visual, CWOverrideRedirect | CWEventMask, &attr );
XFlush( data->display );
wine_tsx11_unlock();
SetPropA( hwnd, clip_window_prop, (HANDLE)data->clip_window );
}
return TRUE;
@ -2189,24 +2123,17 @@ HWND create_foreign_window( Display *display, Window xwin )
class_registered = TRUE;
}
wine_tsx11_lock();
if (XFindContext( display, xwin, winContext, (char **)&hwnd )) hwnd = 0;
if (hwnd) /* already created */
{
wine_tsx11_unlock();
return hwnd;
}
if (hwnd) return hwnd; /* already created */
XSelectInput( display, xwin, StructureNotifyMask );
if (!XGetWindowAttributes( display, xwin, &attr ) ||
!XQueryTree( display, xwin, &xroot, &xparent, &xchildren, &nchildren ))
{
XSelectInput( display, xwin, 0 );
wine_tsx11_unlock();
return 0;
}
XFree( xchildren );
wine_tsx11_unlock();
if (xparent == xroot)
{
@ -2236,9 +2163,7 @@ HWND create_foreign_window( Display *display, Window xwin )
data->mapped = TRUE;
SetPropA( hwnd, foreign_window_prop, (HANDLE)xwin );
wine_tsx11_lock();
XSaveContext( display, xwin, winContext, (char *)data->hwnd );
wine_tsx11_unlock();
ShowWindow( hwnd, SW_SHOW );
@ -2405,21 +2330,17 @@ void CDECL X11DRV_SetCapture( HWND hwnd, UINT flags )
Window grab_win = X11DRV_get_client_window( GetAncestor( hwnd, GA_ROOT ) );
if (!grab_win) return;
wine_tsx11_lock();
XFlush( gdi_display );
XGrabPointer( thread_data->display, grab_win, False,
PointerMotionMask | ButtonPressMask | ButtonReleaseMask,
GrabModeAsync, GrabModeAsync, None, None, CurrentTime );
wine_tsx11_unlock();
thread_data->grab_window = grab_win;
}
else /* release capture */
{
wine_tsx11_lock();
XFlush( gdi_display );
XUngrabPointer( thread_data->display, CurrentTime );
XFlush( thread_data->display );
wine_tsx11_unlock();
thread_data->grab_window = None;
}
}
@ -2483,11 +2404,9 @@ void CDECL X11DRV_SetFocus( HWND hwnd )
timestamp = CurrentTime;
/* Set X focus and install colormap */
wine_tsx11_lock();
changes.stack_mode = Above;
XConfigureWindow( display, data->whole_window, CWStackMode, &changes );
XSetInputFocus( display, data->whole_window, RevertToParent, timestamp );
wine_tsx11_unlock();
}
@ -2573,9 +2492,7 @@ void CDECL X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags
move_window_bits( data, &valid_rects[1], &valid_rects[0], &old_client_rect );
}
wine_tsx11_lock();
XFlush( gdi_display ); /* make sure painting is done before we move the window */
wine_tsx11_unlock();
sync_client_position( display, data, swp_flags, &old_client_rect, &old_whole_rect );
@ -2621,12 +2538,10 @@ void CDECL X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags
{
data->iconic = (new_style & WS_MINIMIZE) != 0;
TRACE( "changing win %p iconic state to %u\n", data->hwnd, data->iconic );
wine_tsx11_lock();
if (data->iconic)
XIconifyWindow( display, data->whole_window, DefaultScreen(display) );
else if (is_window_rect_mapped( rectWindow ))
XMapWindow( display, data->whole_window );
wine_tsx11_unlock();
update_net_wm_states( display, data );
}
else if (!event_type)
@ -2635,9 +2550,7 @@ void CDECL X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags
}
}
wine_tsx11_lock();
XFlush( display ); /* make sure changes are done before we start painting again */
wine_tsx11_unlock();
}
@ -2669,11 +2582,9 @@ UINT CDECL X11DRV_ShowWindow( HWND hwnd, INT cmd, RECT *rect, UINT swp )
TRACE( "win %p/%lx cmd %d at %s flags %08x\n",
hwnd, data->whole_window, cmd, wine_dbgstr_rect(rect), swp );
wine_tsx11_lock();
XGetGeometry( thread_data->display, data->whole_window,
&root, &x, &y, &width, &height, &border, &depth );
XTranslateCoordinates( thread_data->display, data->whole_window, root, 0, 0, &x, &y, &top );
wine_tsx11_unlock();
rect->left = x;
rect->top = y;
rect->right = x + width;
@ -2708,9 +2619,7 @@ void CDECL X11DRV_SetWindowIcon( HWND hwnd, UINT type, HICON icon )
{
if (type == ICON_BIG) set_icon_hints( display, data, icon, 0 );
else set_icon_hints( display, data, 0, icon );
wine_tsx11_lock();
XSetWMHints( display, data->whole_window, data->wm_hints );
wine_tsx11_unlock();
}
}

View File

@ -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;
}

View File

@ -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.

View File

@ -338,10 +338,7 @@ static int load_xrender_formats(void)
{
unsigned long mask = 0;
get_xrender_template(&wxr_formats_template[i], &templ, &mask);
wine_tsx11_lock();
pict_formats[i] = pXRenderFindFormat(gdi_display, mask, &templ, 0);
wine_tsx11_unlock();
}
if (pict_formats[i])
{
@ -361,7 +358,6 @@ static int load_xrender_formats(void)
const struct gdi_dc_funcs *X11DRV_XRender_Init(void)
{
int event_base, i;
BOOL ok;
if (!client_side_with_render) return NULL;
if (!(xrender_handle = wine_dlopen(SONAME_LIBXRENDER, RTLD_NOW, NULL, 0))) return NULL;
@ -390,10 +386,7 @@ const struct gdi_dc_funcs *X11DRV_XRender_Init(void)
#undef LOAD_OPTIONAL_FUNCPTR
#undef LOAD_FUNCPTR
wine_tsx11_lock();
ok = pXRenderQueryExtension(gdi_display, &event_base, &xrender_error_base);
wine_tsx11_unlock();
if (!ok) return NULL;
if (!pXRenderQueryExtension(gdi_display, &event_base, &xrender_error_base)) return NULL;
TRACE("Xrender is up and running error_base = %d\n", xrender_error_base);
if(!load_xrender_formats()) /* This fails in buggy versions of libXrender.so */
@ -536,18 +529,14 @@ static void update_xrender_clipping( struct xrender_physdev *dev, HRGN rgn )
if (!rgn)
{
wine_tsx11_lock();
pa.clip_mask = None;
pXRenderChangePicture( gdi_display, dev->pict, CPClipMask, &pa );
wine_tsx11_unlock();
}
else if ((data = X11DRV_GetRegionData( rgn, 0 )))
{
wine_tsx11_lock();
pXRenderSetPictureClipRectangles( gdi_display, dev->pict,
dev->x11dev->dc_rect.left, dev->x11dev->dc_rect.top,
(XRectangle *)data->Buffer, data->rdh.nCount );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, data );
}
}
@ -559,11 +548,9 @@ static Picture get_xrender_picture( struct xrender_physdev *dev, HRGN clip_rgn,
{
XRenderPictureAttributes pa;
wine_tsx11_lock();
pa.subwindow_mode = IncludeInferiors;
dev->pict = pXRenderCreatePicture( gdi_display, dev->x11dev->drawable,
dev->pict_format, CPSubwindowMode, &pa );
wine_tsx11_unlock();
TRACE( "Allocing pict=%lx dc=%p drawable=%08lx\n",
dev->pict, dev->dev.hdc, dev->x11dev->drawable );
dev->update_clip = (dev->region != 0);
@ -600,12 +587,10 @@ static Picture get_xrender_picture_source( struct xrender_physdev *dev, BOOL rep
{
XRenderPictureAttributes pa;
wine_tsx11_lock();
pa.subwindow_mode = IncludeInferiors;
pa.repeat = repeat ? RepeatNormal : RepeatNone;
dev->pict_src = pXRenderCreatePicture( gdi_display, dev->x11dev->drawable,
dev->pict_format, CPSubwindowMode|CPRepeat, &pa );
wine_tsx11_unlock();
TRACE("Allocing pict_src=%lx dc=%p drawable=%08lx repeat=%u\n",
dev->pict_src, dev->dev.hdc, dev->x11dev->drawable, pa.repeat);
@ -719,9 +704,7 @@ static void FreeEntry(int entry)
formatEntry = glyphsetCache[entry].format[format];
if(formatEntry->glyphset) {
wine_tsx11_lock();
pXRenderFreeGlyphSet(gdi_display, formatEntry->glyphset);
wine_tsx11_unlock();
formatEntry->glyphset = 0;
}
if(formatEntry->nrealized) {
@ -1357,10 +1340,8 @@ static void UploadGlyph(struct xrender_physdev *physDev, int glyph, AA_Type form
break;
}
wine_tsx11_lock();
formatEntry->font_format = pict_formats[wxr_format];
formatEntry->glyphset = pXRenderCreateGlyphSet(gdi_display, formatEntry->font_format);
wine_tsx11_unlock();
}
@ -1448,10 +1429,8 @@ static void UploadGlyph(struct xrender_physdev *physDev, int glyph, AA_Type form
if(buflen == 0)
gi.width = gi.height = 1;
wine_tsx11_lock();
pXRenderAddGlyphs(gdi_display, formatEntry->glyphset, &gid, &gi, 1,
buflen ? buf : zero, buflen ? buflen : sizeof(zero));
wine_tsx11_unlock();
HeapFree(GetProcessHeap(), 0, buf);
}
@ -1480,12 +1459,10 @@ static Picture get_tile_pict( enum wxr_format wxr_format, const XRenderColor *co
XRenderPictureAttributes pa;
XRenderPictFormat *pict_format = pict_formats[wxr_format];
wine_tsx11_lock();
tile->xpm = XCreatePixmap(gdi_display, root_window, 1, 1, pict_format->depth);
pa.repeat = RepeatNormal;
tile->pict = pXRenderCreatePicture(gdi_display, tile->xpm, pict_format, CPRepeat, &pa);
wine_tsx11_unlock();
/* init current_color to something different from text_pixel */
tile->current_color = *color;
@ -1497,17 +1474,13 @@ static Picture get_tile_pict( enum wxr_format wxr_format, const XRenderColor *co
XRenderColor col;
col.red = col.green = col.blue = 0;
col.alpha = 0xffff;
wine_tsx11_lock();
pXRenderFillRectangle(gdi_display, PictOpSrc, tile->pict, &col, 0, 0, 1, 1);
wine_tsx11_unlock();
}
}
if (memcmp( color, &tile->current_color, sizeof(*color) ) && wxr_format != WXR_FORMAT_MONO)
{
wine_tsx11_lock();
pXRenderFillRectangle(gdi_display, PictOpSrc, tile->pict, color, 0, 0, 1, 1);
wine_tsx11_unlock();
tile->current_color = *color;
}
return tile->pict;
@ -1531,12 +1504,10 @@ static Picture get_mask_pict( int alpha )
{
XRenderPictureAttributes pa;
wine_tsx11_lock();
pixmap = XCreatePixmap( gdi_display, root_window, 1, 1, 32 );
pa.repeat = RepeatNormal;
pict = pXRenderCreatePicture( gdi_display, pixmap,
pict_formats[WXR_FORMAT_A8R8G8B8], CPRepeat, &pa );
wine_tsx11_unlock();
current_alpha = -1;
}
@ -1545,9 +1516,7 @@ static Picture get_mask_pict( int alpha )
XRenderColor col;
col.red = col.green = col.blue = 0;
col.alpha = current_alpha = alpha;
wine_tsx11_lock();
pXRenderFillRectangle( gdi_display, PictOpSrc, pict, &col, 0, 0, 1, 1 );
wine_tsx11_unlock();
}
return pict;
}
@ -1583,14 +1552,12 @@ static BOOL xrenderdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
else
get_xrender_color( physdev, GetBkColor( physdev->dev.hdc ), &bg );
wine_tsx11_lock();
set_xrender_transformation( pict, 1, 1, 0, 0 );
pXRenderFillRectangle( gdi_display, PictOpSrc, pict, &bg,
physdev->x11dev->dc_rect.left + lprect->left,
physdev->x11dev->dc_rect.top + lprect->top,
lprect->right - lprect->left,
lprect->bottom - lprect->top );
wine_tsx11_unlock();
add_device_bounds( physdev->x11dev, lprect );
}
@ -1859,10 +1826,8 @@ static DWORD create_image_pixmap( BITMAPINFO *info, const struct gdi_image_bits
GC gc;
XImage *image;
wine_tsx11_lock();
image = XCreateImage( gdi_display, visual, depth, ZPixmap, 0, NULL,
info->bmiHeader.biWidth, height, 32, 0 );
wine_tsx11_unlock();
if (!image) return ERROR_OUTOFMEMORY;
ret = copy_image_bits( info, (format == WXR_FORMAT_R8G8B8), image, bits, &dst_bits, src, NULL, ~0u );
@ -1873,13 +1838,11 @@ static DWORD create_image_pixmap( BITMAPINFO *info, const struct gdi_image_bits
*use_repeat = (width == 1 && height == 1);
pa.repeat = *use_repeat ? RepeatNormal : RepeatNone;
wine_tsx11_lock();
*pixmap = XCreatePixmap( gdi_display, root_window, width, height, depth );
gc = XCreateGC( gdi_display, *pixmap, 0, NULL );
XPutImage( gdi_display, *pixmap, gc, image, src->visrect.left, 0, 0, 0, width, height );
*pict = pXRenderCreatePicture( gdi_display, *pixmap, pict_formats[format], CPRepeat, &pa );
XFreeGC( gdi_display, gc );
wine_tsx11_unlock();
/* make coordinates relative to the pixmap */
src->x -= src->visrect.left;
@ -1887,9 +1850,7 @@ static DWORD create_image_pixmap( BITMAPINFO *info, const struct gdi_image_bits
OffsetRect( &src->visrect, -src->visrect.left, -src->visrect.top );
image->data = NULL;
wine_tsx11_lock();
XDestroyImage( image );
wine_tsx11_unlock();
if (dst_bits.free) dst_bits.free( &dst_bits );
return ret;
}
@ -1907,9 +1868,7 @@ static void xrender_stretch_blit( struct xrender_physdev *physdev_src, struct xr
{
x_dst = dst->x;
y_dst = dst->y;
wine_tsx11_lock();
dst_pict = pXRenderCreatePicture( gdi_display, drawable, physdev_dst->pict_format, 0, NULL );
wine_tsx11_unlock();
}
else
{
@ -1945,12 +1904,7 @@ static void xrender_stretch_blit( struct xrender_physdev *physdev_src, struct xr
src->width, src->height, x_dst, y_dst, dst->width, dst->height, xscale, yscale );
}
if (drawable)
{
wine_tsx11_lock();
pXRenderFreePicture( gdi_display, dst_pict );
wine_tsx11_unlock();
}
if (drawable) pXRenderFreePicture( gdi_display, dst_pict );
}
@ -1970,12 +1924,10 @@ static void xrender_put_image( Pixmap src_pixmap, Picture src_pict, Picture mask
if (clip) clip_data = X11DRV_GetRegionData( clip, 0 );
x_dst = dst->x;
y_dst = dst->y;
wine_tsx11_lock();
dst_pict = pXRenderCreatePicture( gdi_display, drawable, dst_format, 0, NULL );
if (clip_data)
pXRenderSetPictureClipRectangles( gdi_display, dst_pict, 0, 0,
(XRectangle *)clip_data->Buffer, clip_data->rdh.nCount );
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, clip_data );
}
else
@ -1995,12 +1947,7 @@ static void xrender_put_image( Pixmap src_pixmap, Picture src_pict, Picture mask
xrender_blit( PictOpSrc, src_pict, mask_pict, dst_pict, src->x, src->y, src->width, src->height,
x_dst, y_dst, dst->width, dst->height, xscale, yscale );
if (drawable)
{
wine_tsx11_lock();
pXRenderFreePicture( gdi_display, dst_pict );
wine_tsx11_unlock();
}
if (drawable) pXRenderFreePicture( gdi_display, dst_pict );
}
@ -2039,21 +1986,17 @@ static BOOL xrenderdrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
tmp.y -= tmp.visrect.top;
OffsetRect( &tmp.visrect, -tmp.visrect.left, -tmp.visrect.top );
wine_tsx11_lock();
tmpGC = XCreateGC( gdi_display, physdev_dst->x11dev->drawable, 0, NULL );
XSetSubwindowMode( gdi_display, tmpGC, IncludeInferiors );
XSetGraphicsExposures( gdi_display, tmpGC, False );
tmp_pixmap = XCreatePixmap( gdi_display, root_window, tmp.visrect.right - tmp.visrect.left,
tmp.visrect.bottom - tmp.visrect.top, physdev_dst->pict_format->depth );
wine_tsx11_unlock();
xrender_stretch_blit( physdev_src, physdev_dst, tmp_pixmap, src, &tmp );
execute_rop( physdev_dst->x11dev, tmp_pixmap, tmpGC, &dst->visrect, rop );
wine_tsx11_lock();
XFreePixmap( gdi_display, tmp_pixmap );
XFreeGC( gdi_display, tmpGC );
wine_tsx11_unlock();
}
else xrender_stretch_blit( physdev_src, physdev_dst, 0, src, dst );
@ -2127,11 +2070,8 @@ static DWORD xrenderdrv_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info,
NULL, tmp_pixmap, src, &tmp, use_repeat );
execute_rop( physdev->x11dev, tmp_pixmap, gc, &dst->visrect, rop );
wine_tsx11_lock();
XFreePixmap( gdi_display, tmp_pixmap );
XFreeGC( gdi_display, gc );
wine_tsx11_unlock();
if (restore_region) restore_clipping_region( physdev->x11dev );
}
else xrender_put_image( src_pixmap, src_pict, mask_pict, clip,
@ -2139,10 +2079,8 @@ static DWORD xrenderdrv_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info,
add_device_bounds( physdev->x11dev, &dst->visrect );
wine_tsx11_lock();
pXRenderFreePicture( gdi_display, src_pict );
XFreePixmap( gdi_display, src_pixmap );
wine_tsx11_unlock();
}
return ret;
@ -2212,10 +2150,8 @@ static DWORD xrenderdrv_BlendImage( PHYSDEV dev, BITMAPINFO *info, const struct
physdev->x11dev->dc_rect.top + dst->y,
dst->width, dst->height, xscale, yscale );
wine_tsx11_lock();
pXRenderFreePicture( gdi_display, src_pict );
XFreePixmap( gdi_display, src_pixmap );
wine_tsx11_unlock();
LeaveCriticalSection( &xrender_cs );
add_device_bounds( physdev->x11dev, &dst->visrect );
@ -2273,11 +2209,9 @@ static BOOL xrenderdrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst,
bg.red = bg.green = bg.blue = 0xffff;
fg.alpha = bg.alpha = 0xffff;
wine_tsx11_lock();
tmp_pixmap = XCreatePixmap( gdi_display, root_window, width, height,
physdev_dst->pict_format->depth );
tmp_pict = pXRenderCreatePicture( gdi_display, tmp_pixmap, physdev_dst->pict_format, 0, NULL );
wine_tsx11_unlock();
xrender_mono_blit( src_pict, tmp_pict, physdev_dst->format, &fg, &bg,
src->visrect.left, src->visrect.top, width, height, 0, 0, width, height, 1, 1 );
@ -2288,11 +2222,9 @@ static BOOL xrenderdrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst,
enum wxr_format format = get_format_without_alpha( physdev_src->format );
if (format != physdev_src->format)
{
wine_tsx11_lock();
pa.subwindow_mode = IncludeInferiors;
tmp_pict = pXRenderCreatePicture( gdi_display, physdev_src->x11dev->drawable,
pict_formats[format], CPSubwindowMode, &pa );
wine_tsx11_unlock();
}
}
@ -2309,10 +2241,8 @@ static BOOL xrenderdrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst,
physdev_dst->x11dev->dc_rect.top + dst->y,
dst->width, dst->height, xscale, yscale );
wine_tsx11_lock();
if (tmp_pict) pXRenderFreePicture( gdi_display, tmp_pict );
if (tmp_pixmap) XFreePixmap( gdi_display, tmp_pixmap );
wine_tsx11_unlock();
LeaveCriticalSection( &xrender_cs );
add_device_bounds( physdev_dst->x11dev, &dst->visrect );
@ -2449,13 +2379,11 @@ static HBRUSH xrenderdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct b
&pattern->bits, pattern->usage );
if (!pixmap) return 0;
wine_tsx11_lock();
if (physdev->x11dev->brush.pixmap) XFreePixmap( gdi_display, physdev->x11dev->brush.pixmap );
physdev->x11dev->brush.pixmap = pixmap;
physdev->x11dev->brush.fillStyle = FillTiled;
physdev->x11dev->brush.pixel = 0; /* ignored */
physdev->x11dev->brush.style = BS_PATTERN;
wine_tsx11_unlock();
return hbrush;
x11drv_fallback:

View File

@ -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 */