]> Dogcows Code - chaz/openbox/commitdiff
will draw fonts when stop segging
authorDana Jansens <danakj@orodu.net>
Sun, 16 Mar 2003 23:45:25 +0000 (23:45 +0000)
committerDana Jansens <danakj@orodu.net>
Sun, 16 Mar 2003 23:45:25 +0000 (23:45 +0000)
engines/openbox/openbox.c
engines/openbox/openbox.h
engines/openbox/theme.c
openbox/openbox.c

index fdab22a31a5ecf0d2cc8a8df8a6db787f7f834d6..80e9e81216d11382eda7f70b67c2d5148bd3fa87 100644 (file)
@@ -6,12 +6,13 @@
 #include "../../kernel/frame.h"
 #include "../../render/render.h"
 #include "../../render/color.h"
+#include "../../render/font.h"
 
 #include <X11/Xlib.h>
 #include <glib.h>
 
-#define TITLE_HEIGHT    (s_font_height + s_bevel * 2)
-#define LABEL_HEIGHT    (s_font_height)
+#define TITLE_HEIGHT    (s_winfont_height + s_bevel * 2)
+#define LABEL_HEIGHT    (s_winfont_height)
 #define HANDLE_Y(f)     (f->innersize.top + f->frame.client->area.height + \
                         f->cbwidth)
 #define BUTTON_SIZE     (LABEL_HEIGHT - 2)
@@ -22,7 +23,6 @@
 #define FRAME_EVENTMASK (EnterWindowMask | LeaveWindowMask)
 
 /* style settings - geometry */
-int s_font_height;
 int s_bevel;
 int s_handle_height;
 int s_bwidth;
@@ -31,6 +31,13 @@ int s_cbwidth;
 color_rgb *s_b_color;
 color_rgb *s_cb_focused_color;
 color_rgb *s_cb_unfocused_color;
+color_rgb *s_title_focused_color;
+color_rgb *s_title_unfocused_color;
+/* style settings - fonts */
+int s_winfont_height;
+int s_winfont_shadow;
+int s_winfont_shadow_offset;
+ObFont *s_winfont;
 
 /* global appearances */
 Appearance *a_focused_unpressed_max;
@@ -128,6 +135,7 @@ gboolean startup()
     g_quark_from_string("close");
 
     s_b_color = s_cb_unfocused_color = s_cb_focused_color = NULL;
+    s_winfont = NULL;
 
     a_focused_unpressed_max = appearance_new(Surface_Planar, 0);//1);
     a_focused_pressed_max = appearance_new(Surface_Planar, 0);//1);
@@ -149,12 +157,24 @@ gboolean startup()
     a_unfocused_grip = appearance_new(Surface_Planar, 0);
     a_focused_title = appearance_new(Surface_Planar, 0);
     a_unfocused_title = appearance_new(Surface_Planar, 0);
-    a_focused_label = appearance_new(Surface_Planar, 0);//1);
-    a_unfocused_label = appearance_new(Surface_Planar, 0);//1);
+    a_focused_label = appearance_new(Surface_Planar, 1);
+    a_unfocused_label = appearance_new(Surface_Planar, 1);
     a_icon = appearance_new(Surface_Planar, 0);//1);
     a_focused_handle = appearance_new(Surface_Planar, 0);
     a_unfocused_handle = appearance_new(Surface_Planar, 0);
 
+    a_focused_label->texture[0].type = Text;
+    a_focused_label->texture[0].data.text.font = s_winfont;
+    a_focused_label->texture[0].data.text.shadow = s_winfont_shadow;
+    a_focused_label->texture[0].data.text.offset = s_winfont_shadow_offset;
+    a_focused_label->texture[0].data.text.color = s_title_focused_color;
+
+    a_unfocused_label->texture[0].type = Text;
+    a_unfocused_label->texture[0].data.text.font = s_winfont;
+    a_unfocused_label->texture[0].data.text.shadow = s_winfont_shadow;
+    a_unfocused_label->texture[0].data.text.offset = s_winfont_shadow_offset;
+    a_unfocused_label->texture[0].data.text.color = s_title_unfocused_color;
+
     return load();
 }
 
@@ -164,6 +184,8 @@ void shutdown()
     if (s_cb_unfocused_color != NULL) color_free(s_cb_unfocused_color);
     if (s_cb_focused_color != NULL) color_free(s_cb_focused_color);
 
+    if (s_winfont != NULL) font_close(s_winfont);
+
     appearance_free(a_focused_unpressed_max);
     appearance_free(a_focused_pressed_max);
     appearance_free(a_unfocused_unpressed_max);
@@ -602,7 +624,8 @@ static void layout_title(ObFrame *self)
     }
     if (self->label_width < 1) self->label_width = 1;
 
-    XResizeWindow(ob_display, self->label, self->label_width, s_font_height);
+    XResizeWindow(ob_display, self->label, self->label_width,
+                  s_winfont_height);
   
     if (!n) {
        self->frame.client->decorations &= ~Decor_Icon;
@@ -726,7 +749,10 @@ static void render_label(ObFrame *self)
 {
     if (self->label_x < 0) return;
 
-    /* XXX set the texture's text! */
+    /* set the texture's text! */
+    self->a_focused_label->texture[0].data.text.string =
+        self->frame.client->title;
+
     paint(self->label, (self->frame.client->focused ?
                        self->a_focused_label :
                        self->a_unfocused_label),
index f072a6e0a51d100085bf4093a44874b962bdae50..3a3b1904414bb607ffea747f4d0b60c869858b9e 100644 (file)
@@ -3,8 +3,8 @@
 
 #include "../../render/render.h"
 #include "../../render/color.h"
+#include "../../render/font.h"
 
-extern int s_font_height;
 extern int s_bevel;
 extern int s_handle_height;
 extern int s_bwidth;
@@ -13,6 +13,13 @@ extern int s_cbwidth;
 extern color_rgb *s_b_color;
 extern color_rgb *s_cb_focused_color;
 extern color_rgb *s_cb_unfocused_color;
+extern color_rgb *s_title_focused_color;
+extern color_rgb *s_title_unfocused_color;
+
+extern int s_winfont_height;
+extern int s_winfont_shadow;
+extern int s_winfont_shadow_offset;
+extern ObFont *s_winfont;
 
 extern Appearance *a_focused_unpressed_max;
 extern Appearance *a_focused_pressed_max;
index 2c96224f34821e4606da5dc0f96837a4202ad73e..b5e4b9822c7bb8a0beae106d96952acaf14140fb 100644 (file)
@@ -250,8 +250,12 @@ gboolean load()
        }
     }
 
-    /* XXX load the font, not from the theme file tho, its in themerc_font */
-    s_font_height = 10;
+    /* load the font, not from the theme file tho, its in themerc_font */
+    s_winfont_shadow = 1; /* XXX read from themrc */
+    s_winfont_shadow_offset = 2; /* XXX read from themerc */
+    s_winfont = font_open(themerc_font);
+    s_winfont_height = font_height(s_winfont, s_winfont_shadow,
+                                   s_winfont_shadow_offset);
 
     if (!read_int(db, "handleWidth", &s_handle_height) ||
        s_handle_height < 0 || s_handle_height > 100) s_handle_height = 6;
@@ -268,6 +272,12 @@ gboolean load()
        s_cb_focused_color = color_new(0xff, 0xff, 0xff);
     if (!read_color(db, "window.frame.unfocusColor", &s_cb_unfocused_color))
        s_cb_unfocused_color = color_new(0xff, 0xff, 0xff);
+    if (!read_color(db, "window.label.focus.textColor",
+                    &s_title_focused_color))
+       s_title_focused_color = color_new(0xff, 0xff, 0xff);
+    if (!read_color(db, "window.label.unfocus.textColor",
+                    &s_title_unfocused_color))
+       s_title_unfocused_color = color_new(0xff, 0xff, 0xff);
 
     if (!read_appearance(db, "window.title.focus", a_focused_title))
        set_default_appearance(a_focused_title);
@@ -318,6 +328,7 @@ gboolean load()
 
     a_icon->surface.data.planar.grad = Background_ParentRelative;
 
+
     /* XXX load the button masks */
 
     XrmDestroyDatabase(db);
index 54f9b77eb61b3870e9807b5904ad10673d963330..c77f6df1151ee16b099f57d7d9df7cbe201e5b51 100644 (file)
@@ -18,6 +18,7 @@
 #include "themerc.h"
 #include "timer.h"
 #include "../render/render.h"
+#include "../render/font.h"
 
 #ifdef HAVE_FCNTL_H
 #  include <fcntl.h>
This page took 0.029261 seconds and 4 git commands to generate.