From c559735bf81ac454d5f1bb7d2b5137089571223b Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 11 May 2001 00:17:47 +0000 Subject: [PATCH] Renamed display to gdi_display where it is used for GDI operations, to allow supporting multiple X connections. --- dlls/ddraw/d3ddevice/mesa.c | 16 +-- dlls/opengl32/wgl.c | 32 ++--- dlls/x11drv/x11ddraw.c | 6 +- dlls/x11drv/x11drv_main.c | 17 +-- dlls/x11drv/xvidmode.c | 24 ++-- graphics/x11drv/bitblt.c | 157 +++++++++++------------ graphics/x11drv/bitmap.c | 55 ++++---- graphics/x11drv/brush.c | 43 +++---- graphics/x11drv/clipping.c | 2 +- graphics/x11drv/dib.c | 148 +++++++++++---------- graphics/x11drv/graphics.c | 249 ++++++++++++++++++------------------ graphics/x11drv/init.c | 60 ++++----- graphics/x11drv/oembitmap.c | 9 +- graphics/x11drv/opengl.c | 30 ++--- graphics/x11drv/palette.c | 81 ++++++------ graphics/x11drv/text.c | 25 ++-- graphics/x11drv/xfont.c | 22 ++-- include/x11drv.h | 21 +-- windows/x11drv/clipboard.c | 4 +- windows/x11drv/wnd.c | 18 +-- 20 files changed, 500 insertions(+), 519 deletions(-) diff --git a/dlls/ddraw/d3ddevice/mesa.c b/dlls/ddraw/d3ddevice/mesa.c index 63ea4e734b9..215a8ec2c7e 100644 --- a/dlls/ddraw/d3ddevice/mesa.c +++ b/dlls/ddraw/d3ddevice/mesa.c @@ -55,7 +55,7 @@ static void set_context(IDirect3DDevice2Impl* This) { This->surface->s.surface_desc.dwWidth, This->surface->s.surface_desc.dwHeight); #else - if (glXMakeCurrent(display,ddpriv->drawable, odev->ctx) == False) { + if (glXMakeCurrent(gdi_display,ddpriv->drawable, odev->ctx) == False) { ERR("Error in setting current context (context %p drawable %ld)!\n", odev->ctx, ddpriv->drawable); } @@ -192,9 +192,9 @@ is_OpenGL( XVisualInfo template; template.visualid = XVisualIDFromVisual(visual); - vis = XGetVisualInfo(display, VisualIDMask, &template, &num); + vis = XGetVisualInfo(gdi_display, VisualIDMask, &template, &num); - odev->ctx = glXCreateContext(display, vis, + odev->ctx = glXCreateContext(gdi_display, vis, NULL, GL_TRUE); } @@ -263,7 +263,7 @@ static ULONG WINAPI MESA_IDirect3DDevice2Impl_Release(LPDIRECT3DDEVICE2 iface) OSMesaDestroyContext(odev->ctx); #else ENTER_GL(); - glXDestroyContext(display, odev->ctx); + glXDestroyContext(gdi_display, odev->ctx); LEAVE_GL(); #endif This->private = NULL; @@ -900,15 +900,15 @@ int is_OpenGL_dx3(REFCLSID rguid, IDirectDrawSurfaceImpl* surface, IDirect3DDevi /* if (surface->s.backbuffer == NULL) attributeList[3] = None; */ ENTER_GL(); - xvis = glXChooseVisual(display, - DefaultScreen(display), + xvis = glXChooseVisual(gdi_display, + DefaultScreen(gdi_display), attributeList); if (xvis == NULL) ERR("No visual found !\n"); else TRACE("Visual found\n"); /* Create the context */ - odev->ctx = glXCreateContext(display, + odev->ctx = glXCreateContext(gdi_display, xvis, NULL, GL_TRUE); @@ -960,7 +960,7 @@ static ULONG WINAPI MESA_IDirect3DDeviceImpl_Release(LPDIRECT3DDEVICE iface) OSMesaDestroyContext(odev->ctx); #else ENTER_GL(); - glXDestroyContext(display, odev->ctx); + glXDestroyContext(gdi_display, odev->ctx); LEAVE_GL(); #endif This->private = NULL; diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index ffda9e253d2..c9eb1c813e3 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -84,7 +84,7 @@ HGLRC WINAPI wglCreateContext(HDC hdc) /* First, get the visual in use by the X11DRV */ template.visualid = XVisualIDFromVisual(X11DRV_GetVisual()); - vis = XGetVisualInfo(display, VisualIDMask, &template, &num); + vis = XGetVisualInfo(gdi_display, VisualIDMask, &template, &num); if (vis == NULL) { ERR("NULL visual !!!\n"); @@ -137,13 +137,13 @@ BOOL WINAPI wglDeleteContext(HGLRC hglrc) { ENTER_GL(); /* A game (Half Life not to name it) deletes twice the same context. To prevent crashes, run with our own error function enabled */ - XSync(display, False); + XSync(gdi_display, False); XGLErrorFlag = 0; WineXHandler = XSetErrorHandler(XGLErrorHandler); __TRY { - glXDestroyContext(display, ctx->ctx); - XSync(display, False); - XFlush(display); + glXDestroyContext(gdi_display, ctx->ctx); + XSync(gdi_display, False); + XFlush(gdi_display); if (XGLErrorHandler == 0) free_context(ctx); } @@ -308,7 +308,7 @@ BOOL WINAPI wglMakeCurrent(HDC hdc, if (hglrc == NULL) { ENTER_GL(); - ret = glXMakeCurrent(display, + ret = glXMakeCurrent(gdi_display, None, NULL); LEAVE_GL(); @@ -326,13 +326,13 @@ BOOL WINAPI wglMakeCurrent(HDC hdc, if (ctx->ctx == NULL) { ENTER_GL(); - ctx->ctx = glXCreateContext(display, ctx->vis, NULL, True); + ctx->ctx = glXCreateContext(gdi_display, ctx->vis, NULL, True); LEAVE_GL(); TRACE(" created a delayed OpenGL context (%p)\n", ctx->ctx); } ENTER_GL(); - ret = glXMakeCurrent(display, + ret = glXMakeCurrent(gdi_display, physDev->drawable, ctx->ctx); LEAVE_GL(); @@ -383,14 +383,14 @@ BOOL WINAPI wglShareLists(HGLRC hglrc1, } else { if (org->ctx == NULL) { ENTER_GL(); - org->ctx = glXCreateContext(display, org->vis, NULL, True); + org->ctx = glXCreateContext(gdi_display, org->vis, NULL, True); LEAVE_GL(); TRACE(" created a delayed OpenGL context (%p) for Wine context %p\n", org->ctx, org); } ENTER_GL(); /* Create the destination context with display lists shared */ - dest->ctx = glXCreateContext(display, dest->vis, org->ctx, True); + dest->ctx = glXCreateContext(gdi_display, dest->vis, org->ctx, True); LEAVE_GL(); TRACE(" created a delayed OpenGL context (%p) for Wine context %p sharing lists with OpenGL ctx %p\n", dest->ctx, dest, org->ctx); } @@ -468,7 +468,7 @@ static void process_attach(void) { Window was created using the standard X11DRV visual, and glXMakeCurrent can't deal with mismatched visuals. Note that the Root Window visual may not be double buffered, so apps actually attempting to render this way may flicker */ - if (TSXGetWindowAttributes( display, X11DRV_GetXRootWindow(), &win_attr )) + if (TSXGetWindowAttributes( gdi_display, X11DRV_GetXRootWindow(), &win_attr )) { rootVisual = win_attr.visual; } @@ -476,13 +476,13 @@ static void process_attach(void) { { /* Get the default visual, since we can't seem to get the attributes from the Root Window. Let's hope that the Root Window Visual matches the DefaultVisual */ - rootVisual = DefaultVisual( display, DefaultScreen(display) ); + rootVisual = DefaultVisual( gdi_display, DefaultScreen(gdi_display) ); } template.visualid = XVisualIDFromVisual(rootVisual); - vis = XGetVisualInfo(display, VisualIDMask, &template, &num); - if (vis != NULL) default_cx = glXCreateContext(display, vis, 0, GL_TRUE); - if (default_cx != NULL) glXMakeCurrent(display, X11DRV_GetXRootWindow(), default_cx); + vis = XGetVisualInfo(gdi_display, VisualIDMask, &template, &num); + if (vis != NULL) default_cx = glXCreateContext(gdi_display, vis, 0, GL_TRUE); + if (default_cx != NULL) glXMakeCurrent(gdi_display, X11DRV_GetXRootWindow(), default_cx); XFree(vis); LEAVE_GL(); @@ -494,7 +494,7 @@ static void process_attach(void) { } static void process_detach(void) { - glXDestroyContext(display, default_cx); + glXDestroyContext(gdi_display, default_cx); } /*********************************************************************** diff --git a/dlls/x11drv/x11ddraw.c b/dlls/x11drv/x11ddraw.c index cad9e4df53e..378cdbd041e 100644 --- a/dlls/x11drv/x11ddraw.c +++ b/dlls/x11drv/x11ddraw.c @@ -162,7 +162,7 @@ static DDHAL_DDSURFACECALLBACKS hal_ddsurfcallbacks = { static DWORD PASCAL X11DRV_DDHAL_DestroyPalette(LPDDHAL_DESTROYPALETTEDATA data) { Colormap pal = data->lpDDPalette->u1.dwReserved1; - if (pal) TSXFreeColormap(display, pal); + if (pal) TSXFreeColormap(gdi_display, pal); data->ddRVal = DD_OK; return DDHAL_DRIVER_HANDLED; } @@ -386,8 +386,8 @@ void X11DRV_DDHAL_SetPalEntries(Colormap pal, DWORD dwBase, DWORD dwNumEntries, c.red = lpEntries[n].peRed << 8; c.green = lpEntries[n].peGreen << 8; c.blue = lpEntries[n].peBlue << 8; - TSXStoreColor(display, pal, &c); + TSXStoreColor(gdi_display, pal, &c); } - TSXFlush(display); /* update display immediate */ + TSXFlush(gdi_display); /* update display immediately */ } } diff --git a/dlls/x11drv/x11drv_main.c b/dlls/x11drv/x11drv_main.c index 32daccf3dee..a788543b085 100644 --- a/dlls/x11drv/x11drv_main.c +++ b/dlls/x11drv/x11drv_main.c @@ -413,7 +413,7 @@ static void process_attach(void) } /* initialize GDI */ - if(!X11DRV_GDI_Initialize()) + if(!X11DRV_GDI_Initialize( display )) { ERR( "Couldn't Initialize GDI.\n" ); ExitProcess(1); @@ -463,9 +463,6 @@ static void process_detach(void) /* cleanup GDI */ X11DRV_GDI_Finalize(); - - /* close the display */ - XCloseDisplay( display ); display = NULL; /* restore TSX11 locking */ @@ -504,7 +501,7 @@ BOOL WINAPI X11DRV_Init( HINSTANCE hinst, DWORD reason, LPVOID reserved ) BOOL X11DRV_GetScreenSaveActive(void) { int timeout, temp; - TSXGetScreenSaver(display, &timeout, &temp, &temp, &temp); + TSXGetScreenSaver(gdi_display, &timeout, &temp, &temp, &temp); return timeout != 0; } @@ -516,9 +513,9 @@ BOOL X11DRV_GetScreenSaveActive(void) void X11DRV_SetScreenSaveActive(BOOL bActivate) { if(bActivate) - TSXActivateScreenSaver(display); + TSXActivateScreenSaver(gdi_display); else - TSXResetScreenSaver(display); + TSXResetScreenSaver(gdi_display); } /*********************************************************************** @@ -529,7 +526,7 @@ void X11DRV_SetScreenSaveActive(BOOL bActivate) int X11DRV_GetScreenSaveTimeout(void) { int timeout, temp; - TSXGetScreenSaver(display, &timeout, &temp, &temp, &temp); + TSXGetScreenSaver(gdi_display, &timeout, &temp, &temp, &temp); return timeout; } @@ -543,7 +540,7 @@ void X11DRV_SetScreenSaveTimeout(int nTimeout) /* timeout is a 16bit entity (CARD16) in the protocol, so it should * not get over 32767 or it will get negative. */ if (nTimeout>32767) nTimeout = 32767; - TSXSetScreenSaver(display, nTimeout, 60, DefaultBlanking, DefaultExposures); + TSXSetScreenSaver(gdi_display, nTimeout, 60, DefaultBlanking, DefaultExposures); } /*********************************************************************** @@ -551,5 +548,5 @@ void X11DRV_SetScreenSaveTimeout(int nTimeout) */ BOOL X11DRV_IsSingleWindow(void) { - return (root_window != DefaultRootWindow(display)); + return (root_window != DefaultRootWindow(gdi_display)); } diff --git a/dlls/x11drv/xvidmode.c b/dlls/x11drv/xvidmode.c index 40980fa50c9..60fb8049de6 100644 --- a/dlls/x11drv/xvidmode.c +++ b/dlls/x11drv/xvidmode.c @@ -63,14 +63,14 @@ void X11DRV_XF86VM_Init(void) if (xf86vm_major) return; /* already initialized? */ /* see if XVidMode is available */ - if (!TSXF86VidModeQueryExtension(display, &xf86vm_event, &xf86vm_error)) return; - if (!TSXF86VidModeQueryVersion(display, &xf86vm_major, &xf86vm_minor)) return; + if (!TSXF86VidModeQueryExtension(gdi_display, &xf86vm_event, &xf86vm_error)) return; + if (!TSXF86VidModeQueryVersion(gdi_display, &xf86vm_major, &xf86vm_minor)) return; /* if in desktop mode, don't use XVidMode */ - if (X11DRV_GetXRootWindow() != DefaultRootWindow(display)) return; + if (root_window != DefaultRootWindow(gdi_display)) return; /* retrieve modes */ - if (!TSXF86VidModeGetAllModeLines(display, DefaultScreen(display), &nmodes, + if (!TSXF86VidModeGetAllModeLines(gdi_display, DefaultScreen(gdi_display), &nmodes, &modes)) return; @@ -100,7 +100,7 @@ int X11DRV_XF86VM_GetCurrentMode(void) if (!xf86vm_modes) return 0; /* no XVidMode */ TRACE("Querying XVidMode current mode\n"); - TSXF86VidModeGetModeLine(display, DefaultScreen(display), &dotclock, &line); + TSXF86VidModeGetModeLine(gdi_display, DefaultScreen(gdi_display), &dotclock, &line); convert_modeline(dotclock, &line, &cmode); for (i=0; ired, gamma.red); @@ -268,7 +268,7 @@ BOOL X11DRV_XF86VM_SetGammaRamp(LPDDGAMMARAMP ramp) ComputeGammaFromRamp(ramp->blue, &gamma.blue)) { Bool ret; wine_tsx11_lock(); - ret = XF86VidModeSetGamma(display, DefaultScreen(display), &gamma); + ret = XF86VidModeSetGamma(gdi_display, DefaultScreen(gdi_display), &gamma); wine_tsx11_unlock(); return ret; } diff --git a/graphics/x11drv/bitblt.c b/graphics/x11drv/bitblt.c index d5b0be07cce..17a0b9d96a8 100644 --- a/graphics/x11drv/bitblt.c +++ b/graphics/x11drv/bitblt.c @@ -855,20 +855,20 @@ static void BITBLT_GetSrcAreaStretch( DC *dcSrc, DC *dcDst, rectDst.bottom -= yDst; /* FIXME: avoid BadMatch errors */ - imageSrc = XGetImage( display, physDevSrc->drawable, + imageSrc = XGetImage( gdi_display, physDevSrc->drawable, visRectSrc->left, visRectSrc->top, visRectSrc->right - visRectSrc->left, visRectSrc->bottom - visRectSrc->top, AllPlanes, ZPixmap ); - XCREATEIMAGE( imageDst, rectDst.right - rectDst.left, - rectDst.bottom - rectDst.top, dcDst->bitsPerPixel ); + imageDst = X11DRV_DIB_CreateXImage( rectDst.right - rectDst.left, + rectDst.bottom - rectDst.top, dcDst->bitsPerPixel ); BITBLT_StretchImage( imageSrc, imageDst, widthSrc, heightSrc, widthDst, heightDst, &rectSrc, &rectDst, physDevDst->textPixel, dcDst->bitsPerPixel != 1 ? physDevDst->backgroundPixel : physDevSrc->backgroundPixel, dcDst->stretchBltMode ); - XPutImage( 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 ); XDestroyImage( imageSrc ); XDestroyImage( imageDst ); @@ -902,36 +902,36 @@ static void BITBLT_GetSrcArea( DC *dcSrc, DC *dcDst, Pixmap pixmap, GC gc, to color or vice versa, the forground and background color of the device context are used. In fact, it also applies to the case when it is converted from mono to mono. */ - XSetBackground( display, gc, physDevDst->textPixel ); - XSetForeground( display, gc, physDevDst->backgroundPixel ); - XCopyPlane( display, physDevSrc->drawable, pixmap, gc, + XSetBackground( gdi_display, gc, physDevDst->textPixel ); + XSetForeground( gdi_display, gc, physDevDst->backgroundPixel ); + XCopyPlane( gdi_display, physDevSrc->drawable, pixmap, gc, visRectSrc->left, visRectSrc->top, width, height, 0, 0, 1); } else - XCopyArea( display, physDevSrc->drawable, pixmap, gc, visRectSrc - ->left, visRectSrc->top, width, height, 0, 0); + XCopyArea( gdi_display, physDevSrc->drawable, pixmap, gc, + visRectSrc->left, visRectSrc->top, width, height, 0, 0); } else /* color -> color */ { if (dcSrc->flags & DC_MEMORY) - imageSrc = XGetImage( display, physDevSrc->drawable, + imageSrc = XGetImage( gdi_display, physDevSrc->drawable, visRectSrc->left, visRectSrc->top, width, height, AllPlanes, ZPixmap ); else { /* Make sure we don't get a BadMatch error */ - XCopyArea( display, physDevSrc->drawable, pixmap, gc, + XCopyArea( gdi_display, physDevSrc->drawable, pixmap, gc, visRectSrc->left, visRectSrc->top, width, height, 0, 0); - imageSrc = XGetImage( display, pixmap, 0, 0, width, height, + imageSrc = XGetImage( gdi_display, pixmap, 0, 0, width, height, AllPlanes, ZPixmap ); } for (y = 0; y < height; y++) for (x = 0; x < width; x++) XPutPixel(imageSrc, x, y, X11DRV_PALETTE_XPixelToPalette[XGetPixel(imageSrc, x, y)]); - XPutImage( display, pixmap, gc, imageSrc, + XPutImage( gdi_display, pixmap, gc, imageSrc, 0, 0, 0, 0, width, height ); XDestroyImage( imageSrc ); } @@ -942,32 +942,32 @@ static void BITBLT_GetSrcArea( DC *dcSrc, DC *dcDst, Pixmap pixmap, GC gc, { if (X11DRV_PALETTE_XPixelToPalette) { - XSetBackground( display, gc, + XSetBackground( gdi_display, gc, X11DRV_PALETTE_XPixelToPalette[physDevDst->textPixel] ); - XSetForeground( display, gc, + XSetForeground( gdi_display, gc, X11DRV_PALETTE_XPixelToPalette[physDevDst->backgroundPixel]); } else { - XSetBackground( display, gc, physDevDst->textPixel ); - XSetForeground( display, gc, physDevDst->backgroundPixel ); + XSetBackground( gdi_display, gc, physDevDst->textPixel ); + XSetForeground( gdi_display, gc, physDevDst->backgroundPixel ); } - XCopyPlane( display, physDevSrc->drawable, pixmap, gc, + XCopyPlane( gdi_display, physDevSrc->drawable, pixmap, gc, visRectSrc->left, visRectSrc->top, width, height, 0, 0, 1 ); } else /* color -> monochrome */ { /* FIXME: avoid BadMatch error */ - imageSrc = XGetImage( display, physDevSrc->drawable, + imageSrc = XGetImage( gdi_display, physDevSrc->drawable, visRectSrc->left, visRectSrc->top, width, height, AllPlanes, ZPixmap ); - XCREATEIMAGE( imageDst, width, height, dcDst->bitsPerPixel ); + imageDst = X11DRV_DIB_CreateXImage( width, height, dcDst->bitsPerPixel ); for (y = 0; y < height; y++) for (x = 0; x < width; x++) XPutPixel(imageDst, x, y, (XGetPixel(imageSrc,x,y) == physDevSrc->backgroundPixel) ); - XPutImage( display, pixmap, gc, imageDst, + XPutImage( gdi_display, pixmap, gc, imageDst, 0, 0, 0, 0, width, height ); XDestroyImage( imageSrc ); XDestroyImage( imageDst ); @@ -991,7 +991,7 @@ static void BITBLT_GetDstArea(DC *dc, Pixmap pixmap, GC gc, RECT *visRectDst) if (!X11DRV_PALETTE_XPixelToPalette || (dc->bitsPerPixel == 1) || (X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_VIRTUAL) ) { - XCopyArea( display, physDev->drawable, pixmap, gc, + XCopyArea( gdi_display, physDev->drawable, pixmap, gc, visRectDst->left, visRectDst->top, width, height, 0, 0 ); } else @@ -1000,22 +1000,22 @@ static void BITBLT_GetDstArea(DC *dc, Pixmap pixmap, GC gc, RECT *visRectDst) XImage *image; if (dc->flags & DC_MEMORY) - image = XGetImage( display, physDev->drawable, + image = XGetImage( gdi_display, physDev->drawable, visRectDst->left, visRectDst->top, width, height, AllPlanes, ZPixmap ); else { /* Make sure we don't get a BadMatch error */ - XCopyArea( display, physDev->drawable, pixmap, gc, + XCopyArea( gdi_display, physDev->drawable, pixmap, gc, visRectDst->left, visRectDst->top, width, height, 0, 0); - image = XGetImage( display, pixmap, 0, 0, width, height, + image = XGetImage( gdi_display, pixmap, 0, 0, width, height, AllPlanes, ZPixmap ); } for (y = 0; y < height; y++) for (x = 0; x < width; x++) XPutPixel( image, x, y, X11DRV_PALETTE_XPixelToPalette[XGetPixel( image, x, y )]); - XPutImage( display, pixmap, gc, image, 0, 0, 0, 0, width, height ); + XPutImage( gdi_display, pixmap, gc, image, 0, 0, 0, 0, width, height ); XDestroyImage( image ); } } @@ -1038,13 +1038,13 @@ static void BITBLT_PutDstArea(DC *dc, Pixmap pixmap, GC gc, RECT *visRectDst) if (!X11DRV_PALETTE_PaletteToXPixel || (dc->bitsPerPixel == 1) || (X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_VIRTUAL) ) { - XCopyArea( display, pixmap, physDev->drawable, gc, 0, 0, + XCopyArea( gdi_display, pixmap, physDev->drawable, gc, 0, 0, width, height, visRectDst->left, visRectDst->top ); } else { register INT x, y; - XImage *image = XGetImage( display, pixmap, 0, 0, width, height, + XImage *image = XGetImage( gdi_display, pixmap, 0, 0, width, height, AllPlanes, ZPixmap ); for (y = 0; y < height; y++) for (x = 0; x < width; x++) @@ -1052,7 +1052,7 @@ static void BITBLT_PutDstArea(DC *dc, Pixmap pixmap, GC gc, RECT *visRectDst) XPutPixel( image, x, y, X11DRV_PALETTE_PaletteToXPixel[XGetPixel( image, x, y )]); } - XPutImage( display, physDev->drawable, gc, image, 0, 0, + XPutImage( gdi_display, physDev->drawable, gc, image, 0, 0, visRectDst->left, visRectDst->top, width, height ); XDestroyImage( image ); } @@ -1247,14 +1247,14 @@ static BOOL BITBLT_InternalStretchBlt( DC *dcDst, INT xDst, INT yDst, { case BLACKNESS: /* 0x00 */ if ((dcDst->bitsPerPixel == 1) || !X11DRV_PALETTE_PaletteToXPixel) - XSetFunction( display, physDevDst->gc, GXclear ); + XSetFunction( gdi_display, physDevDst->gc, GXclear ); else { - XSetFunction( display, physDevDst->gc, GXcopy ); - XSetForeground( display, physDevDst->gc, X11DRV_PALETTE_PaletteToXPixel[0] ); - XSetFillStyle( display, physDevDst->gc, FillSolid ); + XSetFunction( gdi_display, physDevDst->gc, GXcopy ); + XSetForeground( gdi_display, physDevDst->gc, X11DRV_PALETTE_PaletteToXPixel[0] ); + XSetFillStyle( gdi_display, physDevDst->gc, FillSolid ); } - XFillRectangle( display, physDevDst->drawable, physDevDst->gc, + XFillRectangle( gdi_display, physDevDst->drawable, physDevDst->gc, visRectDst.left, visRectDst.top, width, height ); return TRUE; @@ -1262,22 +1262,22 @@ static BOOL BITBLT_InternalStretchBlt( DC *dcDst, INT xDst, INT yDst, if ((dcDst->bitsPerPixel == 1) || !X11DRV_PALETTE_PaletteToXPixel || !perfect_graphics()) { - XSetFunction( display, physDevDst->gc, GXinvert ); + XSetFunction( gdi_display, physDevDst->gc, GXinvert ); if( X11DRV_PALETTE_PaletteFlags & (X11DRV_PALETTE_PRIVATE | X11DRV_PALETTE_VIRTUAL) ) - XSetFunction( display, physDevDst->gc, GXinvert); + XSetFunction( gdi_display, physDevDst->gc, GXinvert); else { /* Xor is much better when we do not have full colormap. */ /* Using white^black ensures that we invert at least black */ /* and white. */ - Pixel xor_pix = (WhitePixelOfScreen(X11DRV_GetXScreen()) ^ - BlackPixelOfScreen(X11DRV_GetXScreen())); - XSetFunction( display, physDevDst->gc, GXxor ); - XSetForeground( display, physDevDst->gc, xor_pix); - XSetFillStyle( display, physDevDst->gc, FillSolid ); + Pixel xor_pix = (WhitePixel( gdi_display, DefaultScreen(gdi_display) ) ^ + BlackPixel( gdi_display, DefaultScreen(gdi_display) )); + XSetFunction( gdi_display, physDevDst->gc, GXxor ); + XSetForeground( gdi_display, physDevDst->gc, xor_pix); + XSetFillStyle( gdi_display, physDevDst->gc, FillSolid ); } - XFillRectangle( display, physDevDst->drawable, physDevDst->gc, + XFillRectangle( gdi_display, physDevDst->drawable, physDevDst->gc, visRectDst.left, visRectDst.top, width, height ); return TRUE; } @@ -1287,8 +1287,8 @@ static BOOL BITBLT_InternalStretchBlt( DC *dcDst, INT xDst, INT yDst, if (perfect_graphics()) break; if (X11DRV_SetupGCForBrush( dcDst )) { - XSetFunction( display, physDevDst->gc, GXxor ); - XFillRectangle( display, physDevDst->drawable, physDevDst->gc, + XSetFunction( gdi_display, physDevDst->gc, GXxor ); + XFillRectangle( gdi_display, physDevDst->drawable, physDevDst->gc, visRectDst.left, visRectDst.top, width, height ); } return TRUE; @@ -1297,8 +1297,8 @@ static BOOL BITBLT_InternalStretchBlt( DC *dcDst, INT xDst, INT yDst, if (perfect_graphics()) break; if (X11DRV_SetupGCForBrush( dcDst )) { - XSetFunction( display, physDevDst->gc, GXequiv ); - XFillRectangle( display, physDevDst->drawable, physDevDst->gc, + XSetFunction( gdi_display, physDevDst->gc, GXequiv ); + XFillRectangle( gdi_display, physDevDst->drawable, physDevDst->gc, visRectDst.left, visRectDst.top, width, height ); } return TRUE; @@ -1307,61 +1307,60 @@ static BOOL BITBLT_InternalStretchBlt( DC *dcDst, INT xDst, INT yDst, if (dcSrc->bitsPerPixel == dcDst->bitsPerPixel) { BOOL expose = !(dcSrc->flags & DC_MEMORY) && !(dcDst->flags & DC_MEMORY); - if ( expose ) XSetGraphicsExposures( display, physDevDst->gc, True ); - XSetFunction( display, physDevDst->gc, GXcopy ); - XCopyArea( display, physDevSrc->drawable, + if ( expose ) XSetGraphicsExposures( gdi_display, physDevDst->gc, True ); + XSetFunction( gdi_display, physDevDst->gc, GXcopy ); + XCopyArea( gdi_display, physDevSrc->drawable, physDevDst->drawable, physDevDst->gc, visRectSrc.left, visRectSrc.top, width, height, visRectDst.left, visRectDst.top ); - if ( expose ) XSetGraphicsExposures( display, physDevDst->gc, False ); + if ( expose ) XSetGraphicsExposures( gdi_display, physDevDst->gc, False ); return TRUE; } if (dcSrc->bitsPerPixel == 1) { BOOL expose = !(dcSrc->flags & DC_MEMORY) && !(dcDst->flags & DC_MEMORY); - XSetBackground( display, physDevDst->gc, physDevDst->textPixel ); - XSetForeground( display, physDevDst->gc, - physDevDst->backgroundPixel ); - XSetFunction( display, physDevDst->gc, GXcopy ); - if ( expose ) XSetGraphicsExposures( display, physDevDst->gc, True ); - XCopyPlane( display, physDevSrc->drawable, + XSetBackground( gdi_display, physDevDst->gc, physDevDst->textPixel ); + XSetForeground( gdi_display, physDevDst->gc, physDevDst->backgroundPixel ); + XSetFunction( gdi_display, physDevDst->gc, GXcopy ); + if ( expose ) XSetGraphicsExposures( gdi_display, physDevDst->gc, True ); + XCopyPlane( gdi_display, physDevSrc->drawable, physDevDst->drawable, physDevDst->gc, visRectSrc.left, visRectSrc.top, width, height, visRectDst.left, visRectDst.top, 1 ); - if ( expose ) XSetGraphicsExposures( display, physDevDst->gc, False ); + if ( expose ) XSetGraphicsExposures( gdi_display, physDevDst->gc, False ); return TRUE; } break; case PATCOPY: /* 0xf0 */ if (!X11DRV_SetupGCForBrush( dcDst )) return TRUE; - XSetFunction( display, physDevDst->gc, GXcopy ); - XFillRectangle( display, physDevDst->drawable, physDevDst->gc, + XSetFunction( gdi_display, physDevDst->gc, GXcopy ); + XFillRectangle( gdi_display, physDevDst->drawable, physDevDst->gc, visRectDst.left, visRectDst.top, width, height ); return TRUE; case WHITENESS: /* 0xff */ if ((dcDst->bitsPerPixel == 1) || !X11DRV_PALETTE_PaletteToXPixel) - XSetFunction( display, physDevDst->gc, GXset ); + XSetFunction( gdi_display, physDevDst->gc, GXset ); else { - XSetFunction( display, physDevDst->gc, GXcopy ); - XSetForeground( display, physDevDst->gc, - WhitePixelOfScreen( X11DRV_GetXScreen() )); - XSetFillStyle( display, physDevDst->gc, FillSolid ); + XSetFunction( gdi_display, physDevDst->gc, GXcopy ); + XSetForeground( gdi_display, physDevDst->gc, + WhitePixel( gdi_display, DefaultScreen(gdi_display) )); + XSetFillStyle( gdi_display, physDevDst->gc, FillSolid ); } - XFillRectangle( display, physDevDst->drawable, physDevDst->gc, + XFillRectangle( gdi_display, physDevDst->drawable, physDevDst->gc, visRectDst.left, visRectDst.top, width, height ); return TRUE; } - tmpGC = XCreateGC( display, physDevDst->drawable, 0, NULL ); - XSetGraphicsExposures( display, tmpGC, False ); - pixmaps[DST] = XCreatePixmap( display, X11DRV_GetXRootWindow(), width, height, + tmpGC = XCreateGC( gdi_display, physDevDst->drawable, 0, NULL ); + XSetGraphicsExposures( gdi_display, tmpGC, False ); + pixmaps[DST] = XCreatePixmap( gdi_display, root_window, width, height, dcDst->bitsPerPixel ); if (useSrc) { - pixmaps[SRC] = XCreatePixmap( display, X11DRV_GetXRootWindow(), width, height, + pixmaps[SRC] = XCreatePixmap( gdi_display, root_window, width, height, dcDst->bitsPerPixel ); if (fStretch) BITBLT_GetSrcAreaStretch( dcSrc, dcDst, pixmaps[SRC], tmpGC, @@ -1380,13 +1379,13 @@ static BOOL BITBLT_InternalStretchBlt( DC *dcDst, INT xDst, INT yDst, for (opcode = BITBLT_Opcodes[(rop >> 16) & 0xff]; *opcode; opcode++) { if (OP_DST(*opcode) == DST) destUsed = TRUE; - XSetFunction( display, tmpGC, OP_ROP(*opcode) ); + XSetFunction( gdi_display, tmpGC, OP_ROP(*opcode) ); switch(OP_SRCDST(*opcode)) { case OP_ARGS(DST,TMP): case OP_ARGS(SRC,TMP): if (!pixmaps[TMP]) - pixmaps[TMP] = XCreatePixmap( display, X11DRV_GetXRootWindow(), + pixmaps[TMP] = XCreatePixmap( gdi_display, root_window, width, height, dcDst->bitsPerPixel ); /* fall through */ @@ -1394,32 +1393,32 @@ static BOOL BITBLT_InternalStretchBlt( DC *dcDst, INT xDst, INT yDst, case OP_ARGS(SRC,DST): case OP_ARGS(TMP,SRC): case OP_ARGS(TMP,DST): - XCopyArea( display, pixmaps[OP_SRC(*opcode)], + XCopyArea( gdi_display, pixmaps[OP_SRC(*opcode)], pixmaps[OP_DST(*opcode)], tmpGC, 0, 0, width, height, 0, 0 ); break; case OP_ARGS(PAT,TMP): if (!pixmaps[TMP] && !fNullBrush) - pixmaps[TMP] = XCreatePixmap( display, X11DRV_GetXRootWindow(), + pixmaps[TMP] = XCreatePixmap( gdi_display, root_window, width, height, dcDst->bitsPerPixel ); /* fall through */ case OP_ARGS(PAT,DST): case OP_ARGS(PAT,SRC): if (!fNullBrush) - XFillRectangle( display, pixmaps[OP_DST(*opcode)], + XFillRectangle( gdi_display, pixmaps[OP_DST(*opcode)], tmpGC, 0, 0, width, height ); break; } } - XSetFunction( display, physDevDst->gc, GXcopy ); + XSetFunction( gdi_display, physDevDst->gc, GXcopy ); BITBLT_PutDstArea( dcDst, pixmaps[destUsed ? DST : SRC], physDevDst->gc, &visRectDst ); - XFreePixmap( display, pixmaps[DST] ); - if (pixmaps[SRC]) XFreePixmap( display, pixmaps[SRC] ); - if (pixmaps[TMP]) XFreePixmap( display, pixmaps[TMP] ); - XFreeGC( display, tmpGC ); + XFreePixmap( gdi_display, pixmaps[DST] ); + if (pixmaps[SRC]) XFreePixmap( gdi_display, pixmaps[SRC] ); + if (pixmaps[TMP]) XFreePixmap( gdi_display, pixmaps[TMP] ); + XFreeGC( gdi_display, tmpGC ); return TRUE; } diff --git a/graphics/x11drv/bitmap.c b/graphics/x11drv/bitmap.c index 665bd6ccb21..343323e1f21 100644 --- a/graphics/x11drv/bitmap.c +++ b/graphics/x11drv/bitmap.c @@ -33,29 +33,27 @@ GC BITMAP_monoGC = 0, BITMAP_colorGC = 0; BOOL X11DRV_BITMAP_Init(void) { Pixmap tmpPixmap; - + /* Create the necessary GCs */ - - if ((tmpPixmap = TSXCreatePixmap(display, - X11DRV_GetXRootWindow(), - 1, 1, - 1))) + + wine_tsx11_lock(); + if ((tmpPixmap = XCreatePixmap( gdi_display, root_window, 1, 1, 1 ))) { - BITMAP_monoGC = TSXCreateGC( display, tmpPixmap, 0, NULL ); - TSXSetGraphicsExposures( display, BITMAP_monoGC, False ); - TSXFreePixmap( display, tmpPixmap ); + BITMAP_monoGC = XCreateGC( gdi_display, tmpPixmap, 0, NULL ); + XSetGraphicsExposures( gdi_display, BITMAP_monoGC, False ); + XFreePixmap( gdi_display, tmpPixmap ); } - if (X11DRV_GetDepth() != 1) + if (screen_depth != 1) { - if ((tmpPixmap = TSXCreatePixmap(display, X11DRV_GetXRootWindow(), - 1, 1, X11DRV_GetDepth()))) - { - BITMAP_colorGC = TSXCreateGC( display, tmpPixmap, 0, NULL ); - TSXSetGraphicsExposures( display, BITMAP_colorGC, False ); - TSXFreePixmap( display, tmpPixmap ); - } + if ((tmpPixmap = XCreatePixmap( gdi_display, root_window, 1, 1, screen_depth ))) + { + BITMAP_colorGC = XCreateGC( gdi_display, tmpPixmap, 0, NULL ); + XSetGraphicsExposures( gdi_display, BITMAP_colorGC, False ); + XFreePixmap( gdi_display, tmpPixmap ); + } } + wine_tsx11_unlock(); return TRUE; } @@ -99,9 +97,11 @@ HBITMAP X11DRV_BITMAP_SelectObject( DC * dc, HBITMAP hbitmap, if (dc->bitsPerPixel != bmp->bitmap.bmBitsPixel) { - TSXFreeGC( display, physDev->gc ); - physDev->gc = TSXCreateGC( display, physDev->drawable, 0, NULL ); - TSXSetGraphicsExposures( display, physDev->gc, False ); + wine_tsx11_lock(); + XFreeGC( gdi_display, physDev->gc ); + physDev->gc = XCreateGC( gdi_display, physDev->drawable, 0, NULL ); + XSetGraphicsExposures( gdi_display, physDev->gc, False ); + wine_tsx11_unlock(); dc->bitsPerPixel = bmp->bitmap.bmBitsPixel; DC_InitDC( dc ); } @@ -134,8 +134,7 @@ BOOL X11DRV_CreateBitmap( HBITMAP hbitmap ) GDI_ReleaseObj( hbitmap ); return 0; } - if ((bmp->bitmap.bmBitsPixel != 1) && - (bmp->bitmap.bmBitsPixel != X11DRV_GetDepth())) + if ((bmp->bitmap.bmBitsPixel != 1) && (bmp->bitmap.bmBitsPixel != screen_depth)) { ERR("Trying to make bitmap with planes=%d, bpp=%d\n", bmp->bitmap.bmPlanes, bmp->bitmap.bmBitsPixel); @@ -147,7 +146,7 @@ BOOL X11DRV_CreateBitmap( HBITMAP hbitmap ) bmp->bitmap.bmHeight, bmp->bitmap.bmBitsPixel); /* Create the pixmap */ - if (!(bmp->physBitmap = (void *)TSXCreatePixmap(display, X11DRV_GetXRootWindow(), + if (!(bmp->physBitmap = (void *)TSXCreatePixmap(gdi_display, root_window, bmp->bitmap.bmWidth, bmp->bitmap.bmHeight, bmp->bitmap.bmBitsPixel))) { @@ -191,7 +190,7 @@ static LONG X11DRV_GetBitmapBits(BITMAPOBJ *bmp, void *buffer, LONG count) old_height = bmp->bitmap.bmHeight; height = bmp->bitmap.bmHeight = count / bmp->bitmap.bmWidthBytes; - image = XGetImage( display, (Pixmap)bmp->physBitmap, + image = XGetImage( gdi_display, (Pixmap)bmp->physBitmap, 0, 0, bmp->bitmap.bmWidth, bmp->bitmap.bmHeight, AllPlanes, ZPixmap ); bmp->bitmap.bmHeight = old_height; @@ -313,7 +312,7 @@ static LONG X11DRV_SetBitmapBits(BITMAPOBJ *bmp, void *bits, LONG count) height = count / bmp->bitmap.bmWidthBytes; wine_tsx11_lock(); - image = XCreateImage( display, X11DRV_GetVisual(), bmp->bitmap.bmBitsPixel, ZPixmap, 0, NULL, + image = XCreateImage( gdi_display, visual, bmp->bitmap.bmBitsPixel, ZPixmap, 0, NULL, bmp->bitmap.bmWidth, height, 32, 0 ); if (!(image->data = (LPBYTE)malloc(image->bytes_per_line * height))) { @@ -404,7 +403,7 @@ static LONG X11DRV_SetBitmapBits(BITMAPOBJ *bmp, void *bits, LONG count) FIXME("Unhandled bits:%d\n", bmp->bitmap.bmBitsPixel); } - XPutImage( display, (Pixmap)bmp->physBitmap, BITMAP_GC(bmp), + XPutImage( gdi_display, (Pixmap)bmp->physBitmap, BITMAP_GC(bmp), image, 0, 0, 0, 0, bmp->bitmap.bmWidth, height ); XDestroyImage( image ); /* frees image->data too */ wine_tsx11_unlock(); @@ -440,7 +439,7 @@ LONG X11DRV_BitmapBits(HBITMAP hbitmap, void *bits, LONG count, WORD flags) */ BOOL X11DRV_BITMAP_DeleteObject( HBITMAP hbitmap, BITMAPOBJ * bmp ) { - TSXFreePixmap( display, (Pixmap)bmp->physBitmap ); + TSXFreePixmap( gdi_display, (Pixmap)bmp->physBitmap ); bmp->physBitmap = NULL; bmp->funcs = NULL; return TRUE; @@ -463,7 +462,7 @@ HBITMAP X11DRV_BITMAP_CreateBitmapHeaderFromPixmap(Pixmap pixmap) unsigned int depth, width, height; /* Get the Pixmap dimensions and bit depth */ - if ( 0 == TSXGetGeometry(display, pixmap, &root, &x, &y, &width, &height, + if ( 0 == TSXGetGeometry(gdi_display, pixmap, &root, &x, &y, &width, &height, &border_width, &depth) ) goto END; diff --git a/graphics/x11drv/brush.c b/graphics/x11drv/brush.c index 84eca7fd913..2dba09431ad 100644 --- a/graphics/x11drv/brush.c +++ b/graphics/x11drv/brush.c @@ -91,18 +91,6 @@ static const int EGAmapping[TOTAL_LEVELS] = static XImage *ditherImage = NULL; -/*********************************************************************** - * BRUSH_Init - * - * Create the X image used for dithering. - */ -BOOL X11DRV_BRUSH_Init(void) -{ - XCREATEIMAGE( ditherImage, MATRIX_SIZE, MATRIX_SIZE, X11DRV_GetDepth() ); - return (ditherImage != NULL); -} - - /*********************************************************************** * BRUSH_DitherColor */ @@ -112,6 +100,12 @@ static Pixmap BRUSH_DitherColor( DC *dc, COLORREF color ) unsigned int x, y; Pixmap pixmap; + if (!ditherImage) + { + ditherImage = X11DRV_DIB_CreateXImage( MATRIX_SIZE, MATRIX_SIZE, screen_depth ); + if (!ditherImage) return 0; + } + wine_tsx11_lock(); if (color != prevColor) { @@ -134,9 +128,8 @@ static Pixmap BRUSH_DitherColor( DC *dc, COLORREF color ) prevColor = color; } - pixmap = XCreatePixmap( display, X11DRV_GetXRootWindow(), - MATRIX_SIZE, MATRIX_SIZE, X11DRV_GetDepth() ); - XPutImage( display, pixmap, BITMAP_colorGC, ditherImage, 0, 0, + pixmap = XCreatePixmap( gdi_display, root_window, MATRIX_SIZE, MATRIX_SIZE, screen_depth ); + XPutImage( gdi_display, pixmap, BITMAP_colorGC, ditherImage, 0, 0, 0, 0, MATRIX_SIZE, MATRIX_SIZE ); wine_tsx11_unlock(); return pixmap; @@ -150,7 +143,7 @@ static void BRUSH_SelectSolidBrush( DC *dc, COLORREF color ) { X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; - if ((dc->bitsPerPixel > 1) && (X11DRV_GetDepth() <= 8) && !COLOR_IsSolid( color )) + if ((dc->bitsPerPixel > 1) && (screen_depth <= 8) && !COLOR_IsSolid( color )) { /* Dithered brush */ physDev->brush.pixmap = BRUSH_DitherColor( dc, color ); @@ -188,17 +181,17 @@ static BOOL BRUSH_SelectPatternBrush( DC * dc, HBITMAP hbitmap ) if ((dc->bitsPerPixel == 1) && (bmp->bitmap.bmBitsPixel != 1)) { /* Special case: a color pattern on a monochrome DC */ - physDev->brush.pixmap = TSXCreatePixmap( display, X11DRV_GetXRootWindow(), 8, 8, 1); + physDev->brush.pixmap = TSXCreatePixmap( gdi_display, root_window, 8, 8, 1); /* FIXME: should probably convert to monochrome instead */ - TSXCopyPlane( display, (Pixmap)bmp->physBitmap, physDev->brush.pixmap, - BITMAP_monoGC, 0, 0, 8, 8, 0, 0, 1 ); + TSXCopyPlane( gdi_display, (Pixmap)bmp->physBitmap, physDev->brush.pixmap, + BITMAP_monoGC, 0, 0, 8, 8, 0, 0, 1 ); } else { - physDev->brush.pixmap = TSXCreatePixmap( display, X11DRV_GetXRootWindow(), - 8, 8, bmp->bitmap.bmBitsPixel ); - TSXCopyArea( display, (Pixmap)bmp->physBitmap, physDev->brush.pixmap, - BITMAP_GC(bmp), 0, 0, 8, 8, 0, 0 ); + physDev->brush.pixmap = TSXCreatePixmap( gdi_display, root_window, + 8, 8, bmp->bitmap.bmBitsPixel ); + TSXCopyArea( gdi_display, (Pixmap)bmp->physBitmap, physDev->brush.pixmap, + BITMAP_GC(bmp), 0, 0, 8, 8, 0, 0 ); } if (bmp->bitmap.bmBitsPixel > 1) @@ -237,7 +230,7 @@ HBRUSH X11DRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush, BRUSHOBJ * brush ) if (physDev->brush.pixmap) { - TSXFreePixmap( display, physDev->brush.pixmap ); + TSXFreePixmap( gdi_display, physDev->brush.pixmap ); physDev->brush.pixmap = 0; } physDev->brush.style = brush->logbrush.lbStyle; @@ -256,7 +249,7 @@ HBRUSH X11DRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush, BRUSHOBJ * brush ) case BS_HATCHED: TRACE("BS_HATCHED\n" ); physDev->brush.pixel = X11DRV_PALETTE_ToPhysical( dc, brush->logbrush.lbColor ); - physDev->brush.pixmap = TSXCreateBitmapFromData( display, X11DRV_GetXRootWindow(), + physDev->brush.pixmap = TSXCreateBitmapFromData( gdi_display, root_window, HatchBrushes[brush->logbrush.lbHatch], 8, 8 ); physDev->brush.fillStyle = FillStippled; break; diff --git a/graphics/x11drv/clipping.c b/graphics/x11drv/clipping.c index c71833a3576..e1090e8753d 100644 --- a/graphics/x11drv/clipping.c +++ b/graphics/x11drv/clipping.c @@ -63,7 +63,7 @@ void X11DRV_SetDeviceClipping( DC * dc ) else pXrect = NULL; - TSXSetClipRectangles( display, physDev->gc, 0, 0, + TSXSetClipRectangles( gdi_display, physDev->gc, 0, 0, pXrect, obj->rgn->numRects, YXBanded ); if(pXrect) diff --git a/graphics/x11drv/dib.c b/graphics/x11drv/dib.c index 58052f705a8..dae4cb325a9 100644 --- a/graphics/x11drv/dib.c +++ b/graphics/x11drv/dib.c @@ -32,8 +32,7 @@ DEFAULT_DEBUG_CHANNEL(bitmap); DECLARE_DEBUG_CHANNEL(x11drv); -static int bitmapDepthTable[] = { 8, 1, 32, 16, 24, 15, 4, 0 }; -static int ximageDepthTable[] = { 0, 0, 0, 0, 0, 0, 0 }; +static int ximageDepthTable[32]; static int XShmErrorFlag = 0; @@ -66,46 +65,56 @@ typedef struct int dibpitch; } X11DRV_DIB_IMAGEBITS_DESCR; -/*********************************************************************** - * X11DRV_DIB_Init - */ -BOOL X11DRV_DIB_Init(void) -{ - int i; - XImage* testimage; - - for( i = 0; bitmapDepthTable[i]; i++ ) - { - testimage = TSXCreateImage(display, X11DRV_GetVisual(), - bitmapDepthTable[i], ZPixmap, 0, NULL, 1, 1, 32, 20 ); - if( testimage ) ximageDepthTable[i] = testimage->bits_per_pixel; - else return FALSE; - TSXDestroyImage(testimage); - } - return TRUE; -} - /*********************************************************************** * X11DRV_DIB_GetXImageWidthBytes * * Return the width of an X image in bytes */ -int X11DRV_DIB_GetXImageWidthBytes( int width, int depth ) +inline static int X11DRV_DIB_GetXImageWidthBytes( int width, int depth ) { - int i; + if (!depth || depth > 32) goto error; - if (!ximageDepthTable[0]) { - X11DRV_DIB_Init(); + if (!ximageDepthTable[depth-1]) + { + XImage *testimage = XCreateImage( gdi_display, visual, depth, + ZPixmap, 0, NULL, 1, 1, 32, 20 ); + if (testimage) + { + ximageDepthTable[depth-1] = testimage->bits_per_pixel; + XDestroyImage( testimage ); + } + else ximageDepthTable[depth-1] = -1; } - for( i = 0; bitmapDepthTable[i] ; i++ ) - if( bitmapDepthTable[i] == depth ) - return (4 * ((width * ximageDepthTable[i] + 31)/32)); - - WARN("(%d): Unsupported depth\n", depth ); - return (4 * width); + if (ximageDepthTable[depth-1] != -1) + return (4 * ((width * ximageDepthTable[depth-1] + 31) / 32)); + + error: + WARN( "(%d): Unsupported depth\n", depth ); + return 4 * width; } + +/*********************************************************************** + * X11DRV_DIB_CreateXImage + * + * Create an X image. + */ +XImage *X11DRV_DIB_CreateXImage( int width, int height, int depth ) +{ + int width_bytes; + XImage *image; + + wine_tsx11_lock(); + width_bytes = X11DRV_DIB_GetXImageWidthBytes( width, depth ); + image = XCreateImage( gdi_display, visual, depth, ZPixmap, 0, + calloc( height, width_bytes ), + width, height, 32, width_bytes ); + wine_tsx11_unlock(); + return image; +} + + /*********************************************************************** * X11DRV_DIB_GenColorMap * @@ -2688,7 +2697,7 @@ static int X11DRV_DIB_SetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr ) if (descr->image) bmpImage = descr->image; else { - bmpImage = XCreateImage( display, X11DRV_GetVisual(), descr->depth, ZPixmap, 0, NULL, + bmpImage = XCreateImage( gdi_display, visual, descr->depth, ZPixmap, 0, NULL, descr->infoWidth, lines, 32, 0 ); bmpImage->data = calloc( lines, bmpImage->bytes_per_line ); if(bmpImage->data == NULL) { @@ -2709,7 +2718,7 @@ static int X11DRV_DIB_SetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr ) break; case 4: if (descr->compression) { - XGetSubImage( display, descr->drawable, descr->xDest, descr->yDest, + XGetSubImage( gdi_display, descr->drawable, descr->xDest, descr->yDest, descr->width, descr->height, AllPlanes, ZPixmap, bmpImage, descr->xSrc, descr->ySrc ); @@ -2725,7 +2734,7 @@ static int X11DRV_DIB_SetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr ) break; case 8: if (descr->compression) { - XGetSubImage( display, descr->drawable, descr->xDest, descr->yDest, + XGetSubImage( gdi_display, descr->drawable, descr->xDest, descr->yDest, descr->width, descr->height, AllPlanes, ZPixmap, bmpImage, descr->xSrc, descr->ySrc ); X11DRV_DIB_SetImageBits_RLE8( descr->lines, descr->bits, @@ -2763,19 +2772,19 @@ static int X11DRV_DIB_SetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr ) break; } - TRACE("XPutImage(%p,%ld,%p,%p,%d,%d,%d,%d,%d,%d)\n", - display, descr->drawable, descr->gc, bmpImage, + TRACE("XPutImage(%ld,%p,%p,%d,%d,%d,%d,%d,%d)\n", + descr->drawable, descr->gc, bmpImage, descr->xSrc, descr->ySrc, descr->xDest, descr->yDest, descr->width, descr->height); if (descr->useShm) { - XShmPutImage( display, descr->drawable, descr->gc, bmpImage, + XShmPutImage( gdi_display, descr->drawable, descr->gc, bmpImage, descr->xSrc, descr->ySrc, descr->xDest, descr->yDest, descr->width, descr->height, FALSE ); - XSync( display, 0 ); + XSync( gdi_display, 0 ); } else - XPutImage( display, descr->drawable, descr->gc, bmpImage, + XPutImage( gdi_display, descr->drawable, descr->gc, bmpImage, descr->xSrc, descr->ySrc, descr->xDest, descr->yDest, descr->width, descr->height ); @@ -2798,7 +2807,7 @@ static int X11DRV_DIB_GetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr ) if (descr->image) bmpImage = descr->image; else { - bmpImage = XCreateImage( display, X11DRV_GetVisual(), descr->depth, ZPixmap, 0, NULL, + bmpImage = XCreateImage( gdi_display, visual, descr->depth, ZPixmap, 0, NULL, descr->infoWidth, lines, 32, 0 ); bmpImage->data = calloc( lines, bmpImage->bytes_per_line ); if(bmpImage->data == NULL) { @@ -2809,10 +2818,10 @@ static int X11DRV_DIB_GetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr ) } } - TRACE("XGetSubImage(%p,%ld,%d,%d,%d,%d,%ld,%d,%p,%d,%d)\n", - display, descr->drawable, descr->xSrc, descr->ySrc, descr->width, + TRACE("XGetSubImage(%ld,%d,%d,%d,%d,%ld,%d,%p,%d,%d)\n", + descr->drawable, descr->xSrc, descr->ySrc, descr->width, lines, AllPlanes, ZPixmap, bmpImage, descr->xDest, descr->yDest); - XGetSubImage( display, descr->drawable, descr->xSrc, descr->ySrc, + XGetSubImage( gdi_display, descr->drawable, descr->xSrc, descr->ySrc, descr->width, lines, AllPlanes, ZPixmap, bmpImage, descr->xDest, descr->yDest ); @@ -2907,7 +2916,7 @@ INT X11DRV_SetDIBitsToDevice( DC *dc, INT xDest, INT yDest, DWORD cx, if (!cx || !cy) return 0; X11DRV_SetupGCForText( dc ); /* To have the correct colors */ - TSXSetFunction(display, physDev->gc, X11DRV_XROPfunction[dc->ROPmode-1]); + TSXSetFunction(gdi_display, physDev->gc, X11DRV_XROPfunction[dc->ROPmode-1]); switch (descr.infoBpp) { @@ -3776,29 +3785,30 @@ static int XShmErrorHandler(Display *dpy, XErrorEvent *event) */ #ifdef HAVE_LIBXXSHM -extern BOOL X11DRV_XShmCreateImage(XImage** image, int width, int height, int bpp, - XShmSegmentInfo* shminfo) +static XImage *X11DRV_XShmCreateImage( int width, int height, int bpp, + XShmSegmentInfo* shminfo) { int (*WineXHandler)(Display *, XErrorEvent *); - - *image = TSXShmCreateImage(display, X11DRV_GetVisual(), bpp, ZPixmap, NULL, shminfo, width, height); - if( *image != NULL ) + XImage *image; + + wine_tsx11_lock(); + image = XShmCreateImage(gdi_display, visual, bpp, ZPixmap, NULL, shminfo, width, height); + if (image) { - wine_tsx11_lock(); - shminfo->shmid = shmget(IPC_PRIVATE, (*image)->bytes_per_line * height, + shminfo->shmid = shmget(IPC_PRIVATE, image->bytes_per_line * height, IPC_CREAT|0700); if( shminfo->shmid != -1 ) { - shminfo->shmaddr = (*image)->data = shmat(shminfo->shmid, 0, 0); + shminfo->shmaddr = image->data = shmat(shminfo->shmid, 0, 0); if( shminfo->shmaddr != (char*)-1 ) { shminfo->readOnly = FALSE; - if( TSXShmAttach( display, shminfo ) != 0) + if( XShmAttach( gdi_display, shminfo ) != 0) { - /* Reset the error flag */ + /* Reset the error flag */ XShmErrorFlag = 0; WineXHandler = XSetErrorHandler(XShmErrorHandler); - XSync( display, 0 ); + XSync( gdi_display, 0 ); if (!XShmErrorFlag) { @@ -3806,8 +3816,8 @@ extern BOOL X11DRV_XShmCreateImage(XImage** image, int width, int height, int bp XSetErrorHandler(WineXHandler); wine_tsx11_unlock(); - return TRUE; /* Success! */ - } + return image; /* Success! */ + } /* An error occured */ XShmErrorFlag = 0; XSetErrorHandler(WineXHandler); @@ -3815,16 +3825,16 @@ extern BOOL X11DRV_XShmCreateImage(XImage** image, int width, int height, int bp shmdt(shminfo->shmaddr); } shmctl(shminfo->shmid, IPC_RMID, 0); - } - XFlush(display); - XDestroyImage(*image); - wine_tsx11_unlock(); + } + XFlush(gdi_display); + XDestroyImage(image); + image = NULL; } - return FALSE; + wine_tsx11_unlock(); + return image; } #endif /* HAVE_LIBXXSHM */ - /*********************************************************************** * X11DRV_DIB_CreateDIBSection @@ -3959,17 +3969,17 @@ HBITMAP X11DRV_DIB_CreateDIBSection( if (dib && bmp) { #ifdef HAVE_LIBXXSHM - if (TSXShmQueryExtension(display) && - X11DRV_XShmCreateImage( &dib->image, bm.bmWidth, effHeight, - bmp->bitmap.bmBitsPixel, &dib->shminfo ) ) + if (TSXShmQueryExtension(gdi_display) && + (dib->image = X11DRV_XShmCreateImage( bm.bmWidth, effHeight, + bmp->bitmap.bmBitsPixel, &dib->shminfo )) ) { ; /* Created Image */ } else { - XCREATEIMAGE( dib->image, bm.bmWidth, effHeight, bmp->bitmap.bmBitsPixel ); + dib->image = X11DRV_DIB_CreateXImage( bm.bmWidth, effHeight, bmp->bitmap.bmBitsPixel ); dib->shminfo.shmid = -1; } #else - XCREATEIMAGE( dib->image, bm.bmWidth, effHeight, bmp->bitmap.bmBitsPixel ); + dib->image = X11DRV_DIB_CreateXImage( bm.bmWidth, effHeight, bmp->bitmap.bmBitsPixel ); #endif } @@ -4029,7 +4039,7 @@ void X11DRV_DIB_DeleteDIBSection(BITMAPOBJ *bmp) #ifdef HAVE_LIBXXSHM if (dib->shminfo.shmid != -1) { - TSXShmDetach (display, &(dib->shminfo)); + TSXShmDetach (gdi_display, &(dib->shminfo)); XDestroyImage (dib->image); shmdt (dib->shminfo.shmaddr); dib->shminfo.shmid = -1; diff --git a/graphics/x11drv/graphics.c b/graphics/x11drv/graphics.c index f48a758f3e4..c7ce13891e4 100644 --- a/graphics/x11drv/graphics.c +++ b/graphics/x11drv/graphics.c @@ -104,10 +104,11 @@ BOOL X11DRV_SetupGCForPatBlt( DC * dc, GC gc, BOOL fMapColors ) ** FIXME : Let's do that only if we work with X-pixels, not with Win-pixels */ if (val.function == GXinvert) - { - val.foreground = BlackPixelOfScreen(X11DRV_GetXScreen()) ^ WhitePixelOfScreen(X11DRV_GetXScreen()); + { + val.foreground = (WhitePixel( gdi_display, DefaultScreen(gdi_display) ) ^ + BlackPixel( gdi_display, DefaultScreen(gdi_display) )); val.function = GXxor; - } + } val.fill_style = physDev->brush.fillStyle; switch(val.fill_style) { @@ -124,15 +125,14 @@ BOOL X11DRV_SetupGCForPatBlt( DC * dc, GC gc, BOOL fMapColors ) register int x, y; XImage *image; wine_tsx11_lock(); - pixmap = XCreatePixmap( display, X11DRV_GetXRootWindow(), - 8, 8, X11DRV_GetDepth() ); - image = XGetImage( display, physDev->brush.pixmap, 0, 0, 8, 8, + pixmap = XCreatePixmap( gdi_display, root_window, 8, 8, screen_depth ); + image = XGetImage( gdi_display, physDev->brush.pixmap, 0, 0, 8, 8, AllPlanes, ZPixmap ); for (y = 0; y < 8; y++) for (x = 0; x < 8; x++) XPutPixel( image, x, y, X11DRV_PALETTE_XPixelToPalette[XGetPixel( image, x, y)] ); - XPutImage( display, pixmap, gc, image, 0, 0, 0, 0, 8, 8 ); + XPutImage( gdi_display, pixmap, gc, image, 0, 0, 0, 0, 8, 8 ); XDestroyImage( image ); wine_tsx11_unlock(); val.tile = pixmap; @@ -148,11 +148,11 @@ BOOL X11DRV_SetupGCForPatBlt( DC * dc, GC gc, BOOL fMapColors ) val.ts_x_origin = dc->DCOrgX + dc->brushOrgX; val.ts_y_origin = dc->DCOrgY + dc->brushOrgY; val.fill_rule = (dc->polyFillMode==WINDING) ? WindingRule : EvenOddRule; - TSXChangeGC( display, gc, + TSXChangeGC( gdi_display, gc, GCFunction | GCForeground | GCBackground | GCFillStyle | GCFillRule | GCTileStipXOrigin | GCTileStipYOrigin | mask, &val ); - if (pixmap) TSXFreePixmap( display, pixmap ); + if (pixmap) TSXFreePixmap( gdi_display, pixmap ); return TRUE; } @@ -186,11 +186,11 @@ BOOL X11DRV_SetupGCForPen( DC * dc ) switch (dc->ROPmode) { case R2_BLACK : - val.foreground = BlackPixelOfScreen( X11DRV_GetXScreen() ); + val.foreground = BlackPixel( gdi_display, DefaultScreen(gdi_display) ); val.function = GXcopy; break; case R2_WHITE : - val.foreground = WhitePixelOfScreen( X11DRV_GetXScreen() ); + val.foreground = WhitePixel( gdi_display, DefaultScreen(gdi_display) ); val.function = GXcopy; break; case R2_XORPEN : @@ -198,8 +198,8 @@ BOOL X11DRV_SetupGCForPen( DC * dc ) /* It is very unlikely someone wants to XOR with 0 */ /* This fixes the rubber-drawings in paintbrush */ if (val.foreground == 0) - val.foreground = BlackPixelOfScreen( X11DRV_GetXScreen() ) - ^ WhitePixelOfScreen( X11DRV_GetXScreen() ); + val.foreground = (WhitePixel( gdi_display, DefaultScreen(gdi_display) ) ^ + BlackPixel( gdi_display, DefaultScreen(gdi_display) )); val.function = GXxor; break; default : @@ -212,8 +212,7 @@ BOOL X11DRV_SetupGCForPen( DC * dc ) (physDev->pen.style != PS_SOLID) && (physDev->pen.style != PS_INSIDEFRAME)) { - TSXSetDashes( display, physDev->gc, 0, physDev->pen.dashes, - physDev->pen.dash_len ); + TSXSetDashes( gdi_display, physDev->gc, 0, physDev->pen.dashes, physDev->pen.dash_len ); val.line_style = (dc->backgroundMode == OPAQUE) ? LineDoubleDash : LineOnOffDash; } @@ -247,7 +246,7 @@ BOOL X11DRV_SetupGCForPen( DC * dc ) default: val.join_style = JoinRound; } - TSXChangeGC( display, physDev->gc, + TSXChangeGC( gdi_display, physDev->gc, GCFunction | GCForeground | GCBackground | GCLineWidth | GCLineStyle | GCCapStyle | GCJoinStyle | GCFillStyle, &val ); return TRUE; @@ -275,7 +274,7 @@ BOOL X11DRV_SetupGCForText( DC * dc ) val.fill_style = FillSolid; val.font = xfs->fid; - TSXChangeGC( display, physDev->gc, + TSXChangeGC( gdi_display, physDev->gc, GCFunction | GCForeground | GCBackground | GCFillStyle | GCFont, &val ); return TRUE; @@ -305,7 +304,7 @@ X11DRV_LineTo( DC *dc, INT x, INT y ) INTERNAL_LPTODP(dc,&start); INTERNAL_LPTODP(dc,&end); - TSXDrawLine(display, physDev->drawable, physDev->gc, + TSXDrawLine(gdi_display, physDev->drawable, physDev->gc, dc->DCOrgX + start.x, dc->DCOrgY + start.y, dc->DCOrgX + end.x, @@ -401,9 +400,8 @@ X11DRV_DrawArc( DC *dc, INT left, INT top, INT right, /* Fill arc with brush if Chord() or Pie() */ if ((lines > 0) && X11DRV_SetupGCForBrush( dc )) { - TSXSetArcMode( display, physDev->gc, - (lines==1) ? ArcChord : ArcPieSlice); - TSXFillArc( display, physDev->drawable, physDev->gc, + TSXSetArcMode( gdi_display, physDev->gc, (lines==1) ? ArcChord : ArcPieSlice); + TSXFillArc( gdi_display, physDev->drawable, physDev->gc, dc->DCOrgX + left, dc->DCOrgY + top, right-left-1, bottom-top-1, istart_angle, idiff_angle ); update = TRUE; @@ -412,9 +410,9 @@ X11DRV_DrawArc( DC *dc, INT left, INT top, INT right, /* Draw arc and lines */ if (X11DRV_SetupGCForPen( dc )){ - TSXDrawArc( display, physDev->drawable, physDev->gc, - dc->DCOrgX + left, dc->DCOrgY + top, - right-left-1, bottom-top-1, istart_angle, idiff_angle ); + TSXDrawArc( gdi_display, physDev->drawable, physDev->gc, + dc->DCOrgX + left, dc->DCOrgY + top, + right-left-1, bottom-top-1, istart_angle, idiff_angle ); if (lines) { /* use the truncated values */ start_angle=(double)istart_angle*PI/64./180.; @@ -468,8 +466,8 @@ X11DRV_DrawArc( DC *dc, INT left, INT top, INT right, } lines++; } - TSXDrawLines( display, physDev->drawable, physDev->gc, - points, lines+1, CoordModeOrigin ); + TSXDrawLines( gdi_display, physDev->drawable, physDev->gc, + points, lines+1, CoordModeOrigin ); } update = TRUE; } @@ -558,16 +556,16 @@ X11DRV_Ellipse( DC *dc, INT left, INT top, INT right, INT bottom ) if (X11DRV_SetupGCForBrush( dc )) { - TSXFillArc( display, physDev->drawable, physDev->gc, - dc->DCOrgX + left, dc->DCOrgY + top, - right-left-1, bottom-top-1, 0, 360*64 ); + TSXFillArc( gdi_display, physDev->drawable, physDev->gc, + dc->DCOrgX + left, dc->DCOrgY + top, + right-left-1, bottom-top-1, 0, 360*64 ); update = TRUE; } if (X11DRV_SetupGCForPen( dc )) { - TSXDrawArc( display, physDev->drawable, physDev->gc, - dc->DCOrgX + left, dc->DCOrgY + top, - right-left-1, bottom-top-1, 0, 360*64 ); + TSXDrawArc( gdi_display, physDev->drawable, physDev->gc, + dc->DCOrgX + left, dc->DCOrgY + top, + right-left-1, bottom-top-1, 0, 360*64 ); update = TRUE; } @@ -627,17 +625,17 @@ X11DRV_Rectangle(DC *dc, INT left, INT top, INT right, INT bottom) if ((right > left + width) && (bottom > top + width)) if (X11DRV_SetupGCForBrush( dc )) { - TSXFillRectangle( display, physDev->drawable, physDev->gc, - dc->DCOrgX + left + (width + 1) / 2, - dc->DCOrgY + top + (width + 1) / 2, - right-left-width-1, bottom-top-width-1); + TSXFillRectangle( gdi_display, physDev->drawable, physDev->gc, + dc->DCOrgX + left + (width + 1) / 2, + dc->DCOrgY + top + (width + 1) / 2, + right-left-width-1, bottom-top-width-1); update = TRUE; } if (X11DRV_SetupGCForPen( dc )) { - TSXDrawRectangle( display, physDev->drawable, physDev->gc, - dc->DCOrgX + left, dc->DCOrgY + top, - right-left-1, bottom-top-1 ); + TSXDrawRectangle( gdi_display, physDev->drawable, physDev->gc, + dc->DCOrgX + left, dc->DCOrgY + top, + right-left-1, bottom-top-1 ); update = TRUE; } @@ -701,57 +699,58 @@ X11DRV_RoundRect( DC *dc, INT left, INT top, INT right, /* Update the pixmap from the DIB section */ X11DRV_LockDIBSection(dc, DIB_Status_GdiMod, FALSE); - + + wine_tsx11_lock(); if (X11DRV_SetupGCForBrush( dc )) { if (ell_width > (right-left) ) if (ell_height > (bottom-top) ) - TSXFillArc( display, physDev->drawable, physDev->gc, - dc->DCOrgX + left, dc->DCOrgY + top, - right - left - 1, bottom - top - 1, - 0, 360 * 64 ); + XFillArc( gdi_display, physDev->drawable, physDev->gc, + dc->DCOrgX + left, dc->DCOrgY + top, + right - left - 1, bottom - top - 1, + 0, 360 * 64 ); else{ - TSXFillArc( display, physDev->drawable, physDev->gc, - dc->DCOrgX + left, dc->DCOrgY + top, - right - left - 1, ell_height, 0, 180 * 64 ); - TSXFillArc( display, physDev->drawable, physDev->gc, - dc->DCOrgX + left, - dc->DCOrgY + bottom - ell_height - 1, - right - left - 1, ell_height, 180 * 64, - 180 * 64 ); - } + XFillArc( gdi_display, physDev->drawable, physDev->gc, + dc->DCOrgX + left, dc->DCOrgY + top, + right - left - 1, ell_height, 0, 180 * 64 ); + XFillArc( gdi_display, physDev->drawable, physDev->gc, + dc->DCOrgX + left, + dc->DCOrgY + bottom - ell_height - 1, + right - left - 1, ell_height, 180 * 64, + 180 * 64 ); + } else if (ell_height > (bottom-top) ){ - TSXFillArc( display, physDev->drawable, physDev->gc, + XFillArc( gdi_display, physDev->drawable, physDev->gc, dc->DCOrgX + left, dc->DCOrgY + top, ell_width, bottom - top - 1, 90 * 64, 180 * 64 ); - TSXFillArc( display, physDev->drawable, physDev->gc, + XFillArc( gdi_display, physDev->drawable, physDev->gc, dc->DCOrgX + right - ell_width -1, dc->DCOrgY + top, ell_width, bottom - top - 1, 270 * 64, 180 * 64 ); }else{ - TSXFillArc( display, physDev->drawable, physDev->gc, + XFillArc( gdi_display, physDev->drawable, physDev->gc, dc->DCOrgX + left, dc->DCOrgY + top, ell_width, ell_height, 90 * 64, 90 * 64 ); - TSXFillArc( display, physDev->drawable, physDev->gc, + XFillArc( gdi_display, physDev->drawable, physDev->gc, dc->DCOrgX + left, dc->DCOrgY + bottom - ell_height - 1, ell_width, ell_height, 180 * 64, 90 * 64 ); - TSXFillArc( display, physDev->drawable, physDev->gc, + XFillArc( gdi_display, physDev->drawable, physDev->gc, dc->DCOrgX + right - ell_width - 1, dc->DCOrgY + bottom - ell_height - 1, ell_width, ell_height, 270 * 64, 90 * 64 ); - TSXFillArc( display, physDev->drawable, physDev->gc, + XFillArc( gdi_display, physDev->drawable, physDev->gc, dc->DCOrgX + right - ell_width - 1, dc->DCOrgY + top, ell_width, ell_height, 0, 90 * 64 ); } if (ell_width < right - left) { - TSXFillRectangle( display, physDev->drawable, physDev->gc, + XFillRectangle( gdi_display, physDev->drawable, physDev->gc, dc->DCOrgX + left + (ell_width + 1) / 2, dc->DCOrgY + top + 1, right - left - ell_width - 1, (ell_height + 1) / 2 - 1); - TSXFillRectangle( display, physDev->drawable, physDev->gc, + XFillRectangle( gdi_display, physDev->drawable, physDev->gc, dc->DCOrgX + left + (ell_width + 1) / 2, dc->DCOrgY + bottom - (ell_height) / 2 - 1, right - left - ell_width - 1, @@ -759,7 +758,7 @@ X11DRV_RoundRect( DC *dc, INT left, INT top, INT right, } if (ell_height < bottom - top) { - TSXFillRectangle( display, physDev->drawable, physDev->gc, + XFillRectangle( gdi_display, physDev->drawable, physDev->gc, dc->DCOrgX + left + 1, dc->DCOrgY + top + (ell_height + 1) / 2, right - left - 2, @@ -779,70 +778,70 @@ X11DRV_RoundRect( DC *dc, INT left, INT top, INT right, if (X11DRV_SetupGCForPen(dc)) { if (ell_width > (right-left) ) if (ell_height > (bottom-top) ) - TSXDrawArc( display, physDev->drawable, physDev->gc, - dc->DCOrgX + left, dc->DCOrgY + top, - right - left - 1, bottom -top - 1, 0 , 360 * 64 ); + XDrawArc( gdi_display, physDev->drawable, physDev->gc, + dc->DCOrgX + left, dc->DCOrgY + top, + right - left - 1, bottom -top - 1, 0 , 360 * 64 ); else{ - TSXDrawArc( display, physDev->drawable, physDev->gc, - dc->DCOrgX + left, dc->DCOrgY + top, - right - left - 1, ell_height - 1, 0 , 180 * 64 ); - TSXDrawArc( display, physDev->drawable, physDev->gc, - dc->DCOrgX + left, - dc->DCOrgY + bottom - ell_height, - right - left - 1, ell_height - 1, 180 * 64 , 180 * 64 ); + XDrawArc( gdi_display, physDev->drawable, physDev->gc, + dc->DCOrgX + left, dc->DCOrgY + top, + right - left - 1, ell_height - 1, 0 , 180 * 64 ); + XDrawArc( gdi_display, physDev->drawable, physDev->gc, + dc->DCOrgX + left, + dc->DCOrgY + bottom - ell_height, + right - left - 1, ell_height - 1, 180 * 64 , 180 * 64 ); } else if (ell_height > (bottom-top) ){ - TSXDrawArc( display, physDev->drawable, physDev->gc, + XDrawArc( gdi_display, physDev->drawable, physDev->gc, dc->DCOrgX + left, dc->DCOrgY + top, ell_width - 1 , bottom - top - 1, 90 * 64 , 180 * 64 ); - TSXDrawArc( display, physDev->drawable, physDev->gc, - dc->DCOrgX + right - ell_width, + XDrawArc( gdi_display, physDev->drawable, physDev->gc, + dc->DCOrgX + right - ell_width, dc->DCOrgY + top, ell_width - 1 , bottom - top - 1, 270 * 64 , 180 * 64 ); }else{ - TSXDrawArc( display, physDev->drawable, physDev->gc, + XDrawArc( gdi_display, physDev->drawable, physDev->gc, dc->DCOrgX + left, dc->DCOrgY + top, ell_width - 1, ell_height - 1, 90 * 64, 90 * 64 ); - TSXDrawArc( display, physDev->drawable, physDev->gc, + XDrawArc( gdi_display, physDev->drawable, physDev->gc, dc->DCOrgX + left, dc->DCOrgY + bottom - ell_height, ell_width - 1, ell_height - 1, 180 * 64, 90 * 64 ); - TSXDrawArc( display, physDev->drawable, physDev->gc, + XDrawArc( gdi_display, physDev->drawable, physDev->gc, dc->DCOrgX + right - ell_width, dc->DCOrgY + bottom - ell_height, ell_width - 1, ell_height - 1, 270 * 64, 90 * 64 ); - TSXDrawArc( display, physDev->drawable, physDev->gc, + XDrawArc( gdi_display, physDev->drawable, physDev->gc, dc->DCOrgX + right - ell_width, dc->DCOrgY + top, ell_width - 1, ell_height - 1, 0, 90 * 64 ); } if (ell_width < right - left) { - TSXDrawLine( display, physDev->drawable, physDev->gc, - dc->DCOrgX + left + ell_width / 2, - dc->DCOrgY + top, - dc->DCOrgX + right - (ell_width+1) / 2, - dc->DCOrgY + top); - TSXDrawLine( display, physDev->drawable, physDev->gc, - dc->DCOrgX + left + ell_width / 2 , - dc->DCOrgY + bottom - 1, - dc->DCOrgX + right - (ell_width+1)/ 2, - dc->DCOrgY + bottom - 1); + XDrawLine( gdi_display, physDev->drawable, physDev->gc, + dc->DCOrgX + left + ell_width / 2, + dc->DCOrgY + top, + dc->DCOrgX + right - (ell_width+1) / 2, + dc->DCOrgY + top); + XDrawLine( gdi_display, physDev->drawable, physDev->gc, + dc->DCOrgX + left + ell_width / 2 , + dc->DCOrgY + bottom - 1, + dc->DCOrgX + right - (ell_width+1)/ 2, + dc->DCOrgY + bottom - 1); } if (ell_height < bottom - top) { - TSXDrawLine( display, physDev->drawable, physDev->gc, - dc->DCOrgX + right - 1, - dc->DCOrgY + top + ell_height / 2, - dc->DCOrgX + right - 1, - dc->DCOrgY + bottom - (ell_height+1) / 2); - TSXDrawLine( display, physDev->drawable, physDev->gc, - dc->DCOrgX + left, - dc->DCOrgY + top + ell_height / 2, - dc->DCOrgX + left, - dc->DCOrgY + bottom - (ell_height+1) / 2); + XDrawLine( gdi_display, physDev->drawable, physDev->gc, + dc->DCOrgX + right - 1, + dc->DCOrgY + top + ell_height / 2, + dc->DCOrgX + right - 1, + dc->DCOrgY + bottom - (ell_height+1) / 2); + XDrawLine( gdi_display, physDev->drawable, physDev->gc, + dc->DCOrgX + left, + dc->DCOrgY + top + ell_height / 2, + dc->DCOrgX + left, + dc->DCOrgY + bottom - (ell_height+1) / 2); } update = TRUE; } - + wine_tsx11_unlock(); /* Update the DIBSection from the pixmap */ X11DRV_UnlockDIBSection(dc, update); @@ -869,9 +868,11 @@ X11DRV_SetPixel( DC *dc, INT x, INT y, COLORREF color ) X11DRV_LockDIBSection(dc, DIB_Status_GdiMod, FALSE); /* inefficient but simple... */ - TSXSetForeground( display, physDev->gc, pixel ); - TSXSetFunction( display, physDev->gc, GXcopy ); - TSXDrawPoint( display, physDev->drawable, physDev->gc, x, y ); + wine_tsx11_lock(); + XSetForeground( gdi_display, physDev->gc, pixel ); + XSetFunction( gdi_display, physDev->gc, GXcopy ); + XDrawPoint( gdi_display, physDev->drawable, physDev->gc, x, y ); + wine_tsx11_unlock(); /* Update the DIBSection from the pixmap */ X11DRV_UnlockDIBSection(dc, TRUE); @@ -899,18 +900,18 @@ X11DRV_GetPixel( DC *dc, INT x, INT y ) wine_tsx11_lock(); if (dc->flags & DC_MEMORY) { - image = XGetImage( display, physDev->drawable, x, y, 1, 1, + image = XGetImage( gdi_display, physDev->drawable, x, y, 1, 1, AllPlanes, ZPixmap ); } else { /* If we are reading from the screen, use a temporary copy */ /* to avoid a BadMatch error */ - if (!pixmap) pixmap = XCreatePixmap( display, X11DRV_GetXRootWindow(), + if (!pixmap) pixmap = XCreatePixmap( gdi_display, root_window, 1, 1, dc->bitsPerPixel ); - XCopyArea( display, physDev->drawable, pixmap, BITMAP_colorGC, + XCopyArea( gdi_display, physDev->drawable, pixmap, BITMAP_colorGC, x, y, 1, 1, 0, 0 ); - image = XGetImage( display, pixmap, 0, 0, 1, 1, AllPlanes, ZPixmap ); + image = XGetImage( gdi_display, pixmap, 0, 0, 1, 1, AllPlanes, ZPixmap ); } pixel = XGetPixel( image, 0, 0 ); XDestroyImage( image ); @@ -960,7 +961,7 @@ X11DRV_PaintRgn( DC *dc, HRGN hrgn ) /* Update the pixmap from the DIB section */ X11DRV_LockDIBSection(dc, DIB_Status_GdiMod, FALSE); - TSXFillRectangle( display, physDev->drawable, physDev->gc, + TSXFillRectangle( gdi_display, physDev->drawable, physDev->gc, box.left, box.top, box.right-box.left, box.bottom-box.top ); @@ -1003,8 +1004,8 @@ X11DRV_Polyline( DC *dc, const POINT* pt, INT count ) /* Update the pixmap from the DIB section */ X11DRV_LockDIBSection(dc, DIB_Status_GdiMod, FALSE); - TSXDrawLines( display, physDev->drawable, physDev->gc, - points, count, CoordModeOrigin ); + TSXDrawLines( gdi_display, physDev->drawable, physDev->gc, + points, count, CoordModeOrigin ); /* Update the DIBSection from the pixmap */ X11DRV_UnlockDIBSection(dc, TRUE); @@ -1044,14 +1045,14 @@ X11DRV_Polygon( DC *dc, const POINT* pt, INT count ) if (X11DRV_SetupGCForBrush( dc )) { - TSXFillPolygon( display, physDev->drawable, physDev->gc, - points, count+1, Complex, CoordModeOrigin); + TSXFillPolygon( gdi_display, physDev->drawable, physDev->gc, + points, count+1, Complex, CoordModeOrigin); update = TRUE; } if (X11DRV_SetupGCForPen ( dc )) { - TSXDrawLines( display, physDev->drawable, physDev->gc, - points, count+1, CoordModeOrigin ); + TSXDrawLines( gdi_display, physDev->drawable, physDev->gc, + points, count+1, CoordModeOrigin ); update = TRUE; } @@ -1104,8 +1105,8 @@ X11DRV_PolyPolygon( DC *dc, const POINT* pt, const INT* counts, UINT polygons) pt++; } points[j] = points[0]; - TSXDrawLines( display, physDev->drawable, physDev->gc, - points, j + 1, CoordModeOrigin ); + TSXDrawLines( gdi_display, physDev->drawable, physDev->gc, + points, j + 1, CoordModeOrigin ); } /* Update the DIBSection of the dc's bitmap */ @@ -1147,7 +1148,7 @@ X11DRV_PolyPolyline( DC *dc, const POINT* pt, const DWORD* counts, DWORD polylin points[j].y = dc->DCOrgY + INTERNAL_YWPTODP( dc, pt->x, pt->y ); pt++; } - TSXDrawLines( display, physDev->drawable, physDev->gc, + TSXDrawLines( gdi_display, physDev->drawable, physDev->gc, points, j, CoordModeOrigin ); } @@ -1186,7 +1187,7 @@ static void X11DRV_InternalFloodFill(XImage *image, DC *dc, left = right = x; while ((left > 0) && TO_FLOOD( left-1, y )) left--; while ((right < image->width) && TO_FLOOD( right, y )) right++; - XFillRectangle( display, physDev->drawable, physDev->gc, + XFillRectangle( gdi_display, physDev->drawable, physDev->gc, xOrg + left, yOrg + y, right-left, 1 ); /* Set the pixels of this line so we don't fill it again */ @@ -1246,7 +1247,7 @@ X11DRV_ExtFloodFill( DC *dc, INT x, INT y, COLORREF color, if (!PtVisible( dc->hSelf, x, y )) return FALSE; if (GetRgnBox( dc->hGCClipRgn, &rect ) == ERROR) return FALSE; - if (!(image = TSXGetImage( display, physDev->drawable, + if (!(image = TSXGetImage( gdi_display, physDev->drawable, rect.left, rect.top, rect.right - rect.left, @@ -1260,7 +1261,7 @@ X11DRV_ExtFloodFill( DC *dc, INT x, INT y, COLORREF color, X11DRV_LockDIBSection(dc, DIB_Status_GdiMod, FALSE); /* ROP mode is always GXcopy for flood-fill */ - XSetFunction( display, physDev->gc, GXcopy ); + XSetFunction( gdi_display, physDev->gc, GXcopy ); X11DRV_InternalFloodFill(image, dc, XLPTODP(dc,x) + dc->DCOrgX - rect.left, YLPTODP(dc,y) + dc->DCOrgY - rect.top, @@ -1319,11 +1320,13 @@ BOOL X11DRV_GetDCOrgEx( DC *dc, LPPOINT lpp ) { X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *) dc->physDev; Window root; - int w, h, border, depth; + int x, y, w, h, border, depth; /* FIXME: this is not correct for managed windows */ - TSXGetGeometry( display, physDev->drawable, &root, - (int*)&lpp->x, (int*)&lpp->y, &w, &h, &border, &depth ); + TSXGetGeometry( gdi_display, physDev->drawable, &root, + &x, &y, &w, &h, &border, &depth ); + lpp->x = x; + lpp->y = y; } else lpp->x = lpp->y = 0; return TRUE; diff --git a/graphics/x11drv/init.c b/graphics/x11drv/init.c index 33ba2edd873..8b5dd5ea6ce 100644 --- a/graphics/x11drv/init.c +++ b/graphics/x11drv/init.c @@ -168,30 +168,29 @@ DeviceCaps X11DRV_DevCaps = { /* palette size */ 0, /* ..etc */ 0, 0 }; + +Display *gdi_display; /* display to use for all GDI functions */ + + /********************************************************************** * X11DRV_GDI_Initialize */ -BOOL X11DRV_GDI_Initialize(void) +BOOL X11DRV_GDI_Initialize( Display *display ) { + Screen *screen = DefaultScreenOfDisplay(display); + + gdi_display = display; BITMAP_Driver = &X11DRV_BITMAP_Driver; PALETTE_Driver = &X11DRV_PALETTE_Driver; /* FIXME: colormap management should be merged with the X11DRV */ - if( !X11DRV_DIB_Init() ) return FALSE; - if( !X11DRV_PALETTE_Init() ) return FALSE; if( !X11DRV_OBM_Init() ) return FALSE; /* Finish up device caps */ -#if 0 - TRACE("Height = %-4i pxl, %-4i mm, Width = %-4i pxl, %-4i mm\n", - HeightOfScreen(X11DRV_GetXScreen()), HeightMMOfScreen(X11DRV_GetXScreen()), - WidthOfScreen(X11DRV_GetXScreen()), WidthMMOfScreen(X11DRV_GetXScreen()) ); -#endif - X11DRV_DevCaps.version = 0x300; X11DRV_DevCaps.horzSize = WidthMMOfScreen(screen) * screen_width / WidthOfScreen(screen); X11DRV_DevCaps.vertSize = HeightMMOfScreen(screen) * screen_height / HeightOfScreen(screen); @@ -214,10 +213,6 @@ BOOL X11DRV_GDI_Initialize(void) if (!X11DRV_BITMAP_Init()) return FALSE; - /* Initialize brush dithering */ - - if (!X11DRV_BRUSH_Init()) return FALSE; - /* Initialize fonts and text caps */ if (!X11DRV_FONT_Init( &X11DRV_DevCaps )) return FALSE; @@ -230,7 +225,9 @@ BOOL X11DRV_GDI_Initialize(void) */ void X11DRV_GDI_Finalize(void) { - X11DRV_PALETTE_Cleanup(); + X11DRV_PALETTE_Cleanup(); + XCloseDisplay( gdi_display ); + gdi_display = NULL; } /********************************************************************** @@ -259,43 +256,40 @@ static BOOL X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, } if (!bmp->physBitmap) X11DRV_CreateBitmap( dc->hBitmap ); physDev->drawable = (Pixmap)bmp->physBitmap; - physDev->gc = TSXCreateGC(display, physDev->drawable, 0, NULL); - dc->bitsPerPixel = bmp->bitmap.bmBitsPixel; - + physDev->gc = TSXCreateGC( gdi_display, physDev->drawable, 0, NULL ); + dc->bitsPerPixel = bmp->bitmap.bmBitsPixel; dc->totalExtent.left = 0; dc->totalExtent.top = 0; dc->totalExtent.right = bmp->bitmap.bmWidth; dc->totalExtent.bottom = bmp->bitmap.bmHeight; - dc->hVisRgn = CreateRectRgnIndirect( &dc->totalExtent ); - GDI_ReleaseObj( dc->hBitmap ); } else { - physDev->drawable = X11DRV_GetXRootWindow(); - physDev->gc = TSXCreateGC( display, physDev->drawable, 0, NULL ); - dc->bitsPerPixel = screen_depth; - + physDev->drawable = root_window; + physDev->gc = TSXCreateGC( gdi_display, physDev->drawable, 0, NULL ); + dc->bitsPerPixel = screen_depth; dc->totalExtent.left = 0; dc->totalExtent.top = 0; dc->totalExtent.right = screen_width; dc->totalExtent.bottom = screen_height; - dc->hVisRgn = CreateRectRgnIndirect( &dc->totalExtent ); } physDev->current_pf = 0; physDev->used_visuals = 0; - - if (!dc->hVisRgn) + + if (!(dc->hVisRgn = CreateRectRgnIndirect( &dc->totalExtent ))) { - TSXFreeGC( display, physDev->gc ); + TSXFreeGC( gdi_display, physDev->gc ); HeapFree( GetProcessHeap(), 0, physDev ); return FALSE; } - TSXSetGraphicsExposures( display, physDev->gc, False ); - TSXSetSubwindowMode( display, physDev->gc, IncludeInferiors ); - + wine_tsx11_lock(); + XSetGraphicsExposures( gdi_display, physDev->gc, False ); + XSetSubwindowMode( gdi_display, physDev->gc, IncludeInferiors ); + XFlush( gdi_display ); + wine_tsx11_unlock(); return TRUE; } @@ -306,9 +300,11 @@ static BOOL X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, static BOOL X11DRV_DeleteDC( DC *dc ) { X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; - TSXFreeGC( display, physDev->gc ); + wine_tsx11_lock(); + XFreeGC( gdi_display, physDev->gc ); while (physDev->used_visuals-- > 0) - TSXFree(physDev->visuals[physDev->used_visuals]); + XFree(physDev->visuals[physDev->used_visuals]); + wine_tsx11_unlock(); HeapFree( GetProcessHeap(), 0, physDev ); dc->physDev = NULL; return TRUE; diff --git a/graphics/x11drv/oembitmap.c b/graphics/x11drv/oembitmap.c index 3daf0d12020..c924dfaec8a 100644 --- a/graphics/x11drv/oembitmap.c +++ b/graphics/x11drv/oembitmap.c @@ -260,12 +260,11 @@ static BOOL OBM_CreateBitmaps( char **data, BOOL color, if (attrs == NULL) return FALSE; attrs->valuemask = XpmColormap | XpmDepth | XpmColorSymbols | XpmHotspot; attrs->colormap = X11DRV_PALETTE_PaletteXColormap; - attrs->depth = color ? X11DRV_GetDepth() : 1; + attrs->depth = color ? screen_depth : 1; attrs->colorsymbols = (attrs->depth > 1) ? OBM_Colors : OBM_BlackAndWhite; attrs->numsymbols = (attrs->depth > 1) ? NB_COLOR_SYMBOLS : 2; - err = TSXpmCreatePixmapFromData( display, X11DRV_GetXRootWindow(), data, - &pixmap, &pixmask, attrs ); + err = TSXpmCreatePixmapFromData( gdi_display, root_window, data, &pixmap, &pixmask, attrs ); if (err != XpmSuccess) { HeapFree( GetProcessHeap(), 0, attrs ); @@ -288,8 +287,8 @@ static BOOL OBM_CreateBitmaps( char **data, BOOL color, HeapFree( GetProcessHeap(), 0, attrs ); - if (pixmap && (!bitmap || !*bitmap)) TSXFreePixmap( display, pixmap ); - if (pixmask && (!mask || !*mask)) TSXFreePixmap( display, pixmask ); + if (pixmap && (!bitmap || !*bitmap)) TSXFreePixmap( gdi_display, pixmap ); + if (pixmask && (!mask || !*mask)) TSXFreePixmap( gdi_display, pixmask ); if (bitmap && !*bitmap) { diff --git a/graphics/x11drv/opengl.c b/graphics/x11drv/opengl.c index 970e4a0044d..c4eb37f827b 100644 --- a/graphics/x11drv/opengl.c +++ b/graphics/x11drv/opengl.c @@ -123,13 +123,13 @@ int X11DRV_ChoosePixelFormat(DC *dc, This command cannot be used as we need to use the default visual... Let's hope it at least contains some OpenGL functionnalities - vis = glXChooseVisual(display, DefaultScreen(display), att_list); + vis = glXChooseVisual(gdi_display, DefaultScreen(gdi_display), att_list); */ int num; XVisualInfo template; template.visualid = XVisualIDFromVisual(visual); - vis = XGetVisualInfo(display, VisualIDMask, &template, &num); + vis = XGetVisualInfo(gdi_display, VisualIDMask, &template, &num); TRACE("Found visual : %p - returns %d\n", vis, physDev->used_visuals + 1); } @@ -178,9 +178,7 @@ int X11DRV_DescribePixelFormat(DC *dc, /* Create a 'standard' X Visual */ ENTER_GL(); - vis = glXChooseVisual(display, - DefaultScreen(display), - dblBuf); + vis = glXChooseVisual(gdi_display, DefaultScreen(gdi_display), dblBuf); LEAVE_GL(); WARN("Uninitialized Visual. Creating standard (%p) !\n", vis); @@ -203,27 +201,27 @@ int X11DRV_DescribePixelFormat(DC *dc, ppfd->dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_GENERIC_ACCELERATED; /* Now the flags extraced from the Visual */ ENTER_GL(); - glXGetConfig(display, vis, GLX_DOUBLEBUFFER, &value); if (value) ppfd->dwFlags |= PFD_DOUBLEBUFFER; - glXGetConfig(display, vis, GLX_STEREO, &value); if (value) ppfd->dwFlags |= PFD_STEREO; + glXGetConfig(gdi_display, vis, GLX_DOUBLEBUFFER, &value); if (value) ppfd->dwFlags |= PFD_DOUBLEBUFFER; + glXGetConfig(gdi_display, vis, GLX_STEREO, &value); if (value) ppfd->dwFlags |= PFD_STEREO; /* Pixel type */ - glXGetConfig(display, vis, GLX_RGBA, &value); + glXGetConfig(gdi_display, vis, GLX_RGBA, &value); if (value) ppfd->iPixelType = PFD_TYPE_RGBA; else ppfd->iPixelType = PFD_TYPE_COLORINDEX; /* Color bits */ - glXGetConfig(display, vis, GLX_BUFFER_SIZE, &value); + glXGetConfig(gdi_display, vis, GLX_BUFFER_SIZE, &value); ppfd->cColorBits = value; /* Red, green, blue and alpha bits / shifts */ if (ppfd->iPixelType == PFD_TYPE_RGBA) { - glXGetConfig(display, vis, GLX_RED_SIZE, &rb); - glXGetConfig(display, vis, GLX_GREEN_SIZE, &gb); - glXGetConfig(display, vis, GLX_BLUE_SIZE, &bb); - glXGetConfig(display, vis, GLX_ALPHA_SIZE, &ab); - + glXGetConfig(gdi_display, vis, GLX_RED_SIZE, &rb); + glXGetConfig(gdi_display, vis, GLX_GREEN_SIZE, &gb); + glXGetConfig(gdi_display, vis, GLX_BLUE_SIZE, &bb); + glXGetConfig(gdi_display, vis, GLX_ALPHA_SIZE, &ab); + ppfd->cRedBits = rb; ppfd->cRedShift = gb + bb + ab; ppfd->cBlueBits = bb; @@ -245,7 +243,7 @@ int X11DRV_DescribePixelFormat(DC *dc, /* Accums : to do ... */ /* Depth bits */ - glXGetConfig(display, vis, GLX_DEPTH_SIZE, &value); + glXGetConfig(gdi_display, vis, GLX_DEPTH_SIZE, &value); ppfd->cDepthBits = value; LEAVE_GL(); @@ -298,7 +296,7 @@ BOOL X11DRV_SwapBuffers(DC *dc) { TRACE("(%p)\n", dc); ENTER_GL(); - glXSwapBuffers(display, physDev->drawable); + glXSwapBuffers(gdi_display, physDev->drawable); LEAVE_GL(); return TRUE; diff --git a/graphics/x11drv/palette.c b/graphics/x11drv/palette.c index 644c6f4bc2c..dd096094b67 100644 --- a/graphics/x11drv/palette.c +++ b/graphics/x11drv/palette.c @@ -98,12 +98,10 @@ BOOL X11DRV_PALETTE_Init(void) int mask, white, black; int monoPlane; - Visual *visual = X11DRV_GetVisual(); - TRACE("initializing palette manager...\n"); - white = WhitePixelOfScreen( X11DRV_GetXScreen() ); - black = BlackPixelOfScreen( X11DRV_GetXScreen() ); + white = WhitePixel( gdi_display, DefaultScreen(gdi_display) ); + black = BlackPixel( gdi_display, DefaultScreen(gdi_display) ); monoPlane = 1; for( mask = 1; !((white & mask)^(black & mask)); mask <<= 1 ) monoPlane++; @@ -120,7 +118,7 @@ BOOL X11DRV_PALETTE_Init(void) { XSetWindowAttributes win_attr; - X11DRV_PALETTE_PaletteXColormap = TSXCreateColormap( display, X11DRV_GetXRootWindow(), + X11DRV_PALETTE_PaletteXColormap = TSXCreateColormap( gdi_display, root_window, visual, AllocAll ); if (X11DRV_PALETTE_PaletteXColormap) { @@ -130,22 +128,23 @@ BOOL X11DRV_PALETTE_Init(void) for( white = X11DRV_DevCaps.sizePalette - 1; !(white & 1); white >>= 1 ) monoPlane++; - if( X11DRV_GetXRootWindow() != DefaultRootWindow(display) ) + if( root_window != DefaultRootWindow(gdi_display) ) { win_attr.colormap = X11DRV_PALETTE_PaletteXColormap; - TSXChangeWindowAttributes( display, X11DRV_GetXRootWindow(), - CWColormap, &win_attr ); + TSXChangeWindowAttributes( gdi_display, root_window, CWColormap, &win_attr ); } break; } } - X11DRV_PALETTE_PaletteXColormap = TSXCreateColormap(display, X11DRV_GetXRootWindow(), visual, AllocNone); + X11DRV_PALETTE_PaletteXColormap = TSXCreateColormap(gdi_display, root_window, + visual, AllocNone); break; case StaticGray: - X11DRV_PALETTE_PaletteXColormap = TSXCreateColormap(display, X11DRV_GetXRootWindow(), visual, AllocNone); + X11DRV_PALETTE_PaletteXColormap = TSXCreateColormap(gdi_display, root_window, + visual, AllocNone); X11DRV_PALETTE_PaletteFlags |= X11DRV_PALETTE_FIXED; - X11DRV_PALETTE_Graymax = (1 << X11DRV_GetDepth())-1; + X11DRV_PALETTE_Graymax = (1 << screen_depth)-1; break; case TrueColor: @@ -155,18 +154,20 @@ BOOL X11DRV_PALETTE_Init(void) /* FIXME: hack to detect XFree32 XF_VGA16 ... We just have * depths 1 and 4 */ - depths=TSXListDepths(display,DefaultScreen(display),&nrofdepths); + depths=TSXListDepths(gdi_display,DefaultScreen(gdi_display),&nrofdepths); if ((nrofdepths==2) && ((depths[0]==4) || depths[1]==4)) { monoPlane = 1; for( white = X11DRV_DevCaps.sizePalette - 1; !(white & 1); white >>= 1 ) monoPlane++; X11DRV_PALETTE_PaletteFlags = (white & mask) ? X11DRV_PALETTE_WHITESET : 0; - X11DRV_PALETTE_PaletteXColormap = TSXCreateColormap(display, X11DRV_GetXRootWindow(), visual, AllocNone); + X11DRV_PALETTE_PaletteXColormap = TSXCreateColormap(gdi_display, root_window, + visual, AllocNone); TSXFree(depths); break; } TSXFree(depths); - X11DRV_PALETTE_PaletteXColormap = TSXCreateColormap(display, X11DRV_GetXRootWindow(), visual, AllocNone); + X11DRV_PALETTE_PaletteXColormap = TSXCreateColormap(gdi_display, root_window, + visual, AllocNone); X11DRV_PALETTE_PaletteFlags |= X11DRV_PALETTE_FIXED; X11DRV_PALETTE_ComputeShifts(visual->red_mask, &X11DRV_PALETTE_Redshift, &X11DRV_PALETTE_Redmax); X11DRV_PALETTE_ComputeShifts(visual->green_mask, &X11DRV_PALETTE_Greenshift, &X11DRV_PALETTE_Greenmax); @@ -210,7 +211,7 @@ BOOL X11DRV_PALETTE_Init(void) void X11DRV_PALETTE_Cleanup(void) { if( COLOR_gapFilled ) - TSXFreeColors(display, X11DRV_PALETTE_PaletteXColormap, + TSXFreeColors(gdi_display, X11DRV_PALETTE_PaletteXColormap, (unsigned long*)(X11DRV_PALETTE_PaletteToXPixel + COLOR_gapStart), COLOR_gapFilled, 0); } @@ -279,7 +280,7 @@ static BOOL X11DRV_PALETTE_BuildPrivateMap(void) color.flags = DoRed | DoGreen | DoBlue; color.pixel = i; - TSXStoreColor(display, X11DRV_PALETTE_PaletteXColormap, &color); + TSXStoreColor(gdi_display, X11DRV_PALETTE_PaletteXColormap, &color); /* Set EGA mapping if color is from the first or last eight */ @@ -319,13 +320,13 @@ static BOOL X11DRV_PALETTE_BuildSharedMap(void) /* Copy the first bunch of colors out of the default colormap to prevent * colormap flashing as much as possible. We're likely to get the most * important Window Manager colors, etc in the first 128 colors */ - defaultCM = DefaultColormapOfScreen( X11DRV_GetXScreen() ); + defaultCM = DefaultColormap( gdi_display, DefaultScreen(gdi_display) ); defaultCM_max_copy = PROFILE_GetWineIniInt( "x11drv", "CopyDefaultColors", 128); for (i = 0; i < defaultCM_max_copy; i++) defaultColors[i].pixel = (long) i; - TSXQueryColors(display, defaultCM, &defaultColors[0], defaultCM_max_copy); + TSXQueryColors(gdi_display, defaultCM, &defaultColors[0], defaultCM_max_copy); for (i = 0; i < defaultCM_max_copy; i++) - TSXAllocColor( display, X11DRV_PALETTE_PaletteXColormap, &defaultColors[i] ); + TSXAllocColor( gdi_display, X11DRV_PALETTE_PaletteXColormap, &defaultColors[i] ); /* read "AllocSystemColors" from wine.conf */ @@ -345,7 +346,7 @@ static BOOL X11DRV_PALETTE_BuildSharedMap(void) color.blue = COLOR_sysPalTemplate[i].peBlue * 65535 / 255; color.flags = DoRed | DoGreen | DoBlue; - if (!TSXAllocColor( display, X11DRV_PALETTE_PaletteXColormap, &color )) + if (!TSXAllocColor( gdi_display, X11DRV_PALETTE_PaletteXColormap, &color )) { XColor best, c; @@ -353,10 +354,10 @@ static BOOL X11DRV_PALETTE_BuildSharedMap(void) { WARN("Not enough colors for the full system palette.\n"); - bp = BlackPixel(display, DefaultScreen(display)); - wp = WhitePixel(display, DefaultScreen(display)); + bp = BlackPixel(gdi_display, DefaultScreen(gdi_display)); + wp = WhitePixel(gdi_display, DefaultScreen(gdi_display)); - max = (0xffffffff)>>(32 - X11DRV_GetDepth()); + max = (0xffffffff)>>(32 - screen_depth); if( max > 256 ) { step = max/256; @@ -374,7 +375,7 @@ static BOOL X11DRV_PALETTE_BuildSharedMap(void) best.pixel = best.red = best.green = best.blue = 0; for( c.pixel = 0, diff = 0x7fffffff; c.pixel < max; c.pixel += step ) { - TSXQueryColor(display, X11DRV_PALETTE_PaletteXColormap, &c); + TSXQueryColor(gdi_display, X11DRV_PALETTE_PaletteXColormap, &c); r = (c.red - color.red)>>8; g = (c.green - color.green)>>8; b = (c.blue - color.blue)>>8; @@ -382,7 +383,7 @@ static BOOL X11DRV_PALETTE_BuildSharedMap(void) if( r < diff ) { best = c; diff = r; } } - if( TSXAllocColor(display, X11DRV_PALETTE_PaletteXColormap, &best) ) + if( TSXAllocColor(gdi_display, X11DRV_PALETTE_PaletteXColormap, &best) ) color.pixel = best.pixel; else color.pixel = (i < NB_RESERVED_COLORS/2)? bp : wp; } @@ -418,18 +419,18 @@ static BOOL X11DRV_PALETTE_BuildSharedMap(void) } /* comment this out if you want to debug palette init */ - TSXGrabServer(display); + TSXGrabServer(gdi_display); while( c_max - c_min > 0 ) { c_val = (c_max + c_min)/2 + (c_max + c_min)%2; - if( !TSXAllocColorCells(display, X11DRV_PALETTE_PaletteXColormap, False, + if( !TSXAllocColorCells(gdi_display, X11DRV_PALETTE_PaletteXColormap, False, plane_masks, 0, pixDynMapping, c_val) ) c_max = c_val - 1; else { - TSXFreeColors(display, X11DRV_PALETTE_PaletteXColormap, pixDynMapping, c_val, 0); + TSXFreeColors(gdi_display, X11DRV_PALETTE_PaletteXColormap, pixDynMapping, c_val, 0); c_min = c_val; } } @@ -440,7 +441,7 @@ static BOOL X11DRV_PALETTE_BuildSharedMap(void) c_min = (c_min/2) + (c_min/2); /* need even set for split palette */ if( c_min > 0 ) - if( !TSXAllocColorCells(display, X11DRV_PALETTE_PaletteXColormap, False, + if( !TSXAllocColorCells(gdi_display, X11DRV_PALETTE_PaletteXColormap, False, plane_masks, 0, pixDynMapping, c_min) ) { WARN("Inexplicable failure during colorcell allocation.\n"); @@ -449,7 +450,7 @@ static BOOL X11DRV_PALETTE_BuildSharedMap(void) X11DRV_DevCaps.sizePalette = c_min + NB_RESERVED_COLORS; - TSXUngrabServer(display); + TSXUngrabServer(gdi_display); TRACE("adjusted size %i colorcells\n", X11DRV_DevCaps.sizePalette); } @@ -460,7 +461,7 @@ static BOOL X11DRV_PALETTE_BuildSharedMap(void) * to maintain compatibility */ X11DRV_DevCaps.sizePalette = 256; - TRACE("Virtual colorspace - screendepth %i\n", X11DRV_GetDepth()); + TRACE("Virtual colorspace - screendepth %i\n", screen_depth); } else X11DRV_DevCaps.sizePalette = NB_RESERVED_COLORS; /* system palette only - however we can alloc a bunch * of colors and map to them */ @@ -487,7 +488,7 @@ static BOOL X11DRV_PALETTE_BuildSharedMap(void) /* setup system palette entry <-> pixel mappings and fill in 20 fixed entries */ - if (X11DRV_GetDepth() <= 8) + if (screen_depth <= 8) { X11DRV_PALETTE_XPixelToPalette = (int*)calloc(256, sizeof(int)); if(X11DRV_PALETTE_XPixelToPalette == NULL) { @@ -554,7 +555,7 @@ static void X11DRV_PALETTE_FillDefaultColors(void) int red, no_r, inc_r; int green, no_g, inc_g; int blue, no_b, inc_b; - + if (X11DRV_DevCaps.sizePalette <= NB_RESERVED_COLORS) return; while (i*i*i < (X11DRV_DevCaps.sizePalette - NB_RESERVED_COLORS)) i++; @@ -598,7 +599,7 @@ static void X11DRV_PALETTE_FillDefaultColors(void) color.green = COLOR_sysPal[idx].peGreen << 8; color.blue = COLOR_sysPal[idx].peBlue << 8; color.flags = DoRed | DoGreen | DoBlue; - TSXStoreColor(display, X11DRV_PALETTE_PaletteXColormap, &color); + TSXStoreColor(gdi_display, X11DRV_PALETTE_PaletteXColormap, &color); } idx = X11DRV_PALETTE_freeList[idx]; } @@ -618,11 +619,11 @@ static void X11DRV_PALETTE_FillDefaultColors(void) { xc.pixel = i; - TSXQueryColor(display, X11DRV_PALETTE_PaletteXColormap, &xc); + TSXQueryColor(gdi_display, X11DRV_PALETTE_PaletteXColormap, &xc); r = xc.red>>8; g = xc.green>>8; b = xc.blue>>8; if( xc.pixel < 256 && X11DRV_PALETTE_CheckSysColor(RGB(r, g, b)) && - TSXAllocColor(display, X11DRV_PALETTE_PaletteXColormap, &xc) ) + TSXAllocColor(gdi_display, X11DRV_PALETTE_PaletteXColormap, &xc) ) { X11DRV_PALETTE_XPixelToPalette[xc.pixel] = idx; X11DRV_PALETTE_PaletteToXPixel[idx] = xc.pixel; @@ -648,7 +649,7 @@ COLORREF X11DRV_PALETTE_ToLogical(int pixel) #if 0 /* truecolor visual */ - if (X11DRV_GetDepth() >= 24) return pixel; + if (screen_depth >= 24) return pixel; #endif /* check for hicolor visuals first */ @@ -665,13 +666,13 @@ COLORREF X11DRV_PALETTE_ToLogical(int pixel) /* check if we can bypass X */ - if ((X11DRV_GetDepth() <= 8) && (pixel < 256) && + if ((screen_depth <= 8) && (pixel < 256) && !(X11DRV_PALETTE_PaletteFlags & (X11DRV_PALETTE_VIRTUAL | X11DRV_PALETTE_FIXED)) ) return ( *(COLORREF*)(COLOR_sysPal + ((X11DRV_PALETTE_XPixelToPalette)?X11DRV_PALETTE_XPixelToPalette[pixel]:pixel)) ) & 0x00ffffff; color.pixel = pixel; - TSXQueryColor(display, X11DRV_PALETTE_PaletteXColormap, &color); + TSXQueryColor(gdi_display, X11DRV_PALETTE_PaletteXColormap, &color); return RGB(color.red >> 8, color.green >> 8, color.blue >> 8); } @@ -934,7 +935,7 @@ int X11DRV_PALETTE_SetMapping( PALETTEOBJ* palPtr, UINT uStart, UINT uNum, BOOL color.green = palPtr->logpalette.palPalEntry[uStart].peGreen << 8; color.blue = palPtr->logpalette.palPalEntry[uStart].peBlue << 8; color.flags = DoRed | DoGreen | DoBlue; - TSXStoreColor(display, X11DRV_PALETTE_PaletteXColormap, &color); + TSXStoreColor(gdi_display, X11DRV_PALETTE_PaletteXColormap, &color); COLOR_sysPal[index] = palPtr->logpalette.palPalEntry[uStart]; COLOR_sysPal[index].peFlags = flag; diff --git a/graphics/x11drv/text.c b/graphics/x11drv/text.c index 7c2f7909ef2..865db60f049 100644 --- a/graphics/x11drv/text.c +++ b/graphics/x11drv/text.c @@ -115,8 +115,8 @@ X11DRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags, { X11DRV_LockDIBSection( dc, DIB_Status_GdiMod, FALSE ); dibUpdateFlag = TRUE; - TSXSetForeground( display, physDev->gc, physDev->backgroundPixel ); - TSXFillRectangle( display, physDev->drawable, physDev->gc, + TSXSetForeground( gdi_display, physDev->gc, physDev->backgroundPixel ); + TSXFillRectangle( gdi_display, physDev->drawable, physDev->gc, dc->DCOrgX + rect.left, dc->DCOrgY + rect.top, rect.right-rect.left, rect.bottom-rect.top ); } @@ -213,9 +213,8 @@ X11DRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags, (y - ascent < rect.top) || (y + descent >= rect.bottom)) { - TSXSetForeground( display, physDev->gc, - physDev->backgroundPixel ); - TSXFillRectangle( display, physDev->drawable, physDev->gc, + TSXSetForeground( gdi_display, physDev->gc, physDev->backgroundPixel ); + TSXFillRectangle( gdi_display, physDev->drawable, physDev->gc, dc->DCOrgX + x, dc->DCOrgY + y - ascent, width, @@ -228,13 +227,13 @@ X11DRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags, if (!(str2b = X11DRV_cptable[pfo->fi->cptable].punicode_to_char2b( pfo, wstr, count ))) goto FAIL; - TSXSetForeground( display, physDev->gc, physDev->textPixel ); + TSXSetForeground( gdi_display, physDev->gc, physDev->textPixel ); if(!rotated) { if (!dc->charExtra && !dc->breakExtra && !lpDx) { X11DRV_cptable[pfo->fi->cptable].pDrawString( - pfo, display, physDev->drawable, physDev->gc, + pfo, gdi_display, physDev->drawable, physDev->gc, dc->DCOrgX + x, dc->DCOrgY + y, str2b, count ); } else /* Now the fun begins... */ @@ -305,7 +304,7 @@ X11DRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags, } } - X11DRV_cptable[pfo->fi->cptable].pDrawText( pfo, display, + X11DRV_cptable[pfo->fi->cptable].pDrawText( pfo, gdi_display, physDev->drawable, physDev->gc, dc->DCOrgX + x, dc->DCOrgY + y, items, pitem - items ); HeapFree( GetProcessHeap(), 0, items ); @@ -327,7 +326,7 @@ X11DRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags, pfo->lpX11Trans->b / pfo->lpX11Trans->pixelsize ); X11DRV_cptable[pfo->fi->cptable].pDrawString( - pfo, display, physDev->drawable, physDev->gc, + pfo, gdi_display, physDev->drawable, physDev->gc, x_i, y_i, &str2b[i], 1); if (lpDx) { @@ -358,9 +357,9 @@ X11DRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags, if (!TSXGetFontProperty( font, XA_UNDERLINE_THICKNESS, &lineWidth )) lineWidth = 0; else if (lineWidth == 1) lineWidth = 0; - TSXSetLineAttributes( display, physDev->gc, lineWidth, + TSXSetLineAttributes( gdi_display, physDev->gc, lineWidth, LineSolid, CapRound, JoinBevel ); - TSXDrawLine( display, physDev->drawable, physDev->gc, + TSXDrawLine( gdi_display, physDev->drawable, physDev->gc, dc->DCOrgX + x, dc->DCOrgY + y + linePos, dc->DCOrgX + x + width, dc->DCOrgY + y + linePos ); } @@ -371,9 +370,9 @@ X11DRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags, lineAscent = ascent / 2; if (!TSXGetFontProperty( font, XA_STRIKEOUT_DESCENT, &lineDescent )) lineDescent = -lineAscent * 2 / 3; - TSXSetLineAttributes( display, physDev->gc, lineAscent + lineDescent, + TSXSetLineAttributes( gdi_display, physDev->gc, lineAscent + lineDescent, LineSolid, CapRound, JoinBevel ); - TSXDrawLine( display, physDev->drawable, physDev->gc, + TSXDrawLine( gdi_display, physDev->drawable, physDev->gc, dc->DCOrgX + x, dc->DCOrgY + y - lineAscent, dc->DCOrgX + x + width, dc->DCOrgY + y - lineAscent ); } diff --git a/graphics/x11drv/xfont.c b/graphics/x11drv/xfont.c index 907c5972850..52d6bb34b70 100644 --- a/graphics/x11drv/xfont.c +++ b/graphics/x11drv/xfont.c @@ -1007,7 +1007,7 @@ static void XFONT_GetLeading( const LPIFONTINFO16 pFI, const XFontStruct* x_fs, if( pEL ) *pEL = 0; if(XFT) { - Atom RAW_CAP_HEIGHT = TSXInternAtom(display, "RAW_CAP_HEIGHT", TRUE); + Atom RAW_CAP_HEIGHT = TSXInternAtom(gdi_display, "RAW_CAP_HEIGHT", TRUE); if(TSXGetFontProperty((XFontStruct*)x_fs, RAW_CAP_HEIGHT, &height)) *pIL = XFT->ascent - (INT)(XFT->pixelsize / 1000.0 * height); @@ -1981,10 +1981,10 @@ static int XFONT_BuildMetrics(char** x_pattern, int res, unsigned x_checksum, in } else lpstr = x_pattern[i]; - if( (x_fs = TSXLoadQueryFont(display, lpstr)) ) + if( (x_fs = TSXLoadQueryFont(gdi_display, lpstr)) ) { XFONT_SetFontMetric( fi, fr, x_fs ); - TSXFreeFont( display, x_fs ); + TSXFreeFont( gdi_display, x_fs ); XFONT_FixupPointSize(fi); @@ -2648,7 +2648,7 @@ static fontObject* XFONT_GetCacheEntry(void) if(fontCache[j].lpX11Trans) HeapFree( GetProcessHeap(), 0, fontCache[j].lpX11Trans ); - TSXFreeFont( display, fontCache[j].fs ); + TSXFreeFont( gdi_display, fontCache[j].fs ); memset( fontCache + j, 0, sizeof(fontObject) ); return (fontCache + j); @@ -2719,7 +2719,7 @@ BOOL X11DRV_FONT_Init( DeviceCaps* pDevCaps ) res = XFONT_GetPointResolution( pDevCaps ); - x_pattern = TSXListFonts(display, "*", MAX_FONTS, &x_count ); + x_pattern = TSXListFonts(gdi_display, "*", MAX_FONTS, &x_count ); TRACE("Font Mapper: initializing %i fonts [logical dpi=%i, default dpi=%i]\n", x_count, res, DefResolution); @@ -2778,10 +2778,10 @@ BOOL X11DRV_FONT_Init( DeviceCaps* pDevCaps ) { XFontStruct* x_fs; strcpy(buffer, "-*-*-*-*-normal-*-[12 0 0 12]-*-72-*-*-*-iso8859-1"); - if( (x_fs = TSXLoadQueryFont(display, buffer)) ) + if( (x_fs = TSXLoadQueryFont(gdi_display, buffer)) ) { XTextCaps |= TC_SF_X_YINDEP; - TSXFreeFont(display, x_fs); + TSXFreeFont(gdi_display, x_fs); } } HeapFree(GetProcessHeap(), 0, buffer); @@ -2802,8 +2802,8 @@ BOOL X11DRV_FONT_Init( DeviceCaps* pDevCaps ) pDevCaps->textCaps = XTextCaps; - RAW_ASCENT = TSXInternAtom(display, "RAW_ASCENT", TRUE); - RAW_DESCENT = TSXInternAtom(display, "RAW_DESCENT", TRUE); + RAW_ASCENT = TSXInternAtom(gdi_display, "RAW_ASCENT", TRUE); + RAW_DESCENT = TSXInternAtom(gdi_display, "RAW_DESCENT", TRUE); return TRUE; } @@ -2818,7 +2818,7 @@ static BOOL XFONT_SetX11Trans( fontObject *pfo ) LFD* lfd; TSXGetFontProperty( pfo->fs, XA_FONT, &nameAtom ); - fontName = TSXGetAtomName( display, nameAtom ); + fontName = TSXGetAtomName( gdi_display, nameAtom ); lfd = LFD_Parse(fontName); if (!lfd) { @@ -2910,7 +2910,7 @@ static X_PHYSFONT XFONT_RealizeFont( const LPLOGFONT16 plf, do { LFD_ComposeLFD( pfo, fm.height, lpLFD, uRelaxLevel++ ); - if( (pfo->fs = TSXLoadQueryFont( display, lpLFD )) ) break; + if( (pfo->fs = TSXLoadQueryFont( gdi_display, lpLFD )) ) break; } while( uRelaxLevel ); diff --git a/include/x11drv.h b/include/x11drv.h index b1d654bf142..0006cef0ebc 100644 --- a/include/x11drv.h +++ b/include/x11drv.h @@ -170,14 +170,12 @@ extern BOOL X11DRV_SwapBuffers(DC *dc) ; /* X11 driver internal functions */ extern BOOL X11DRV_BITMAP_Init(void); -extern BOOL X11DRV_BRUSH_Init(void); -extern BOOL X11DRV_DIB_Init(void); extern BOOL X11DRV_FONT_Init( struct tagDeviceCaps* ); extern BOOL X11DRV_OBM_Init(void); struct tagBITMAPOBJ; extern XImage *X11DRV_BITMAP_GetXImage( const struct tagBITMAPOBJ *bmp ); -extern int X11DRV_DIB_GetXImageWidthBytes( int width, int depth ); +extern XImage *X11DRV_DIB_CreateXImage( int width, int height, int depth ); extern HBITMAP X11DRV_BITMAP_CreateBitmapHeaderFromPixmap(Pixmap pixmap); extern HGLOBAL X11DRV_DIB_CreateDIBFromPixmap(Pixmap pixmap, HDC hdc, BOOL bDeletePixmap); extern HBITMAP X11DRV_BITMAP_CreateBitmapFromPixmap(Pixmap pixmap, BOOL bDeletePixmap); @@ -194,14 +192,6 @@ extern const int X11DRV_XROPfunction[]; extern void _XInitImageFuncPtrs(XImage *); -#define XCREATEIMAGE(image,width,height,bpp) \ -{ \ - int width_bytes = X11DRV_DIB_GetXImageWidthBytes( (width), (bpp) ); \ - (image) = TSXCreateImage(display, X11DRV_GetVisual(), \ - (bpp), ZPixmap, 0, calloc( (height), width_bytes ),\ - (width), (height), 32, width_bytes ); \ -} - /* exported dib functions for now */ /* Additional info for DIB section objects */ @@ -277,9 +267,11 @@ extern INT X11DRV_DCICommand(INT cbInput, LPVOID lpInData, LPVOID lpOutData); * X11 GDI driver */ -BOOL X11DRV_GDI_Initialize(void); +BOOL X11DRV_GDI_Initialize( Display *display ); void X11DRV_GDI_Finalize(void); +extern Display *gdi_display; /* display to use for all GDI functions */ + /* X11 GDI palette driver */ #define X11DRV_PALETTE_FIXED 0x0001 /* read-only colormap - have to use XAllocColor (if not virtual) */ @@ -395,11 +387,6 @@ extern void X11DRV_WND_SurfaceCopy(struct tagWND *wndPtr, HDC hdc, INT dx, INT d extern void X11DRV_WND_SetGravity(struct tagWND* wndPtr, int value ); extern BOOL X11DRV_WND_SetHostAttr(struct tagWND *wndPtr, INT haKey, INT value); -extern int X11DRV_EVENT_PrepareShmCompletion( Drawable dw ); -extern void X11DRV_EVENT_WaitShmCompletion( int compl ); -extern void X11DRV_EVENT_WaitShmCompletions( Drawable dw ); -extern void X11DRV_EVENT_WaitReplaceShmCompletion( int *compl, Drawable dw ); - extern void X11DRV_SetFocus( HWND hwnd ); #endif /* __WINE_X11DRV_H */ diff --git a/windows/x11drv/clipboard.c b/windows/x11drv/clipboard.c index 6717c890f69..aece6ca0d1b 100644 --- a/windows/x11drv/clipboard.c +++ b/windows/x11drv/clipboard.c @@ -837,7 +837,7 @@ void X11DRV_ReleaseClipboard(void) { PROPERTY *prop = prop_head; prop_head = prop->next; - XFreePixmap( display, prop->pixmap ); + XFreePixmap( gdi_display, prop->pixmap ); HeapFree( GetProcessHeap(), 0, prop ); } } @@ -1234,7 +1234,7 @@ void X11DRV_CLIPBOARD_FreeResources( Atom property ) if ((*prop)->atom == property) { PROPERTY *next = (*prop)->next; - XFreePixmap( display, (*prop)->pixmap ); + XFreePixmap( gdi_display, (*prop)->pixmap ); HeapFree( GetProcessHeap(), 0, *prop ); *prop = next; } diff --git a/windows/x11drv/wnd.c b/windows/x11drv/wnd.c index 187b9cb49f2..263a9f4f916 100644 --- a/windows/x11drv/wnd.c +++ b/windows/x11drv/wnd.c @@ -329,17 +329,17 @@ void X11DRV_WND_SurfaceCopy(WND* wndPtr, HDC hdc, INT dx, INT dy, physDev = (X11DRV_PDEVICE *)dcPtr->physDev; dst.x = (src.x = dcPtr->DCOrgX + rect->left) + dx; dst.y = (src.y = dcPtr->DCOrgY + rect->top) + dy; - + + wine_tsx11_lock(); if (bUpdate) /* handles non-Wine windows hanging over the copied area */ - TSXSetGraphicsExposures( display, physDev->gc, True ); - TSXSetFunction( display, physDev->gc, GXcopy ); - TSXCopyArea( display, physDev->drawable, physDev->drawable, - physDev->gc, src.x, src.y, - rect->right - rect->left, - rect->bottom - rect->top, - dst.x, dst.y ); + XSetGraphicsExposures( gdi_display, physDev->gc, True ); + XSetFunction( gdi_display, physDev->gc, GXcopy ); + XCopyArea( gdi_display, physDev->drawable, physDev->drawable, physDev->gc, + src.x, src.y, rect->right - rect->left, rect->bottom - rect->top, + dst.x, dst.y ); if (bUpdate) - TSXSetGraphicsExposures( display, physDev->gc, False ); + XSetGraphicsExposures( gdi_display, physDev->gc, False ); + wine_tsx11_unlock(); GDI_ReleaseObj( hdc ); if (bUpdate) /* Make sure exposure events have been processed */