Commit 809af590 authored by Alexandre Julliard's avatar Alexandre Julliard

winex11.drv: Don't call GDI functions while holding the X11 lock.

parent 2ba32473
...@@ -717,6 +717,7 @@ static void BITBLT_StretchImage( XImage *srcImage, XImage *dstImage, ...@@ -717,6 +717,7 @@ static void BITBLT_StretchImage( XImage *srcImage, XImage *dstImage,
xoff = ((widthDst << 16) - (xinc * widthSrc)) / 2; xoff = ((widthDst << 16) - (xinc * widthSrc)) / 2;
} }
wine_tsx11_lock();
if (vstretch) if (vstretch)
{ {
yinc = ((int)heightSrc << 16) / heightDst; yinc = ((int)heightSrc << 16) / heightDst;
...@@ -836,6 +837,7 @@ static void BITBLT_StretchImage( XImage *srcImage, XImage *dstImage, ...@@ -836,6 +837,7 @@ static void BITBLT_StretchImage( XImage *srcImage, XImage *dstImage,
widthDst*sizeof(int) ); widthDst*sizeof(int) );
} }
} }
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, rowSrc ); HeapFree( GetProcessHeap(), 0, rowSrc );
} }
...@@ -873,6 +875,7 @@ static int BITBLT_GetSrcAreaStretch( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE ...@@ -873,6 +875,7 @@ static int BITBLT_GetSrcAreaStretch( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE
rectDst.bottom -= yDst; rectDst.bottom -= yDst;
get_colors(physDevDst, physDevSrc, &fg, &bg); get_colors(physDevDst, physDevSrc, &fg, &bg);
wine_tsx11_lock();
/* FIXME: avoid BadMatch errors */ /* FIXME: avoid BadMatch errors */
imageSrc = XGetImage( gdi_display, physDevSrc->drawable, imageSrc = XGetImage( gdi_display, physDevSrc->drawable,
physDevSrc->dc_rect.left + visRectSrc->left, physDevSrc->dc_rect.left + visRectSrc->left,
...@@ -880,6 +883,8 @@ static int BITBLT_GetSrcAreaStretch( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE ...@@ -880,6 +883,8 @@ static int BITBLT_GetSrcAreaStretch( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE
visRectSrc->right - visRectSrc->left, visRectSrc->right - visRectSrc->left,
visRectSrc->bottom - visRectSrc->top, visRectSrc->bottom - visRectSrc->top,
AllPlanes, ZPixmap ); AllPlanes, ZPixmap );
wine_tsx11_unlock();
imageDst = X11DRV_DIB_CreateXImage( rectDst.right - rectDst.left, imageDst = X11DRV_DIB_CreateXImage( rectDst.right - rectDst.left,
rectDst.bottom - rectDst.top, physDevDst->depth ); rectDst.bottom - rectDst.top, physDevDst->depth );
BITBLT_StretchImage( imageSrc, imageDst, widthSrc, heightSrc, BITBLT_StretchImage( imageSrc, imageDst, widthSrc, heightSrc,
...@@ -887,10 +892,12 @@ static int BITBLT_GetSrcAreaStretch( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE ...@@ -887,10 +892,12 @@ static int BITBLT_GetSrcAreaStretch( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE
fg, physDevDst->depth != 1 ? fg, physDevDst->depth != 1 ?
bg : physDevSrc->backgroundPixel, bg : physDevSrc->backgroundPixel,
GetStretchBltMode(physDevDst->hdc) ); GetStretchBltMode(physDevDst->hdc) );
wine_tsx11_lock();
XPutImage( gdi_display, pixmap, gc, imageDst, 0, 0, 0, 0, XPutImage( gdi_display, pixmap, gc, imageDst, 0, 0, 0, 0,
rectDst.right - rectDst.left, rectDst.bottom - rectDst.top ); rectDst.right - rectDst.left, rectDst.bottom - rectDst.top );
XDestroyImage( imageSrc ); XDestroyImage( imageSrc );
XDestroyImage( imageDst ); XDestroyImage( imageDst );
wine_tsx11_unlock();
return 0; /* no exposure events generated */ return 0; /* no exposure events generated */
} }
...@@ -910,9 +917,11 @@ static int BITBLT_GetSrcArea( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDe ...@@ -910,9 +917,11 @@ static int BITBLT_GetSrcArea( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDe
INT width = visRectSrc->right - visRectSrc->left; INT width = visRectSrc->right - visRectSrc->left;
INT height = visRectSrc->bottom - visRectSrc->top; INT height = visRectSrc->bottom - visRectSrc->top;
int fg, bg; int fg, bg;
BOOL memdc = (GetObjectType(physDevSrc->hdc) == OBJ_MEMDC);
if (physDevSrc->depth == physDevDst->depth) if (physDevSrc->depth == physDevDst->depth)
{ {
wine_tsx11_lock();
if (!X11DRV_PALETTE_XPixelToPalette || if (!X11DRV_PALETTE_XPixelToPalette ||
(physDevDst->depth == 1)) /* monochrome -> monochrome */ (physDevDst->depth == 1)) /* monochrome -> monochrome */
{ {
...@@ -938,7 +947,7 @@ static int BITBLT_GetSrcArea( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDe ...@@ -938,7 +947,7 @@ static int BITBLT_GetSrcArea( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDe
} }
else /* color -> color */ else /* color -> color */
{ {
if (GetObjectType(physDevSrc->hdc) == OBJ_MEMDC) if (memdc)
imageSrc = XGetImage( gdi_display, physDevSrc->drawable, imageSrc = XGetImage( gdi_display, physDevSrc->drawable,
physDevSrc->dc_rect.left + visRectSrc->left, physDevSrc->dc_rect.left + visRectSrc->left,
physDevSrc->dc_rect.top + visRectSrc->top, physDevSrc->dc_rect.top + visRectSrc->top,
...@@ -962,6 +971,7 @@ static int BITBLT_GetSrcArea( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDe ...@@ -962,6 +971,7 @@ static int BITBLT_GetSrcArea( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDe
0, 0, 0, 0, width, height ); 0, 0, 0, 0, width, height );
XDestroyImage( imageSrc ); XDestroyImage( imageSrc );
} }
wine_tsx11_unlock();
} }
else else
{ {
...@@ -969,6 +979,7 @@ static int BITBLT_GetSrcArea( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDe ...@@ -969,6 +979,7 @@ static int BITBLT_GetSrcArea( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDe
{ {
get_colors(physDevDst, physDevSrc, &fg, &bg); get_colors(physDevDst, physDevSrc, &fg, &bg);
wine_tsx11_lock();
if (X11DRV_PALETTE_XPixelToPalette) if (X11DRV_PALETTE_XPixelToPalette)
{ {
XSetBackground( gdi_display, gc, XSetBackground( gdi_display, gc,
...@@ -986,9 +997,11 @@ static int BITBLT_GetSrcArea( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDe ...@@ -986,9 +997,11 @@ static int BITBLT_GetSrcArea( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDe
physDevSrc->dc_rect.top + visRectSrc->top, physDevSrc->dc_rect.top + visRectSrc->top,
width, height, 0, 0, 1 ); width, height, 0, 0, 1 );
exposures++; exposures++;
wine_tsx11_unlock();
} }
else /* color -> monochrome */ else /* color -> monochrome */
{ {
wine_tsx11_lock();
/* FIXME: avoid BadMatch error */ /* FIXME: avoid BadMatch error */
imageSrc = XGetImage( gdi_display, physDevSrc->drawable, imageSrc = XGetImage( gdi_display, physDevSrc->drawable,
physDevSrc->dc_rect.left + visRectSrc->left, physDevSrc->dc_rect.left + visRectSrc->left,
...@@ -996,12 +1009,14 @@ static int BITBLT_GetSrcArea( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDe ...@@ -996,12 +1009,14 @@ static int BITBLT_GetSrcArea( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDe
width, height, AllPlanes, ZPixmap ); width, height, AllPlanes, ZPixmap );
if (!imageSrc) if (!imageSrc)
{ {
wine_tsx11_unlock();
return exposures; return exposures;
} }
imageDst = X11DRV_DIB_CreateXImage( width, height, physDevDst->depth ); imageDst = X11DRV_DIB_CreateXImage( width, height, physDevDst->depth );
if (!imageDst) if (!imageDst)
{ {
XDestroyImage(imageSrc); XDestroyImage(imageSrc);
wine_tsx11_unlock();
return exposures; return exposures;
} }
for (y = 0; y < height; y++) for (y = 0; y < height; y++)
...@@ -1012,6 +1027,7 @@ static int BITBLT_GetSrcArea( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDe ...@@ -1012,6 +1027,7 @@ static int BITBLT_GetSrcArea( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDe
0, 0, 0, 0, width, height ); 0, 0, 0, 0, width, height );
XDestroyImage( imageSrc ); XDestroyImage( imageSrc );
XDestroyImage( imageDst ); XDestroyImage( imageDst );
wine_tsx11_unlock();
} }
} }
return exposures; return exposures;
...@@ -1029,6 +1045,9 @@ static int BITBLT_GetDstArea(X11DRV_PDEVICE *physDev, Pixmap pixmap, GC gc, RECT ...@@ -1029,6 +1045,9 @@ static int BITBLT_GetDstArea(X11DRV_PDEVICE *physDev, Pixmap pixmap, GC gc, RECT
int exposures = 0; int exposures = 0;
INT width = visRectDst->right - visRectDst->left; INT width = visRectDst->right - visRectDst->left;
INT height = visRectDst->bottom - visRectDst->top; INT height = visRectDst->bottom - visRectDst->top;
BOOL memdc = (GetObjectType( physDev->hdc ) == OBJ_MEMDC);
wine_tsx11_lock();
if (!X11DRV_PALETTE_XPixelToPalette || (physDev->depth == 1) || if (!X11DRV_PALETTE_XPixelToPalette || (physDev->depth == 1) ||
(X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_VIRTUAL) ) (X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_VIRTUAL) )
...@@ -1043,7 +1062,7 @@ static int BITBLT_GetDstArea(X11DRV_PDEVICE *physDev, Pixmap pixmap, GC gc, RECT ...@@ -1043,7 +1062,7 @@ static int BITBLT_GetDstArea(X11DRV_PDEVICE *physDev, Pixmap pixmap, GC gc, RECT
register INT x, y; register INT x, y;
XImage *image; XImage *image;
if (GetObjectType( physDev->hdc ) == OBJ_MEMDC) if (memdc)
image = XGetImage( gdi_display, physDev->drawable, image = XGetImage( gdi_display, physDev->drawable,
physDev->dc_rect.left + visRectDst->left, physDev->dc_rect.left + visRectDst->left,
physDev->dc_rect.top + visRectDst->top, physDev->dc_rect.top + visRectDst->top,
...@@ -1059,13 +1078,18 @@ static int BITBLT_GetDstArea(X11DRV_PDEVICE *physDev, Pixmap pixmap, GC gc, RECT ...@@ -1059,13 +1078,18 @@ static int BITBLT_GetDstArea(X11DRV_PDEVICE *physDev, Pixmap pixmap, GC gc, RECT
image = XGetImage( gdi_display, pixmap, 0, 0, width, height, image = XGetImage( gdi_display, pixmap, 0, 0, width, height,
AllPlanes, ZPixmap ); AllPlanes, ZPixmap );
} }
for (y = 0; y < height; y++) if (image)
for (x = 0; x < width; x++) {
XPutPixel( image, x, y, for (y = 0; y < height; y++)
X11DRV_PALETTE_XPixelToPalette[XGetPixel( image, x, y )]); for (x = 0; x < width; x++)
XPutImage( gdi_display, pixmap, gc, image, 0, 0, 0, 0, width, height ); XPutPixel( image, x, y,
XDestroyImage( image ); X11DRV_PALETTE_XPixelToPalette[XGetPixel( image, x, y )]);
XPutImage( gdi_display, pixmap, gc, image, 0, 0, 0, 0, width, height );
XDestroyImage( image );
}
} }
wine_tsx11_unlock();
return exposures; return exposures;
} }
...@@ -1435,16 +1459,19 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT ...@@ -1435,16 +1459,19 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT
} }
wine_tsx11_lock(); wine_tsx11_lock();
tmpGC = XCreateGC( gdi_display, physDevDst->drawable, 0, NULL ); tmpGC = XCreateGC( gdi_display, physDevDst->drawable, 0, NULL );
XSetSubwindowMode( gdi_display, tmpGC, IncludeInferiors ); XSetSubwindowMode( gdi_display, tmpGC, IncludeInferiors );
XSetGraphicsExposures( gdi_display, tmpGC, False ); XSetGraphicsExposures( gdi_display, tmpGC, False );
pixmaps[DST] = XCreatePixmap( gdi_display, root_window, width, height, pixmaps[DST] = XCreatePixmap( gdi_display, root_window, width, height,
physDevDst->depth ); physDevDst->depth );
wine_tsx11_unlock();
if (useSrc) if (useSrc)
{ {
wine_tsx11_lock();
pixmaps[SRC] = XCreatePixmap( gdi_display, root_window, width, height, pixmaps[SRC] = XCreatePixmap( gdi_display, root_window, width, height,
physDevDst->depth ); physDevDst->depth );
wine_tsx11_unlock();
if (fStretch) if (fStretch)
BITBLT_GetSrcAreaStretch( physDevSrc, physDevDst, pixmaps[SRC], tmpGC, BITBLT_GetSrcAreaStretch( physDevSrc, physDevDst, pixmaps[SRC], tmpGC,
xSrc, ySrc, widthSrc, heightSrc, xSrc, ySrc, widthSrc, heightSrc,
...@@ -1460,6 +1487,7 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT ...@@ -1460,6 +1487,7 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT
else fNullBrush = FALSE; else fNullBrush = FALSE;
destUsed = FALSE; destUsed = FALSE;
wine_tsx11_lock();
for (opcode = BITBLT_Opcodes[(rop >> 16) & 0xff]; *opcode; opcode++) for (opcode = BITBLT_Opcodes[(rop >> 16) & 0xff]; *opcode; opcode++)
{ {
if (OP_DST(*opcode) == DST) destUsed = TRUE; if (OP_DST(*opcode) == DST) destUsed = TRUE;
......
...@@ -3501,6 +3501,7 @@ static int X11DRV_DIB_SetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr ) ...@@ -3501,6 +3501,7 @@ static int X11DRV_DIB_SetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr )
return lines; return lines;
} }
} }
wine_tsx11_unlock();
TRACE("Dib: depth=%d r=%x g=%x b=%x\n", TRACE("Dib: depth=%d r=%x g=%x b=%x\n",
descr->infoBpp,descr->rMask,descr->gMask,descr->bMask); descr->infoBpp,descr->rMask,descr->gMask,descr->bMask);
...@@ -3573,6 +3574,8 @@ static int X11DRV_DIB_SetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr ) ...@@ -3573,6 +3574,8 @@ static int X11DRV_DIB_SetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr )
descr->drawable, descr->gc, bmpImage, descr->drawable, descr->gc, bmpImage,
descr->xSrc, descr->ySrc, descr->xDest, descr->yDest, descr->xSrc, descr->ySrc, descr->xDest, descr->yDest,
descr->width, descr->height); descr->width, descr->height);
wine_tsx11_lock();
#ifdef HAVE_LIBXXSHM #ifdef HAVE_LIBXXSHM
if (descr->image && descr->useShm) if (descr->image && descr->useShm)
{ {
...@@ -3656,6 +3659,7 @@ static int X11DRV_DIB_GetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr ) ...@@ -3656,6 +3659,7 @@ static int X11DRV_DIB_GetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr )
descr->width, lines, AllPlanes, ZPixmap, descr->width, lines, AllPlanes, ZPixmap,
bmpImage, descr->xDest, descr->yDest ); bmpImage, descr->xDest, descr->yDest );
} }
wine_tsx11_unlock();
TRACE("Dib: depth=%2d r=%x g=%x b=%x\n", TRACE("Dib: depth=%2d r=%x g=%x b=%x\n",
descr->infoBpp,descr->rMask,descr->gMask,descr->bMask); descr->infoBpp,descr->rMask,descr->gMask,descr->bMask);
...@@ -3724,8 +3728,12 @@ static int X11DRV_DIB_GetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr ) ...@@ -3724,8 +3728,12 @@ static int X11DRV_DIB_GetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr )
break; break;
} }
if (!descr->image) XDestroyImage( bmpImage ); if (!descr->image)
wine_tsx11_unlock(); {
wine_tsx11_lock();
XDestroyImage( bmpImage );
wine_tsx11_unlock();
}
return lines; return lines;
} }
...@@ -3743,6 +3751,7 @@ INT X11DRV_SetDIBitsToDevice( X11DRV_PDEVICE *physDev, INT xDest, INT yDest, DWO ...@@ -3743,6 +3751,7 @@ INT X11DRV_SetDIBitsToDevice( X11DRV_PDEVICE *physDev, INT xDest, INT yDest, DWO
LONG width, height; LONG width, height;
BOOL top_down; BOOL top_down;
POINT pt; POINT pt;
int rop = X11DRV_XROPfunction[GetROP2(physDev->hdc) - 1];
if (DIB_GetBitmapInfo( &info->bmiHeader, &width, &height, if (DIB_GetBitmapInfo( &info->bmiHeader, &width, &height,
&descr.infoBpp, &descr.compression ) == -1) &descr.infoBpp, &descr.compression ) == -1)
...@@ -3795,7 +3804,7 @@ INT X11DRV_SetDIBitsToDevice( X11DRV_PDEVICE *physDev, INT xDest, INT yDest, DWO ...@@ -3795,7 +3804,7 @@ INT X11DRV_SetDIBitsToDevice( X11DRV_PDEVICE *physDev, INT xDest, INT yDest, DWO
X11DRV_SetupGCForText( physDev ); /* To have the correct colors */ X11DRV_SetupGCForText( physDev ); /* To have the correct colors */
wine_tsx11_lock(); wine_tsx11_lock();
XSetFunction(gdi_display, physDev->gc, X11DRV_XROPfunction[GetROP2(physDev->hdc) - 1]); XSetFunction(gdi_display, physDev->gc, rop);
wine_tsx11_unlock(); wine_tsx11_unlock();
switch (descr.infoBpp) switch (descr.infoBpp)
......
...@@ -242,15 +242,16 @@ BOOL X11DRV_SetupGCForPen( X11DRV_PDEVICE *physDev ) ...@@ -242,15 +242,16 @@ BOOL X11DRV_SetupGCForPen( X11DRV_PDEVICE *physDev )
default: default:
val.join_style = JoinRound; val.join_style = JoinRound;
} }
wine_tsx11_lock();
if (physDev->pen.dash_len) if (physDev->pen.dash_len)
{
XSetDashes( gdi_display, physDev->gc, 0, physDev->pen.dashes, physDev->pen.dash_len );
val.line_style = ((GetBkMode(physDev->hdc) == OPAQUE) && (!physDev->pen.ext)) val.line_style = ((GetBkMode(physDev->hdc) == OPAQUE) && (!physDev->pen.ext))
? LineDoubleDash : LineOnOffDash; ? LineDoubleDash : LineOnOffDash;
} else
else val.line_style = LineSolid; 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, XChangeGC( gdi_display, physDev->gc,
GCFunction | GCForeground | GCBackground | GCLineWidth | GCFunction | GCForeground | GCBackground | GCLineWidth |
GCLineStyle | GCCapStyle | GCJoinStyle | GCFillStyle, &val ); GCLineStyle | GCCapStyle | GCJoinStyle | GCFillStyle, &val );
...@@ -748,9 +749,9 @@ X11DRV_RoundRect( X11DRV_PDEVICE *physDev, INT left, INT top, INT right, ...@@ -748,9 +749,9 @@ X11DRV_RoundRect( X11DRV_PDEVICE *physDev, INT left, INT top, INT right,
/* Update the pixmap from the DIB section */ /* Update the pixmap from the DIB section */
X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod, FALSE); X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod, FALSE);
wine_tsx11_lock();
if (X11DRV_SetupGCForBrush( physDev )) if (X11DRV_SetupGCForBrush( physDev ))
{ {
wine_tsx11_lock();
if (ell_width > (rc.right-rc.left) ) if (ell_width > (rc.right-rc.left) )
if (ell_height > (rc.bottom-rc.top) ) if (ell_height > (rc.bottom-rc.top) )
XFillArc( gdi_display, physDev->drawable, physDev->gc, XFillArc( gdi_display, physDev->drawable, physDev->gc,
...@@ -812,6 +813,7 @@ X11DRV_RoundRect( X11DRV_PDEVICE *physDev, INT left, INT top, INT right, ...@@ -812,6 +813,7 @@ X11DRV_RoundRect( X11DRV_PDEVICE *physDev, INT left, INT top, INT right,
rc.right - rc.left - 2, rc.right - rc.left - 2,
rc.bottom - rc.top - ell_height - 1); rc.bottom - rc.top - ell_height - 1);
} }
wine_tsx11_unlock();
update = TRUE; update = TRUE;
} }
/* FIXME: this could be done with on X call /* FIXME: this could be done with on X call
...@@ -825,6 +827,7 @@ X11DRV_RoundRect( X11DRV_PDEVICE *physDev, INT left, INT top, INT right, ...@@ -825,6 +827,7 @@ X11DRV_RoundRect( X11DRV_PDEVICE *physDev, INT left, INT top, INT right,
*/ */
if (X11DRV_SetupGCForPen( physDev )) if (X11DRV_SetupGCForPen( physDev ))
{ {
wine_tsx11_lock();
if (ell_width > (rc.right-rc.left) ) if (ell_width > (rc.right-rc.left) )
if (ell_height > (rc.bottom-rc.top) ) if (ell_height > (rc.bottom-rc.top) )
XDrawArc( gdi_display, physDev->drawable, physDev->gc, XDrawArc( gdi_display, physDev->drawable, physDev->gc,
...@@ -888,9 +891,9 @@ X11DRV_RoundRect( X11DRV_PDEVICE *physDev, INT left, INT top, INT right, ...@@ -888,9 +891,9 @@ X11DRV_RoundRect( X11DRV_PDEVICE *physDev, INT left, INT top, INT right,
physDev->dc_rect.left + rc.left, physDev->dc_rect.left + rc.left,
physDev->dc_rect.top + rc.bottom - (ell_height+1) / 2); physDev->dc_rect.top + rc.bottom - (ell_height+1) / 2);
} }
wine_tsx11_unlock();
update = TRUE; update = TRUE;
} }
wine_tsx11_unlock();
/* Update the DIBSection from the pixmap */ /* Update the DIBSection from the pixmap */
X11DRV_UnlockDIBSection(physDev, update); X11DRV_UnlockDIBSection(physDev, update);
...@@ -1294,18 +1297,18 @@ X11DRV_ExtFloodFill( X11DRV_PDEVICE *physDev, INT x, INT y, COLORREF color, ...@@ -1294,18 +1297,18 @@ X11DRV_ExtFloodFill( X11DRV_PDEVICE *physDev, INT x, INT y, COLORREF color,
if (!PtInRegion( physDev->region, pt.x, pt.y )) return FALSE; if (!PtInRegion( physDev->region, pt.x, pt.y )) return FALSE;
GetRgnBox( physDev->region, &rect ); GetRgnBox( physDev->region, &rect );
wine_tsx11_lock();
X11DRV_expect_error( gdi_display, ExtFloodFillXGetImageErrorHandler, NULL ); X11DRV_expect_error( gdi_display, ExtFloodFillXGetImageErrorHandler, NULL );
image = XGetImage( gdi_display, physDev->drawable, image = XGetImage( gdi_display, physDev->drawable,
physDev->dc_rect.left + rect.left, physDev->dc_rect.top + rect.top, physDev->dc_rect.left + rect.left, physDev->dc_rect.top + rect.top,
rect.right - rect.left, rect.bottom - rect.top, rect.right - rect.left, rect.bottom - rect.top,
AllPlanes, ZPixmap ); AllPlanes, ZPixmap );
if(X11DRV_check_error()) image = NULL; if(X11DRV_check_error()) image = NULL;
wine_tsx11_unlock();
if (!image) return FALSE; if (!image) return FALSE;
if (X11DRV_SetupGCForBrush( physDev )) if (X11DRV_SetupGCForBrush( physDev ))
{ {
unsigned long pixel = X11DRV_PALETTE_ToPhysical( physDev, color );
/* Update the pixmap from the DIB section */ /* Update the pixmap from the DIB section */
X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod, FALSE); X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod, FALSE);
...@@ -1317,8 +1320,7 @@ X11DRV_ExtFloodFill( X11DRV_PDEVICE *physDev, INT x, INT y, COLORREF color, ...@@ -1317,8 +1320,7 @@ X11DRV_ExtFloodFill( X11DRV_PDEVICE *physDev, INT x, INT y, COLORREF color,
pt.y - rect.top, pt.y - rect.top,
physDev->dc_rect.left + rect.left, physDev->dc_rect.left + rect.left,
physDev->dc_rect.top + rect.top, physDev->dc_rect.top + rect.top,
X11DRV_PALETTE_ToPhysical( physDev, color ), pixel, fillType );
fillType );
wine_tsx11_unlock(); wine_tsx11_unlock();
/* Update the DIBSection of the dc's bitmap */ /* Update the DIBSection of the dc's bitmap */
X11DRV_UnlockDIBSection(physDev, TRUE); X11DRV_UnlockDIBSection(physDev, TRUE);
......
...@@ -360,13 +360,16 @@ INT X11DRV_ExtEscape( X11DRV_PDEVICE *physDev, INT escape, INT in_count, LPCVOID ...@@ -360,13 +360,16 @@ INT X11DRV_ExtEscape( X11DRV_PDEVICE *physDev, INT escape, INT in_count, LPCVOID
wine_tsx11_lock(); wine_tsx11_lock();
XSetGraphicsExposures( gdi_display, physDev->gc, False ); XSetGraphicsExposures( gdi_display, physDev->gc, False );
wine_tsx11_unlock();
if (physDev->exposures) if (physDev->exposures)
{ {
for (;;) for (;;)
{ {
XEvent event; XEvent event;
wine_tsx11_lock();
XWindowEvent( gdi_display, physDev->drawable, ~0, &event ); XWindowEvent( gdi_display, physDev->drawable, ~0, &event );
wine_tsx11_unlock();
if (event.type == NoExpose) break; if (event.type == NoExpose) break;
if (event.type == GraphicsExpose) if (event.type == GraphicsExpose)
{ {
...@@ -398,7 +401,6 @@ INT X11DRV_ExtEscape( X11DRV_PDEVICE *physDev, INT escape, INT in_count, LPCVOID ...@@ -398,7 +401,6 @@ INT X11DRV_ExtEscape( X11DRV_PDEVICE *physDev, INT escape, INT in_count, LPCVOID
} }
if (tmp) DeleteObject( tmp ); if (tmp) DeleteObject( tmp );
} }
wine_tsx11_unlock();
*(HRGN *)out_data = hrgn; *(HRGN *)out_data = hrgn;
return TRUE; return TRUE;
} }
......
...@@ -1690,6 +1690,8 @@ BOOL X11DRV_wglMakeCurrent(X11DRV_PDEVICE *physDev, HGLRC hglrc) { ...@@ -1690,6 +1690,8 @@ BOOL X11DRV_wglMakeCurrent(X11DRV_PDEVICE *physDev, HGLRC hglrc) {
BOOL X11DRV_wglMakeContextCurrentARB(X11DRV_PDEVICE* pDrawDev, X11DRV_PDEVICE* pReadDev, HGLRC hglrc) BOOL X11DRV_wglMakeContextCurrentARB(X11DRV_PDEVICE* pDrawDev, X11DRV_PDEVICE* pReadDev, HGLRC hglrc)
{ {
BOOL ret; BOOL ret;
int indirect = (GetObjectType(pDrawDev->hdc) == OBJ_MEMDC);
TRACE("(%p,%p,%p)\n", pDrawDev, pReadDev, hglrc); TRACE("(%p,%p,%p)\n", pDrawDev, pReadDev, hglrc);
if (!has_opengl()) { if (!has_opengl()) {
...@@ -1710,7 +1712,7 @@ BOOL X11DRV_wglMakeContextCurrentARB(X11DRV_PDEVICE* pDrawDev, X11DRV_PDEVICE* p ...@@ -1710,7 +1712,7 @@ BOOL X11DRV_wglMakeContextCurrentARB(X11DRV_PDEVICE* pDrawDev, X11DRV_PDEVICE* p
Drawable d_read = get_glxdrawable(pReadDev); Drawable d_read = get_glxdrawable(pReadDev);
if (ctx->ctx == NULL) { if (ctx->ctx == NULL) {
ctx->ctx = pglXCreateContext(gdi_display, ctx->vis, NULL, GetObjectType(pDrawDev->hdc) == OBJ_MEMDC ? False : True); ctx->ctx = pglXCreateContext(gdi_display, ctx->vis, NULL, !indirect);
TRACE(" created a delayed OpenGL context (%p)\n", ctx->ctx); TRACE(" created a delayed OpenGL context (%p)\n", ctx->ctx);
} }
ctx->hdc = pDrawDev->hdc; ctx->hdc = pDrawDev->hdc;
...@@ -1747,22 +1749,24 @@ BOOL X11DRV_wglShareLists(HGLRC hglrc1, HGLRC hglrc2) { ...@@ -1747,22 +1749,24 @@ BOOL X11DRV_wglShareLists(HGLRC hglrc1, HGLRC hglrc2) {
return FALSE; return FALSE;
} else { } else {
if (org->ctx == NULL) { if (org->ctx == NULL) {
int indirect = (GetObjectType(org->hdc) == OBJ_MEMDC);
wine_tsx11_lock(); wine_tsx11_lock();
describeContext(org); describeContext(org);
if(org->vis) if(org->vis)
org->ctx = pglXCreateContext(gdi_display, org->vis, NULL, GetObjectType(org->hdc) == OBJ_MEMDC ? False : True); org->ctx = pglXCreateContext(gdi_display, org->vis, NULL, !indirect);
else /* Create a GLX Context for a pbuffer */ else /* Create a GLX Context for a pbuffer */
org->ctx = pglXCreateNewContext(gdi_display, org->fmt->fbconfig, org->fmt->render_type, NULL, True); org->ctx = pglXCreateNewContext(gdi_display, org->fmt->fbconfig, org->fmt->render_type, NULL, True);
wine_tsx11_unlock(); wine_tsx11_unlock();
TRACE(" created a delayed OpenGL context (%p) for Wine context %p\n", org->ctx, org); TRACE(" created a delayed OpenGL context (%p) for Wine context %p\n", org->ctx, org);
} }
if (NULL != dest) { if (NULL != dest) {
int indirect = (GetObjectType(dest->hdc) == OBJ_MEMDC);
wine_tsx11_lock(); wine_tsx11_lock();
describeContext(dest); describeContext(dest);
/* Create the destination context with display lists shared */ /* Create the destination context with display lists shared */
if(dest->vis) if(dest->vis)
dest->ctx = pglXCreateContext(gdi_display, dest->vis, org->ctx, GetObjectType(org->hdc) == OBJ_MEMDC ? False : True); dest->ctx = pglXCreateContext(gdi_display, dest->vis, org->ctx, !indirect);
else /* Create a GLX Context for a pbuffer */ else /* Create a GLX Context for a pbuffer */
dest->ctx = pglXCreateNewContext(gdi_display, dest->fmt->fbconfig, dest->fmt->render_type, org->ctx, True); dest->ctx = pglXCreateNewContext(gdi_display, dest->fmt->fbconfig, dest->fmt->render_type, org->ctx, True);
wine_tsx11_unlock(); wine_tsx11_unlock();
......
...@@ -1630,6 +1630,8 @@ BOOL X11DRV_AlphaBlend(X11DRV_PDEVICE *devDst, INT xDst, INT yDst, INT widthDst, ...@@ -1630,6 +1630,8 @@ BOOL X11DRV_AlphaBlend(X11DRV_PDEVICE *devDst, INT xDst, INT yDst, INT widthDst,
} }
rgndata = X11DRV_GetRegionData( devDst->region, 0 );
wine_tsx11_lock(); wine_tsx11_lock();
image = XCreateImage(gdi_display, visual, 32, ZPixmap, 0, image = XCreateImage(gdi_display, visual, 32, ZPixmap, 0,
(char*) data, widthSrc, heightSrc, 32, widthSrc * 4); (char*) data, widthSrc, heightSrc, 32, widthSrc * 4);
...@@ -1664,7 +1666,7 @@ BOOL X11DRV_AlphaBlend(X11DRV_PDEVICE *devDst, INT xDst, INT yDst, INT widthDst, ...@@ -1664,7 +1666,7 @@ BOOL X11DRV_AlphaBlend(X11DRV_PDEVICE *devDst, INT xDst, INT yDst, INT widthDst,
CPSubwindowMode, &pa); CPSubwindowMode, &pa);
TRACE("src_pict %08lx\n", src_pict); TRACE("src_pict %08lx\n", src_pict);
if ((rgndata = X11DRV_GetRegionData( devDst->region, 0 ))) if (rgndata)
{ {
pXRenderSetPictureClipRectangles( gdi_display, dst_pict, pXRenderSetPictureClipRectangles( gdi_display, dst_pict,
devDst->dc_rect.left, devDst->dc_rect.top, devDst->dc_rect.left, devDst->dc_rect.top,
......
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