1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 04:20:27 +01:00

Code refactoring: replaced macro 'XSHM' by 'USE_XSHM' for consistency

The usual way to define a macro in is to name macro with 'USE_xxx' when
they are used to enable a feature 'xxx'.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2013-11-17 18:51:19 +01:00
committed by Carlos R. Mafra
parent ee3422dd10
commit 062f6dd59d
5 changed files with 24 additions and 24 deletions

View File

@@ -604,7 +604,7 @@ if test "$shm" = yes; then
if test "$added_xext" = no; then
XLIBS="-lXext $XLIBS"
fi
AC_DEFINE(XSHM, 1, [define if X's shared memory extension is available (set by configure)])
AC_DEFINE(USE_XSHM, 1, [define if X's shared memory extension is available (set by configure)])
fi
fi

View File

@@ -664,7 +664,7 @@ RContext *RCreateContext(Display * dpy, int screen_number, const RContextAttribu
}
/* check avaiability of MIT-SHM */
#ifdef XSHM
#ifdef USE_XSHM
if (!(context->attribs->flags & RC_UseSharedMemory)) {
context->attribs->flags |= RC_UseSharedMemory;
context->attribs->use_shared_memory = True;

View File

@@ -35,7 +35,7 @@
#include "wraster.h"
#ifdef XSHM
#ifdef USE_XSHM
extern Pixmap R_CreateXImageMappedPixmap(RContext * context, RXImage * ximage);
#endif
@@ -819,7 +819,7 @@ static RXImage *image2Bitmap(RContext * ctx, RImage * image, int threshold)
int RConvertImage(RContext * context, RImage * image, Pixmap * pixmap)
{
RXImage *ximg = NULL;
#ifdef XSHM
#ifdef USE_XSHM
Pixmap tmp;
#endif
@@ -852,7 +852,7 @@ int RConvertImage(RContext * context, RImage * image, Pixmap * pixmap)
*pixmap = XCreatePixmap(context->dpy, context->drawable, image->width, image->height, context->depth);
#ifdef XSHM
#ifdef USE_XSHM
if (context->flags.use_shared_pixmap && ximg->is_shared)
tmp = R_CreateXImageMappedPixmap(context, ximg);
else
@@ -873,9 +873,9 @@ int RConvertImage(RContext * context, RImage * image, Pixmap * pixmap)
} else {
RPutXImage(context, *pixmap, context->copy_gc, ximg, 0, 0, 0, 0, image->width, image->height);
}
#else /* !XSHM */
#else /* !USE_XSHM */
RPutXImage(context, *pixmap, context->copy_gc, ximg, 0, 0, 0, 0, image->width, image->height);
#endif /* !XSHM */
#endif /* !USE_XSHM */
RDestroyXImage(context, ximg);

View File

@@ -47,7 +47,7 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#ifdef XSHM
#ifdef USE_XSHM
#include <X11/extensions/XShm.h>
#endif
@@ -204,7 +204,7 @@ typedef struct RXImage {
XImage *image;
/* Private data. Do not access */
#ifdef XSHM
#ifdef USE_XSHM
XShmSegmentInfo info;
char is_shared;
#endif

View File

@@ -30,14 +30,14 @@
#include <assert.h>
#ifdef XSHM
#ifdef USE_XSHM
#include <sys/ipc.h>
#include <sys/shm.h>
#endif /* XSHM */
#endif /* USE_XSHM */
#include "wraster.h"
#ifdef XSHM
#ifdef USE_XSHM
static int shmError;
@@ -64,7 +64,7 @@ RXImage *RCreateXImage(RContext * context, int depth, unsigned width, unsigned h
RErrorCode = RERR_NOMEMORY;
return NULL;
}
#ifndef XSHM
#ifndef USE_XSHM
rximg->image = XCreateImage(context->dpy, visual, depth, ZPixmap, 0, NULL, width, height, 8, 0);
if (!rximg->image) {
free(rximg);
@@ -78,7 +78,7 @@ RXImage *RCreateXImage(RContext * context, int depth, unsigned width, unsigned h
RErrorCode = RERR_NOMEMORY;
return NULL;
}
#else /* XSHM */
#else /* USE_XSHM */
if (!context->attribs->use_shared_memory) {
retry_without_shm:
@@ -145,16 +145,16 @@ RXImage *RCreateXImage(RContext * context, int depth, unsigned width, unsigned h
goto retry_without_shm;
}
}
#endif /* XSHM */
#endif /* USE_XSHM */
return rximg;
}
void RDestroyXImage(RContext * context, RXImage * rximage)
{
#ifndef XSHM
#ifndef USE_XSHM
XDestroyImage(rximage->image);
#else /* XSHM */
#else /* USE_XSHM */
if (rximage->is_shared) {
XSync(context->dpy, False);
XShmDetach(context->dpy, &rximage->info);
@@ -186,7 +186,7 @@ RXImage *RGetXImage(RContext * context, Drawable d, int x, int y, unsigned width
{
RXImage *ximg = NULL;
#ifdef XSHM
#ifdef USE_XSHM
if (context->attribs->use_shared_memory && 0) {
ximg = RCreateXImage(context, getDepth(context->dpy, d), width, height);
@@ -208,7 +208,7 @@ RXImage *RGetXImage(RContext * context, Drawable d, int x, int y, unsigned width
ximg->image = XGetImage(context->dpy, d, x, y, width, height, AllPlanes, ZPixmap);
}
return ximg;
#else /* !XSHM */
#else /* !USE_XSHM */
ximg = malloc(sizeof(RXImage));
if (!ximg) {
RErrorCode = RERR_NOMEMORY;
@@ -218,14 +218,14 @@ RXImage *RGetXImage(RContext * context, Drawable d, int x, int y, unsigned width
ximg->image = XGetImage(context->dpy, d, x, y, width, height, AllPlanes, ZPixmap);
return ximg;
#endif /* !XSHM */
#endif /* !USE_XSHM */
}
void
RPutXImage(RContext * context, Drawable d, GC gc, RXImage * ximage, int src_x,
int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height)
{
#ifndef XSHM
#ifndef USE_XSHM
XPutImage(context->dpy, d, gc, ximage->image, src_x, src_y, dest_x, dest_y, width, height);
#else
if (ximage->is_shared) {
@@ -235,10 +235,10 @@ RPutXImage(RContext * context, Drawable d, GC gc, RXImage * ximage, int src_x,
XPutImage(context->dpy, d, gc, ximage->image, src_x, src_y, dest_x, dest_y, width, height);
}
XFlush(context->dpy);
#endif /* XSHM */
#endif /* USE_XSHM */
}
#ifdef XSHM
#ifdef USE_XSHM
Pixmap R_CreateXImageMappedPixmap(RContext * context, RXImage * rximage)
{
Pixmap pix;
@@ -250,4 +250,4 @@ Pixmap R_CreateXImageMappedPixmap(RContext * context, RXImage * rximage)
return pix;
}
#endif /* XSHM */
#endif /* USE_XSHM */