]> Dogcows Code - chaz/openbox/commitdiff
pixmap button masks work (hardcoded)
authorDana Jansens <danakj@orodu.net>
Mon, 17 Mar 2003 01:15:17 +0000 (01:15 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 17 Mar 2003 01:15:17 +0000 (01:15 +0000)
engines/openbox/openbox.c
engines/openbox/openbox.h
engines/openbox/theme.c
openbox/themerc.c
otk/renderstyle.cc

index 75dc32679c43498c9ee9f89736719744846b42ed..184262ec25f88e30e165f7e2020edef7db0ae614 100644 (file)
@@ -7,6 +7,7 @@
 #include "../../render/render.h"
 #include "../../render/color.h"
 #include "../../render/font.h"
+#include "../../render/mask.h"
 
 #include <X11/Xlib.h>
 #include <glib.h>
@@ -33,11 +34,18 @@ 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;
@@ -135,13 +143,15 @@ gboolean startup()
     g_quark_from_string("close");
 
     s_b_color = s_cb_unfocused_color = s_cb_focused_color = 
-        s_title_unfocused_color = s_title_focused_color = NULL;
+        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;
@@ -174,6 +184,15 @@ void shutdown()
     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);
 
index 3a3b1904414bb607ffea747f4d0b60c869858b9e..5e9b981828b68542c0d74125b892dd76ad4ab53c 100644 (file)
@@ -4,6 +4,7 @@
 #include "../../render/render.h"
 #include "../../render/color.h"
 #include "../../render/font.h"
+#include "../../render/mask.h"
 
 extern int s_bevel;
 extern int s_handle_height;
@@ -15,12 +16,19 @@ 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 color_rgb *s_titlebut_focused_color;
+extern color_rgb *s_titlebut_unfocused_color;
 
 extern int s_winfont_height;
 extern int s_winfont_shadow;
 extern int s_winfont_shadow_offset;
 extern ObFont *s_winfont;
 
+extern pixmap_mask *s_max_mask;
+extern pixmap_mask *s_icon_mask;
+extern pixmap_mask *s_desk_mask;
+extern pixmap_mask *s_close_mask;
+
 extern Appearance *a_focused_unpressed_max;
 extern Appearance *a_focused_pressed_max;
 extern Appearance *a_unfocused_unpressed_max;
index 18a04e8f049e90b0445f257a5e4a6506883d9c8a..2165ccca9793eb12385161ca8d905d1078ef77e8 100644 (file)
@@ -123,6 +123,21 @@ gboolean read_color(XrmDatabase db, char *rname, color_rgb **value)
     return ret;
 }
 
+gboolean read_mask(XrmDatabase db, char *rname, pixmap_mask **value)
+{
+    gboolean ret = FALSE;
+    char *rclass = create_class_name(rname);
+    char *rettype;
+    XrmValue retvalue;
+  
+    if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
+       retvalue.addr != NULL) {
+    }
+
+    g_free(rclass);
+    return ret;
+}
+
 static void parse_appearance(char *tex, SurfaceColorType *grad,
                          ReliefType *relief, BevelType *bevel,
                          gboolean *interlaced, gboolean *border)
@@ -278,6 +293,29 @@ gboolean load()
     if (!read_color(db, "window.label.unfocus.textColor",
                     &s_title_unfocused_color))
        s_title_unfocused_color = color_new(0xff, 0xff, 0xff);
+    if (!read_color(db, "window.button.focus.picColor",
+                    &s_titlebut_focused_color))
+       s_titlebut_focused_color = color_new(0, 0, 0);
+    if (!read_color(db, "window.button.unfocus.picColor",
+                    &s_titlebut_unfocused_color))
+       s_titlebut_unfocused_color = color_new(0xff, 0xff, 0xff);
+
+    if (!read_mask(db, "window.button.max.mask", &s_max_mask)) {
+        char data []  = { 0x7c, 0x44, 0x47, 0x47, 0x7f, 0x1f, 0x1f  };
+        s_max_mask = pixmap_mask_new(7, 7, data);
+    }
+    if (!read_mask(db, "window.button.icon.mask", &s_icon_mask)) {
+        char data[] = { 0x00, 0x00, 0x00, 0x00, 0x3e, 0x3e, 0x3e };
+        s_icon_mask = pixmap_mask_new(7, 7, data);
+    }
+    if (!read_mask(db, "window.button.stick.mask", &s_desk_mask)) {
+        char data[] = { 0x00, 0x36, 0x36, 0x00, 0x36, 0x36, 0x00 };
+        s_desk_mask = pixmap_mask_new(7, 7, data);
+    }
+    if (!read_mask(db, "window.button.close.mask", &s_close_mask)) {
+        char data[] = { 0x22, 0x77, 0x3e, 0x1c, 0x3e, 0x77, 0x22 };
+        s_close_mask = pixmap_mask_new(7, 7, data);
+    }        
 
     if (!read_appearance(db, "window.title.focus", a_focused_title))
        set_default_appearance(a_focused_title);
@@ -328,8 +366,6 @@ gboolean load()
 
     a_icon->surface.data.planar.grad = Background_ParentRelative;
 
-    /* XXX load the button masks */
-
     /* set up the textures */
     a_focused_label->texture[0].type = Text;
     a_focused_label->texture[0].data.text.font = s_winfont;
@@ -343,6 +379,57 @@ gboolean load()
     a_unfocused_label->texture[0].data.text.offset = s_winfont_shadow_offset;
     a_unfocused_label->texture[0].data.text.color = s_title_unfocused_color;
 
+    a_focused_unpressed_max->texture[0].type = 
+        a_focused_pressed_max->texture[0].type = 
+        a_unfocused_unpressed_max->texture[0].type = 
+        a_unfocused_pressed_max->texture[0].type = 
+        a_focused_unpressed_close->texture[0].type = 
+        a_focused_pressed_close->texture[0].type = 
+        a_unfocused_unpressed_close->texture[0].type = 
+        a_unfocused_pressed_close->texture[0].type = 
+        a_focused_unpressed_desk->texture[0].type = 
+        a_focused_pressed_desk->texture[0].type = 
+        a_unfocused_unpressed_desk->texture[0].type = 
+        a_unfocused_pressed_desk->texture[0].type = 
+        a_focused_unpressed_iconify->texture[0].type = 
+        a_focused_pressed_iconify->texture[0].type = 
+        a_unfocused_unpressed_iconify->texture[0].type = 
+        a_unfocused_pressed_iconify->texture[0].type = Bitmask;
+    a_focused_unpressed_max->texture[0].data.mask.mask = 
+        a_focused_pressed_max->texture[0].data.mask.mask = 
+        a_unfocused_unpressed_max->texture[0].data.mask.mask = 
+        a_unfocused_pressed_max->texture[0].data.mask.mask = s_max_mask;
+    a_focused_unpressed_close->texture[0].data.mask.mask = 
+        a_focused_pressed_close->texture[0].data.mask.mask = 
+        a_unfocused_unpressed_close->texture[0].data.mask.mask = 
+        a_unfocused_pressed_close->texture[0].data.mask.mask = s_close_mask;
+    a_focused_unpressed_desk->texture[0].data.mask.mask = 
+        a_focused_pressed_desk->texture[0].data.mask.mask = 
+        a_unfocused_unpressed_desk->texture[0].data.mask.mask = 
+        a_unfocused_pressed_desk->texture[0].data.mask.mask = s_desk_mask;
+    a_focused_unpressed_iconify->texture[0].data.mask.mask = 
+        a_focused_pressed_iconify->texture[0].data.mask.mask = 
+        a_unfocused_unpressed_iconify->texture[0].data.mask.mask = 
+        a_unfocused_pressed_iconify->texture[0].data.mask.mask = s_icon_mask;
+    a_focused_unpressed_max->texture[0].data.mask.color = 
+        a_focused_pressed_max->texture[0].data.mask.color = 
+        a_focused_unpressed_close->texture[0].data.mask.color = 
+        a_focused_pressed_close->texture[0].data.mask.color = 
+        a_focused_unpressed_desk->texture[0].data.mask.color = 
+        a_focused_pressed_desk->texture[0].data.mask.color = 
+        a_focused_unpressed_iconify->texture[0].data.mask.color = 
+        a_focused_pressed_iconify->texture[0].data.mask.color =
+        s_titlebut_focused_color;
+    a_unfocused_unpressed_max->texture[0].data.mask.color = 
+        a_unfocused_pressed_max->texture[0].data.mask.color = 
+        a_unfocused_unpressed_close->texture[0].data.mask.color = 
+        a_unfocused_pressed_close->texture[0].data.mask.color = 
+        a_unfocused_unpressed_desk->texture[0].data.mask.color = 
+        a_unfocused_pressed_desk->texture[0].data.mask.color = 
+        a_unfocused_unpressed_iconify->texture[0].data.mask.color = 
+        a_unfocused_pressed_iconify->texture[0].data.mask.color =
+        s_titlebut_unfocused_color;
+
     XrmDestroyDatabase(db);
     return TRUE;
 }
index 7f587afe9ebf56dbb93bee7767996b8c18e0495a..b79fc6e16e1b659d9a1ecc971a7aa7a706897108 100644 (file)
@@ -144,7 +144,7 @@ void themerc_startup()
     if (themerc_titlebar_layout == NULL)
        themerc_titlebar_layout = g_strdup("NDLIMC");
     if (themerc_font == NULL)
-       themerc_font = g_strdup("sans-8");
+       themerc_font = g_strdup("sans-7");
 }
 
 void themerc_shutdown()
index 4b3bc1bd75a9cf23ed6bcbc283213c114015735f..482f33034c1222e679bfd92c028737c026a8db7c 100644 (file)
@@ -455,7 +455,7 @@ bool RenderStyle::loadStyle(RenderStyle *s, int screen,
   s->_icon_mask = new PixmapMask();
   s->_icon_mask->w = s->_icon_mask->h = 7;
   {
-    char data[] = {0x00, 0x00, 0x00, 0x00, 0x3e, 0x3e, 0x3e };
+    char data[] = { 0x00, 0x00, 0x00, 0x00, 0x3e, 0x3e, 0x3e };
     s->_icon_mask->mask =
       XCreateBitmapFromData(**display,
                             display->screenInfo(screen)->rootWindow(),
This page took 0.030651 seconds and 4 git commands to generate.