Martin Duquesnoy пре 12 година
родитељ
комит
5e34dcf916
6 измењених фајлова са 36 додато и 16 уклоњено
  1. 6 4
      wmfs2/src/client.c
  2. 18 7
      wmfs2/src/config.c
  3. 3 1
      wmfs2/src/config.h
  4. 0 2
      wmfs2/src/infobar.c
  5. 2 0
      wmfs2/src/infobar.h
  6. 7 2
      wmfs2/src/wmfs.h

+ 6 - 4
wmfs2/src/client.c

@@ -4,7 +4,9 @@
  */
 
 #include "client.h"
+#include "config.h"
 #include "util.h"
+#include "barwin.h"
 
 #define CLIENT_MOUSE_MOD Mod1Mask
 
@@ -97,7 +99,7 @@ client_focus(Client *c)
      /* Unfocus selected */
      if(W->client && W->client != c)
      {
-          XSetWindowBorder(W->dpy, W->client->win, 0xfF0000);
+          XSetWindowBorder(W->dpy, W->client->win, THEME_DEFAULT->client_n.bg);
 
           client_grabbuttons(W->client, false);
      }
@@ -107,7 +109,7 @@ client_focus(Client *c)
      {
           c->tag->sel = c;
 
-          XSetWindowBorder(W->dpy, c->win, 0xffffff);
+          XSetWindowBorder(W->dpy, c->win, THEME_DEFAULT->client_s.bg);
 
           client_grabbuttons(c, true);
 
@@ -202,8 +204,8 @@ client_new(Window w, XWindowAttributes *wa)
      /* X window attributes */
      XSelectInput(W->dpy, w, EnterWindowMask | FocusChangeMask | PropertyChangeMask | StructureNotifyMask);
 
-     XSetWindowBorder(W->dpy, w, 0xffffff);
-     XSetWindowBorderWidth(W->dpy, w, 1);
+     XSetWindowBorder(W->dpy, w, THEME_DEFAULT->client_n.bg);
+     XSetWindowBorderWidth(W->dpy, w, THEME_DEFAULT->client_border_width);
      client_grabbuttons(c, false);
 
      /* Attach */

+ 18 - 7
wmfs2/src/config.c

@@ -25,6 +25,7 @@ config_theme(void)
      sec = fetch_section_first(NULL, "themes");
      ks = fetch_section(sec, "theme");
 
+     /* No theme section? Make one with default value anyway. */
      if(!(n = fetch_section_count(ks)))
           ++n;
 
@@ -40,20 +41,30 @@ config_theme(void)
           wmfs_init_font(fetch_opt_first(ks[i], "fixed", "font").str, t);
 
           /* bars */
-          t->bars.fg = color_atoh(fetch_opt_first(ks[i], "#CCCCCC", "bars_fg").str);
-          t->bars.bg = color_atoh(fetch_opt_first(ks[i], "#222222", "bars_bg").str);
+          t->bars.fg    = color_atoh(fetch_opt_first(ks[i], "#CCCCCC", "bars_fg").str);
+          t->bars.bg    = color_atoh(fetch_opt_first(ks[i], "#222222", "bars_bg").str);
           t->bars_width = fetch_opt_first(ks[i], "12", "bars_width").num;
 
           /*
            * Elements
            */
-          t->tags_n.fg = color_atoh(fetch_opt_first(ks[i], "#CCCCCC", "tags_normal_fg").str);
-          t->tags_n.bg = color_atoh(fetch_opt_first(ks[i], "#222222", "tags_normal_bg").str);
-          t->tags_s.fg = color_atoh(fetch_opt_first(ks[i], "#222222", "tags_sel_fg").str);
-          t->tags_s.bg = color_atoh(fetch_opt_first(ks[i], "#CCCCCC", "tags_sel_bg").str);
-          t->tags_border_col = color_atoh(fetch_opt_first(ks[i], "#888888", "tags_border_color").str);
+          t->tags_n.fg         = color_atoh(fetch_opt_first(ks[i], "#CCCCCC", "tags_normal_fg").str);
+          t->tags_n.bg         = color_atoh(fetch_opt_first(ks[i], "#222222", "tags_normal_bg").str);
+          t->tags_s.fg         = color_atoh(fetch_opt_first(ks[i], "#222222", "tags_sel_fg").str);
+          t->tags_s.bg         = color_atoh(fetch_opt_first(ks[i], "#CCCCCC", "tags_sel_bg").str);
+          t->tags_border_col   = color_atoh(fetch_opt_first(ks[i], "#888888", "tags_border_color").str);
           t->tags_border_width = fetch_opt_first(ks[i], "0", "tags_border_width").num;
 
+          /* Client / Frame */
+          t->client_n.fg = color_atoh(fetch_opt_first(ks[i], "#CCCCCC", "client_normal_fg").str);
+          t->client_n.bg = color_atoh(fetch_opt_first(ks[i], "#222222", "client_normal_bg").str);
+          t->client_s.fg = color_atoh(fetch_opt_first(ks[i], "#222222", "client_sel_fg").str);
+          t->client_s.bg = color_atoh(fetch_opt_first(ks[i], "#CCCCCC", "client_sel_bg").str);
+          t->frame_bg    = color_atoh(fetch_opt_first(ks[i], "#555555", "frame_bg").str);
+          t->client_titlebar_width = fetch_opt_first(ks[i], "12", "client_titlebar_width").num;
+          t->client_border_width   = fetch_opt_first(ks[i], "1", "client_border_width").num;
+
+
           SLIST_INSERT_HEAD(&W->h.theme, t, next);
      }
 

+ 3 - 1
wmfs2/src/config.h

@@ -14,6 +14,8 @@
 #include "util.h"
 #include "tag.h"
 
+#define THEME_DEFAULT (SLIST_FIRST(&W->h.theme))
+
 static const struct { char *name; void (*func)(Uicb cmd); } uicb_list[] =
 {
      /* Sys */
@@ -78,7 +80,7 @@ name_to_theme(const char *name)
           if(!strcmp(t->name, name))
                return t;
 
-     return SLIST_FIRST(&W->h.theme);
+     return THEME_DEFAULT;
 }
 
 

+ 0 - 2
wmfs2/src/infobar.c

@@ -109,8 +109,6 @@ infobar_elem_tag_update(Element *e)
 
           barwin_refresh(b);
      }
-
-     e->infobar->screen->elemupdate &= ~FLAGINT(ElemTag);
 }
 
 static void

+ 2 - 0
wmfs2/src/infobar.h

@@ -64,6 +64,8 @@ infobar_elem_screen_update(Scr33n *s, int addf)
 
      SLIST_FOREACH(i, &s->infobars, next)
           infobar_elem_update(i);
+
+     s->elemupdate &= ~FLAGINT(ElemTag);
 }
 
 #endif /* INFOBAR_H */

+ 7 - 2
wmfs2/src/wmfs.h

@@ -185,11 +185,16 @@ struct Theme
      int bars_width;
 
      /* Elements */
-     struct Colpair tags_n; /* normal */
-     struct Colpair tags_s; /* selected */
+     struct Colpair tags_n, tags_s; /* normal / selected */
      int tags_border_width;
      Color tags_border_col;
 
+     /* Client / Frame */
+     struct Colpair client_n, client_s;
+     Color frame_bg;
+     int client_titlebar_width;
+     int client_border_width;
+
      SLIST_ENTRY(Theme) next;
 };