add taglayouts in jdwmconf as tag_layouts

This commit is contained in:
Julien Danjou 2007-09-06 21:53:45 +02:00
parent 9f9757e1b4
commit 274f1270e6
5 changed files with 31 additions and 33 deletions

View File

@ -153,6 +153,7 @@ uicb_reload(Display *disp, jdwm_config *jdwmconf, const char *arg __attribute__
p_delete(&jdwmconf->tags);
p_delete(&jdwmconf->selected_tags);
p_delete(&jdwmconf->layouts);
p_delete(&jdwmconf->tag_layouts);
parse_config(disp, screen, &dc, jdwmconf);
}
@ -192,28 +193,6 @@ parse_config(Display * disp, int scr, DC * drawcontext, jdwm_config *jdwmconf)
eprint("error parsing configuration file at line %d: %s\n",
config_error_line(&jdwmlibconf), config_error_text(&jdwmlibconf));
/* tags */
conftags = config_lookup(&jdwmlibconf, "jdwm.tags");
if(!conftags)
eprint("tags not found in configuration file\n");
jdwmconf->ntags = config_setting_length(conftags);
jdwmconf->tags = p_new(const char *, jdwmconf->ntags);
jdwmconf->selected_tags = p_new(Bool, jdwmconf->ntags);
jdwmconf->prev_selected_tags = p_new(Bool, jdwmconf->ntags);
for(i = 0; (tmp = config_setting_get_string_elem(conftags, i)); i++)
{
jdwmconf->tags[i] = tmp;
jdwmconf->selected_tags[i] = False;
jdwmconf->prev_selected_tags[i] = False;
}
/* select first tag by default */
jdwmconf->selected_tags[0] = True;
jdwmconf->prev_selected_tags[0] = True;
/* layouts */
conflayouts = config_lookup(&jdwmlibconf, "jdwm.layouts");
@ -228,13 +207,38 @@ parse_config(Display * disp, int scr, DC * drawcontext, jdwm_config *jdwmconf)
jdwmconf->layouts[i].arrange =
name_func_lookup(config_setting_get_string_elem(confsublayouts, 1), LayoutsList);
if(!jdwmconf->layouts[i].arrange)
eprint("unknown layout in configuration file: %s", tmp);
eprint("unknown layout in configuration file\n");
}
jdwmconf->layouts[i].symbol = NULL;
jdwmconf->layouts[i].arrange = NULL;
/** \todo put this in set_default_layout */
jdwmconf->current_layout = jdwmconf->layouts;
/* tags */
conftags = config_lookup(&jdwmlibconf, "jdwm.tags");
if(!conftags)
eprint("tags not found in configuration file\n");
jdwmconf->ntags = config_setting_length(conftags);
jdwmconf->tags = p_new(const char *, jdwmconf->ntags);
jdwmconf->selected_tags = p_new(Bool, jdwmconf->ntags);
jdwmconf->prev_selected_tags = p_new(Bool, jdwmconf->ntags);
jdwmconf->tag_layouts = p_new(Layout *, jdwmconf->ntags);
for(i = 0; (tmp = config_setting_get_string_elem(conftags, i)); i++)
{
jdwmconf->tags[i] = tmp;
jdwmconf->selected_tags[i] = False;
jdwmconf->prev_selected_tags[i] = False;
/** \todo add support for default tag/layout in configuration file */
jdwmconf->tag_layouts[i] = jdwmconf->layouts;
}
/* select first tag by default */
jdwmconf->selected_tags[0] = True;
jdwmconf->prev_selected_tags[0] = True;
/* rules */
confrules = config_lookup(&jdwmlibconf, "jdwm.rules");

View File

@ -69,6 +69,8 @@ struct jdwm_config
Layout *layouts;
/** Number of layouts in *layouts */
int nlayouts;
/** Store layout for eatch tag */
Layout **tag_layouts;
/** Rules list */
Rule *rules;
/** Number of rules in *rules */

2
jdwm.c
View File

@ -32,7 +32,6 @@ Client *stack = NULL;
Cursor cursor[CurLast];
DC dc;
Window barwin;
Layout ** taglayouts;
/* static */
@ -97,7 +96,6 @@ cleanup(Display *disp, jdwm_config *jdwmconf)
XFreeCursor(disp, cursor[CurMove]);
XSetInputFocus(disp, PointerRoot, RevertToPointerRoot, CurrentTime);
XSync(disp, False);
p_delete(&taglayouts);
}
static long

View File

@ -18,7 +18,6 @@ int blw = 0;
static char prop[128];
/* extern */
extern Layout ** taglayouts;
extern int wax, way, wah, waw; /* windowarea geometry */
extern Window barwin;
extern Client *clients, *sel; /* global client list */
@ -92,10 +91,6 @@ initlayouts(jdwm_config * jdwmconf)
if(w > blw)
blw = w;
}
taglayouts = p_new(Layout *, jdwmconf->ntags);
for(i = 0; i < jdwmconf->ntags; i++)
taglayouts[i] = jdwmconf->layouts;
}
void
@ -192,7 +187,7 @@ uicb_setlayout(Display *disp, jdwm_config * jdwmconf, const char *arg)
for(j = 0; j < jdwmconf->ntags; j++)
if (jdwmconf->selected_tags[j])
taglayouts[j] = jdwmconf->current_layout;
jdwmconf->tag_layouts[j] = jdwmconf->current_layout;
}
void

3
tag.c
View File

@ -10,7 +10,6 @@
#include "tag.h"
extern Client *sel; /* global client list */
extern Layout ** taglayouts;
static Regs *regs = NULL;
static char prop[512];
@ -233,7 +232,7 @@ uicb_view(Display *disp,
if(i >= 0 && i < jdwmconf->ntags)
{
jdwmconf->selected_tags[i] = True;
jdwmconf->current_layout = taglayouts[i];
jdwmconf->current_layout = jdwmconf->tag_layouts[i];
}
savejdwmprops(disp, jdwmconf);
arrange(disp, jdwmconf);