#include "renderbuffer.h"
-#ifndef XFree86Server
+#if defined(USE_XSHM) && !defined(XFree86Server)
static volatile int mesaXErrorFlag = 0;
/**
mesaXErrorFlag = 1;
return 0;
}
-#endif
-
/**
* Allocate a shared memory XImage back buffer for the given XMesaBuffer.
* Return: GL_TRUE if success, GL_FALSE if error
*/
-#ifndef XFree86Server
static GLboolean
alloc_back_shm_ximage(XMesaBuffer b, GLuint width, GLuint height)
{
-#ifdef USE_XSHM
/*
* We have to do a _lot_ of error checking here to be sure we can
* really use the XSHM extension. It seems different servers trigger
}
return GL_TRUE;
+}
#else
+static GLboolean
+alloc_back_shm_ximage(XMesaBuffer b, GLuint width, GLuint height)
+{
/* Can't compile XSHM support */
return GL_FALSE;
-#endif
}
#endif
return;
/* Allocate new back buffer */
-#ifdef XFree86Server
- /* Allocate a regular XImage for the back buffer. */
- b->backxrb->ximage = XMesaCreateImage(b->xm_visual->BitsPerPixel,
- width, height, NULL);
- {
-#else
if (b->shm == 0 || !alloc_back_shm_ximage(b, width, height)) {
/* Allocate a regular XImage for the back buffer. */
+#ifdef XFree86Server
+ b->backxrb->ximage = XMesaCreateImage(b->xm_visual->BitsPerPixel,
+ width, height, NULL);
+#else
b->backxrb->ximage = XCreateImage(b->xm_visual->display,
b->xm_visual->visinfo->visual,
GET_VISUAL_DEPTH(b->xm_visual),
}
if (b->gc)
- XMesaFreeGC(b->xm_visual->display, b->gc);
+ XMesaFreeGC(b->display, b->gc);
if (b->cleargc)
- XMesaFreeGC(b->xm_visual->display, b->cleargc);
+ XMesaFreeGC(b->display, b->cleargc);
if (b->swapgc)
- XMesaFreeGC(b->xm_visual->display, b->swapgc);
+ XMesaFreeGC(b->display, b->swapgc);
- if (b->xm_visual->mesa_visual.doubleBufferMode) {
+ if (fb->Visual.doubleBufferMode) {
/* free back ximage/pixmap/shmregion */
if (b->backxrb->ximage) {
#if defined(USE_XSHM) && !defined(XFree86Server)
if (b->shm) {
- XShmDetach( b->xm_visual->display, &b->shminfo );
+ XShmDetach( b->display, &b->shminfo );
XDestroyImage( b->backxrb->ximage );
shmdt( b->shminfo.shmaddr );
}
b->backxrb->ximage = NULL;
}
if (b->backxrb->pixmap) {
- XMesaFreePixmap( b->xm_visual->display, b->backxrb->pixmap );
+ XMesaFreePixmap( b->display, b->backxrb->pixmap );
if (b->xm_visual->hpcr_clear_flag) {
- XMesaFreePixmap( b->xm_visual->display,
+ XMesaFreePixmap( b->display,
b->xm_visual->hpcr_clear_pixmap );
XMesaDestroyImage( b->xm_visual->hpcr_clear_ximage );
}