removing the old render stuffs
authorDana Jansens <danakj@orodu.net>
Tue, 27 May 2003 03:15:27 +0000 (03:15 +0000)
committerDana Jansens <danakj@orodu.net>
Tue, 27 May 2003 03:15:27 +0000 (03:15 +0000)
19 files changed:
Makefile.am
configure.ac
render/.cvsignore [deleted file]
render/Makefile.am [deleted file]
render/color.c [deleted file]
render/color.h [deleted file]
render/font.c [deleted file]
render/font.h [deleted file]
render/gradient.c [deleted file]
render/gradient.h [deleted file]
render/image.c [deleted file]
render/image.h [deleted file]
render/mask.c [deleted file]
render/mask.h [deleted file]
render/render.c [deleted file]
render/render.h [deleted file]
render/test.c [deleted file]
render/theme.c [deleted file]
render/theme.h [deleted file]

index 01ab3d725f5fda2673e07a511e44557232ea4d9b..312982442b58b23148771906a23b479017f3a136 100644 (file)
@@ -1,4 +1,4 @@
-SUBDIRS = po themes data render glft render2 parser kernel plugins tools
+SUBDIRS = po themes data glft render2 parser kernel plugins tools
 MAINTAINERCLEANFILES = aclocal.m4 config.h.in configure Makefile.in stamp-h.in
 
 doc:
index cbaf0d94c1cbe847362312fce5d353848b8c8446..4b2769413834ce43c6066c4696f00db48c5e382d 100644 (file)
@@ -112,7 +112,6 @@ AC_CONFIG_FILES([Makefile
                  po/Makefile.in
                  themes/Makefile
                 data/Makefile
-                 render/Makefile
                 glft/Makefile
                  render2/Makefile
                 parser/Makefile
diff --git a/render/.cvsignore b/render/.cvsignore
deleted file mode 100644 (file)
index 54aa917..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-rendertest
-librender.a
-.libs
-color.lo
-font.lo
-gradient.lo
-image.lo
-mask.lo
-render.lo
-test.lo
-libobrender.la
-theme.lo
-Makefile.in
-.deps
-Makefile
diff --git a/render/Makefile.am b/render/Makefile.am
deleted file mode 100644 (file)
index 579ff68..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-themedir=$(datadir)/openbox/themes
-
-theme=operation
-
-CPPFLAGS=$(XFT_CFLAGS) $(GLIB_CFLAGS) $(LIBSN_CFLAGS) $(GL_CFLAGS) @CPPFLAGS@ \
-         -DG_LOG_DOMAIN=\"Render\" \
-         -DDEFAULT_THEME=\"$(theme)\" \
-         -DTHEMEDIR=\"$(themedir)\"
-
-INCLUDES=-I..
-LIBS=$(XFT_LIBS) $(GLIB_LIBS) $(GL_LIBS) @LIBS@
-
-noinst_PROGRAMS=rendertest
-rendertest_LDFLAGS=-lobrender -L.
-rendertest_SOURCES=test.c
-
-lib_LTLIBRARIES=libobrender.la
-libobrender_la_SOURCES=color.c font.c gradient.c image.c mask.c render.c \
-                       theme.c
-
-
-noinst_HEADERS=render.h gradient.h color.h font.h mask.h image.h
-
-MAINTAINERCLEANFILES=Makefile.in
-
-distclean-local:
-       $(RM) *\~ *.orig *.rej .\#*
diff --git a/render/color.c b/render/color.c
deleted file mode 100644 (file)
index ca1f6e8..0000000
+++ /dev/null
@@ -1,261 +0,0 @@
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <string.h>
-#include "render.h"
-#include "color.h"
-#include "../kernel/openbox.h"
-
-XColor *pseudo_colors;
-int pseudo_bpc;
-
-void color_allocate_gc(color_rgb *in)
-{
-    XGCValues gcv;
-
-    gcv.foreground = in->pixel;
-    gcv.cap_style = CapProjecting;
-    in->gc = XCreateGC(ob_display, ob_root, GCForeground | GCCapStyle, &gcv);
-}
-
-color_rgb *color_parse(char *colorname)
-{
-    XColor xcol;
-
-    g_assert(colorname != NULL);
-    /* get rgb values from colorname */
-
-    xcol.red = 0;
-    xcol.green = 0;
-    xcol.blue = 0;
-    xcol.pixel = 0;
-    if (!XParseColor(ob_display, render_colormap, colorname, &xcol)) {
-        g_warning("unable to parse color '%s'", colorname);
-       return NULL;
-    }
-    return color_new(xcol.red >> 8, xcol.green >> 8, xcol.blue >> 8);
-}
-
-color_rgb *color_new(int r, int g, int b)
-{
-/* this should be replaced with something far cooler */
-    color_rgb *out;
-    XColor xcol;
-    xcol.red = (r << 8) | r;
-    xcol.green = (g << 8) | g;
-    xcol.blue = (b << 8) | b;
-    if (XAllocColor(ob_display, render_colormap, &xcol)) {
-        out = g_new(color_rgb, 1);
-        out->r = xcol.red >> 8;
-        out->g = xcol.green >> 8;
-        out->b = xcol.blue >> 8;
-        out->gc = None;
-        out->pixel = xcol.pixel;
-        return out;
-    }
-    return NULL;
-}
-
-/*XXX same color could be pointed to twice, this might have to be a refcount*/
-
-void color_free(color_rgb *c)
-{
-    if (c != NULL) {
-        if (c->gc != None)
-            XFreeGC(ob_display, c->gc);
-        g_free(c);
-    }
-}
-
-void reduce_depth(pixel32 *data, XImage *im)
-{
-    int r, g, b;
-    int x,y;
-    pixel32 *p32 = (pixel32 *) im->data;
-    pixel16 *p16 = (pixel16 *) im->data;
-    unsigned char *p8 = (unsigned char *)im->data;
-    switch (im->bits_per_pixel) {
-    case 32:
-        if ((render_red_offset != default_red_offset) ||
-            (render_blue_offset != default_blue_offset) ||
-            (render_green_offset != default_green_offset)) {
-            for (y = 0; y < im->height; y++) {
-                for (x = 0; x < im->width; x++) {
-                    r = (data[x] >> default_red_offset) & 0xFF;
-                    g = (data[x] >> default_green_offset) & 0xFF;
-                    b = (data[x] >> default_blue_offset) & 0xFF;
-                    p32[x] = (r << render_red_shift)
-                           + (g << render_green_shift)
-                           + (b << render_blue_shift);
-                }
-                data += im->width;
-                p32 += im->width;
-            } 
-        } else im->data = (char*) data;
-        break;
-    case 16:
-        for (y = 0; y < im->height; y++) {
-            for (x = 0; x < im->width; x++) {
-                r = (data[x] >> default_red_offset) & 0xFF;
-                r = r >> render_red_shift;
-                g = (data[x] >> default_green_offset) & 0xFF;
-                g = g >> render_green_shift;
-                b = (data[x] >> default_blue_offset) & 0xFF;
-                b = b >> render_blue_shift;
-                p16[x] = (r << render_red_offset)
-                    + (g << render_green_offset)
-                    + (b << render_blue_offset);
-            }
-            data += im->width;
-            p16 += im->bytes_per_line/2;
-        }
-    break;
-    case 8:
-        g_assert(render_visual->class != TrueColor);
-        for (y = 0; y < im->height; y++) {
-            for (x = 0; x < im->width; x++) {
-                p8[x] = pickColor(data[x] >> default_red_offset,
-                       data[x] >> default_green_offset,
-                       data[x] >> default_blue_offset)->pixel;
-        }
-        data += im->width;
-        p8 += im->bytes_per_line;
-  }
-
-    break;
-    default:
-        g_message("your bit depth is currently unhandled\n");
-    }
-}
-
-XColor *pickColor(int r, int g, int b) 
-{
-  r = (r & 0xff) >> (8-pseudo_bpc);
-  g = (g & 0xff) >> (8-pseudo_bpc);
-  b = (b & 0xff) >> (8-pseudo_bpc);
-  return &pseudo_colors[(r << (2*pseudo_bpc)) + (g << (1*pseudo_bpc)) + b];
-}
-
-static void swap_byte_order(XImage *im)
-{
-    int x, y, di;
-
-    g_message("SWAPPING BYTE ORDER");
-
-    di = 0;
-    for (y = 0; y < im->height; ++y) {
-        for (x = 0; x < im->height; ++x) {
-            char *c = &im->data[di + x * im->bits_per_pixel / 8];
-            char t;
-
-            switch (im->bits_per_pixel) {
-            case 32:
-                t = c[2];
-                c[2] = c[3];
-                c[3] = t;
-            case 16:
-                t = c[0];
-                c[0] = c[1];
-                c[1] = t;
-            case 8:
-                break;
-            default:
-                g_message("your bit depth is currently unhandled\n");
-            }
-        }
-        di += im->bytes_per_line;
-    }
-
-    if (im->byte_order == LSBFirst)
-        im->byte_order = MSBFirst;
-    else
-        im->byte_order = LSBFirst;
-}
-
-void increase_depth(pixel32 *data, XImage *im)
-{
-    int r, g, b;
-    int x,y;
-    pixel32 *p32 = (pixel32 *) im->data;
-    pixel16 *p16 = (pixel16 *) im->data;
-    unsigned char *p8 = (unsigned char *)im->data;
-
-    if (im->byte_order != render_endian)
-        swap_byte_order(im);
-
-    switch (im->bits_per_pixel) {
-    case 32:
-        for (y = 0; y < im->height; y++) {
-            for (x = 0; x < im->width; x++) {
-                r = (p32[x] >> render_red_offset) & 0xff;
-                g = (p32[x] >> render_green_offset) & 0xff;
-                b = (p32[x] >> render_blue_offset) & 0xff;
-                data[x] = (r << default_red_offset)
-                    + (g << default_green_offset)
-                    + (b << default_blue_offset)
-                    + (0xff << default_alpha_offset);
-            }
-            data += im->width;
-            p32 += im->bytes_per_line/4;
-        }
-        break;
-    case 16:
-        for (y = 0; y < im->height; y++) {
-            for (x = 0; x < im->width; x++) {
-                r = (p16[x] & render_red_mask) >> render_red_offset <<
-                    render_red_shift;
-                g = (p16[x] & render_green_mask) >> render_green_offset <<
-                    render_green_shift;
-                b = (p16[x] & render_blue_mask) >> render_blue_offset <<
-                    render_blue_shift;
-                data[x] = (r << default_red_offset)
-                    + (g << default_green_offset)
-                    + (b << default_blue_offset)
-                    + (0xff << default_alpha_offset);
-            }
-            data += im->width;
-            p16 += im->bytes_per_line/2;
-        }
-        break;
-    case 8:
-        g_assert(render_visual->class != TrueColor);
-        for (y = 0; y < im->height; y++) {
-            for (x = 0; x < im->width; x++) {
-                XColor icolor;
-                int ii, r, g, b;
-                gulong dev, closest = 0xffffffff, close = 0;
-
-                icolor.pixel = p8[x];
-                XQueryColor(ob_display, render_colormap, &icolor);
-
-                /* find the nearest color match */
-                for (ii = 0; ii < pseudo_ncolors(); ii++) {
-                    /* find deviations */
-                    r = (pseudo_colors[ii].red - icolor.red) & 0xff;
-                    g = (pseudo_colors[ii].green - icolor.green) & 0xff;
-                    b = (pseudo_colors[ii].blue - icolor.blue) & 0xff;
-                    /* find a weighted absolute deviation */
-                    dev = (r * r) + (g * g) + (b * b);
-
-                    if (dev < closest) {
-                        closest = dev;
-                        close = ii;
-                    }
-                }
-                data[x] =
-                    (pseudo_colors[close].red & 0xff <<
-                     default_red_offset) +
-                    (pseudo_colors[close].green & 0xff <<
-                       default_green_offset) +
-                    (pseudo_colors[close].blue & 0xff <<
-                       default_blue_offset) +
-                    (0xff << default_alpha_offset);
-        }
-        data += im->width;
-        p8 += im->bytes_per_line;
-  }
-
-    break;
-    default:
-        g_message("your bit depth is currently unhandled\n");
-    }
-}
diff --git a/render/color.h b/render/color.h
deleted file mode 100644 (file)
index fb669fb..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-#ifndef __color_h
-#define __color_h
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-#ifdef HAVE_STDINT_H 
-#  include <stdint.h>
-#else
-#  ifdef HAVE_SYS_TYPES_H
-#    include <sys/types.h>
-#  endif   
-#endif
-
-
-#ifdef HAVE_STDINT_H
-typedef uint32_t pixel32;
-typedef uint16_t pixel16;
-#else
-typedef u_int32_t pixel32;  
-typedef u_int16_t pixel16;   
-#endif /* HAVE_STDINT_H */  
-
-#if (G_BYTE_ORDER == G_BIG_ENDIAN)
-#define default_red_offset 0
-#define default_green_offset 8
-#define default_blue_offset 16
-#define default_alpha_offset 24
-#define render_endian MSBFirst  
-#else
-#define default_alpha_offset 24
-#define default_red_offset 16
-#define default_green_offset 8
-#define default_blue_offset 0
-#define render_endian LSBFirst
-#endif /* G_BYTE_ORDER == G_BIG_ENDIAN */
-
-
-typedef struct color_rgb {
-    int r;
-    int g;
-    int b;
-    unsigned long pixel;
-    GC gc;
-} color_rgb;
-
-void color_allocate_gc(color_rgb *in);
-XColor *pickColor(int r, int g, int b);
-color_rgb *color_parse(char *colorname);
-color_rgb *color_new(int r, int g, int b);
-void color_free(color_rgb *in);
-void reduce_depth(pixel32 *data, XImage *im);
-void increase_depth(pixel32 *data, XImage *im);
-
-extern int render_red_offset;
-extern int render_green_offset;
-extern int render_blue_offset;
-
-extern int render_red_shift;
-extern int render_green_shift;
-extern int render_blue_shift;
-
-extern int render_red_mask;
-extern int render_green_mask;
-extern int render_blue_mask;
-
-extern int pseudo_bpc;
-#define pseudo_ncolors() (1 << (pseudo_bpc * 3))
-extern XColor *pseudo_colors;
-#endif /* __color_h */
diff --git a/render/font.c b/render/font.c
deleted file mode 100644 (file)
index db4e848..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-#include "font.h"
-#include "kernel/openbox.h"
-#include "kernel/geom.h"
-#include "kernel/gettext.h"
-#define _(str) gettext(str)
-
-#include <X11/Xft/Xft.h>
-#include <glib.h>
-#include <string.h>
-
-#define ELIPSES "..."
-#define ELIPSES_LENGTH(font, shadow, offset) \
-    (font->elipses_length + (shadow ? offset : 0))
-
-void font_startup(void)
-{
-#ifdef DEBUG
-    int version;
-#endif /* DEBUG */
-    if (!XftInit(0)) {
-        g_warning(_("Couldn't initialize Xft.\n"));
-        exit(3);
-    }
-#ifdef DEBUG
-    version = XftGetVersion();
-    g_message("Using Xft %d.%d.%d (Built against %d.%d.%d).",
-              version / 10000 % 100, version / 100 % 100, version % 100,
-              XFT_MAJOR, XFT_MINOR, XFT_REVISION);
-#endif
-}
-
-static void measure_height(ObFont *f)
-{
-    XGlyphInfo info;
-    char *str;
-
-    /* XXX add some extended UTF8 characters in here? */
-    str = "12345678900-qwertyuiopasdfghjklzxcvbnm"
-        "!@#$%^&*()_+QWERTYUIOPASDFGHJKLZXCVBNM"
-        "`~[]\\;',./{}|:\"<>?";
-
-    XftTextExtentsUtf8(ob_display, f->xftfont,
-                       (FcChar8*)str, strlen(str), &info);
-    f->height = (signed) info.height;
-
-    /* measure an elipses */
-    XftTextExtentsUtf8(ob_display, f->xftfont,
-                       (FcChar8*)ELIPSES, strlen(ELIPSES), &info);
-    f->elipses_length = (signed) info.xOff;
-}
-
-ObFont *font_open(char *fontstring)
-{
-    ObFont *out;
-    XftFont *xf;
-    
-    if ((xf = XftFontOpenName(ob_display, ob_screen, fontstring))) {
-        out = g_new(ObFont, 1);
-        out->xftfont = xf;
-        measure_height(out);
-        return out;
-    }
-    g_warning(_("Unable to load font: %s\n"), fontstring);
-    g_warning(_("Trying fallback font: %s\n"), "sans");
-
-    if ((xf = XftFontOpenName(ob_display, ob_screen, "sans"))) {
-        out = g_new(ObFont, 1);
-        out->xftfont = xf;
-        measure_height(out);
-        return out;
-    }
-    g_warning(_("Unable to load font: %s\n"), "sans");
-    g_warning(_("Aborting!.\n"));
-
-    exit(3); /* can't continue without a font */
-}
-
-void font_close(ObFont *f)
-{
-    if (f) {
-        XftFontClose(ob_display, f->xftfont);
-        g_free(f);
-    }
-}
-
-int font_measure_string(ObFont *f, char *str, int shadow, int offset)
-{
-    XGlyphInfo info;
-
-    XftTextExtentsUtf8(ob_display, f->xftfont,
-                       (FcChar8*)str, strlen(str), &info);
-
-    return (signed) info.xOff + (shadow ? offset : 0);
-}
-
-int font_height(ObFont *f, int shadow, int offset)
-{
-    return f->height + (shadow ? offset : 0);
-}
-
-int font_max_char_width(ObFont *f)
-{
-    return (signed) f->xftfont->max_advance_width;
-}
-
-void font_draw(XftDraw *d, TextureText *t, Rect *position)
-{
-    int x,y,w,h;
-    XftColor c;
-    GString *text;
-    int m, em;
-    size_t l;
-    gboolean shortened = FALSE;
-
-    y = position->y;
-    w = position->width;
-    h = position->height;
-
-    /* accomidate for areas bigger/smaller than Xft thinks the font is tall */
-    y -= (2 * (t->font->xftfont->ascent + t->font->xftfont->descent) -
-          (t->font->height + h) - 1) / 2;
-
-    text = g_string_new(t->string);
-    l = g_utf8_strlen(text->str, -1);
-    m = font_measure_string(t->font, text->str, t->shadow, t->offset);
-    while (l && m > position->width) {
-        shortened = TRUE;
-        /* remove a character from the middle */
-        text = g_string_erase(text, l-- / 2, 1);
-        em = ELIPSES_LENGTH(t->font, t->shadow, t->offset);
-        /* if the elipses are too large, don't show them at all */
-        if (em > position->width)
-            shortened = FALSE;
-        m = font_measure_string(t->font, text->str, t->shadow, t->offset) + em;
-    }
-    if (shortened) {
-        text = g_string_insert(text, (l + 1) / 2, ELIPSES);
-        l += 3;
-    }
-    if (!l) return;
-
-    switch (t->justify) {
-    case Justify_Left:
-        x = position->x;
-        break;
-    case Justify_Right:
-        x = position->x + (w - m);
-        break;
-    case Justify_Center:
-        x = position->x + (w - m) / 2;
-        break;
-    }
-
-    l = strlen(text->str); /* number of bytes */
-
-    if (t->shadow) {
-        if (t->tint >= 0) {
-            c.color.red = 0;
-            c.color.green = 0;
-            c.color.blue = 0;
-            c.color.alpha = 0xffff * t->tint / 100; /* transparent shadow */
-            c.pixel = BlackPixel(ob_display, ob_screen);
-        } else {
-            c.color.red = 0xffff * -t->tint / 100;
-            c.color.green = 0xffff * -t->tint / 100;
-            c.color.blue = 0xffff * -t->tint / 100;
-            c.color.alpha = 0xffff * -t->tint / 100; /* transparent shadow */
-            c.pixel = WhitePixel(ob_display, ob_screen);
-        }  
-        XftDrawStringUtf8(d, &c, t->font->xftfont, x + t->offset,
-                          t->font->xftfont->ascent + y + t->offset,
-                          (FcChar8*)text->str, l);
-    }  
-    c.color.red = t->color->r | t->color->r << 8;
-    c.color.green = t->color->g | t->color->g << 8;
-    c.color.blue = t->color->b | t->color->b << 8;
-    c.color.alpha = 0xff | 0xff << 8; /* fully opaque text */
-    c.pixel = t->color->pixel;
-                     
-    XftDrawStringUtf8(d, &c, t->font->xftfont, x,
-                      t->font->xftfont->ascent + y,
-                      (FcChar8*)text->str, l);
-    return;
-}
diff --git a/render/font.h b/render/font.h
deleted file mode 100644 (file)
index 6a5d4c6..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef __font_h
-#define __font_h
-#include <X11/Xft/Xft.h>
-#include "render.h"
-#include "kernel/geom.h"
-
-void font_startup(void);
-ObFont *font_open(char *fontstring);
-void font_close(ObFont *f);
-int font_measure_string(ObFont *f, char *str, int shadow, int offset);
-int font_height(ObFont *f, int shadow, int offset);
-int font_max_char_width(ObFont *f);
-void font_draw(XftDraw *d, TextureText *t, Rect *position);
-#endif /* __font_h */
diff --git a/render/gradient.c b/render/gradient.c
deleted file mode 100644 (file)
index 31d4c73..0000000
+++ /dev/null
@@ -1,758 +0,0 @@
-#ifdef USE_GL
-#include <GL/gl.h>
-#endif /* USE_GL */
-#include <glib.h>
-#include "render.h"
-#include "gradient.h"
-#include "../kernel/openbox.h"
-#include "color.h"
-
-void gradient_render(Surface *sf, int w, int h)
-{
-    pixel32 *data = sf->data.planar.pixel_data;
-    pixel32 current;
-    unsigned int r,g,b;
-    int off, x;
-
-    switch (sf->data.planar.grad) {
-    case Background_Solid: /* already handled */
-        return;
-    case Background_Vertical:
-        gradient_vertical(sf, w, h);
-        break;
-    case Background_Horizontal:
-        gradient_horizontal(sf, w, h);
-        break;
-    case Background_Diagonal:
-        gradient_diagonal(sf, w, h);
-        break;
-    case Background_CrossDiagonal:
-        gradient_crossdiagonal(sf, w, h);
-        break;
-    case Background_Pyramid:
-        gradient_pyramid(sf, w, h);
-        break;
-    case Background_PipeCross:
-        gradient_pipecross(sf, w, h);
-        break;
-    case Background_Rectangle:
-        gradient_rectangle(sf, w, h);
-        break;
-    default:
-        g_message("unhandled gradient");
-        return;
-    }
-  
-    if (sf->data.planar.relief == Flat && sf->data.planar.border) {
-        r = sf->data.planar.border_color->r;
-        g = sf->data.planar.border_color->g;
-        b = sf->data.planar.border_color->b;
-        current = (r << default_red_offset)
-            + (g << default_green_offset)
-            + (b << default_blue_offset);
-        for (off = 0, x = 0; x < w; ++x, off++) {
-            *(data + off) = current;
-            *(data + off + ((h-1) * w)) = current;
-        }
-        for (off = 0, x = 0; x < h; ++x, off++) {
-            *(data + (off * w)) = current;
-            *(data + (off * w) + w - 1) = current;
-        }
-    }
-
-    if (sf->data.planar.relief != Flat) {
-        if (sf->data.planar.bevel == Bevel1) {
-            for (off = 1, x = 1; x < w - 1; ++x, off++)
-                highlight(data + off,
-                          data + off + (h-1) * w,
-                          sf->data.planar.relief==Raised);
-            for (off = 0, x = 0; x < h; ++x, off++)
-                highlight(data + off * w,
-                          data + off * w + w - 1,
-                          sf->data.planar.relief==Raised);
-        }
-
-        if (sf->data.planar.bevel == Bevel2) {
-            for (off = 2, x = 2; x < w - 2; ++x, off++)
-                highlight(data + off + w,
-                          data + off + (h-2) * w,
-                          sf->data.planar.relief==Raised);
-            for (off = 1, x = 1; x < h-1; ++x, off++)
-                highlight(data + off * w + 1,
-                          data + off * w + w - 2,
-                          sf->data.planar.relief==Raised);
-        }
-    }
-}
-
-
-
-void gradient_vertical(Surface *sf, int w, int h)
-{
-    pixel32 *data = sf->data.planar.pixel_data;
-    pixel32 current;
-    float dr, dg, db;
-    unsigned int r,g,b;
-    int x, y;
-
-    dr = (float)(sf->data.planar.secondary->r - sf->data.planar.primary->r);
-    dr/= (float)h;
-
-    dg = (float)(sf->data.planar.secondary->g - sf->data.planar.primary->g);
-    dg/= (float)h;
-
-    db = (float)(sf->data.planar.secondary->b - sf->data.planar.primary->b);
-    db/= (float)h;
-
-    for (y = 0; y < h; ++y) {
-        r = sf->data.planar.primary->r + (int)(dr * y);
-        g = sf->data.planar.primary->g + (int)(dg * y);
-        b = sf->data.planar.primary->b + (int)(db * y);
-        current = (r << default_red_offset)
-            + (g << default_green_offset)
-            + (b << default_blue_offset);
-        for (x = 0; x < w; ++x, ++data)
-            *data = current;
-    }
-}
-
-void gradient_horizontal(Surface *sf, int w, int h)
-{
-    pixel32 *data = sf->data.planar.pixel_data;
-    pixel32 current;
-    float dr, dg, db;
-    unsigned int r,g,b;
-    int x, y;
-
-    dr = (float)(sf->data.planar.secondary->r - sf->data.planar.primary->r);
-    dr/= (float)w;
-
-    dg = (float)(sf->data.planar.secondary->g - sf->data.planar.primary->g);
-    dg/= (float)w;
-
-    db = (float)(sf->data.planar.secondary->b - sf->data.planar.primary->b);
-    db/= (float)w;
-
-    for (x = 0; x < w; ++x, ++data) {
-        r = sf->data.planar.primary->r + (int)(dr * x);
-        g = sf->data.planar.primary->g + (int)(dg * x);
-        b = sf->data.planar.primary->b + (int)(db * x);
-        current = (r << default_red_offset)
-            + (g << default_green_offset)
-            + (b << default_blue_offset);
-        for (y = 0; y < h; ++y)
-            *(data + y*w) = current;
-    }
-}
-
-void gradient_diagonal(Surface *sf, int w, int h)
-{
-    pixel32 *data = sf->data.planar.pixel_data;
-    pixel32 current;
-    float drx, dgx, dbx, dry, dgy, dby;
-    unsigned int r,g,b;
-    int x, y;
-
-    for (y = 0; y < h; ++y) {
-        drx = (float)(sf->data.planar.secondary->r -
-                      sf->data.planar.primary->r);
-        dry = drx/(float)h;
-        drx/= (float)w;
-
-        dgx = (float)(sf->data.planar.secondary->g -
-                      sf->data.planar.primary->g);
-        dgy = dgx/(float)h;
-        dgx/= (float)w;
-
-        dbx = (float)(sf->data.planar.secondary->b -
-                      sf->data.planar.primary->b);
-        dby = dbx/(float)h;
-        dbx/= (float)w;
-        for (x = 0; x < w; ++x, ++data) {
-            r = sf->data.planar.primary->r +
-                ((int)(drx * x) + (int)(dry * y))/2;
-            g = sf->data.planar.primary->g +
-                ((int)(dgx * x) + (int)(dgy * y))/2;
-            b = sf->data.planar.primary->b +
-                ((int)(dbx * x) + (int)(dby * y))/2;
-            current = (r << default_red_offset)
-                + (g << default_green_offset)
-                + (b << default_blue_offset);
-            *data = current;
-        }
-    }
-}
-
-void gradient_crossdiagonal(Surface *sf, int w, int h)
-{
-    pixel32 *data = sf->data.planar.pixel_data;
-    pixel32 current;
-    float drx, dgx, dbx, dry, dgy, dby;
-    unsigned int r,g,b;
-    int x, y;
-
-    for (y = 0; y < h; ++y) {
-        drx = (float)(sf->data.planar.secondary->r -
-                      sf->data.planar.primary->r);
-        dry = drx/(float)h;
-        drx/= (float)w;
-
-        dgx = (float)(sf->data.planar.secondary->g -
-                      sf->data.planar.primary->g);
-        dgy = dgx/(float)h;
-        dgx/= (float)w;
-
-        dbx = (float)(sf->data.planar.secondary->b -
-                      sf->data.planar.primary->b);
-        dby = dbx/(float)h;
-        dbx/= (float)w;
-        for (x = w; x > 0; --x, ++data) {
-            r = sf->data.planar.primary->r +
-                ((int)(drx * (x-1)) + (int)(dry * y))/2;
-            g = sf->data.planar.primary->g +
-                ((int)(dgx * (x-1)) + (int)(dgy * y))/2;
-            b = sf->data.planar.primary->b +
-                ((int)(dbx * (x-1)) + (int)(dby * y))/2;
-            current = (r << default_red_offset)
-                + (g << default_green_offset)
-                + (b << default_blue_offset);
-            *data = current;
-        }
-    }
-}
-
-void highlight(pixel32 *x, pixel32 *y, gboolean raised)
-{
-    int r, g, b;
-
-    pixel32 *up, *down;
-    if (raised) {
-        up = x;
-        down = y;
-    } else {
-        up = y;
-        down = x;
-    }
-    r = (*up >> default_red_offset) & 0xFF;
-    r += r >> 1;
-    g = (*up >> default_green_offset) & 0xFF;
-    g += g >> 1;
-    b = (*up >> default_blue_offset) & 0xFF;
-    b += b >> 1;
-    if (r > 0xFF) r = 0xFF;
-    if (g > 0xFF) g = 0xFF;
-    if (b > 0xFF) b = 0xFF;
-    *up = (r << default_red_offset) + (g << default_green_offset)
-        + (b << default_blue_offset);
-  
-    r = (*down >> default_red_offset) & 0xFF;
-    r = (r >> 1) + (r >> 2);
-    g = (*down >> default_green_offset) & 0xFF;
-    g = (g >> 1) + (g >> 2);
-    b = (*down >> default_blue_offset) & 0xFF;
-    b = (b >> 1) + (b >> 2);
-    *down = (r << default_red_offset) + (g << default_green_offset)
-        + (b << default_blue_offset);
-}
-
-static void create_bevel_colors(Appearance *l)
-{
-    int r, g, b;
-
-    /* light color */
-    r = l->surface.data.planar.primary->r;
-    r += r >> 1;
-    g = l->surface.data.planar.primary->g;
-    g += g >> 1;
-    b = l->surface.data.planar.primary->b;
-    b += b >> 1;
-    if (r > 0xFF) r = 0xFF;
-    if (g > 0xFF) g = 0xFF;
-    if (b > 0xFF) b = 0xFF;
-    g_assert(!l->surface.data.planar.bevel_light);
-    l->surface.data.planar.bevel_light = color_new(r, g, b);
-    color_allocate_gc(l->surface.data.planar.bevel_light);
-
-    /* dark color */
-    r = l->surface.data.planar.primary->r;
-    r = (r >> 1) + (r >> 2);
-    g = l->surface.data.planar.primary->g;
-    g = (g >> 1) + (g >> 2);
-    b = l->surface.data.planar.primary->b;
-    b = (b >> 1) + (b >> 2);
-    g_assert(!l->surface.data.planar.bevel_dark);
-    l->surface.data.planar.bevel_dark = color_new(r, g, b);
-    color_allocate_gc(l->surface.data.planar.bevel_dark);
-}
-
-void gradient_solid(Appearance *l, int x, int y, int w, int h) 
-{
-    pixel32 pix;
-    int i, a, b;
-    PlanarSurface *sp = &l->surface.data.planar;
-    int left = x, top = y, right = x + w - 1, bottom = y + h - 1;
-
-    if (sp->primary->gc == None)
-        color_allocate_gc(sp->primary);
-    pix = (sp->primary->r << default_red_offset)
-        + (sp->primary->g << default_green_offset)
-        + (sp->primary->b << default_blue_offset);
-
-    for (a = 0; a < l->area.width; a++)
-        for (b = 0; b < l->area.height; b++)
-            sp->pixel_data[a + b*l->area.width] = pix;
-
-    XFillRectangle(ob_display, l->pixmap, sp->primary->gc,
-                   x, y, w, h);
-
-    if (sp->interlaced) {
-        if (sp->secondary->gc == None)
-            color_allocate_gc(sp->secondary);
-        for (i = y; i < h; i += 2)
-            XDrawLine(ob_display, l->pixmap, sp->secondary->gc,
-                      x, i, w, i);
-    }
-
-    switch (sp->relief) {
-    case Raised:
-        if (!sp->bevel_dark)
-            create_bevel_colors(l);
-
-        switch (sp->bevel) {
-        case Bevel1:
-            XDrawLine(ob_display, l->pixmap, sp->bevel_dark->gc,
-                      left, bottom, right, bottom);
-            XDrawLine(ob_display, l->pixmap, sp->bevel_dark->gc,
-                      right, bottom, right, top);
-                
-            XDrawLine(ob_display, l->pixmap, sp->bevel_light->gc,
-                      left, top, right, top);
-            XDrawLine(ob_display, l->pixmap, sp->bevel_light->gc,
-                      left, bottom, left, top);
-            break;
-        case Bevel2:
-            XDrawLine(ob_display, l->pixmap,
-                      sp->bevel_dark->gc,
-                      left + 1, bottom - 2, right - 2, bottom - 2);
-            XDrawLine(ob_display, l->pixmap,
-                      sp->bevel_dark->gc,
-                      right - 2, bottom - 2, right - 2, top + 1);
-
-            XDrawLine(ob_display, l->pixmap,
-                      sp->bevel_light->gc,
-                      left + 1, top + 1, right - 2, top + 1);
-            XDrawLine(ob_display, l->pixmap,
-                      sp->bevel_light->gc,
-                      left + 1, bottom - 2, left + 1, top + 1);
-            break;
-        default:
-            g_assert_not_reached(); /* unhandled BevelType */
-        }
-        break;
-    case Sunken:
-        if (!sp->bevel_dark)
-            create_bevel_colors(l);
-
-        switch (sp->bevel) {
-        case Bevel1:
-            XDrawLine(ob_display, l->pixmap, sp->bevel_light->gc,
-                      left, bottom, right, bottom);
-            XDrawLine(ob_display, l->pixmap, sp->bevel_light->gc,
-                      right, bottom, right, top);
-      
-            XDrawLine(ob_display, l->pixmap, sp->bevel_dark->gc,
-                      left, top, right, top);
-            XDrawLine(ob_display, l->pixmap, sp->bevel_dark->gc,
-                      left, bottom, left, top);
-            break;
-        case Bevel2:
-            XDrawLine(ob_display, l->pixmap, sp->bevel_light->gc,
-                      left + 1, bottom - 2, right - 2, bottom - 2);
-            XDrawLine(ob_display, l->pixmap, sp->bevel_light->gc,
-                      right - 2, bottom - 2, right - 2, top + 1);
-      
-            XDrawLine(ob_display, l->pixmap, sp->bevel_dark->gc,
-                      left + 1, top + 1, right - 2, top + 1);
-            XDrawLine(ob_display, l->pixmap, sp->bevel_dark->gc,
-                      left + 1, bottom - 2, left + 1, top + 1);
-
-            break;
-        default:
-            g_assert_not_reached(); /* unhandled BevelType */
-        }
-        break;
-    case Flat:
-        if (sp->border) {
-            if (sp->border_color->gc == None)
-                color_allocate_gc(sp->border_color);
-            XDrawRectangle(ob_display, l->pixmap, sp->border_color->gc,
-                           left, top, right, bottom);
-        }
-        break;
-    default:  
-        g_assert_not_reached(); /* unhandled ReliefType */
-    }
-}
-
-void gradient_pyramid(Surface *sf, int inw, int inh)
-{
-    pixel32 *data = sf->data.planar.pixel_data;
-    pixel32 *end = data + inw*inh - 1;
-    pixel32 current;
-    float drx, dgx, dbx, dry, dgy, dby;
-    unsigned int r,g,b;
-    int x, y, h=(inh/2) + 1, w=(inw/2) + 1;
-    for (y = 0; y < h; ++y) {
-        drx = (float)(sf->data.planar.secondary->r -
-                      sf->data.planar.primary->r);
-        dry = drx/(float)h;
-        drx/= (float)w;
-
-        dgx = (float)(sf->data.planar.secondary->g -
-                      sf->data.planar.primary->g);
-        dgy = dgx/(float)h;
-        dgx/= (float)w;
-
-        dbx = (float)(sf->data.planar.secondary->b -
-                      sf->data.planar.primary->b);
-        dby = dbx/(float)h;
-        dbx/= (float)w;
-        for (x = 0; x < w; ++x, data) {
-            r = sf->data.planar.primary->r +
-                ((int)(drx * x) + (int)(dry * y))/2;
-            g = sf->data.planar.primary->g +
-                ((int)(dgx * x) + (int)(dgy * y))/2;
-            b = sf->data.planar.primary->b +
-                ((int)(dbx * x) + (int)(dby * y))/2;
-            current = (r << default_red_offset)
-                + (g << default_green_offset)
-                + (b << default_blue_offset);
-            *(data+x) = current;
-            *(data+inw-x) = current;
-            *(end-x) = current;
-            *(end-(inw-x)) = current;
-        }
-        data+=inw;
-        end-=inw;
-    }
-}
-
-void gradient_rectangle(Surface *sf, int inw, int inh)
-{
-    pixel32 *data = sf->data.planar.pixel_data;
-    pixel32 *end = data + inw*inh - 1;
-    pixel32 current;
-    float drx, dgx, dbx, dry, dgy, dby;
-    unsigned int r,g,b;
-    int x, y, h=(inh/2) + 1, w=(inw/2) + 1;
-    int val;
-
-    for (y = 0; y < h; ++y) {
-        drx = (float)(sf->data.planar.primary->r -
-                      sf->data.planar.secondary->r);
-        dry = drx/(float)h;
-        drx/= (float)w;
-
-        dgx = (float)(sf->data.planar.primary->g -
-                      sf->data.planar.secondary->g);
-        dgy = dgx/(float)h;
-        dgx/= (float)w;
-
-        dbx = (float)(sf->data.planar.primary->b -
-                      sf->data.planar.secondary->b);
-        dby = dbx/(float)h;
-        dbx/= (float)w;
-        for (x = 0; x < w; ++x, data) {
-            if ((float)x/(float)w < (float)y/(float)h) val = (int)(drx * x);
-            else val = (int)(dry * y);
-
-            r = sf->data.planar.secondary->r + val;
-            g = sf->data.planar.secondary->g + val;
-            b = sf->data.planar.secondary->b + val;
-            current = (r << default_red_offset)
-                + (g << default_green_offset)
-                + (b << default_blue_offset);
-            *(data+x) = current;
-            *(data+inw-x) = current;
-            *(end-x) = current;
-            *(end-(inw-x)) = current;
-        }
-        data+=inw;
-        end-=inw;
-    }
-}
-
-void gradient_pipecross(Surface *sf, int inw, int inh)
-{
-    pixel32 *data = sf->data.planar.pixel_data;
-    pixel32 *end = data + inw*inh - 1;
-    pixel32 current;
-    float drx, dgx, dbx, dry, dgy, dby;
-    unsigned int r,g,b;
-    int x, y, h=(inh/2) + 1, w=(inw/2) + 1;
-    int val;
-
-    for (y = 0; y < h; ++y) {
-        drx = (float)(sf->data.planar.secondary->r -
-                      sf->data.planar.primary->r);
-        dry = drx/(float)h;
-        drx/= (float)w;
-
-        dgx = (float)(sf->data.planar.secondary->g -
-                      sf->data.planar.primary->g);
-        dgy = dgx/(float)h;
-        dgx/= (float)w;
-
-        dbx = (float)(sf->data.planar.secondary->b -
-                      sf->data.planar.primary->b);
-        dby = dbx/(float)h;
-        dbx/= (float)w;
-        for (x = 0; x < w; ++x, data) {
-            if ((float)x/(float)w > (float)y/(float)h) val = (int)(drx * x);
-            else val = (int)(dry * y);
-
-            r = sf->data.planar.primary->r + val;
-            g = sf->data.planar.primary->g + val;
-            b = sf->data.planar.primary->b + val;
-            current = (r << default_red_offset)
-                + (g << default_green_offset)
-                + (b << default_blue_offset);
-            *(data+x) = current;
-            *(data+inw-x) = current;
-            *(end-x) = current;
-            *(end-(inw-x)) = current;
-        }
-        data+=inw;
-        end-=inw;
-    }
-}
-#ifdef USE_GL
-void render_gl_gradient(Surface *sf, int x, int y, int w, int h)
-{
-    float pr,pg,pb;
-    float sr, sg, sb;
-    float ar, ag, ab;
-
-    pr = (float)sf->data.planar.primary->r/255.0;
-    pg = (float)sf->data.planar.primary->g/255.0;
-    pb = (float)sf->data.planar.primary->b/255.0;
-    if (sf->data.planar.secondary) {
-        sr = (float)sf->data.planar.secondary->r/255.0;
-        sg = (float)sf->data.planar.secondary->g/255.0;
-        sb = (float)sf->data.planar.secondary->b/255.0;
-    }
-    switch (sf->data.planar.grad) {
-    case Background_Solid: /* already handled */
-        glBegin(GL_TRIANGLES);
-        glColor3f(pr, pg, pb);
-        glVertex2i(x, y);
-        glVertex2i(x+w, y);
-        glVertex2i(x+w, y+h);
-
-        glVertex2i(x+w, y+h);
-        glVertex2i(x, y+h);
-        glVertex2i(x, y);
-        glEnd();
-        return;
-    case Background_Horizontal:
-        glBegin(GL_TRIANGLES);
-        glColor3f(pr, pg, pb);
-        glVertex2i(x, y);
-        glColor3f(sr, sg, sb);
-        glVertex2i(x+w, y);
-        glVertex2i(x+w, y+h);
-
-        glVertex2i(x+w, y+h);
-        glColor3f(pr, pg, pb);
-        glVertex2i(x, y+h);
-        glVertex2i(x, y);
-        glEnd();
-        break;
-    case Background_Vertical:
-        glBegin(GL_TRIANGLES);
-        glColor3f(pr, pg, pb);
-        glVertex2i(x, y);
-        glVertex2i(x+w, y);
-        glColor3f(sr, sg, sb);
-        glVertex2i(x+w, y+h);
-
-        glVertex2i(x+w, y+h);
-        glVertex2i(x, y+h);
-        glColor3f(pr, pg, pb);
-        glVertex2i(x, y);
-        glEnd();
-        break;
-    case Background_Diagonal:
-       ar = (pr + sr) / 2.0;
-       ag = (pg + sg) / 2.0;
-       ab = (pb + sb) / 2.0;
-        glBegin(GL_TRIANGLES);
-        glColor3f(ar, ag, ab);
-        glVertex2i(x, y);
-        glColor3f(pr, pg, pb);
-        glVertex2i(x+w, y);
-        glColor3f(ar, ag, ab);
-        glVertex2i(x+w, y+h);
-
-        glColor3f(ar, ag, ab);
-        glVertex2i(x+w, y+h);
-        glColor3f(sr, sg, sb);
-        glVertex2i(x, y+h);
-        glColor3f(ar, ag, ab);
-        glVertex2i(x, y);
-        glEnd();
-        break;
-    case Background_CrossDiagonal:
-       ar = (pr + sr) / 2.0;
-       ag = (pg + sg) / 2.0;
-       ab = (pb + sb) / 2.0;
-        glBegin(GL_TRIANGLES);
-        glColor3f(pr, pg, pb);
-        glVertex2i(x, y);
-        glColor3f(ar, ag, ab);
-        glVertex2i(x+w, y);
-        glColor3f(sr, sg, sb);
-        glVertex2i(x+w, y+h);
-
-        glColor3f(sr, sg, sb);
-        glVertex2i(x+w, y+h);
-        glColor3f(ar, ag, ab);
-        glVertex2i(x, y+h);
-        glColor3f(pr, pg, pb);
-        glVertex2i(x, y);
-        glEnd();
-        break;
-    case Background_Pyramid:
-       ar = (pr + sr) / 2.0;
-       ag = (pg + sg) / 2.0;
-       ab = (pb + sb) / 2.0;
-        glBegin(GL_TRIANGLES);
-        glColor3f(pr, pg, pb);
-        glVertex2i(x, y);
-        glColor3f(sr, sg, sb);
-        glVertex2i(x+w/2, y+h/2);
-        glColor3f(ar, ag, ab);
-        glVertex2i(x, y+h/2);
-
-        glVertex2i(x, y+h/2);
-        glColor3f(sr, sg, sb);
-        glVertex2i(x+w/2, y+h/2);
-        glColor3f(pr, pg, pb);
-        glVertex2i(x, y+h);
-
-        glVertex2i(x, y+h);
-        glColor3f(sr, sg, sb);
-        glVertex2i(x+w/2, y+h/2);
-        glColor3f(ar, ag, ab);
-        glVertex2i(x+w/2, y+h);
-
-        glVertex2i(x+w/2, y+h);
-        glColor3f(sr, sg, sb);
-        glVertex2i(x+w/2, y+h/2);
-        glColor3f(pr, pg, pb);
-        glVertex2i(x+w, y+h);
-
-        glVertex2i(x+w, y+h);
-        glColor3f(sr, sg, sb);
-        glVertex2i(x+w/2, y+h/2);
-        glColor3f(ar, ag, ab);
-        glVertex2i(x+w, y+h/2);
-
-        glVertex2i(x+w, y+h/2);
-        glColor3f(sr, sg, sb);
-        glVertex2i(x+w/2, y+h/2);
-        glColor3f(pr, pg, pb);
-        glVertex2i(x+w, y);
-
-        glVertex2i(x+w, y);
-        glColor3f(sr, sg, sb);
-        glVertex2i(x+w/2, y+h/2);
-        glColor3f(ar, ag, ab);
-        glVertex2i(x+w/2, y);
-
-        glVertex2i(x+w/2, y);
-        glColor3f(sr, sg, sb);
-        glVertex2i(x+w/2, y+h/2);
-        glColor3f(pr, pg, pb);
-        glVertex2i(x, y);
-        glEnd();
-        break;
-    case Background_PipeCross:
-        glBegin(GL_TRIANGLES);
-        glColor3f(pr, pg, pb);
-        glVertex2i(x, y);
-        glColor3f(sr, sg, sb);
-        glVertex2i(x+w/2, y+h/2);
-        glVertex2i(x, y+h/2);
-
-        glVertex2i(x, y+h/2);
-        glVertex2i(x+w/2, y+h/2);
-        glColor3f(pr, pg, pb);
-        glVertex2i(x, y+h);
-
-        glVertex2i(x, y+h);
-        glColor3f(sr, sg, sb);
-        glVertex2i(x+w/2, y+h/2);
-        glVertex2i(x+w/2, y+h);
-
-        glVertex2i(x+w/2, y+h);
-        glVertex2i(x+w/2, y+h/2);
-        glColor3f(pr, pg, pb);
-        glVertex2i(x+w, y+h);
-
-        glVertex2i(x+w, y+h);
-        glColor3f(sr, sg, sb);
-        glVertex2i(x+w/2, y+h/2);
-        glVertex2i(x+w, y+h/2);
-
-        glVertex2i(x+w, y+h/2);
-        glVertex2i(x+w/2, y+h/2);
-        glColor3f(pr, pg, pb);
-        glVertex2i(x+w, y);
-
-        glVertex2i(x+w, y);
-        glColor3f(sr, sg, sb);
-        glVertex2i(x+w/2, y+h/2);
-        glVertex2i(x+w/2, y);
-
-        glVertex2i(x+w/2, y);
-        glVertex2i(x+w/2, y+h/2);
-        glColor3f(pr, pg, pb);
-        glVertex2i(x, y);
-        glEnd();
-        break;
-    case Background_Rectangle:
-        glBegin(GL_TRIANGLES);
-        glColor3f(pr, pg, pb);
-        glVertex2i(x, y);
-        glColor3f(sr, sg, sb);
-        glVertex2i(x+w/2, y+h/2);
-        glColor3f(pr, pg, pb);
-        glVertex2i(x, y+h);
-
-        glVertex2i(x, y+h);
-        glColor3f(sr, sg, sb);
-        glVertex2i(x+w/2, y+h/2);
-        glColor3f(pr, pg, pb);
-        glVertex2i(x+w, y+h);
-
-        glVertex2i(x+w, y+h);
-        glColor3f(sr, sg, sb);
-        glVertex2i(x+w/2, y+h/2);
-        glColor3f(pr, pg, pb);
-        glVertex2i(x+w, y);
-
-        glVertex2i(x+w, y);
-        glColor3f(sr, sg, sb);
-        glVertex2i(x+w/2, y+h/2);
-        glColor3f(pr, pg, pb);
-        glVertex2i(x, y);
-
-        glEnd();
-        break;
-    default:
-        g_message("unhandled gradient");
-        return;
-    }
-}
-#endif /* USE_GL */
diff --git a/render/gradient.h b/render/gradient.h
deleted file mode 100644 (file)
index bbadcd0..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef __gradient_h
-#define __gradient_h
-
-#include "render.h"
-
-void gradient_render(Surface *sf, int w, int h);
-void gradient_vertical(Surface *sf, int w, int h);
-void gradient_horizontal(Surface *sf, int w, int h);
-void gradient_diagonal(Surface *sf, int w, int h);
-void gradient_crossdiagonal(Surface *sf, int w, int h);
-void gradient_pyramid(Surface *sf, int w, int h);
-void gradient_pipecross(Surface *sf, int w, int h);
-void gradient_rectangle(Surface *sf, int w, int h);
-void gradient_solid(Appearance *l, int x, int y, int w, int h);
-void highlight(pixel32 *x, pixel32 *y, gboolean raised);
-
-void render_gl_gradient(Surface *sf, int x, int y, int w, int h);
-
-#endif /* __gradient_h */
diff --git a/render/image.c b/render/image.c
deleted file mode 100644 (file)
index feb2597..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-#include <glib.h>
-#include "../kernel/geom.h"
-#include "image.h"
-
-void image_draw(pixel32 *target, TextureRGBA *rgba, Rect *position,
-                Rect *surarea)
-{
-    pixel32 *draw = rgba->data;
-    guint c, i, e, t, sfw, sfh;
-    sfw = position->width;
-    sfh = position->height;
-
-    /* it would be nice if this worked, but this function is well broken in
-       these circumstances. */
-    g_assert(position->width == surarea->width &&
-             position->height == surarea->height);
-
-    g_assert(rgba->data != NULL);
-
-    if ((rgba->width != sfw || rgba->height != sfh) &&
-        (rgba->width != rgba->cwidth || rgba->height != rgba->cheight)) {
-        double dx = rgba->width / (double)sfw;
-        double dy = rgba->height / (double)sfh;
-        double px = 0.0;
-        double py = 0.0;
-        int iy = 0;
-
-        /* scale it and cache it */
-        if (rgba->cache != NULL)
-            g_free(rgba->cache);
-        rgba->cache = g_new(unsigned long, sfw * sfh);
-        rgba->cwidth = sfw;
-        rgba->cheight = sfh;
-        for (i = 0, c = 0, e = sfw*sfh; i < e; ++i) {
-            rgba->cache[i] = rgba->data[(int)px + iy];
-            if (++c >= sfw) {
-                c = 0;
-                px = 0;
-                py += dy;
-                iy = (int)py * rgba->width;
-            } else
-                px += dx;
-        }
-
-        /* do we use the cache we may have just created, or the original? */
-        if (rgba->width != sfw || rgba->height != sfh)
-            draw = rgba->cache;
-
-        /* apply the alpha channel */
-        for (i = 0, c = 0, t = position->x, e = sfw*sfh; i < e; ++i, ++t) {
-            guchar alpha, r, g, b, bgr, bgg, bgb;
-
-            alpha = draw[i] >> default_alpha_offset;
-            r = draw[i] >> default_red_offset;
-            g = draw[i] >> default_green_offset;
-            b = draw[i] >> default_blue_offset;
-
-            if (c >= sfw) {
-                c = 0;
-                t += surarea->width - sfw;
-            }
-
-            /* background color */
-            bgr = target[t] >> default_red_offset;
-            bgg = target[t] >> default_green_offset;
-            bgb = target[t] >> default_blue_offset;
-
-            r = bgr + (((r - bgr) * alpha) >> 8);
-            g = bgg + (((g - bgg) * alpha) >> 8);
-            b = bgb + (((b - bgb) * alpha) >> 8);
-
-            target[t] = (r << default_red_offset)
-                      | (g << default_green_offset)
-                      | (b << default_blue_offset);
-        }
-    }
-}
diff --git a/render/image.h b/render/image.h
deleted file mode 100644 (file)
index 84f61d7..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef __image_h
-#define __image_h
-
-#include "render.h"
-#include "../kernel/geom.h"
-
-void image_draw(pixel32 *target, TextureRGBA *rgba, Rect *position,
-                Rect *surarea);
-
-#endif
diff --git a/render/mask.c b/render/mask.c
deleted file mode 100644 (file)
index 22cb3fe..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-#include "mask.h"
-#include "../kernel/openbox.h"
-
-pixmap_mask *pixmap_mask_new(int w, int h, char *data)
-{
-    pixmap_mask *m = g_new(pixmap_mask, 1);
-    m->w = w;
-    m->h = h;
-    /* round up to nearest byte */
-    m->data = g_memdup(data, (w * h + 7) / 8);
-    m->mask = XCreateBitmapFromData(ob_display, ob_root, data, w, h);
-    return m;
-}
-
-void pixmap_mask_free(pixmap_mask *m)
-{
-    if (m) {
-        XFreePixmap(ob_display, m->mask);
-        g_free(m->data);
-        g_free(m);
-    }
-}
-
-void mask_draw(Pixmap p, TextureMask *m, Rect *position)
-{
-    int x, y;
-    if (m->mask == None) return; /* no mask given */
-
-    /* set the clip region */
-    x = position->x + (position->width - m->mask->w) / 2;
-    y = position->y + (position->height - m->mask->h) / 2;
-
-    if (x < 0) x = 0;
-    if (y < 0) y = 0;
-
-    XSetClipMask(ob_display, m->color->gc, m->mask->mask);
-    XSetClipOrigin(ob_display, m->color->gc, x, y);
-
-    /* fill in the clipped region */
-    XFillRectangle(ob_display, p, m->color->gc, x, y,
-                   x + m->mask->w, y + m->mask->h);
-
-    /* unset the clip region */
-    XSetClipMask(ob_display, m->color->gc, None);
-    XSetClipOrigin(ob_display, m->color->gc, 0, 0);
-}
-
-pixmap_mask *pixmap_mask_copy(pixmap_mask *src)
-{
-    pixmap_mask *m = g_new(pixmap_mask, 1);
-    m->w = src->w;
-    m->h = src->h;
-    /* round up to nearest byte */
-    m->data = g_memdup(src->data, (src->w * src->h + 7) / 8);
-    m->mask = XCreateBitmapFromData(ob_display, ob_root, m->data, m->w, m->h);
-    return m;
-}
diff --git a/render/mask.h b/render/mask.h
deleted file mode 100644 (file)
index 9328daf..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef __mask_h
-#define __mask_h
-
-#include "render.h"
-#include "kernel/geom.h"
-
-pixmap_mask *pixmap_mask_new(int w, int h, char *data);
-pixmap_mask *pixmap_mask_copy(pixmap_mask *src);
-void pixmap_mask_free(pixmap_mask *m);
-void mask_draw(Pixmap p, TextureMask *m, Rect *position);
-
-#endif
diff --git a/render/render.c b/render/render.c
deleted file mode 100644 (file)
index 2082abc..0000000
+++ /dev/null
@@ -1,647 +0,0 @@
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-#ifdef USE_GL
-# include <GL/glx.h>
-#endif
-
-#include <glib.h>
-#include "render.h"
-#include "gradient.h"
-#include "font.h"
-#include "mask.h"
-#include "color.h"
-#include "image.h"
-#include "theme.h"
-#include "kernel/openbox.h"
-
-#ifdef HAVE_STDLIB_H
-#  include <stdlib.h>
-#endif
-
-int render_depth;
-XVisualInfo render_visual_info;
-
-Visual *render_visual;
-Colormap render_colormap;
-
-int render_red_offset = 0, render_green_offset = 0, render_blue_offset = 0;
-int render_red_shift, render_green_shift, render_blue_shift;
-int render_red_mask, render_green_mask, render_blue_mask;
-
-
-#ifdef USE_GL
-
-GLXContext render_glx_context;
-
-int render_glx_rating(XVisualInfo *v)
-{
-    int er;
-    int rating = 0;
-    int val;
-    printf("evaluating visual %d\n", v->visualid);
-    glXGetConfig(ob_display, v, GLX_BUFFER_SIZE, &val);
-    printf("buffer size %d\n", val);
-
-    switch (val) {
-    case 32:
-        rating += 300;
-    break;
-    case 24:
-        rating += 200;
-    break;
-    case 16:
-        rating += 100;
-    break;
-    }
-
-    glXGetConfig(ob_display, v, GLX_LEVEL, &val);
-    printf("level %d\n", val);
-    if (val != 0)
-        rating = -10000;
-
-    glXGetConfig(ob_display, v, GLX_DEPTH_SIZE, &val);
-    printf("depth size %d\n", val);
-    switch (val) {
-    case 32:
-        rating += 30;
-    break;
-    case 24:
-        rating += 20;
-    break;
-    case 16:
-        rating += 10;
-    break;
-    case 0:
-        rating -= 10000;
-    }
-
-    glXGetConfig(ob_display, v, GLX_DOUBLEBUFFER, &val);
-    printf("double buffer %d\n", val);
-    if (val)
-        rating++;
-    return rating;
-}
-#endif /* USE_GL */
-
-void render_startup(void)
-{
-    int count, i = 0, val, best = 0, rate = 0, temp;
-    XVisualInfo vimatch, *vilist;
-    paint = x_paint;
-
-    render_depth = DefaultDepth(ob_display, ob_screen);
-    render_visual = DefaultVisual(ob_display, ob_screen);
-    render_colormap = DefaultColormap(ob_display, ob_screen);
-
-#ifdef USE_GL
-    vimatch.screen = ob_screen;
-    vimatch.class = TrueColor;
-    vilist = XGetVisualInfo(ob_display, VisualScreenMask | VisualClassMask,
-                            &vimatch, &count);
-
-    if (vilist) {
-        printf("looking for a GL visualin %d visuals\n", count);
-        for (i = 0; i < count; i++) {
-            glXGetConfig(ob_display, &vilist[i], GLX_USE_GL, &val);
-            if (val) {
-                temp = render_glx_rating(&vilist[i]);
-                if (temp > rate) {
-                    best = i;
-                    rate = temp;
-                }
-            }
-        }
-    }
-    if (rate > 0) {
-        printf("picked visual %d with rating %d\n", best, rate);
-        render_depth = vilist[best].depth;
-        render_visual = vilist[best].visual;
-        render_colormap = XCreateColormap(ob_display, ob_root, 
-                                          render_visual, AllocNone);
-        render_visual_info = vilist[best];
-        render_glx_context = glXCreateContext(ob_display, &render_visual_info,
-                                              NULL, True);
-        if (render_glx_context == NULL)
-            printf("sadness\n");
-        else {
-            paint = gl_paint;
-        }
-    }
-#endif /*USE_GL*/
-
-
-  switch (render_visual->class) {
-  case TrueColor:
-    truecolor_startup();
-    break;
-  case PseudoColor:
-  case StaticColor:
-  case GrayScale:
-  case StaticGray:
-    pseudocolor_startup();
-    break;
-  default:
-    g_critical("unsupported visual class.\n");
-    exit(EXIT_FAILURE);
-
-  }
-}
-
-void truecolor_startup(void)
-{
-  unsigned long red_mask, green_mask, blue_mask;
-  XImage *timage = NULL;
-
-  timage = XCreateImage(ob_display, render_visual, render_depth,
-                        ZPixmap, 0, NULL, 1, 1, 32, 0);
-  g_assert(timage != NULL);
-  /* find the offsets for each color in the visual's masks */
-  render_red_mask = red_mask = timage->red_mask;
-  render_green_mask = green_mask = timage->green_mask;
-  render_blue_mask = blue_mask = timage->blue_mask;
-
-  render_red_offset = 0;
-  render_green_offset = 0;
-  render_blue_offset = 0;
-
-  while (! (red_mask & 1))   { render_red_offset++;   red_mask   >>= 1; }
-  while (! (green_mask & 1)) { render_green_offset++; green_mask >>= 1; }
-  while (! (blue_mask & 1))  { render_blue_offset++;  blue_mask  >>= 1; }
-
-  render_red_shift = render_green_shift = render_blue_shift = 8;
-  while (red_mask)   { red_mask   >>= 1; render_red_shift--;   }
-  while (green_mask) { green_mask >>= 1; render_green_shift--; }
-  while (blue_mask)  { blue_mask  >>= 1; render_blue_shift--;  }
-  XFree(timage);
-}
-
-void pseudocolor_startup(void)
-{
-  XColor icolors[256];
-  int tr, tg, tb, n, r, g, b, i, incolors, ii;
-  unsigned long dev;
-  int cpc, _ncolors;
-  g_message("Initializing PseudoColor RenderControl\n");
-
-  /* determine the number of colors and the bits-per-color */
-  pseudo_bpc = 2; /* XXX THIS SHOULD BE A USER OPTION */
-  g_assert(pseudo_bpc >= 1);
-  _ncolors = pseudo_ncolors();
-
-  if (_ncolors > 1 << render_depth) {
-    g_warning("PseudoRenderControl: Invalid colormap size. Resizing.\n");
-    pseudo_bpc = 1 << (render_depth/3) >> 3;
-    _ncolors = 1 << (pseudo_bpc * 3);
-  }
-
-  /* build a color cube */
-  pseudo_colors = malloc(_ncolors * sizeof(XColor));
-  cpc = 1 << pseudo_bpc; /* colors per channel */
-
-  for (n = 0, r = 0; r < cpc; r++)
-    for (g = 0; g < cpc; g++)
-      for (b = 0; b < cpc; b++, n++) {
-        tr = (int)(((float)(r)/(float)(cpc-1)) * 0xFF);
-        tg = (int)(((float)(g)/(float)(cpc-1)) * 0xFF);
-        tb = (int)(((float)(b)/(float)(cpc-1)) * 0xFF);
-        pseudo_colors[n].red = tr | tr << 8;
-        pseudo_colors[n].green = tg | tg << 8;
-        pseudo_colors[n].blue = tb | tb << 8;
-        pseudo_colors[n].flags = DoRed|DoGreen|DoBlue; /* used to track 
-                                                          allocation */
-      }
-
-  /* allocate the colors */
-  for (i = 0; i < _ncolors; i++)
-    if (!XAllocColor(ob_display, render_colormap, &pseudo_colors[i]))
-      pseudo_colors[i].flags = 0; /* mark it as unallocated */
-
-  /* try allocate any colors that failed allocation above */
-
-  /* get the allocated values from the X server (only the first 256 XXX why!?)
-   */
-  incolors = (((1 << render_depth) > 256) ? 256 : (1 << render_depth));
-  for (i = 0; i < incolors; i++)
-    icolors[i].pixel = i;
-  XQueryColors(ob_display, render_colormap, icolors, incolors);
-
-  /* try match unallocated ones */
-  for (i = 0; i < _ncolors; i++) {
-    if (!pseudo_colors[i].flags) { /* if it wasn't allocated... */
-      unsigned long closest = 0xffffffff, close = 0;
-      for (ii = 0; ii < incolors; ii++) {
-        /* find deviations */
-        r = (pseudo_colors[i].red - icolors[ii].red) & 0xff;
-        g = (pseudo_colors[i].green - icolors[ii].green) & 0xff;
-        b = (pseudo_colors[i].blue - icolors[ii].blue) & 0xff;
-        /* find a weighted absolute deviation */
-        dev = (r * r) + (g * g) + (b * b);
-
-        if (dev < closest) {
-          closest = dev;
-          close = ii;
-        }
-      }
-
-      pseudo_colors[i].red = icolors[close].red;
-      pseudo_colors[i].green = icolors[close].green;
-      pseudo_colors[i].blue = icolors[close].blue;
-      pseudo_colors[i].pixel = icolors[close].pixel;
-
-      /* try alloc this closest color, it had better succeed! */
-      if (XAllocColor(ob_display, render_colormap, &pseudo_colors[i]))
-        pseudo_colors[i].flags = DoRed|DoGreen|DoBlue; /* mark as alloced */
-      else
-        g_assert(FALSE); /* wtf has gone wrong, its already alloced for
-                            chissake! */
-    }
-  }
-}
-
-void x_paint(Window win, Appearance *l)
-{
-    int i, transferred = 0, sw;
-    pixel32 *source, *dest;
-    Pixmap oldp;
-    int x = l->area.x;
-    int y = l->area.y;
-    int w = l->area.width;
-    int h = l->area.height;
-    Rect tarea; /* area in which to draw textures */
-
-    if (w <= 0 || h <= 0 || x+w <= 0 || y+h <= 0) return;
-
-    g_assert(l->surface.type == Surface_Planar);
-
-    oldp = l->pixmap; /* save to free after changing the visible pixmap */
-    l->pixmap = XCreatePixmap(ob_display, ob_root, x+w, y+h, render_depth);
-    g_assert(l->pixmap != None);
-
-    if (l->xftdraw != NULL)
-        XftDrawDestroy(l->xftdraw);
-    l->xftdraw = XftDrawCreate(ob_display, l->pixmap, render_visual, 
-                               render_colormap);
-    g_assert(l->xftdraw != NULL);
-
-    g_free(l->surface.data.planar.pixel_data);
-    l->surface.data.planar.pixel_data = g_new(pixel32, w * h);
-
-
-    if (l->surface.data.planar.grad == Background_ParentRelative) {
-        sw = l->surface.data.planar.parent->area.width;
-        source = l->surface.data.planar.parent->surface.data.planar.pixel_data
-            + l->surface.data.planar.parentx
-            + sw * l->surface.data.planar.parenty;
-        dest = l->surface.data.planar.pixel_data;
-        for (i = 0; i < h; i++, source += sw, dest += w) {
-            memcpy(dest, source, w * sizeof(pixel32));
-        }
-    }
-    else if (l->surface.data.planar.grad == Background_Solid)
-        gradient_solid(l, x, y, w, h);
-    else gradient_render(&l->surface, w, h);
-
-    for (i = 0; i < l->textures; i++) {
-        tarea = l->texture[i].position;
-        if (l->surface.data.planar.grad != Background_ParentRelative) {
-            if (l->surface.data.planar.relief != Flat) {
-                switch (l->surface.data.planar.bevel) {
-                case Bevel1:
-                    tarea.x += 1; tarea.y += 1;
-                    tarea.width -= 2; tarea.height -= 2;
-                    break;
-                case Bevel2:
-                    tarea.x += 2; tarea.y += 2;
-                    tarea.width -= 4; tarea.height -= 4;
-                    break;
-                }
-            } else if (l->surface.data.planar.border) {
-                tarea.x += 1; tarea.y += 1;
-                tarea.width -= 2; tarea.height -= 2;
-            }
-        }
-
-        switch (l->texture[i].type) {
-        case Text:
-            if (!transferred) {
-                transferred = 1;
-                if (l->surface.data.planar.grad != Background_Solid)
-                    pixel32_to_pixmap(l->surface.data.planar.pixel_data, 
-                                      l->pixmap,x,y,w,h);
-            }
-            if (l->xftdraw == NULL) {
-                l->xftdraw = XftDrawCreate(ob_display, l->pixmap, 
-                                        render_visual, render_colormap);
-            }
-            font_draw(l->xftdraw, &l->texture[i].data.text, 
-                      &tarea);
-        break;
-        case Bitmask:
-            if (!transferred) {
-                transferred = 1;
-                if (l->surface.data.planar.grad != Background_Solid)
-                    pixel32_to_pixmap(l->surface.data.planar.pixel_data, 
-                                      l->pixmap,x,y,w,h);
-            }
-            if (l->texture[i].data.mask.color->gc == None)
-                color_allocate_gc(l->texture[i].data.mask.color);
-            mask_draw(l->pixmap, &l->texture[i].data.mask,
-                      &tarea);
-        break;
-        case RGBA:
-            image_draw(l->surface.data.planar.pixel_data, 
-                       &l->texture[i].data.rgba,
-                       &tarea, &l->area);
-        break;
-        }
-    }
-
-    if (!transferred) {
-        transferred = 1;
-        if (l->surface.data.planar.grad != Background_Solid)
-            pixel32_to_pixmap(l->surface.data.planar.pixel_data, l->pixmap
-                              ,x,y,w,h);
-    }
-
-
-    XSetWindowBackgroundPixmap(ob_display, win, l->pixmap);
-    XClearWindow(ob_display, win);
-    if (oldp != None) XFreePixmap(ob_display, oldp);
-}
-
-void render_shutdown(void)
-{
-}
-
-Appearance *appearance_new(SurfaceType type, int numtex)
-{
-  PlanarSurface *p;
-  Appearance *out;
-
-  out = g_new(Appearance, 1);
-  out->surface.type = type;
-  out->textures = numtex;
-  out->xftdraw = NULL;
-  if (numtex) out->texture = g_new0(Texture, numtex);
-  else out->texture = NULL;
-  out->pixmap = None;
-
-  switch (type) {
-  case Surface_Planar:
-    p = &out->surface.data.planar;
-    p->primary = NULL;
-    p->secondary = NULL;
-    p->border_color = NULL;
-    p->bevel_dark = NULL;
-    p->bevel_light = NULL;
-    p->pixel_data = NULL;
-    break;
-  }
-  return out;
-}
-
-Appearance *appearance_copy(Appearance *orig)
-{
-    PlanarSurface *spo, *spc;
-    Appearance *copy = g_new(Appearance, 1);
-    copy->surface.type = orig->surface.type;
-    switch (orig->surface.type) {
-    case Surface_Planar:
-        spo = &(orig->surface.data.planar);
-        spc = &(copy->surface.data.planar);
-        spc->grad = spo->grad;
-        spc->relief = spo->relief;
-        spc->bevel = spo->bevel;
-        if (spo->primary != NULL)
-            spc->primary = color_new(spo->primary->r,
-                                     spo->primary->g, 
-                                     spo->primary->b);
-        else spc->primary = NULL;
-
-        if (spo->secondary != NULL)
-            spc->secondary = color_new(spo->secondary->r,
-                                       spo->secondary->g,
-                                       spo->secondary->b);
-        else spc->secondary = NULL;
-
-        if (spo->border_color != NULL)
-            spc->border_color = color_new(spo->border_color->r,
-                                          spo->border_color->g,
-                                          spo->border_color->b);
-        else spc->border_color = NULL;
-
-        if (spo->bevel_dark != NULL)
-            spc->bevel_dark = color_new(spo->bevel_dark->r,
-                                        spo->bevel_dark->g,
-                                        spo->bevel_dark->b);
-        else spc->bevel_dark = NULL;
-
-        if (spo->bevel_light != NULL)
-            spc->bevel_light = color_new(spo->bevel_light->r,
-                                         spo->bevel_light->g,
-                                         spo->bevel_light->b);
-        else spc->bevel_light = NULL;
-
-        spc->interlaced = spo->interlaced;
-        spc->border = spo->border;
-        spc->pixel_data = NULL;
-    break;
-    }
-    copy->textures = orig->textures;
-    copy->texture = g_memdup(orig->texture, orig->textures * sizeof(Texture));
-    copy->pixmap = None;
-    copy->xftdraw = NULL;
-    return copy;
-}
-
-void appearance_free(Appearance *a)
-{
-    if (a) {
-        PlanarSurface *p;
-        if (a->pixmap != None) XFreePixmap(ob_display, a->pixmap);
-        if (a->xftdraw != NULL) XftDrawDestroy(a->xftdraw);
-        if (a->textures)
-            g_free(a->texture);
-        if (a->surface.type == Surface_Planar) {
-            p = &a->surface.data.planar;
-            color_free(p->primary);
-            color_free(p->secondary);
-            color_free(p->border_color);
-            color_free(p->bevel_dark);
-            color_free(p->bevel_light);
-            g_free(p->pixel_data);
-        }
-        g_free(a);
-    }
-}
-
-
-void pixel32_to_pixmap(pixel32 *in, Pixmap out, int x, int y, int w, int h)
-{
-    pixel32 *scratch;
-    XImage *im = NULL;
-    im = XCreateImage(ob_display, render_visual, render_depth,
-                      ZPixmap, 0, NULL, w, h, 32, 0);
-    g_assert(im != NULL);
-    im->byte_order = render_endian;
-/* this malloc is a complete waste of time on normal 32bpp
-   as reduce_depth just sets im->data = data and returns
-*/
-    scratch = g_new(pixel32, im->width * im->height);
-    im->data = (char*) scratch;
-    reduce_depth(in, im);
-    XPutImage(ob_display, out, DefaultGC(ob_display, ob_screen),
-              im, 0, 0, x, y, w, h);
-    im->data = NULL;
-    XDestroyImage(im);
-    g_free(scratch);
-}
-
-void appearance_minsize(Appearance *l, int *w, int *h)
-{
-    int i;
-    int m;
-    *w = *h = 1;
-
-    switch (l->surface.type) {
-    case Surface_Planar:
-        if (l->surface.data.planar.relief != Flat) {
-            switch (l->surface.data.planar.bevel) {
-            case Bevel1:
-                *w = *h = 2;
-                break;
-            case Bevel2:
-                *w = *h = 4;
-                break;
-            }
-        } else if (l->surface.data.planar.border)
-            *w = *h = 2;
-
-        for (i = 0; i < l->textures; ++i) {
-            switch (l->texture[i].type) {
-            case Bitmask:
-                *w += l->texture[i].data.mask.mask->w;
-                *h += l->texture[i].data.mask.mask->h;
-                break;
-            case Text:
-                m = font_measure_string(l->texture[i].data.text.font,
-                                        l->texture[i].data.text.string,
-                                        l->texture[i].data.text.shadow,
-                                        l->texture[i].data.text.offset);
-                *w += m;
-                m = font_height(l->texture[i].data.text.font,
-                                l->texture[i].data.text.shadow,
-                                l->texture[i].data.text.offset);
-                *h += m;
-                break;
-            case RGBA:
-                *w += l->texture[i].data.rgba.width;
-                *h += l->texture[i].data.rgba.height;
-                break;
-            case NoTexture:
-                break;
-            }
-        }
-        break;
-    }
-}
-
-gboolean render_pixmap_to_rgba(Pixmap pmap, Pixmap mask,
-                               int *w, int *h, pixel32 **data)
-{
-    Window xr;
-    int xx, xy;
-    guint pw, ph, mw, mh, xb, xd, i, x, y, di;
-    XImage *xi, *xm = NULL;
-
-    if (!XGetGeometry(ob_display, pmap, &xr, &xx, &xy, &pw, &ph, &xb, &xd))
-        return FALSE;
-    if (mask) {
-        if (!XGetGeometry(ob_display, mask, &xr, &xx, &xy, &mw, &mh, &xb, &xd))
-            return FALSE;
-        if (pw != mw || ph != mh || xd != 1)
-            return FALSE;
-    }
-
-    xi = XGetImage(ob_display, pmap, 0, 0, pw, ph, 0xffffffff, ZPixmap);
-    if (!xi)
-        return FALSE;
-
-    if (mask) {
-        xm = XGetImage(ob_display, mask, 0, 0, mw, mh, 0xffffffff, ZPixmap);
-        if (!xm)
-            return FALSE;
-    }
-
-    *data = g_new(pixel32, pw * ph);
-    increase_depth(*data, xi);
-
-    if (mask) {
-        /* apply transparency from the mask */
-        di = 0;
-        for (i = 0, y = 0; y < ph; ++y) {
-            for (x = 0; x < pw; ++x, ++i) {
-                if (!((((unsigned)xm->data[di + x / 8]) >> (x % 8)) & 0x1))
-                    (*data)[i] &= ~(0xff << default_alpha_offset);
-            }
-            di += xm->bytes_per_line;
-        }
-    }
-
-    *w = pw;
-    *h = ph;
-
-    return TRUE;
-}
-
-#ifdef USE_GL
-void gl_paint(Window win, Appearance *l)
-{
-    int err;
-    Window root, child;
-    int i, transferred = 0, sw, b, d;
-    pixel32 *source, *dest;
-    Pixmap oldp;
-    int tempx, tempy, absx, absy, absw, absh;
-    int x = l->area.x;
-    int y = l->area.y;
-    int w = l->area.width;
-    int h = l->area.height;
-    Rect tarea; /* area in which to draw textures */
-    if (w <= 0 || h <= 0 || x+w <= 0 || y+h <= 0) return;
-
-    g_assert(l->surface.type == Surface_Planar);
-
-printf("making %p, %p, %p current\n", ob_display, win, render_glx_context);
-    err = glXMakeCurrent(ob_display, win, render_glx_context);
-g_assert(err != 0);
-
-            glMatrixMode(GL_MODELVIEW);
-            glLoadIdentity();
-            glMatrixMode(GL_PROJECTION);
-            glLoadIdentity();
-            glOrtho(0, 1376, 1032, 0, 0, 10);
-    if (XGetGeometry(ob_display, win, &root, &tempx, &tempy,
-                     &absw, &absh,  &b, &d) &&
-        XTranslateCoordinates(ob_display, win, root, tempx, tempy, 
-        &absx, &absy, &child))
-        printf("window at %d, %d (%d,%d)\n", absx, absy, absw, absh);
-    else
-        return;
-
-    glViewport(0, 0, 1376, 1032);
-    glMatrixMode(GL_MODELVIEW);
-    glTranslatef(-absx, 1032-absh-absy, 0);
-    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
-
-    if (l->surface.data.planar.grad == Background_ParentRelative) {
-        printf("crap\n");
-    } else
-        render_gradient(&l->surface, absx+x, absy+y, absw, absh);
-
-    glXSwapBuffers(ob_display, win);
-}
-
-#endif /* USE_GL */
diff --git a/render/render.h b/render/render.h
deleted file mode 100644 (file)
index 16f5c31..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-#ifndef __render_h
-#define __render_h
-
-#include <X11/Xlib.h>
-#define _XFT_NO_COMPAT_ /* no Xft 1 API */
-#include <X11/Xft/Xft.h>
-#include <glib.h>
-#include "color.h"
-#include "kernel/geom.h"
-
-typedef enum {
-    Surface_Planar,
-    Surface_Nonplanar
-} SurfaceType;
-
-typedef enum {
-    Flat,
-    Raised,
-    Sunken
-} ReliefType;
-
-typedef enum {
-    Bevel1,
-    Bevel2
-} BevelType;
-
-typedef enum {
-    Background_ParentRelative,
-    Background_Solid,
-    Background_Horizontal,
-    Background_Vertical,
-    Background_Diagonal,
-    Background_CrossDiagonal,
-    Background_PipeCross,
-    Background_Rectangle,
-    Background_Pyramid
-} SurfaceColorType;
-
-typedef enum {
-    Bitmask,
-    Text,
-    RGBA,
-    NoTexture
-} TextureType;
-
-struct Appearance;
-
-typedef struct PlanarSurface {
-    SurfaceColorType grad;
-    ReliefType relief;
-    BevelType bevel;
-    color_rgb *primary;
-    color_rgb *secondary;
-    color_rgb *border_color;
-    color_rgb *bevel_dark; 
-    color_rgb *bevel_light;
-    gboolean interlaced;
-    gboolean border;
-    struct Appearance *parent;
-    int parentx;
-    int parenty;
-    pixel32 *pixel_data;
-} PlanarSurface;
-
-typedef struct NonplanarSurface {
-    int poo;
-} NonplanarSurface;
-
-typedef union {
-    PlanarSurface planar;
-    NonplanarSurface nonplanar;
-} SurfaceData;
-
-typedef struct Surface {
-    SurfaceType type;
-    SurfaceColorType colortype;
-    SurfaceData data;
-} Surface;
-
-typedef struct {
-    XftFont *xftfont;
-    int height;
-    int elipses_length;
-} ObFont;
-
-typedef enum {
-    Justify_Center,
-    Justify_Left,
-    Justify_Right
-} Justify;
-
-typedef struct TextureText {
-    ObFont *font;
-    Justify justify;
-    int shadow;
-    char tint;
-    unsigned char offset;
-    color_rgb *color;
-    char *string;
-} TextureText;   
-
-typedef struct {
-    Pixmap mask;
-    guint w, h;
-    char *data;
-} pixmap_mask;
-
-typedef struct TextureMask {
-    color_rgb *color;
-    pixmap_mask *mask;
-} TextureMask;
-
-typedef struct TextureRGBA {
-    guint width;
-    guint height;
-    pixel32 *data;
-/* cached scaled so we don't have to scale often */
-    guint cwidth;
-    guint cheight;
-    pixel32 *cache;
-} TextureRGBA;
-
-typedef union {
-    TextureRGBA rgba;
-    TextureText text;
-    TextureMask mask;
-} TextureData;
-
-typedef struct Texture {
-    Rect position;
-    TextureType type;
-    TextureData data;
-} Texture;
-
-typedef struct Appearance {
-    Surface surface;
-    Rect area;
-    int textures;
-    Texture *texture;
-    Pixmap pixmap;
-    XftDraw *xftdraw;
-} Appearance;
-
-extern Visual *render_visual;
-extern XVisualInfo render_visual_info;
-extern int render_depth;
-extern Colormap render_colormap;
-
-void (*paint)(Window win, Appearance *l);
-
-void render_startup(void);
-void init_appearance(Appearance *l);
-void x_paint(Window win, Appearance *l);
-void gl_paint(Window win, Appearance *l);
-void render_shutdown(void);
-Appearance *appearance_new(SurfaceType type, int numtex);
-Appearance *appearance_copy(Appearance *a);
-void appearance_free(Appearance *a);
-void truecolor_startup(void);
-void pseudocolor_startup(void);
-void pixel32_to_pixmap(pixel32 *in, Pixmap out, int x, int y, int w, int h);
-
-void appearance_minsize(Appearance *l, int *w, int *h);
-
-gboolean render_pixmap_to_rgba(Pixmap pmap, Pixmap mask,
-                               int *w, int *h, pixel32 **data);
-
-#endif /*__render_h*/
diff --git a/render/test.c b/render/test.c
deleted file mode 100644 (file)
index 7c3c83b..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-#include <stdio.h>
-#include <X11/Xlib.h>
-#include <X11/extensions/shape.h>
-#include <string.h>
-#include <stdlib.h>
-#include "render.h"
-#include <glib.h>
-
-static int x_error_handler(Display * disp, XErrorEvent * error)
-{
-       char buf[1024];
-       XGetErrorText(disp, error->error_code, buf, 1024);
-       printf("%s\n", buf);
-       return 0;
-}
-
-Display *ob_display;
-int ob_screen;
-Window ob_root;
-
-int main()
-{
-       Window win;
-       GC gc;
-       Pixmap pm;
-       Appearance *look;
-
-       int grabbed = 0;
-       Window root;
-        XGCValues values;
-       XEvent report;
-       int h = 500, w = 500, tmp;
-       XVisualInfo *vi;
-       int i;
-
-       ob_display = XOpenDisplay(NULL);
-       XSetErrorHandler(x_error_handler);
-       ob_screen = DefaultScreen(ob_display);
-       ob_root = RootWindow(ob_display, ob_screen);
-       win =
-           XCreateWindow(ob_display, RootWindow(ob_display, 0)
-                          , 10, 10, w, h, 10, 
-                          CopyFromParent,      /* depth */
-                         CopyFromParent,       /* class */
-                         CopyFromParent,       /* visual */
-                         0,                    /* valuemask */
-                         0);                   /* attributes */
-       XMapWindow(ob_display, win);
-       XSelectInput(ob_display, win, ExposureMask | StructureNotifyMask);
-       root = RootWindow (ob_display, DefaultScreen (ob_display));
-       render_startup();
-
-       look = appearance_new(Surface_Planar, 0);
-       look->surface.data.planar.grad = Background_Pyramid;
-       look->surface.data.planar.secondary = color_parse("Yellow");
-       look->surface.data.planar.primary = color_parse("Blue");
-        look->surface.data.planar.interlaced = FALSE;
-        look->area.x = 0;
-        look->area.y = 0;
-        look->area.width = 500;
-        look->area.height = 500;
-       if (ob_display == NULL) {
-               fprintf(stderr, "couldn't connect to X server :0\n");
-               return 0;
-       }
-
-       paint(win, look);
-       while (1) {
-               XNextEvent(ob_display, &report);
-               switch (report.type) {
-               case Expose:
-               break;
-               case ConfigureNotify:
-                       look->area.width = report.xconfigure.width;
-                       look->area.height = report.xconfigure.height;
-                       paint(win, look);
-               break;
-               }
-
-       }
-
-       return 1;
-}
diff --git a/render/theme.c b/render/theme.c
deleted file mode 100644 (file)
index 8ba7a9d..0000000
+++ /dev/null
@@ -1,986 +0,0 @@
-#include "render.h"
-#include "color.h"
-#include "font.h"
-#include "mask.h"
-
-#include <X11/Xlib.h>
-#include <X11/Xresource.h>
-
-/* style settings - geometry */
-int theme_bevel;
-int theme_handle_height;
-int theme_bwidth;
-int theme_cbwidth;
-/* style settings - colors */
-color_rgb *theme_b_color;
-color_rgb *theme_cb_focused_color;
-color_rgb *theme_cb_unfocused_color;
-color_rgb *theme_title_focused_color;
-color_rgb *theme_title_unfocused_color;
-color_rgb *theme_titlebut_focused_color;
-color_rgb *theme_titlebut_unfocused_color;
-color_rgb *theme_menu_title_color;
-color_rgb *theme_menu_color;
-color_rgb *theme_menu_disabled_color;
-color_rgb *theme_menu_hilite_color;
-/* style settings - fonts */
-int theme_winfont_height;
-ObFont *theme_winfont;
-gboolean theme_winfont_shadow;
-int theme_winfont_shadow_offset;
-int theme_winfont_shadow_tint;
-int theme_mtitlefont_height;
-ObFont *theme_mtitlefont;
-gboolean theme_mtitlefont_shadow;
-int theme_mtitlefont_shadow_offset;
-int theme_mtitlefont_shadow_tint;
-int theme_mfont_height;
-ObFont *theme_mfont;
-gboolean theme_mfont_shadow;
-int theme_mfont_shadow_offset;
-int theme_mfont_shadow_tint;
-/* style settings - title layout */
-char *theme_title_layout;
-/* style settings - masks */
-pixmap_mask *theme_max_set_mask;
-pixmap_mask *theme_max_unset_mask;
-pixmap_mask *theme_iconify_mask;
-pixmap_mask *theme_desk_set_mask;
-pixmap_mask *theme_desk_unset_mask;
-pixmap_mask *theme_shade_set_mask;
-pixmap_mask *theme_shade_unset_mask;
-pixmap_mask *theme_close_mask;
-
-/* global appearances */
-Appearance *theme_a_focused_unpressed_max;
-Appearance *theme_a_focused_pressed_max;
-Appearance *theme_a_focused_pressed_set_max;
-Appearance *theme_a_unfocused_unpressed_max;
-Appearance *theme_a_unfocused_pressed_max;
-Appearance *theme_a_unfocused_pressed_set_max;
-Appearance *theme_a_focused_unpressed_close;
-Appearance *theme_a_focused_pressed_close;
-Appearance *theme_a_unfocused_unpressed_close;
-Appearance *theme_a_unfocused_pressed_close;
-Appearance *theme_a_focused_unpressed_desk;
-Appearance *theme_a_focused_pressed_desk;
-Appearance *theme_a_focused_pressed_set_desk;
-Appearance *theme_a_unfocused_unpressed_desk;
-Appearance *theme_a_unfocused_pressed_desk;
-Appearance *theme_a_unfocused_pressed_set_desk;
-Appearance *theme_a_focused_unpressed_shade;
-Appearance *theme_a_focused_pressed_shade;
-Appearance *theme_a_focused_pressed_set_shade;
-Appearance *theme_a_unfocused_unpressed_shade;
-Appearance *theme_a_unfocused_pressed_shade;
-Appearance *theme_a_unfocused_pressed_set_shade;
-Appearance *theme_a_focused_unpressed_iconify;
-Appearance *theme_a_focused_pressed_iconify;
-Appearance *theme_a_unfocused_unpressed_iconify;
-Appearance *theme_a_unfocused_pressed_iconify;
-Appearance *theme_a_focused_grip;
-Appearance *theme_a_unfocused_grip;
-Appearance *theme_a_focused_title;
-Appearance *theme_a_unfocused_title;
-Appearance *theme_a_focused_label;
-Appearance *theme_a_unfocused_label;
-Appearance *theme_a_icon; /* always parentrelative, so no focused/unfocused */
-Appearance *theme_a_focused_handle;
-Appearance *theme_a_unfocused_handle;
-Appearance *theme_a_menu_title;
-Appearance *theme_a_menu;
-Appearance *theme_a_menu_item;
-Appearance *theme_a_menu_disabled;
-Appearance *theme_a_menu_hilite;
-
-Appearance *theme_app_hilite_bg;
-Appearance *theme_app_unhilite_bg;
-Appearance *theme_app_hilite_label;
-Appearance *theme_app_unhilite_label;
-Appearance *theme_app_icon;
-
-void theme_startup()
-{
-    theme_b_color = theme_cb_unfocused_color = theme_cb_focused_color = 
-        theme_title_unfocused_color = theme_title_focused_color = 
-        theme_titlebut_unfocused_color = theme_titlebut_focused_color = 
-        theme_menu_color = theme_menu_title_color = theme_menu_disabled_color =
-        theme_menu_hilite_color = NULL;
-    theme_winfont = theme_mtitlefont = theme_mfont = NULL;
-    theme_title_layout = NULL;
-    theme_max_set_mask = theme_max_unset_mask = NULL;
-    theme_desk_set_mask = theme_desk_unset_mask = NULL;
-    theme_shade_set_mask = theme_shade_unset_mask = NULL;
-    theme_iconify_mask = theme_close_mask = NULL;
-
-    theme_a_focused_unpressed_max = appearance_new(Surface_Planar, 1);
-    theme_a_focused_pressed_max = appearance_new(Surface_Planar, 1);
-    theme_a_focused_pressed_set_max = appearance_new(Surface_Planar, 1);
-    theme_a_unfocused_unpressed_max = appearance_new(Surface_Planar, 1);
-    theme_a_unfocused_pressed_max = appearance_new(Surface_Planar, 1);
-    theme_a_unfocused_pressed_set_max = appearance_new(Surface_Planar, 1);
-    theme_a_focused_unpressed_close = NULL;
-    theme_a_focused_pressed_close = NULL;
-    theme_a_unfocused_unpressed_close = NULL;
-    theme_a_unfocused_pressed_close = NULL;
-    theme_a_focused_unpressed_desk = NULL;
-    theme_a_focused_pressed_desk = NULL;
-    theme_a_focused_pressed_set_desk = NULL;
-    theme_a_unfocused_unpressed_desk = NULL;
-    theme_a_unfocused_pressed_desk = NULL;
-    theme_a_unfocused_pressed_set_desk = NULL;
-    theme_a_focused_unpressed_shade = NULL;
-    theme_a_focused_pressed_shade = NULL;
-    theme_a_focused_pressed_set_shade = NULL;
-    theme_a_unfocused_unpressed_shade = NULL;
-    theme_a_unfocused_pressed_shade = NULL;
-    theme_a_unfocused_pressed_set_shade = NULL;
-    theme_a_focused_unpressed_iconify = NULL;
-    theme_a_focused_pressed_iconify = NULL;
-    theme_a_unfocused_unpressed_iconify = NULL;
-    theme_a_unfocused_pressed_iconify = NULL;
-    theme_a_focused_grip = appearance_new(Surface_Planar, 0);
-    theme_a_unfocused_grip = appearance_new(Surface_Planar, 0);
-    theme_a_focused_title = appearance_new(Surface_Planar, 0);
-    theme_a_unfocused_title = appearance_new(Surface_Planar, 0);
-    theme_a_focused_label = appearance_new(Surface_Planar, 1);
-    theme_a_unfocused_label = appearance_new(Surface_Planar, 1);
-    theme_a_icon = appearance_new(Surface_Planar, 1);
-    theme_a_focused_handle = appearance_new(Surface_Planar, 0);
-    theme_a_unfocused_handle = appearance_new(Surface_Planar, 0);
-    theme_a_menu = appearance_new(Surface_Planar, 0);
-    theme_a_menu_title = appearance_new(Surface_Planar, 1);
-    theme_a_menu_item = appearance_new(Surface_Planar, 1);
-    theme_a_menu_disabled = appearance_new(Surface_Planar, 1);
-    theme_a_menu_hilite = appearance_new(Surface_Planar, 1);
-
-    theme_app_hilite_bg = appearance_new(Surface_Planar, 0);
-    theme_app_unhilite_bg = appearance_new(Surface_Planar, 0);
-    theme_app_hilite_label = appearance_new(Surface_Planar, 1);
-    theme_app_unhilite_label = appearance_new(Surface_Planar, 1);
-    theme_app_icon = appearance_new(Surface_Planar, 1);
-
-}
-
-void theme_shutdown()
-{
-    color_free(theme_b_color);
-    color_free(theme_cb_unfocused_color);
-    color_free(theme_cb_focused_color);
-    color_free(theme_title_unfocused_color);
-    color_free(theme_title_focused_color);
-    color_free(theme_titlebut_unfocused_color);
-    color_free(theme_titlebut_focused_color);
-    color_free(theme_menu_color);
-    color_free(theme_menu_title_color);
-    color_free(theme_menu_disabled_color);
-    color_free(theme_menu_hilite_color);
-
-    pixmap_mask_free(theme_max_set_mask);
-    pixmap_mask_free(theme_max_unset_mask);
-    pixmap_mask_free(theme_desk_set_mask);
-    pixmap_mask_free(theme_desk_unset_mask);
-    pixmap_mask_free(theme_shade_set_mask);
-    pixmap_mask_free(theme_shade_unset_mask);
-    pixmap_mask_free(theme_iconify_mask);
-    pixmap_mask_free(theme_close_mask);
-
-    font_close(theme_winfont);
-    font_close(theme_mtitlefont);
-    font_close(theme_mfont);
-
-    g_free(theme_title_layout);
-
-    appearance_free(theme_a_focused_unpressed_max);
-    appearance_free(theme_a_focused_pressed_max);
-    appearance_free(theme_a_focused_pressed_set_max);
-    appearance_free(theme_a_unfocused_unpressed_max);
-    appearance_free(theme_a_unfocused_pressed_max);
-    appearance_free(theme_a_unfocused_pressed_set_max);
-    appearance_free(theme_a_focused_unpressed_close);
-    appearance_free(theme_a_focused_pressed_close);
-    appearance_free(theme_a_unfocused_unpressed_close);
-    appearance_free(theme_a_unfocused_pressed_close);
-    appearance_free(theme_a_focused_unpressed_desk);
-    appearance_free(theme_a_focused_pressed_desk);
-    appearance_free(theme_a_unfocused_unpressed_desk);
-    appearance_free(theme_a_unfocused_pressed_desk);
-    appearance_free(theme_a_focused_unpressed_shade);
-    appearance_free(theme_a_focused_pressed_shade);
-    appearance_free(theme_a_unfocused_unpressed_shade);
-    appearance_free(theme_a_unfocused_pressed_shade);
-    appearance_free(theme_a_focused_unpressed_iconify);
-    appearance_free(theme_a_focused_pressed_iconify);
-    appearance_free(theme_a_unfocused_unpressed_iconify);
-    appearance_free(theme_a_unfocused_pressed_iconify);
-    appearance_free(theme_a_focused_grip);
-    appearance_free(theme_a_unfocused_grip);
-    appearance_free(theme_a_focused_title);
-    appearance_free(theme_a_unfocused_title);
-    appearance_free(theme_a_focused_label);
-    appearance_free(theme_a_unfocused_label);
-    appearance_free(theme_a_icon);
-    appearance_free(theme_a_focused_handle);
-    appearance_free(theme_a_unfocused_handle);
-    appearance_free(theme_a_menu);
-    appearance_free(theme_a_menu_title);
-    appearance_free(theme_a_menu_item);
-    appearance_free(theme_a_menu_disabled);
-    appearance_free(theme_a_menu_hilite);
-    appearance_free(theme_app_hilite_bg);
-    appearance_free(theme_app_unhilite_bg);
-    appearance_free(theme_app_hilite_label);
-    appearance_free(theme_app_unhilite_label);
-    appearance_free(theme_app_icon);
-}
-
-static XrmDatabase loaddb(char *theme)
-{
-    XrmDatabase db;
-
-    db = XrmGetFileDatabase(theme);
-    if (db == NULL) {
-       char *s = g_build_filename(g_get_home_dir(), ".openbox", "themes",
-                                  theme, NULL);
-       db = XrmGetFileDatabase(s);
-       g_free(s);
-    }
-    if (db == NULL) {
-       char *s = g_build_filename(THEMEDIR, theme, NULL);
-       db = XrmGetFileDatabase(s);
-       g_free(s);
-    }
-    return db;
-}
-
-static char *create_class_name(char *rname)
-{
-    char *rclass = g_strdup(rname);
-    char *p = rclass;
-
-    while (TRUE) {
-       *p = toupper(*p);
-       p = strchr(p+1, '.');
-       if (p == NULL) break;
-       ++p;
-       if (*p == '\0') break;
-    }
-    return rclass;
-}
-
-static gboolean read_int(XrmDatabase db, char *rname, int *value)
-{
-    gboolean ret = FALSE;
-    char *rclass = create_class_name(rname);
-    char *rettype, *end;
-    XrmValue retvalue;
-  
-    if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
-       retvalue.addr != NULL) {
-       *value = (int)strtol(retvalue.addr, &end, 10);
-       if (end != retvalue.addr)
-           ret = TRUE;
-    }
-
-    g_free(rclass);
-    return ret;
-}
-
-static gboolean read_string(XrmDatabase db, char *rname, char **value)
-{
-    gboolean ret = FALSE;
-    char *rclass = create_class_name(rname);
-    char *rettype;
-    XrmValue retvalue;
-  
-    if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
-       retvalue.addr != NULL) {
-       *value = g_strdup(retvalue.addr);
-       ret = TRUE;
-    }
-
-    g_free(rclass);
-    return ret;
-}
-
-static gboolean read_color(XrmDatabase db, char *rname, color_rgb **value)
-{
-    gboolean ret = FALSE;
-    char *rclass = create_class_name(rname);
-    char *rettype;
-    XrmValue retvalue;
-  
-    if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
-       retvalue.addr != NULL) {
-       color_rgb *c = color_parse(retvalue.addr);
-       if (c != NULL) {
-           *value = c;
-           ret = TRUE;
-       }
-    }
-
-    g_free(rclass);
-    return ret;
-}
-
-static gboolean read_mask(XrmDatabase db, char *rname, char *theme,
-                          pixmap_mask **value)
-{
-    gboolean ret = FALSE;
-    char *rclass = create_class_name(rname);
-    char *rettype;
-    char *s;
-    char *button_dir;
-    XrmValue retvalue;
-    int hx, hy; /* ignored */
-    unsigned int w, h;
-    unsigned char *b;
-  
-    if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
-        retvalue.addr != NULL) {
-
-       button_dir = g_strdup_printf("%s_data", theme);
-
-        s = g_build_filename(g_get_home_dir(), ".openbox", "themes",
-                             button_dir, retvalue.addr, NULL);
-
-        if (XReadBitmapFileData(s, &w, &h, &b, &hx, &hy) == BitmapSuccess)
-            ret = TRUE;
-        else {
-            g_free(s);
-            s = g_build_filename(THEMEDIR, button_dir, retvalue.addr, NULL);
-       
-            if (XReadBitmapFileData(s, &w, &h, &b, &hx, &hy) == BitmapSuccess) 
-                ret = TRUE;
-            else {
-                char *themename;
-
-                g_free(s);
-                themename = g_path_get_basename(theme);
-                s = g_strdup_printf("%s/%s_data/%s", theme,
-                                    themename, retvalue.addr);
-                g_free(themename);
-                if (XReadBitmapFileData(s, &w, &h, &b, &hx, &hy) ==
-                    BitmapSuccess) 
-                    ret = TRUE;
-                else
-                    g_message("Unable to find bitmap '%s'", retvalue.addr);
-            }
-        }
-
-        if (ret) {
-            *value = pixmap_mask_new(w, h, (char*)b);
-            XFree(b);
-        }
-      
-        g_free(s);
-        g_free(button_dir);
-    }
-
-    g_free(rclass);
-    return ret;
-}
-
-static void parse_appearance(char *tex, SurfaceColorType *grad,
-                             ReliefType *relief, BevelType *bevel,
-                             gboolean *interlaced, gboolean *border)
-{
-    char *t;
-
-    /* convert to all lowercase */
-    for (t = tex; *t != '\0'; ++t)
-       *t = g_ascii_tolower(*t);
-
-    if (strstr(tex, "parentrelative") != NULL) {
-       *grad = Background_ParentRelative;
-    } else {
-       if (strstr(tex, "gradient") != NULL) {
-           if (strstr(tex, "crossdiagonal") != NULL)
-               *grad = Background_CrossDiagonal;
-           else if (strstr(tex, "rectangle") != NULL)
-               *grad = Background_Rectangle;
-           else if (strstr(tex, "pyramid") != NULL)
-               *grad = Background_Pyramid;
-           else if (strstr(tex, "pipecross") != NULL)
-               *grad = Background_PipeCross;
-           else if (strstr(tex, "elliptic") != NULL)
-               *grad = Background_Rectangle;
-           else if (strstr(tex, "horizontal") != NULL)
-               *grad = Background_Horizontal;
-           else if (strstr(tex, "vertical") != NULL)
-               *grad = Background_Vertical;
-           else
-               *grad = Background_Diagonal;
-       } else {
-           *grad = Background_Solid;
-       }
-
-       if (strstr(tex, "sunken") != NULL)
-           *relief = Sunken;
-       else if (strstr(tex, "flat") != NULL)
-           *relief = Flat;
-       else
-           *relief = Raised;
-       
-       *border = FALSE;
-       if (*relief == Flat) {
-           if (strstr(tex, "border") != NULL)
-               *border = TRUE;
-       } else {
-           if (strstr(tex, "bevel2") != NULL)
-               *bevel = Bevel2;
-           else
-               *bevel = Bevel1;
-       }
-
-       if (strstr(tex, "interlaced") != NULL)
-           *interlaced = TRUE;
-       else
-           *interlaced = FALSE;
-    }
-}
-
-
-static gboolean read_appearance(XrmDatabase db, char *rname, Appearance *value)
-{
-    gboolean ret = FALSE;
-    char *rclass = create_class_name(rname), *cname, *ctoname, *bcname;
-    char *rettype;
-    XrmValue retvalue;
-
-    cname = g_strconcat(rname, ".color", NULL);
-    ctoname = g_strconcat(rname, ".colorTo", NULL);
-    bcname = g_strconcat(rname, ".borderColor", NULL);
-
-    if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
-       retvalue.addr != NULL) {
-       parse_appearance(retvalue.addr,
-                        &value->surface.data.planar.grad,
-                        &value->surface.data.planar.relief,
-                        &value->surface.data.planar.bevel,
-                        &value->surface.data.planar.interlaced,
-                        &value->surface.data.planar.border);
-       if (!read_color(db, cname, &value->surface.data.planar.primary))
-           value->surface.data.planar.primary = color_new(0, 0, 0);
-       if (!read_color(db, ctoname, &value->surface.data.planar.secondary))
-           value->surface.data.planar.secondary = color_new(0, 0, 0);
-       if (value->surface.data.planar.border)
-           if (!read_color(db, bcname,
-                           &value->surface.data.planar.border_color))
-               value->surface.data.planar.border_color = color_new(0, 0, 0);
-       ret = TRUE;
-    }
-
-    g_free(bcname);
-    g_free(ctoname);
-    g_free(cname);
-    g_free(rclass);
-    return ret;
-}
-
-static void set_default_appearance(Appearance *a)
-{
-    a->surface.data.planar.grad = Background_Solid;
-    a->surface.data.planar.relief = Flat;
-    a->surface.data.planar.bevel = Bevel1;
-    a->surface.data.planar.interlaced = FALSE;
-    a->surface.data.planar.border = FALSE;
-    a->surface.data.planar.primary = color_new(0, 0, 0);
-    a->surface.data.planar.secondary = color_new(0, 0, 0);
-}
-
-char *theme_load(char *theme)
-{
-    XrmDatabase db = NULL;
-    char *loaded = NULL;
-    Justify winjust, mtitlejust, mjust;
-    char *str;
-    char *font_str;
-
-    if (theme) {
-       db = loaddb(theme);
-        if (db == NULL) {
-           g_warning("Failed to load the theme '%s'", theme);
-           g_message("Falling back to the default: '%s'", DEFAULT_THEME);
-       } else
-            loaded = g_strdup(theme);
-    }
-    if (db == NULL) {
-       db = loaddb(DEFAULT_THEME);
-       if (db == NULL) {
-           g_warning("Failed to load the theme '%s'.", DEFAULT_THEME);
-           return NULL;
-       } else
-            loaded = g_strdup(DEFAULT_THEME);
-    }
-
-    /* load the font stuff */
-    font_str = "arial-8:bold";
-
-    theme_winfont_shadow = FALSE;
-    if (read_string(db, "window.xft.flags", &str)) {
-        if (g_strrstr(str, "shadow"))
-            theme_winfont_shadow = TRUE;
-        g_free(str);
-    }
-    if (!read_int(db, "window.xft.shadow.offset",
-                  &theme_winfont_shadow_offset))
-        theme_winfont_shadow_offset = 1;
-    if (!read_int(db, "window.xft.shadow.tint",
-                  &theme_winfont_shadow_tint) ||
-        theme_winfont_shadow_tint < 100 || theme_winfont_shadow_tint > 100)
-        theme_winfont_shadow_tint = 25;
-
-    theme_winfont = font_open(font_str);
-    theme_winfont_height = font_height(theme_winfont, theme_winfont_shadow,
-                                       theme_winfont_shadow_offset);
-
-    winjust = Justify_Left;
-    if (read_string(db, "window.justify", &str)) {
-        if (!g_ascii_strcasecmp(str, "right"))
-            winjust = Justify_Right;
-        else if (!g_ascii_strcasecmp(str, "center"))
-            winjust = Justify_Center;
-        g_free(str);
-    }
-
-    font_str = "arial-10:bold";
-
-    theme_mtitlefont_shadow = FALSE;
-    if (read_string(db, "menu.title.xft.flags", &str)) {
-        if (g_strrstr(str, "shadow"))
-            theme_mtitlefont_shadow = TRUE;
-        g_free(str);
-    }
-    if (!read_int(db, "menu.title.xft.shadow.offset",
-                  &theme_mtitlefont_shadow_offset))
-        theme_mtitlefont_shadow_offset = 1;
-    if (!read_int(db, "menu.title.xft.shadow.tint",
-                  &theme_mtitlefont_shadow_tint) ||
-        theme_mtitlefont_shadow_tint < 100 ||
-        theme_mtitlefont_shadow_tint > 100)
-        theme_mtitlefont_shadow_tint = 25;
-
-    theme_mtitlefont = font_open(font_str);
-    theme_mtitlefont_height = font_height(theme_mtitlefont,
-                                          theme_mtitlefont_shadow,
-                                          theme_mtitlefont_shadow_offset);
-
-    mtitlejust = Justify_Left;
-    if (read_string(db, "menu.title.justify", &str)) {
-        if (!g_ascii_strcasecmp(str, "right"))
-            mtitlejust = Justify_Right;
-        else if (!g_ascii_strcasecmp(str, "center"))
-            mtitlejust = Justify_Center;
-        g_free(str);
-    }
-
-    font_str = "arial-8";
-
-    theme_mfont_shadow = FALSE;
-    if (read_string(db, "menu.frame.xft.flags", &str)) {
-        if (g_strrstr(str, "shadow"))
-            theme_mfont_shadow = TRUE;
-        g_free(str);
-    }
-    if (!read_int(db, "menu.frame.xft.shadow.offset",
-                  &theme_mfont_shadow_offset))
-        theme_mfont_shadow_offset = 1;
-    if (!read_int(db, "menu.frame.xft.shadow.tint",
-                  &theme_mfont_shadow_tint) ||
-        theme_mfont_shadow_tint < 100 ||
-        theme_mfont_shadow_tint > 100)
-        theme_mfont_shadow_tint = 25;
-
-    theme_mfont = font_open(font_str);
-    theme_mfont_height = font_height(theme_mfont, theme_mfont_shadow,
-                                     theme_mfont_shadow_offset);
-
-    mjust = Justify_Left;
-    if (read_string(db, "menu.frame.justify", &str)) {
-        if (!g_ascii_strcasecmp(str, "right"))
-            mjust = Justify_Right;
-        else if (!g_ascii_strcasecmp(str, "center"))
-            mjust = Justify_Center;
-        g_free(str);
-    }
-
-    /* load the title layout */
-    theme_title_layout = g_strdup("NLIMC");
-
-    if (!read_int(db, "handleWidth", &theme_handle_height) ||
-       theme_handle_height < 0 || theme_handle_height > 100)
-        theme_handle_height = 6;
-    if (!read_int(db, "bevelWidth", &theme_bevel) ||
-       theme_bevel <= 0 || theme_bevel > 100) theme_bevel = 3;
-    if (!read_int(db, "borderWidth", &theme_bwidth) ||
-       theme_bwidth < 0 || theme_bwidth > 100) theme_bwidth = 1;
-    if (!read_int(db, "frameWidth", &theme_cbwidth) ||
-       theme_cbwidth < 0 || theme_cbwidth > 100) theme_cbwidth = theme_bevel;
-
-    /* load colors */
-    if (!read_color(db, "borderColor", &theme_b_color))
-       theme_b_color = color_new(0, 0, 0);
-    if (!read_color(db, "window.frame.focusColor", &theme_cb_focused_color))
-       theme_cb_focused_color = color_new(0xff, 0xff, 0xff);
-    if (!read_color(db, "window.frame.unfocusColor",&theme_cb_unfocused_color))
-       theme_cb_unfocused_color = color_new(0xff, 0xff, 0xff);
-    if (!read_color(db, "window.label.focus.textColor",
-                    &theme_title_focused_color))
-       theme_title_focused_color = color_new(0x0, 0x0, 0x0);
-    if (!read_color(db, "window.label.unfocus.textColor",
-                    &theme_title_unfocused_color))
-       theme_title_unfocused_color = color_new(0xff, 0xff, 0xff);
-    if (!read_color(db, "window.button.focus.picColor",
-                    &theme_titlebut_focused_color))
-       theme_titlebut_focused_color = color_new(0, 0, 0);
-    if (!read_color(db, "window.button.unfocus.picColor",
-                    &theme_titlebut_unfocused_color))
-       theme_titlebut_unfocused_color = color_new(0xff, 0xff, 0xff);
-    if (!read_color(db, "menu.title.textColor", &theme_menu_title_color))
-        theme_menu_title_color = color_new(0, 0, 0);
-    if (!read_color(db, "menu.frame.textColor", &theme_menu_color))
-        theme_menu_color = color_new(0xff, 0xff, 0xff);
-    if (!read_color(db, "menu.frame.disableColor", &theme_menu_disabled_color))
-        theme_menu_disabled_color = color_new(0, 0, 0);
-    if (!read_color(db, "menu.hilite.textColor", &theme_menu_hilite_color))
-        theme_menu_hilite_color = color_new(0, 0, 0);
-
-    if (read_mask(db, "window.button.max.mask", theme, &theme_max_unset_mask)){
-        if (!read_mask(db, "window.button.max.toggled.mask", theme,
-                       &theme_max_set_mask)) {
-            theme_max_set_mask = pixmap_mask_copy(theme_max_unset_mask);
-        }
-    } else {
-        {
-            char data[] = { 0x7f, 0x7f, 0x7f, 0x41, 0x41, 0x41, 0x7f };
-            theme_max_unset_mask = pixmap_mask_new(7, 7, data);
-        }
-        {
-            char data[] = { 0x7c, 0x44, 0x47, 0x47, 0x7f, 0x1f, 0x1f };
-            theme_max_set_mask = pixmap_mask_new(7, 7, data);
-        }
-    }
-
-    if (!read_mask(db, "window.button.icon.mask", theme,
-                   &theme_iconify_mask)) {
-        char data[] = { 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x7f };
-        theme_iconify_mask = pixmap_mask_new(7, 7, data);
-    }
-
-    if (read_mask(db, "window.button.stick.mask", theme,
-                   &theme_desk_unset_mask)) {
-        if (!read_mask(db, "window.button.stick.toggled.mask", theme,
-                       &theme_desk_set_mask)) {
-            theme_desk_set_mask =
-                pixmap_mask_copy(theme_desk_unset_mask);
-        }
-    } else {
-        {
-            char data[] = { 0x63, 0x63, 0x00, 0x00, 0x00, 0x63, 0x63 };
-            theme_desk_unset_mask = pixmap_mask_new(7, 7, data);
-        }
-        {
-            char data[] = { 0x00, 0x36, 0x36, 0x08, 0x36, 0x36, 0x00 };
-            theme_desk_set_mask = pixmap_mask_new(7, 7, data);
-        }
-    }
-
-    if (read_mask(db, "window.button.shade.mask", theme,
-                   &theme_shade_unset_mask)) {
-        if (!read_mask(db, "window.button.shade.toggled.mask", theme,
-                       &theme_shade_set_mask)) {
-            theme_shade_set_mask =
-                pixmap_mask_copy(theme_shade_unset_mask);
-        }
-    } else {
-        {
-            char data[] = { 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00 };
-            theme_shade_unset_mask = pixmap_mask_new(7, 7, data);
-        }
-        {
-            char data[] = { 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x7f };
-            theme_shade_set_mask = pixmap_mask_new(7, 7, data);
-        }
-    }
-
-    if (!read_mask(db, "window.button.close.mask", theme,
-                   &theme_close_mask)) {
-        char data[] = { 0x63, 0x77, 0x3e, 0x1c, 0x3e, 0x77, 0x63 };
-        theme_close_mask = pixmap_mask_new(7, 7, data);
-    }        
-
-    /* read the decoration textures */
-    if (!read_appearance(db, "window.title.focus", theme_a_focused_title))
-       set_default_appearance(theme_a_focused_title);
-    if (!read_appearance(db, "window.title.unfocus", theme_a_unfocused_title))
-       set_default_appearance(theme_a_unfocused_title);
-    if (!read_appearance(db, "window.label.focus", theme_a_focused_label))
-       set_default_appearance(theme_a_focused_label);
-    if (!read_appearance(db, "window.label.unfocus", theme_a_unfocused_label))
-       set_default_appearance(theme_a_unfocused_label);
-    if (!read_appearance(db, "window.handle.focus", theme_a_focused_handle))
-       set_default_appearance(theme_a_focused_handle);
-    if (!read_appearance(db, "window.handle.unfocus",theme_a_unfocused_handle))
-       set_default_appearance(theme_a_unfocused_handle);
-    if (!read_appearance(db, "window.grip.focus", theme_a_focused_grip))
-       set_default_appearance(theme_a_focused_grip);
-    if (!read_appearance(db, "window.grip.unfocus", theme_a_unfocused_grip))
-       set_default_appearance(theme_a_unfocused_grip);
-    if (!read_appearance(db, "menu.frame", theme_a_menu))
-       set_default_appearance(theme_a_menu);
-    if (!read_appearance(db, "menu.title", theme_a_menu_title))
-       set_default_appearance(theme_a_menu_title);
-    if (!read_appearance(db, "menu.hilite", theme_a_menu_hilite))
-       set_default_appearance(theme_a_menu_hilite);
-
-    /* read the appearances for rendering non-decorations */
-    if (!read_appearance(db, "window.title.focus", theme_app_hilite_bg))
-        set_default_appearance(theme_app_hilite_bg);
-    if (!read_appearance(db, "window.label.focus", theme_app_hilite_label))
-        set_default_appearance(theme_app_hilite_label);
-    if (!read_appearance(db, "window.title.unfocus", theme_app_unhilite_bg))
-        set_default_appearance(theme_app_unhilite_bg);
-    if (!read_appearance(db, "window.label.unfocus", theme_app_unhilite_label))
-        set_default_appearance(theme_app_unhilite_label);
-
-    /* read buttons textures */
-    if (!read_appearance(db, "window.button.pressed.focus",
-                        theme_a_focused_pressed_max))
-       if (!read_appearance(db, "window.button.pressed",
-                             theme_a_focused_pressed_max))
-           set_default_appearance(theme_a_focused_pressed_max);
-    if (!read_appearance(db, "window.button.pressed.unfocus",
-                        theme_a_unfocused_pressed_max))
-       if (!read_appearance(db, "window.button.pressed",
-                            theme_a_unfocused_pressed_max))
-           set_default_appearance(theme_a_unfocused_pressed_max);
-    if (!read_appearance(db, "window.button.focus",
-                        theme_a_focused_unpressed_max))
-       set_default_appearance(theme_a_focused_unpressed_max);
-    if (!read_appearance(db, "window.button.unfocus",
-                        theme_a_unfocused_unpressed_max))
-       set_default_appearance(theme_a_unfocused_unpressed_max);
-
-    theme_a_unfocused_unpressed_close =
-        appearance_copy(theme_a_unfocused_unpressed_max);
-    theme_a_unfocused_pressed_close =
-        appearance_copy(theme_a_unfocused_pressed_max);
-    theme_a_focused_unpressed_close =
-        appearance_copy(theme_a_focused_unpressed_max);
-    theme_a_focused_pressed_close =
-        appearance_copy(theme_a_focused_pressed_max);
-    theme_a_unfocused_unpressed_desk =
-        appearance_copy(theme_a_unfocused_unpressed_max);
-    theme_a_unfocused_pressed_desk =
-        appearance_copy(theme_a_unfocused_pressed_max);
-    theme_a_unfocused_pressed_set_desk =
-        appearance_copy(theme_a_unfocused_pressed_max);
-    theme_a_focused_unpressed_desk =
-        appearance_copy(theme_a_focused_unpressed_max);
-    theme_a_focused_pressed_desk =
-        appearance_copy(theme_a_focused_pressed_max);
-    theme_a_focused_pressed_set_desk =
-        appearance_copy(theme_a_focused_pressed_max);
-    theme_a_unfocused_unpressed_shade =
-        appearance_copy(theme_a_unfocused_unpressed_max);
-    theme_a_unfocused_pressed_shade =
-        appearance_copy(theme_a_unfocused_pressed_max);
-    theme_a_unfocused_pressed_set_shade =
-        appearance_copy(theme_a_unfocused_pressed_max);
-    theme_a_focused_unpressed_shade =
-        appearance_copy(theme_a_focused_unpressed_max);
-    theme_a_focused_pressed_shade =
-        appearance_copy(theme_a_focused_pressed_max);
-    theme_a_focused_pressed_set_shade =
-        appearance_copy(theme_a_focused_pressed_max);
-    theme_a_unfocused_unpressed_iconify =
-        appearance_copy(theme_a_unfocused_unpressed_max);
-    theme_a_unfocused_pressed_iconify =
-        appearance_copy(theme_a_unfocused_pressed_max);
-    theme_a_focused_unpressed_iconify =
-        appearance_copy(theme_a_focused_unpressed_max);
-    theme_a_focused_pressed_iconify =
-        appearance_copy(theme_a_focused_pressed_max);
-    theme_a_unfocused_pressed_set_max =
-        appearance_copy(theme_a_unfocused_pressed_max);
-    theme_a_focused_pressed_set_max =
-        appearance_copy(theme_a_focused_pressed_max);
-
-    theme_a_icon->surface.data.planar.grad = Background_ParentRelative;
-
-    /* set up the textures */
-    theme_a_focused_label->texture[0].type = 
-        theme_app_hilite_label->texture[0].type = Text;
-    theme_a_focused_label->texture[0].data.text.justify = winjust;
-    theme_app_hilite_label->texture[0].data.text.justify = Justify_Left;
-    theme_a_focused_label->texture[0].data.text.font =
-        theme_app_hilite_label->texture[0].data.text.font = theme_winfont;
-    theme_a_focused_label->texture[0].data.text.shadow =
-        theme_app_hilite_label->texture[0].data.text.shadow =
-        theme_winfont_shadow;
-    theme_a_focused_label->texture[0].data.text.offset =
-        theme_app_hilite_label->texture[0].data.text.offset =
-        theme_winfont_shadow_offset;
-    theme_a_focused_label->texture[0].data.text.tint =
-        theme_app_hilite_label->texture[0].data.text.tint =
-        theme_winfont_shadow_tint;
-    theme_a_focused_label->texture[0].data.text.color =
-        theme_app_hilite_label->texture[0].data.text.color =
-        theme_title_focused_color;
-
-    theme_a_unfocused_label->texture[0].type =
-        theme_app_unhilite_label->texture[0].type = Text;
-    theme_a_unfocused_label->texture[0].data.text.justify = winjust;
-    theme_app_unhilite_label->texture[0].data.text.justify = Justify_Left;
-    theme_a_unfocused_label->texture[0].data.text.font =
-        theme_app_unhilite_label->texture[0].data.text.font = theme_winfont;
-    theme_a_unfocused_label->texture[0].data.text.shadow =
-        theme_app_unhilite_label->texture[0].data.text.shadow =
-        theme_winfont_shadow;
-    theme_a_unfocused_label->texture[0].data.text.offset =
-        theme_app_unhilite_label->texture[0].data.text.offset =
-        theme_winfont_shadow_offset;
-    theme_a_unfocused_label->texture[0].data.text.tint =
-        theme_app_unhilite_label->texture[0].data.text.tint =
-        theme_winfont_shadow_tint;
-    theme_a_unfocused_label->texture[0].data.text.color =
-        theme_app_unhilite_label->texture[0].data.text.color =
-        theme_title_unfocused_color;
-
-    theme_a_menu_title->texture[0].type = Text;
-    theme_a_menu_title->texture[0].data.text.justify = mtitlejust;
-    theme_a_menu_title->texture[0].data.text.font = theme_mtitlefont;
-    theme_a_menu_title->texture[0].data.text.shadow = theme_mtitlefont_shadow;
-    theme_a_menu_title->texture[0].data.text.offset =
-        theme_mtitlefont_shadow_offset;
-    theme_a_menu_title->texture[0].data.text.tint =
-        theme_mtitlefont_shadow_tint;
-    theme_a_menu_title->texture[0].data.text.color = theme_menu_title_color;
-
-    theme_a_menu_item->surface.data.planar.grad = 
-        theme_a_menu_disabled->surface.data.planar.grad =
-        theme_app_icon->surface.data.planar.grad =
-        Background_ParentRelative;
-
-    theme_a_menu_item->texture[0].type =
-        theme_a_menu_disabled->texture[0].type = 
-        theme_a_menu_hilite->texture[0].type = Text;
-    theme_a_menu_item->texture[0].data.text.justify = 
-        theme_a_menu_disabled->texture[0].data.text.justify = 
-        theme_a_menu_hilite->texture[0].data.text.justify = mjust;
-    theme_a_menu_item->texture[0].data.text.font =
-        theme_a_menu_disabled->texture[0].data.text.font =
-        theme_a_menu_hilite->texture[0].data.text.font = theme_mfont;
-    theme_a_menu_item->texture[0].data.text.shadow = 
-        theme_a_menu_disabled->texture[0].data.text.shadow = 
-        theme_a_menu_hilite->texture[0].data.text.shadow = theme_mfont_shadow;
-    theme_a_menu_item->texture[0].data.text.offset =
-        theme_a_menu_disabled->texture[0].data.text.offset = 
-        theme_a_menu_hilite->texture[0].data.text.offset = 
-        theme_mfont_shadow_offset;
-    theme_a_menu_item->texture[0].data.text.tint =
-        theme_a_menu_disabled->texture[0].data.text.tint =
-        theme_a_menu_hilite->texture[0].data.text.tint =
-        theme_mfont_shadow_tint;
-    theme_a_menu_item->texture[0].data.text.color = theme_menu_color;
-    theme_a_menu_disabled->texture[0].data.text.color =
-        theme_menu_disabled_color;
-    theme_a_menu_hilite->texture[0].data.text.color =  theme_menu_hilite_color;
-
-    theme_a_focused_unpressed_max->texture[0].type = 
-        theme_a_focused_pressed_max->texture[0].type = 
-        theme_a_focused_pressed_set_max->texture[0].type =  
-        theme_a_unfocused_unpressed_max->texture[0].type = 
-        theme_a_unfocused_pressed_max->texture[0].type = 
-        theme_a_unfocused_pressed_set_max->texture[0].type = 
-        theme_a_focused_unpressed_close->texture[0].type = 
-        theme_a_focused_pressed_close->texture[0].type = 
-        theme_a_unfocused_unpressed_close->texture[0].type = 
-        theme_a_unfocused_pressed_close->texture[0].type = 
-        theme_a_focused_unpressed_desk->texture[0].type = 
-        theme_a_focused_pressed_desk->texture[0].type = 
-        theme_a_focused_pressed_set_desk->texture[0].type = 
-        theme_a_unfocused_unpressed_desk->texture[0].type = 
-        theme_a_unfocused_pressed_desk->texture[0].type = 
-        theme_a_unfocused_pressed_set_desk->texture[0].type = 
-        theme_a_focused_unpressed_shade->texture[0].type = 
-        theme_a_focused_pressed_shade->texture[0].type = 
-        theme_a_focused_pressed_set_shade->texture[0].type = 
-        theme_a_unfocused_unpressed_shade->texture[0].type = 
-        theme_a_unfocused_pressed_shade->texture[0].type = 
-        theme_a_unfocused_pressed_set_shade->texture[0].type = 
-        theme_a_focused_unpressed_iconify->texture[0].type = 
-        theme_a_focused_pressed_iconify->texture[0].type = 
-        theme_a_unfocused_unpressed_iconify->texture[0].type = 
-        theme_a_unfocused_pressed_iconify->texture[0].type = Bitmask;
-    theme_a_focused_unpressed_max->texture[0].data.mask.mask = 
-        theme_a_unfocused_unpressed_max->texture[0].data.mask.mask = 
-        theme_a_focused_pressed_max->texture[0].data.mask.mask = 
-        theme_a_unfocused_pressed_max->texture[0].data.mask.mask =
-        theme_max_unset_mask;
-    theme_a_focused_pressed_set_max->texture[0].data.mask.mask = 
-        theme_a_unfocused_pressed_set_max->texture[0].data.mask.mask =
-        theme_max_set_mask;
-    theme_a_focused_pressed_close->texture[0].data.mask.mask = 
-        theme_a_unfocused_pressed_close->texture[0].data.mask.mask =
-        theme_a_focused_unpressed_close->texture[0].data.mask.mask = 
-        theme_a_unfocused_unpressed_close->texture[0].data.mask.mask =
-        theme_close_mask;
-    theme_a_focused_unpressed_desk->texture[0].data.mask.mask = 
-        theme_a_unfocused_unpressed_desk->texture[0].data.mask.mask = 
-        theme_a_focused_pressed_desk->texture[0].data.mask.mask = 
-        theme_a_unfocused_pressed_desk->texture[0].data.mask.mask =
-        theme_desk_unset_mask;
-    theme_a_focused_pressed_set_desk->texture[0].data.mask.mask = 
-        theme_a_unfocused_pressed_set_desk->texture[0].data.mask.mask =
-        theme_desk_set_mask;
-    theme_a_focused_unpressed_shade->texture[0].data.mask.mask = 
-        theme_a_unfocused_unpressed_shade->texture[0].data.mask.mask = 
-        theme_a_focused_pressed_shade->texture[0].data.mask.mask = 
-        theme_a_unfocused_pressed_shade->texture[0].data.mask.mask =
-        theme_shade_unset_mask;
-    theme_a_focused_pressed_set_shade->texture[0].data.mask.mask = 
-        theme_a_unfocused_pressed_set_shade->texture[0].data.mask.mask =
-        theme_shade_set_mask;
-    theme_a_focused_unpressed_iconify->texture[0].data.mask.mask = 
-        theme_a_unfocused_unpressed_iconify->texture[0].data.mask.mask = 
-        theme_a_focused_pressed_iconify->texture[0].data.mask.mask = 
-        theme_a_unfocused_pressed_iconify->texture[0].data.mask.mask =
-        theme_iconify_mask;
-    theme_a_focused_unpressed_max->texture[0].data.mask.color = 
-        theme_a_focused_pressed_max->texture[0].data.mask.color = 
-        theme_a_focused_pressed_set_max->texture[0].data.mask.color = 
-        theme_a_focused_unpressed_close->texture[0].data.mask.color = 
-        theme_a_focused_pressed_close->texture[0].data.mask.color = 
-        theme_a_focused_unpressed_desk->texture[0].data.mask.color = 
-        theme_a_focused_pressed_desk->texture[0].data.mask.color = 
-        theme_a_focused_pressed_set_desk->texture[0].data.mask.color = 
-        theme_a_focused_unpressed_shade->texture[0].data.mask.color = 
-        theme_a_focused_pressed_shade->texture[0].data.mask.color = 
-        theme_a_focused_pressed_set_shade->texture[0].data.mask.color = 
-        theme_a_focused_unpressed_iconify->texture[0].data.mask.color = 
-        theme_a_focused_pressed_iconify->texture[0].data.mask.color =
-        theme_titlebut_focused_color;
-    theme_a_unfocused_unpressed_max->texture[0].data.mask.color = 
-        theme_a_unfocused_pressed_max->texture[0].data.mask.color = 
-        theme_a_unfocused_pressed_set_max->texture[0].data.mask.color = 
-        theme_a_unfocused_unpressed_close->texture[0].data.mask.color = 
-        theme_a_unfocused_pressed_close->texture[0].data.mask.color = 
-        theme_a_unfocused_unpressed_desk->texture[0].data.mask.color = 
-        theme_a_unfocused_pressed_desk->texture[0].data.mask.color = 
-        theme_a_unfocused_pressed_set_desk->texture[0].data.mask.color = 
-        theme_a_unfocused_unpressed_shade->texture[0].data.mask.color = 
-        theme_a_unfocused_pressed_shade->texture[0].data.mask.color = 
-        theme_a_unfocused_pressed_set_shade->texture[0].data.mask.color = 
-        theme_a_unfocused_unpressed_iconify->texture[0].data.mask.color = 
-        theme_a_unfocused_pressed_iconify->texture[0].data.mask.color =
-        theme_titlebut_unfocused_color;
-
-    XrmDestroyDatabase(db);
-
-    return loaded;
-}
diff --git a/render/theme.h b/render/theme.h
deleted file mode 100644 (file)
index 2a93c8d..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-#ifndef __theme_h
-#define __theme_h
-
-#include "render.h"
-#include "color.h"
-#include "font.h"
-#include "mask.h"
-
-extern int theme_bevel;
-extern int theme_handle_height;
-extern int theme_bwidth;
-extern int theme_cbwidth;
-
-#define theme_label_height (theme_winfont_height + 2)
-#define theme_title_height (theme_label_height + theme_bevel * 2)
-#define theme_button_size  (theme_label_height - 2)
-#define theme_grip_width   (theme_button_size * 2)
-
-extern color_rgb *theme_b_color;
-extern color_rgb *theme_cb_focused_color;
-extern color_rgb *theme_cb_unfocused_color;
-extern color_rgb *theme_title_focused_color;
-extern color_rgb *theme_title_unfocused_color;
-extern color_rgb *theme_titlebut_focused_color;
-extern color_rgb *theme_titlebut_unfocused_color;
-
-extern int theme_winfont_height;
-extern ObFont *theme_winfont;
-extern char *theme_title_layout;
-
-extern pixmap_mask *theme_max_set_mask;
-extern pixmap_mask *theme_max_unset_mask;
-extern pixmap_mask *theme_iconify_mask;
-extern pixmap_mask *theme_desk_set_mask;
-extern pixmap_mask *theme_desk_unset_mask;
-extern pixmap_mask *theme_shade_set_mask;
-extern pixmap_mask *theme_shade_unset_mask;
-extern pixmap_mask *theme_close_mask;
-
-extern Appearance *theme_a_focused_unpressed_max;
-extern Appearance *theme_a_focused_pressed_max;
-extern Appearance *theme_a_focused_pressed_set_max;
-extern Appearance *theme_a_unfocused_unpressed_max;
-extern Appearance *theme_a_unfocused_pressed_max;
-extern Appearance *theme_a_unfocused_pressed_set_max;
-extern Appearance *theme_a_focused_unpressed_close;
-extern Appearance *theme_a_focused_pressed_close;
-extern Appearance *theme_a_unfocused_unpressed_close;
-extern Appearance *theme_a_unfocused_pressed_close;
-extern Appearance *theme_a_focused_unpressed_desk;
-extern Appearance *theme_a_focused_pressed_desk;
-extern Appearance *theme_a_focused_pressed_set_desk;
-extern Appearance *theme_a_unfocused_unpressed_desk;
-extern Appearance *theme_a_unfocused_pressed_desk;
-extern Appearance *theme_a_unfocused_pressed_set_desk;
-extern Appearance *theme_a_focused_unpressed_shade;
-extern Appearance *theme_a_focused_pressed_shade;
-extern Appearance *theme_a_focused_pressed_set_shade;
-extern Appearance *theme_a_unfocused_unpressed_shade;
-extern Appearance *theme_a_unfocused_pressed_shade;
-extern Appearance *theme_a_unfocused_pressed_set_shade;
-extern Appearance *theme_a_focused_unpressed_iconify;
-extern Appearance *theme_a_focused_pressed_iconify;
-extern Appearance *theme_a_unfocused_unpressed_iconify;
-extern Appearance *theme_a_unfocused_pressed_iconify;
-extern Appearance *theme_a_focused_grip;
-extern Appearance *theme_a_unfocused_grip;
-extern Appearance *theme_a_focused_title;
-extern Appearance *theme_a_unfocused_title;
-extern Appearance *theme_a_focused_label;
-extern Appearance *theme_a_unfocused_label;
-extern Appearance *theme_a_icon;
-extern Appearance *theme_a_focused_handle;
-extern Appearance *theme_a_unfocused_handle;
-extern Appearance *theme_a_menu_title;
-extern Appearance *theme_a_menu;
-extern Appearance *theme_a_menu_item;
-extern Appearance *theme_a_menu_disabled;
-extern Appearance *theme_a_menu_hilite;
-
-extern Appearance *theme_app_hilite_bg;
-extern Appearance *theme_app_unhilite_bg;
-extern Appearance *theme_app_hilite_label;
-extern Appearance *theme_app_unhilite_label;
-extern Appearance *theme_app_icon;
-
-void theme_startup();
-void theme_shutdown();
-
-char *theme_load(char *theme);
-
-#endif