]> Dogcows Code - chaz/openbox/commitdiff
more namespacing to Rr*
authorDana Jansens <danakj@orodu.net>
Sat, 21 Jun 2003 02:15:13 +0000 (02:15 +0000)
committerDana Jansens <danakj@orodu.net>
Sat, 21 Jun 2003 02:15:13 +0000 (02:15 +0000)
openbox/openbox.c
render/font.c
render/font.h
render/render.c
render/render.h
render/theme.c
render/theme.h

index d63c67b8bbbc9c9a784360eea11f417ad0d5a105..1397d324a3d37ae3990a1ed9e2ba973f947840cd 100644 (file)
@@ -176,7 +176,6 @@ int main(int argc, char **argv)
         /* anything that is going to read data from the rc file needs to be 
            in this group */
        timer_startup();
-       font_startup();
        event_startup();
         grab_startup();
         plugin_startup();
index 64f1da16c6c621b7b721b514a85c2d2794c4811a..7556d1c8cb0f28ed7af6540513287aa9fb942e2a 100644 (file)
@@ -12,7 +12,9 @@
 #define ELIPSES_LENGTH(font, shadow, offset) \
     (font->elipses_length + (shadow ? offset : 0))
 
-void font_startup(void)
+static gboolean started = FALSE;
+
+static void font_startup(void)
 {
 #ifdef DEBUG
     int version;
@@ -29,7 +31,7 @@ void font_startup(void)
 #endif
 }
 
-static void measure_height(RrFont *f)
+static void measure_font(RrFont *f)
 {
     XGlyphInfo info;
 
@@ -39,16 +41,21 @@ static void measure_height(RrFont *f)
     f->elipses_length = (signed) info.xOff;
 }
 
-RrFont *font_open(const RrInstance *inst, char *fontstring)
+RrFont *RrFontOpen(const RrInstance *inst, char *fontstring)
 {
     RrFont *out;
     XftFont *xf;
+
+    if (!started) {
+        font_startup();
+        started = TRUE;
+    }
     
     if ((xf = XftFontOpenName(RrDisplay(inst), RrScreen(inst), fontstring))) {
         out = g_new(RrFont, 1);
         out->inst = inst;
         out->xftfont = xf;
-        measure_height(out);
+        measure_font(out);
         return out;
     }
     g_warning(_("Unable to load font: %s\n"), fontstring);
@@ -58,7 +65,7 @@ RrFont *font_open(const RrInstance *inst, char *fontstring)
         out = g_new(RrFont, 1);
         out->inst = inst;
         out->xftfont = xf;
-        measure_height(out);
+        measure_font(out);
         return out;
     }
     g_warning(_("Unable to load font: %s\n"), "sans");
@@ -67,7 +74,7 @@ RrFont *font_open(const RrInstance *inst, char *fontstring)
     exit(3); /* can't continue without a font */
 }
 
-void font_close(RrFont *f)
+void RrFontClose(RrFont *f)
 {
     if (f) {
         XftFontClose(RrDisplay(f->inst), f->xftfont);
@@ -75,47 +82,48 @@ void font_close(RrFont *f)
     }
 }
 
-void font_measure_full(RrFont *f, char *str, int shadow, int offset,
-                       int *x, int *y)
+static void font_measure_full(const RrFont *f, const gchar *str,
+                              gint shadow, gint offset, gint *x, gint *y)
 {
     XGlyphInfo info;
 
     XftTextExtentsUtf8(RrDisplay(f->inst), f->xftfont,
-                       (FcChar8*)str, strlen(str), &info);
+                       (const FcChar8*)str, strlen(str), &info);
 
     *x = (signed) info.xOff + (shadow ? ABS(offset) : 0);
     *y = info.height + (shadow ? ABS(offset) : 0);
 }
 
-int font_measure_string(RrFont *f, char *str, int shadow, int offset)
+int RrFontMeasureString(const RrFont *f, const gchar *str,
+                        gint shadow, gint offset)
 {
-    int x, y;
+    gint x, y;
     font_measure_full (f, str, shadow, offset, &x, &y);
     return x;
 }
 
-int font_height(RrFont *f, int shadow, int offset)
+int RrFontHeight(const RrFont *f, gint shadow, gint offset)
 {
     return f->xftfont->ascent + f->xftfont->descent + (shadow ? offset : 0);
 }
 
-int font_max_char_width(RrFont *f)
+int RrFontMaxCharWidth(const RrFont *f)
 {
     return (signed) f->xftfont->max_advance_width;
 }
 
-void font_draw(XftDraw *d, RrTextureText *t, Rect *area)
+void RrFontDraw(XftDraw *d, RrTextureText *t, Rect *area)
 {
-    int x,y,w,h;
+    gint x,y,w,h;
     XftColor c;
     GString *text;
-    int mw, em, mh;
+    gint mw, em, mh;
     size_t l;
     gboolean shortened = FALSE;
 
     /* center vertically */
     y = area->y +
-        (area->height - font_height(t->font, t->shadow, t->offset)) / 2;
+        (area->height - RrFontHeight(t->font, t->shadow, t->offset)) / 2;
     w = area->width;
     h = area->height;
 
index 7b483d8931c295c87871d6ba2075b91ca5d3e7df..22aeaec0820ebb486bc2100f0939be7ab3e45bd7 100644 (file)
@@ -11,11 +11,7 @@ struct _RrFont {
     gint elipses_length;
 };
 
-void font_startup(void);
-RrFont *font_open(const RrInstance *inst, char *fontstring);
-void font_close(RrFont *f);
-int font_measure_string(RrFont *f, char *str, int shadow, int offset);
-int font_height(RrFont *f, int shadow, int offset);
-int font_max_char_width(RrFont *f);
-void font_draw(XftDraw *d, RrTextureText *t, Rect *position);
+RrFont *RrFontOpen(const RrInstance *inst, char *fontstring);
+void RrFontClose(RrFont *f);
+void RrFontDraw(XftDraw *d, RrTextureText *t, Rect *position);
 #endif /* __font_h */
index 82c9e26fe9b39bb382c9bb460c83710b0b2211f6..87706c8eea72c9d83e06d70758499968c5c8cbf4 100644 (file)
@@ -100,7 +100,7 @@ void RrPaint(RrAppearance *l, Window win, gint w, gint h)
                                            RrVisual(l->inst),
                                            RrColormap(l->inst));
             }
-            font_draw(l->xftdraw, &l->texture[i].data.text, &tarea);
+            RrFontDraw(l->xftdraw, &l->texture[i].data.text, &tarea);
         break;
         case RR_TEXTURE_MASK:
             if (!transferred) {
@@ -266,14 +266,14 @@ void RrMinsize(RrAppearance *l, gint *w, gint *h)
             *h = MAX(*h, l->texture[i].data.mask.mask->height);
             break;
         case RR_TEXTURE_TEXT:
-            m = font_measure_string(l->texture[i].data.text.font,
+            m = RrFontMeasureString(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 = MAX(*w, m);
-            m = font_height(l->texture[i].data.text.font,
-                            l->texture[i].data.text.shadow,
-                            l->texture[i].data.text.offset);
+            m = RrFontHeight(l->texture[i].data.text.font,
+                             l->texture[i].data.text.shadow,
+                             l->texture[i].data.text.offset);
             *h += MAX(*h, m);
             break;
         case RR_TEXTURE_RGBA:
index 30bf484698e8ae3cc021f0cd4c002b891926c36c..0e34c1973b7d69bea8536f3aee8a06f776890e89 100644 (file)
@@ -161,6 +161,11 @@ RrAppearance *RrAppearanceNew  (const RrInstance *inst, gint numtex);
 RrAppearance *RrAppearanceCopy (RrAppearance *a);
 void          RrAppearanceFree (RrAppearance *a);
 
+int RrFontMeasureString (const RrFont *f, const gchar *str,
+                         gint shadow, gint offset);
+int RrFontHeight        (const RrFont *f, gint shadow, gint offset);
+int RrFontMaxCharWidth  (const RrFont *f);
+
 void RrPaint   (RrAppearance *l, Window win, gint w, gint h);
 void RrMinsize (RrAppearance *l, gint *w, gint *h);
 
index ad727432e7c88cb5e9484501858b5777c8895708..1a38093a3c888d3de9758fed1a993e41294e9054 100644 (file)
@@ -125,9 +125,9 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name)
         theme->winfont_shadow_tint < 100 || theme->winfont_shadow_tint > 100)
         theme->winfont_shadow_tint = 25;
 
-    theme->winfont = font_open(inst, font_str);
-    theme->winfont_height = font_height(theme->winfont, theme->winfont_shadow,
-                                       theme->winfont_shadow_offset);
+    theme->winfont = RrFontOpen(inst, font_str);
+    theme->winfont_height = RrFontHeight(theme->winfont, theme->winfont_shadow,
+                                         theme->winfont_shadow_offset);
 
     winjust = RR_JUSTIFY_LEFT;
     if (read_string(db, "window.justify", &str)) {
@@ -156,10 +156,10 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name)
         theme->mtitlefont_shadow_tint > 100)
         theme->mtitlefont_shadow_tint = 25;
 
-    theme->mtitlefont = font_open(inst, font_str);
-    theme->mtitlefont_height = font_height(theme->mtitlefont,
-                                          theme->mtitlefont_shadow,
-                                          theme->mtitlefont_shadow_offset);
+    theme->mtitlefont = RrFontOpen(inst, font_str);
+    theme->mtitlefont_height = RrFontHeight(theme->mtitlefont,
+                                            theme->mtitlefont_shadow,
+                                            theme->mtitlefont_shadow_offset);
 
     mtitlejust = RR_JUSTIFY_LEFT;
     if (read_string(db, "menu.title.justify", &str)) {
@@ -188,9 +188,9 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name)
         theme->mfont_shadow_tint > 100)
         theme->mfont_shadow_tint = 25;
 
-    theme->mfont = font_open(inst, font_str);
-    theme->mfont_height = font_height(theme->mfont, theme->mfont_shadow,
-                                     theme->mfont_shadow_offset);
+    theme->mfont = RrFontOpen(inst, font_str);
+    theme->mfont_height = RrFontHeight(theme->mfont, theme->mfont_shadow,
+                                       theme->mfont_shadow_offset);
 
     mjust = RR_JUSTIFY_LEFT;
     if (read_string(db, "menu.frame.justify", &str)) {
@@ -647,9 +647,9 @@ void RrThemeFree(RrTheme *theme)
         RrPixmapMaskFree(theme->iconify_mask);
         RrPixmapMaskFree(theme->close_mask);
 
-        font_close(theme->winfont);
-        font_close(theme->mtitlefont);
-        font_close(theme->mfont);
+        RrFontClose(theme->winfont);
+        RrFontClose(theme->mtitlefont);
+        RrFontClose(theme->mfont);
 
         g_free(theme->title_layout);
 
index e3c62c2b0cfb6f1e9b69699e8b398a627d874373..60aac26509b7469d25c0d83b7731a51871ee6b5b 100644 (file)
@@ -3,7 +3,6 @@
 
 #include "render.h"
 #include "color.h"
-#include "font.h"
 #include "mask.h"
 
 typedef struct _RrTheme RrTheme;
This page took 0.032621 seconds and 4 git commands to generate.