load the theme based on _OB_THEME, but it doesnt use it yet. also the function gets...
authorDana Jansens <danakj@orodu.net>
Sun, 10 Jun 2007 03:37:59 +0000 (03:37 +0000)
committerDana Jansens <danakj@orodu.net>
Sun, 10 Jun 2007 03:37:59 +0000 (03:37 +0000)
gui.c
gui.h
rspanel.c
rspanel.h
xprop.c
xprop.h

diff --git a/gui.c b/gui.c
index 7f6759d..3e13889 100644 (file)
--- a/gui.c
+++ b/gui.c
@@ -40,12 +40,29 @@ static void set_icon_geometry(screen *sc, taskbar *tb, task *tk);
 void gui_init(screen *sc)
 {
     XGCValues gcv;
-    RrFont *font;
-    RrAppearance *with;
     
     gcv.graphics_exposures = False;
     sc->fore_gc = XCreateGC(sc->dd, sc->root, GCGraphicsExposures, &gcv);
 
+    gui_load_theme(sc);
+}
+
+void gui_load_theme(screen *sc)
+{
+    RrFont *font;
+    RrAppearance *with;
+    char *name;
+    static int loaded = 0;
+
+    printf("loading theme\n");
+
+    if (loaded) return; /* only run this once for now */
+    loaded = 1;
+
+    name = xprop_get_utf8(sc, sc->root, _OB_THEME);
+    RrThemeFree(sc->theme);
+    sc->theme = RrThemeNew(sc->rr, name, TRUE, NULL, NULL, NULL, NULL, NULL);
+
     /* We don't allow different fonts for various window states... */
     font = RrFontOpen(sc->rr, "Candara, sans", 10,
                       RR_FONTWEIGHT_NORMAL, RR_FONTSLANT_NORMAL);
@@ -116,6 +133,8 @@ void gui_init(screen *sc)
     shaded_text = RrAppearanceCopy(normal_text);
     USE(shaded_text);
     TEXT(color) = RrColorNew(sc->rr, 50, 60, 90);
+
+    XFree(name);
 }
 
 void gui_create_taskbar(screen *sc, taskbar *tb)
diff --git a/gui.h b/gui.h
index 82e54a0..66e7cdd 100644 (file)
--- a/gui.h
+++ b/gui.h
@@ -9,6 +9,7 @@ struct task;
 #include <openbox/render.h>
 
 void gui_init(struct screen *sc);
+void gui_load_theme(struct screen *sc);
 
 void gui_create_taskbar(struct screen *sc, struct taskbar *tb);
 
index 5710510..636d3c1 100644 (file)
--- a/rspanel.c
+++ b/rspanel.c
@@ -500,6 +500,9 @@ static void handle_propertynotify(Window win, Atom at)
             taskbar_read_clientlist();
             gui_draw_taskbar(&sc, &tb);
         }
+
+        if (at == sc.atoms[_OB_THEME])
+            gui_load_theme(&sc);
         return;
     }
 
@@ -570,6 +573,8 @@ main(int argc, char *argv[])
         return 0;
     xfd = ConnectionNumber(sc.dd);
 
+    parse_paths_startup();
+
     sc.num = DefaultScreen(sc.dd);
     sc.height = DisplayHeight(sc.dd, sc.num);
     sc.width = DisplayWidth(sc.dd, sc.num);
@@ -616,8 +621,10 @@ main(int argc, char *argv[])
         }
     }
     /* RrInstanceFree(inst);
+     * parse_paths_shutdown();
      * XCloseDisplay (dd);
 
        return 0; */
+
 }
 
index 3c01b08..611c1dc 100644 (file)
--- a/rspanel.h
+++ b/rspanel.h
@@ -5,6 +5,7 @@
 
 #include <X11/Xlib.h>
 #include <openbox/render.h>
+#include <openbox/theme.h>
 
 struct icon;
 
diff --git a/xprop.c b/xprop.c
index 5ad82f3..3b1408c 100644 (file)
--- a/xprop.c
+++ b/xprop.c
@@ -42,6 +42,7 @@ char *xprop_names[] = {
     "_NET_ACTIVE_WINDOW",
     "_NET_RESTACK_WINDOW",
     "_OB_FOCUS",
+    "_OB_THEME"
 };
 
 void xprop_init(screen *sc)
diff --git a/xprop.h b/xprop.h
index a58e756..0963ae9 100644 (file)
--- a/xprop.h
+++ b/xprop.h
@@ -49,6 +49,7 @@ _NET_WM_WINDOW_TYPE_NORMAL,
     _NET_ACTIVE_WINDOW,
     _NET_RESTACK_WINDOW,
     _OB_FOCUS,
+    _OB_THEME,
     XPROP_COUNT,
 } xprop_t;