]> Dogcows Code - chaz/openbox/blobdiff - engines/openbox/openbox.c
load and set the titles justification
[chaz/openbox] / engines / openbox / openbox.c
index fdab22a31a5ecf0d2cc8a8df8a6db787f7f834d6..184262ec25f88e30e165f7e2020edef7db0ae614 100644 (file)
@@ -6,12 +6,14 @@
 #include "../../kernel/frame.h"
 #include "../../render/render.h"
 #include "../../render/color.h"
+#include "../../render/font.h"
+#include "../../render/mask.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 +24,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 +32,20 @@ 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;
+color_rgb *s_titlebut_focused_color;
+color_rgb *s_titlebut_unfocused_color;
+/* style settings - fonts */
+int s_winfont_height;
+int s_winfont_shadow;
+int s_winfont_shadow_offset;
+ObFont *s_winfont;
+/* style settings - masks */
+pixmap_mask *s_max_mask;
+pixmap_mask *s_icon_mask;
+pixmap_mask *s_desk_mask;
+pixmap_mask *s_close_mask;
 
 /* global appearances */
 Appearance *a_focused_unpressed_max;
@@ -127,12 +142,16 @@ gboolean startup()
     g_quark_from_string("icon");
     g_quark_from_string("close");
 
-    s_b_color = s_cb_unfocused_color = s_cb_focused_color = NULL;
+    s_b_color = s_cb_unfocused_color = s_cb_focused_color = 
+        s_title_unfocused_color = s_title_focused_color = 
+        s_titlebut_unfocused_color = s_titlebut_focused_color = NULL;
+    s_winfont = NULL;
+    s_max_mask = s_icon_mask = s_desk_mask = s_close_mask = NULL;
 
-    a_focused_unpressed_max = appearance_new(Surface_Planar, 0);//1);
-    a_focused_pressed_max = appearance_new(Surface_Planar, 0);//1);
-    a_unfocused_unpressed_max = appearance_new(Surface_Planar, 0);//1);
-    a_unfocused_pressed_max = appearance_new(Surface_Planar, 0);//1);
+    a_focused_unpressed_max = appearance_new(Surface_Planar, 1);
+    a_focused_pressed_max = appearance_new(Surface_Planar, 1);
+    a_unfocused_unpressed_max = appearance_new(Surface_Planar, 1);
+    a_unfocused_pressed_max = appearance_new(Surface_Planar, 1);
     a_focused_unpressed_close = NULL;
     a_focused_pressed_close = NULL;
     a_unfocused_unpressed_close = NULL;
@@ -149,8 +168,8 @@ 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);
@@ -163,6 +182,19 @@ void shutdown()
     if (s_b_color != NULL) color_free(s_b_color);
     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_title_unfocused_color != NULL) color_free(s_title_unfocused_color);
+    if (s_title_focused_color != NULL) color_free(s_title_focused_color);
+    if (s_titlebut_unfocused_color != NULL)
+        color_free(s_titlebut_unfocused_color);
+    if (s_titlebut_focused_color != NULL)
+        color_free(s_titlebut_focused_color);
+
+    if (s_max_mask != NULL) pixmap_mask_free(s_max_mask);
+    if (s_desk_mask != NULL) pixmap_mask_free(s_desk_mask);
+    if (s_icon_mask != NULL) pixmap_mask_free(s_icon_mask);
+    if (s_close_mask != NULL) pixmap_mask_free(s_close_mask);
+
+    if (s_winfont != NULL) font_close(s_winfont);
 
     appearance_free(a_focused_unpressed_max);
     appearance_free(a_focused_pressed_max);
@@ -602,7 +634,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;
@@ -724,13 +757,17 @@ static void render(ObFrame *self)
 
 static void render_label(ObFrame *self)
 {
+    Appearance *a;
+
     if (self->label_x < 0) return;
 
-    /* XXX set the texture's text! */
-    paint(self->label, (self->frame.client->focused ?
-                       self->a_focused_label :
-                       self->a_unfocused_label),
-         self->label_width, LABEL_HEIGHT);
+    a = (self->frame.client->focused ?
+         self->a_focused_label : self->a_focused_label);
+
+    /* set the texture's text! */
+    a->texture[0].data.text.string = self->frame.client->title;
+
+    paint(self->label, a, self->label_width, LABEL_HEIGHT);
 }
 
 static void render_icon(ObFrame *self)
This page took 0.026548 seconds and 4 git commands to generate.