everything compiles. everything is broken.
authorDerek Foreman <manmower@gmail.com>
Sun, 25 May 2003 22:50:50 +0000 (22:50 +0000)
committerDerek Foreman <manmower@gmail.com>
Sun, 25 May 2003 22:50:50 +0000 (22:50 +0000)
rendertest works, yay.

15 files changed:
openbox/dock.c
openbox/frame.c
openbox/framerender.c
openbox/menu.c
openbox/popup.c
openbox/screen.c
render/color.c
render/color.h
render/gradient.c
render/mask.c
render/render.c
render/render.h
render/test.c
render/theme.c
render/theme.h

index 934d3d03bcd8072390b4bb587a2c153df06b5ad4..aaae5b6eb0cd27282d8a75a06376aaccd36f3f9c 100644 (file)
@@ -32,7 +32,6 @@ void dock_startup()
                                 CWOverrideRedirect | CWEventMask,
                                 &attrib);
     dock->a_frame = appearance_copy(theme_a_unfocused_title);
-    XSetWindowBorder(ob_display, dock->frame, theme_b_color->pixel);
     XSetWindowBorderWidth(ob_display, dock->frame, theme_bwidth);
 
     g_hash_table_insert(window_map, &dock->frame, dock);
index 211a275c75024bbd002aab55c8da3d0f1ad037e6..4076db830b3e2ec11421c68939f300aa6fb9921e 100644 (file)
@@ -133,10 +133,6 @@ Frame *frame_new()
     XMapWindow(ob_display, self->label);
 
     /* set colors/appearance/sizes for stuff that doesn't change */
-    XSetWindowBorder(ob_display, self->window, theme_b_color->pixel);
-    XSetWindowBorder(ob_display, self->label, theme_b_color->pixel);
-    XSetWindowBorder(ob_display, self->rgrip, theme_b_color->pixel);
-    XSetWindowBorder(ob_display, self->lgrip, theme_b_color->pixel);
 
     XResizeWindow(ob_display, self->max, theme_button_size, theme_button_size);
     XResizeWindow(ob_display, self->iconify,
index 737dfe950bb00d2661f1c16eb92e3ab714451fba..7033c441c120a8d149b01f9f72920a11bc47babb 100644 (file)
@@ -14,13 +14,6 @@ static void framerender_close(Frame *self, Appearance *a);
 
 void framerender_frame(Frame *self)
 {
-    if (self->focused)
-        XSetWindowBorder(ob_display, self->plate,
-                         theme_cb_focused_color->pixel);
-    else
-        XSetWindowBorder(ob_display, self->plate,
-                         theme_cb_unfocused_color->pixel);
-
     if (self->client->decorations & Decor_Titlebar) {
         Appearance *t, *l, *m, *n, *i, *d, *s, *c;
 
index 2af1a01f2f791e78f91ae273c84939193109ebed..b67f92c3607ecafbbb121989ed8c05afcc1537fa 100644 (file)
@@ -163,13 +163,13 @@ Menu *menu_new_full(char *label, char *name, Menu *parent,
     attrib.event_mask = TITLE_EVENTMASK;
     self->title = createWindow(self->frame, CWEventMask, &attrib);
     self->items = createWindow(self->frame, 0, &attrib);
-
+/*
     XSetWindowBorderWidth(ob_display, self->frame, theme_bwidth);
     XSetWindowBackground(ob_display, self->frame, theme_b_color->pixel);
     XSetWindowBorderWidth(ob_display, self->title, theme_bwidth);
     XSetWindowBorder(ob_display, self->frame, theme_b_color->pixel);
     XSetWindowBorder(ob_display, self->title, theme_b_color->pixel);
-
+*/
     XMapWindow(ob_display, self->title);
     XMapWindow(ob_display, self->items);
 
index efde07582bc47654ff0a1566c110aeaad6655a17..6f2cd240b443bdd804ec2e6fc28f79c6def75444 100644 (file)
@@ -99,10 +99,10 @@ void popup_show(Popup *self, char *text, Icon *icon)
         self->bg = XCreateWindow(ob_display, ob_root,
                                  0, 0, 1, 1, 0, render_depth, InputOutput,
                                  render_visual, CWOverrideRedirect, &attrib);
-
+/*
         XSetWindowBorderWidth(ob_display, self->bg, theme_bwidth);
         XSetWindowBorder(ob_display, self->bg, theme_b_color->pixel);
-
+*/
         self->text = XCreateWindow(ob_display, self->bg,
                                    0, 0, 1, 1, 0, render_depth, InputOutput,
                                    render_visual, 0, NULL);
index a1ad36e0e5fe69b06b78a399cbc80b78eec314ec..c65c23cd7a987734209c58b27ede68f0527a6579 100644 (file)
@@ -482,9 +482,11 @@ void screen_install_colormap(Client *client, gboolean install)
 
     if (client == NULL) {
        if (install)
-           XInstallColormap(ob_display, render_colormap);
+           XInstallColormap(ob_display,
+                             DefaultColormap(ob_display, ob_screen));
        else
-           XUninstallColormap(ob_display, render_colormap);
+           XUninstallColormap(ob_display,
+                               DefaultColormap(ob_display, ob_screen));
     } else {
        if (XGetWindowAttributes(ob_display, client->window, &wa) &&
             wa.colormap != None) {
index ca1f6e89c5aa30e8591e0bc515a9ac85086c493e..59c528d6ed966489f4819c6dcdacbbd5909968d7 100644 (file)
@@ -5,19 +5,7 @@
 #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)
+gboolean color_parse(char *colorname, struct RrRGB *ret)
 {
     XColor xcol;
 
@@ -28,42 +16,19 @@ color_rgb *color_parse(char *colorname)
     xcol.green = 0;
     xcol.blue = 0;
     xcol.pixel = 0;
-    if (!XParseColor(ob_display, render_colormap, colorname, &xcol)) {
+    if (!XParseColor(ob_display, 
+                     DefaultColormap(ob_display, ob_screen),
+                     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);
+        ret->r = 0.0;
+        ret->g = 0.0;
+        ret->b = 0.0;
+       return FALSE;
     }
+    ret->r = (xcol.red >> 8)/255.0;
+    ret->g = (xcol.green >> 8)/255.0;
+    ret->b = (xcol.blue >> 8)/255.0;
+    return TRUE;
 }
 
 void reduce_depth(pixel32 *data, XImage *im)
@@ -109,6 +74,7 @@ void reduce_depth(pixel32 *data, XImage *im)
             p16 += im->bytes_per_line/2;
         }
     break;
+/*
     case 8:
         g_assert(render_visual->class != TrueColor);
         for (y = 0; y < im->height; y++) {
@@ -116,25 +82,17 @@ void reduce_depth(pixel32 *data, XImage *im)
                 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;
         }
-        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;
@@ -177,7 +135,6 @@ void increase_depth(pixel32 *data, XImage *im)
     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);
@@ -217,6 +174,7 @@ void increase_depth(pixel32 *data, XImage *im)
         }
         break;
     case 8:
+#if 0
         g_assert(render_visual->class != TrueColor);
         for (y = 0; y < im->height; y++) {
             for (x = 0; x < im->width; x++) {
@@ -253,7 +211,7 @@ void increase_depth(pixel32 *data, XImage *im)
         data += im->width;
         p8 += im->bytes_per_line;
   }
-
+#endif
     break;
     default:
         g_message("your bit depth is currently unhandled\n");
index fb669fb54f5c5ff910ad8684921141efc7a4c26b..3108d6f563f6ee64d0f67dbbf87afe93c422a1ff 100644 (file)
@@ -36,19 +36,13 @@ typedef u_int16_t pixel16;
 #endif /* G_BYTE_ORDER == G_BIG_ENDIAN */
 
 
-typedef struct color_rgb {
-    int r;
-    int g;
-    int b;
-    unsigned long pixel;
-    GC gc;
-} color_rgb;
+struct RrRGB {
+    float r,g,b;
+};
 
-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);
+#define rr_color_set(col, x, y, z) (col).r = (x), (col).g = (y), (col).b = (z)
+
+gboolean color_parse(char *colorname, struct RrRGB *ret);
 void reduce_depth(pixel32 *data, XImage *im);
 void increase_depth(pixel32 *data, XImage *im);
 
@@ -64,7 +58,4 @@ 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 */
index 8afa4b796b87324d4919582c32c3cb4f9244a1ed..6165215eb8bb255f122c741dc79bcf61736c2e42 100644 (file)
@@ -11,14 +11,12 @@ void render_gl_gradient(Surface *sf, int x, int y, int w, int h)
     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;
-    }
+    pr = sf->data.planar.primary.r;
+    pg = sf->data.planar.primary.g;
+    pb = sf->data.planar.primary.b;
+    sr = sf->data.planar.secondary.r;
+    sg = sf->data.planar.secondary.g;
+    sb = sf->data.planar.secondary.b;
     switch (sf->data.planar.grad) {
     case Background_Solid: /* already handled */
         glBegin(GL_TRIANGLES);
index 22cb3feeb96c5879b485503fbf07c545e7df80b6..9eb6eec2c931917267587594ac6390ae830e764f 100644 (file)
@@ -25,24 +25,6 @@ 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)
index 7dfbaee0e6f551f832b4b54cf4f1401548d9e3d8..bbfd3fd139b43ef09c7dcea3a4fa84a69e1df67f 100644 (file)
 #ifdef HAVE_STDLIB_H
 #  include <stdlib.h>
 #endif
+#include <stdio.h>
 
 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;
@@ -30,10 +30,8 @@ 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);
 
@@ -84,7 +82,6 @@ void render_startup(void)
 
     render_depth = DefaultDepth(ob_display, ob_screen);
     render_visual = DefaultVisual(ob_display, ob_screen);
-    render_colormap = DefaultColormap(ob_display, ob_screen);
 
     vimatch.screen = ob_screen;
     vimatch.class = TrueColor;
@@ -108,8 +105,6 @@ void render_startup(void)
         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);
@@ -166,7 +161,6 @@ void render_shutdown(void)
 
 Appearance *appearance_new(SurfaceType type, int numtex)
 {
-  PlanarSurface *p;
   Appearance *out;
 
   out = g_new(Appearance, 1);
@@ -175,65 +169,16 @@ Appearance *appearance_new(SurfaceType type, int numtex)
   if (numtex) out->texture = g_new0(Texture, numtex);
   else out->texture = NULL;
 
-  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;
+        copy->surface.data.planar = orig->surface.data.planar;
     break;
     }
     copy->textures = orig->textures;
@@ -247,15 +192,6 @@ void appearance_free(Appearance *a)
         PlanarSurface *p;
         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);
     }
 }
index bd64f111450cbe36bdd16a86e1cc645d8f25c153..97994ddf5f8a3ad8a6f5977af7b405feefa06848 100644 (file)
@@ -47,17 +47,16 @@ 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;
+    struct RrRGB primary;
+    struct RrRGB secondary;
+    struct RrRGB border_color;
+    struct RrRGB bevel_dark; 
+    struct RrRGB bevel_light;
     gboolean interlaced;
     gboolean border;
     struct Appearance *parent;
     int parentx;
     int parenty;
-    pixel32 *pixel_data;
 } PlanarSurface;
 
 typedef struct NonplanarSurface {
@@ -92,7 +91,7 @@ typedef struct TextureText {
     int shadow;
     char tint;
     unsigned char offset;
-    color_rgb *color;
+    struct RrRGB color;
     char *string;
 } TextureText;   
 
@@ -103,7 +102,7 @@ typedef struct {
 } pixmap_mask;
 
 typedef struct TextureMask {
-    color_rgb *color;
+    struct RrRGB color;
     pixmap_mask *mask;
 } TextureMask;
 
index 7c3c83b3a4e5877ea6f64100426b607940ed7285..9f5efa295176655ce678c5553dbb085463ae5181 100644 (file)
@@ -52,8 +52,8 @@ int main()
 
        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");
+       color_parse("Yellow", &look->surface.data.planar.secondary);
+       color_parse("Blue", &look->surface.data.planar.primary);
         look->surface.data.planar.interlaced = FALSE;
         look->area.x = 0;
         look->area.y = 0;
index 8ba7a9dcda3104dc6dd0254aa5f569bd9b3307f2..87fb64ab81916ef07b7b17eb5a83dea9040dda10 100644 (file)
@@ -5,6 +5,9 @@
 
 #include <X11/Xlib.h>
 #include <X11/Xresource.h>
+#include <ctype.h>
+#include <string.h>
+#include <stdlib.h>
 
 /* style settings - geometry */
 int theme_bevel;
@@ -12,17 +15,17 @@ 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;
+struct RrRGB theme_b_color;
+struct RrRGB theme_cb_focused_color;
+struct RrRGB theme_cb_unfocused_color;
+struct RrRGB theme_title_focused_color;
+struct RrRGB theme_title_unfocused_color;
+struct RrRGB theme_titlebut_focused_color;
+struct RrRGB theme_titlebut_unfocused_color;
+struct RrRGB theme_menu_title_color;
+struct RrRGB theme_menu_color;
+struct RrRGB theme_menu_disabled_color;
+struct RrRGB theme_menu_hilite_color;
 /* style settings - fonts */
 int theme_winfont_height;
 ObFont *theme_winfont;
@@ -101,11 +104,6 @@ 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;
@@ -164,18 +162,6 @@ void theme_startup()
 
 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);
@@ -303,7 +289,7 @@ static gboolean read_string(XrmDatabase db, char *rname, char **value)
     return ret;
 }
 
-static gboolean read_color(XrmDatabase db, char *rname, color_rgb **value)
+static gboolean read_color(XrmDatabase db, char *rname, struct RrRGB *value)
 {
     gboolean ret = FALSE;
     char *rclass = create_class_name(rname);
@@ -311,14 +297,13 @@ static gboolean read_color(XrmDatabase db, char *rname, color_rgb **value)
     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;
-       }
+       retvalue.addr != NULL)
+           ret = color_parse(retvalue.addr, value);
+    else {
+        value->r = 0.0;
+        value->g = 0.0;
+        value->b = 0.0;
     }
-
     g_free(rclass);
     return ret;
 }
@@ -460,14 +445,10 @@ static gboolean read_appearance(XrmDatabase db, char *rname, Appearance *value)
                         &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);
+       read_color(db, cname, &value->surface.data.planar.primary);
+       read_color(db, ctoname, &value->surface.data.planar.secondary);
        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);
+           read_color(db, bcname, &value->surface.data.planar.border_color);
        ret = TRUE;
     }
 
@@ -485,8 +466,8 @@ static void set_default_appearance(Appearance *a)
     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);
+    rr_color_set(a->surface.data.planar.primary, 0.0, 0.0, 0.0);
+    rr_color_set(a->surface.data.planar.secondary, 0.0, 0.0, 0.0);
 }
 
 char *theme_load(char *theme)
@@ -622,32 +603,25 @@ char *theme_load(char *theme)
        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);
+    read_color(db, "borderColor", &theme_b_color);
     if (!read_color(db, "window.frame.focusColor", &theme_cb_focused_color))
-       theme_cb_focused_color = color_new(0xff, 0xff, 0xff);
+       rr_color_set(theme_cb_focused_color, 1.0, 1.0, 1.0);
     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);
+       rr_color_set(theme_cb_unfocused_color, 1.0, 1.0, 1.0);
+    read_color(db, "window.label.focus.textColor", &theme_title_focused_color);
     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);
+       rr_color_set(theme_title_unfocused_color, 1.0, 1.0, 1.0);
+    read_color(db, "window.button.focus.picColor",
+               &theme_titlebut_focused_color);
     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);
+       rr_color_set(theme_titlebut_unfocused_color, 1.0, 1.0, 1.0);
+    read_color(db, "menu.title.textColor", &theme_menu_title_color);
     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);
+        rr_color_set(theme_menu_color, 1.0, 1.0, 1.0);
+    read_color(db, "menu.frame.disableColor", &theme_menu_disabled_color);
+    read_color(db, "menu.hilite.textColor", &theme_menu_hilite_color);
 
     if (read_mask(db, "window.button.max.mask", theme, &theme_max_unset_mask)){
         if (!read_mask(db, "window.button.max.toggled.mask", theme,
index 2a93c8dff5414a5a9fa3675ce5f5912aaece8502..73597ae2ac65fd76b1ab3699c60633fe74c7a831 100644 (file)
@@ -16,13 +16,13 @@ extern int theme_cbwidth;
 #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 struct RrRGB theme_b_color;
+extern struct RrRGB theme_cb_focused_color;
+extern struct RrRGB theme_cb_unfocused_color;
+extern struct RrRGB theme_title_focused_color;
+extern struct RrRGB theme_title_unfocused_color;
+extern struct RrRGB theme_titlebut_focused_color;
+extern struct RrRGB theme_titlebut_unfocused_color;
 
 extern int theme_winfont_height;
 extern ObFont *theme_winfont;