]> Dogcows Code - chaz/openbox/blobdiff - otk_c/gccache.c
move where transient shit will be
[chaz/openbox] / otk_c / gccache.c
index 71232bf478c37c961b592411029a2ae6533377ac..85ab9f9e4bf9fe8dfaa4651198e0f5feae61d2b4 100644 (file)
@@ -1,4 +1,4 @@
-// -*- mode: C; indent-tabs-mode: nil; -*-
+// -*- mode: C; indent-tabs-mode: nil; c-basic-offset: 2; -*-
 
 #include "../config.h"
 #include "gccache.h"
@@ -40,7 +40,7 @@ void OtkGCCacheContext_Set(OtkGCCacheContext *self,
   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;
@@ -86,7 +86,7 @@ OtkGCCacheItem *OtkGCCacheItem_New()
 }
 
 
-void OtkGCCache_Initialize(int screen_count)
+void OtkGCCache_Initialize()
 {
   unsigned int i;
 
@@ -94,7 +94,7 @@ void OtkGCCache_Initialize(int screen_count)
 
   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*) *
@@ -108,7 +108,7 @@ void OtkGCCache_Initialize(int screen_count)
 }
 
 
-void OtkGCCache_Destroy()
+/*void OtkGCCache_Destroy()
 {
   unsigned int i;
 
@@ -122,9 +122,9 @@ void OtkGCCache_Destroy()
   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;
@@ -156,7 +156,7 @@ static void OtkGCCache_InternalRelease(OtkGCCacheContext *ctx)
 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;
@@ -202,7 +202,7 @@ OtkGCCacheItem *OtkGCCache_Find(OtkColor *color, XFontStruct *font,
       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;
This page took 0.023512 seconds and 4 git commands to generate.