-// -*- mode: C; indent-tabs-mode: nil; -*-
+// -*- mode: C; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#include "../config.h"
#include "gccache.h"
XGCValues gcv;
unsigned long mask;
- self->pixel = gcv.foreground = OtkColor_Pixel(color);
+ self->pixel = gcv.foreground = color->pixel;
self->function = gcv.function = function;
self->subwindow = gcv.subwindow_mode = subwindow;
self->linewidth = gcv.line_width = linewidth;
}
-void OtkGCCache_Initialize(int screen_count)
+void OtkGCCache_Initialize()
{
unsigned int i;
gccache->context_count = 128;
gccache->cache_size = 16;
- gccache->cache_buckets = 8 * screen_count;
+ gccache->cache_buckets = 8 * ScreenCount(OBDisplay->display);
gccache->cache_total_size = gccache->cache_size * gccache->cache_buckets;
gccache->contexts = malloc(sizeof(OtkGCCacheContext*) *
}
-void OtkGCCache_Destroy()
+/*void OtkGCCache_Destroy()
{
unsigned int i;
free(gccache->cache);
free(gccache);
gccache = NULL;
-}
+}*/
-OtkGCCacheContext *OtkGCCache_NextContext(int screen)
+static OtkGCCacheContext *nextContext(int screen)
{
Window hd = OtkDisplay_ScreenInfo(OBDisplay, screen)->root_window;
OtkGCCacheContext *c;
OtkGCCacheItem *OtkGCCache_Find(OtkColor *color, XFontStruct *font,
int function, int subwindow, int linewidth)
{
- const unsigned long pixel = OtkColor_Pixel(color);
+ const unsigned long pixel = color->pixel;
const int screen = color->screen;
const int key = color->red ^ color->green ^ color->blue;
int k = (key % gccache->cache_size) * gccache->cache_buckets;
gccache->cache[k-1] = c;
}
} else {
- c->ctx = OtkGCCache_NextContext(screen);
+ c->ctx = nextContext(screen);
OtkGCCacheContext_Set(c->ctx, color, font, function, subwindow, linewidth);
c->ctx->used = True;
c->count = 1;