/* * PEN.C */ #include "defs.h" void RUNESYSCALL(xSetForeground) (void *args, int *res) { struct { int32_t gcid; int32_t color; } *rhs; pthread_mutex_t *mtx; rhs = args; *res = XSetForeground(SaveDisplay, hashLookup(rhs->gcid, HASH_GC, &mtx), rhs->color); threadMutexUnlock(mtx); } void RUNESYSCALL(xSetBackground) (void *args, int *res) { struct { int32_t gcid; int32_t color; } *rhs; pthread_mutex_t *mtx; rhs = args; *res = XSetBackground(SaveDisplay, hashLookup(rhs->gcid, HASH_GC, &mtx), rhs->color); threadMutexUnlock(mtx); } #define COLORMAP DefaultColormap(SaveDisplay, DefaultScreen(SaveDisplay)) void RUNESYSCALL(xAllocColor) (void *args, int *res) { struct { int32_t r; int32_t g; int32_t b; } *rhs; XColor color = {0}; rhs = args; color.red = rhs->r; color.green = rhs->g; color.blue = rhs->b; *res = XAllocColor(SaveDisplay, COLORMAP, &color); /* XXX */ *res = color.pixel; } void RUNESYSCALL(xFreeColor) (void *args, int *res) { struct { int32_t pixel; } *rhs; unsigned long pixel; rhs = args; pixel = rhs->pixel; *res = XFreeColors(SaveDisplay, COLORMAP, &pixel, 1, 0); }