Config/Client: Remove deprecated code, fix bug with nclients
This commit is contained in:
parent
7839889071
commit
d2f3377f97
54
src/client.c
54
src/client.c
@ -685,7 +685,7 @@ static void
|
||||
client_set_rules(Client *c)
|
||||
{
|
||||
XClassHint xch;
|
||||
int i, j, k, f;
|
||||
int i, f;
|
||||
Atom rf;
|
||||
ulong n, il;
|
||||
uchar *data = NULL;
|
||||
@ -712,53 +712,14 @@ client_set_rules(Client *c)
|
||||
XFree(data);
|
||||
}
|
||||
|
||||
/* Following features is *DEPRECATED*, will be removed in some revision. {{{ */
|
||||
|
||||
/* Auto free */
|
||||
if(conf.client.autofree && ((xch.res_name && strstr(conf.client.autofree, xch.res_name))
|
||||
|| (xch.res_class && strstr(conf.client.autofree, xch.res_class))))
|
||||
c->flags |= FreeFlag;
|
||||
|
||||
/* Auto maximize */
|
||||
if(conf.client.automax && ((xch.res_name && strstr(conf.client.automax, xch.res_name))
|
||||
|| (xch.res_class && strstr(conf.client.automax, xch.res_class))))
|
||||
{
|
||||
client_maximize(c);
|
||||
c->flags |= MaxFlag;
|
||||
}
|
||||
|
||||
/* Wanted tag */
|
||||
for(i = 0; i < screen_count(); ++i)
|
||||
for(j = 1; j < conf.ntag[i] + 1; ++j)
|
||||
if(tags[i][j].clients)
|
||||
for(k = 0; k < tags[i][j].nclients; ++k)
|
||||
if((xch.res_name && strstr(xch.res_name, tags[i][j].clients[k]))
|
||||
|| (xch.res_class && strstr(xch.res_class, tags[i][j].clients[k])))
|
||||
{
|
||||
c->screen = i;
|
||||
c->tag = j;
|
||||
|
||||
if(c->tag != (uint)seltag[selscreen])
|
||||
tags[c->screen][c->tag].request_update = True;
|
||||
else
|
||||
tags[c->screen][c->tag].layout.func(c->screen);
|
||||
|
||||
split_client_integrate(c, NULL, i, j);
|
||||
|
||||
/* Deprecated but still in use */
|
||||
applied_tag_rule = True;
|
||||
applied_screen_rule = True;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* Apply Rule if class || instance || role match */
|
||||
for(i = 0; i < conf.nrule; ++i)
|
||||
{
|
||||
if((xch.res_class && conf.rule[i].class && !strcmp(xch.res_class, conf.rule[i].class))
|
||||
|| (xch.res_name && conf.rule[i].instance && !strcmp(xch.res_name, conf.rule[i].instance)))
|
||||
{
|
||||
if((strlen(wwrole) && conf.rule[i].role && !strcmp(wwrole, conf.rule[i].role)) || (!strlen(wwrole) || !conf.rule[i].role))
|
||||
if((strlen(wwrole) && conf.rule[i].role && !strcmp(wwrole, conf.rule[i].role))
|
||||
|| (!strlen(wwrole) || !conf.rule[i].role))
|
||||
{
|
||||
if(conf.rule[i].screen != -1)
|
||||
c->screen = conf.rule[i].screen;
|
||||
@ -777,8 +738,8 @@ client_set_rules(Client *c)
|
||||
|
||||
if(conf.rule[i].max)
|
||||
{
|
||||
client_maximize(c);
|
||||
c->flags |= MaxFlag;
|
||||
client_maximize(c);
|
||||
}
|
||||
|
||||
if(c->tag != (uint)seltag[selscreen])
|
||||
@ -910,15 +871,16 @@ client_manage(Window w, XWindowAttributes *wa, Bool ar)
|
||||
|
||||
/* Handle client from here */
|
||||
client_attach(c);
|
||||
client_set_rules(c);
|
||||
client_get_name(c);
|
||||
|
||||
tags[c->screen][c->tag].cleanfact = True;
|
||||
client_update_attributes(c);
|
||||
|
||||
client_set_rules(c);
|
||||
|
||||
/* Case of split layout */
|
||||
split_client_integrate(c, sel, c->screen, c->tag);
|
||||
|
||||
client_update_attributes(c);
|
||||
|
||||
/* If client will be visible soon so.. */
|
||||
if(c->tag == (uint)seltag[selscreen])
|
||||
{
|
||||
|
||||
24
src/config.c
24
src/config.c
@ -490,11 +490,10 @@ conf_layout_section(void)
|
||||
static void
|
||||
conf_tag_section(void)
|
||||
{
|
||||
int i, j, k, l = 0, m, n, sc, count, bar_pos;
|
||||
int i, j, k, l = 0, n, sc, bar_pos;
|
||||
char *tmp;
|
||||
char *position;
|
||||
struct conf_sec *sec, *def_tag, **tag, **mouse;
|
||||
struct opt_type *opt;
|
||||
|
||||
sec = fetch_section_first(NULL, "tags");
|
||||
|
||||
@ -533,7 +532,7 @@ conf_tag_section(void)
|
||||
fetch_opt_first(def_tag, "1", "nmaster").num,
|
||||
False, fetch_opt_first(def_tag, "False", "resizehint").bool,
|
||||
False, False, False, bar_pos, bar_pos,
|
||||
layout_name_to_struct(conf.layout, fetch_opt_first(def_tag, "tile_right", "layout").str, conf.nlayout, layout_list),
|
||||
layout_name_to_struct(conf.layout, fetch_opt_first(def_tag, "tile", "layout").str, conf.nlayout, layout_list),
|
||||
0, NULL, 0, False };
|
||||
|
||||
conf.default_tag = default_tag;
|
||||
@ -596,22 +595,9 @@ conf_tag_section(void)
|
||||
tags[k][conf.ntag[k]].barpos = IB_Top;
|
||||
|
||||
tags[k][conf.ntag[k]].layout = layout_name_to_struct(conf.layout,
|
||||
fetch_opt_first(tag[i], fetch_opt_first(def_tag, "title_right", "layout").str, "layout").str,
|
||||
conf.nlayout,
|
||||
layout_list);
|
||||
|
||||
/* Clients list */
|
||||
opt = fetch_opt(tag[i], "", "clients");
|
||||
|
||||
if ((count = fetch_opt_count(opt)))
|
||||
{
|
||||
tags[k][conf.ntag[k]].nclients = count;
|
||||
tags[k][conf.ntag[k]].clients = xcalloc(count, sizeof(char *));
|
||||
for(m = 0; m < count; ++m)
|
||||
tags[k][conf.ntag[k]].clients[m] = opt[m].str;
|
||||
}
|
||||
|
||||
free(opt);
|
||||
fetch_opt_first(tag[i], fetch_opt_first(def_tag, "tile", "layout").str, "layout").str,
|
||||
conf.nlayout,
|
||||
layout_list);
|
||||
|
||||
/* Multi mouse sections */
|
||||
mouse = fetch_section(tag[i], "mouse");
|
||||
|
||||
@ -245,14 +245,12 @@ void
|
||||
split(int screen)
|
||||
{
|
||||
Client *c;
|
||||
unsigned int n, on;
|
||||
|
||||
on = tags[screen][seltag[screen]].nclients;
|
||||
unsigned int n;
|
||||
|
||||
for(n = 0, c = tiled_client(screen, clients); c; c = tiled_client(screen, c->next), ++n);
|
||||
CHECK((tags[screen][seltag[screen]].nclients = n));
|
||||
|
||||
if((c = tiled_client(screen, clients)) && n == 1)
|
||||
if(n == 1 && (c = tiled_client(screen, clients)))
|
||||
client_maximize(c);
|
||||
|
||||
for(c = tiled_client(screen, clients); c; c = tiled_client(screen, c->next))
|
||||
|
||||
7
wmfsrc
7
wmfsrc
@ -80,6 +80,7 @@
|
||||
# layout_button_width = x
|
||||
|
||||
# Tiling layouts.
|
||||
[layout] type = "split" symbol = "SPLI7" [/layout]
|
||||
[layout] type = "tile_right" symbol = "RIGHT" [/layout]
|
||||
[layout] type = "tile_left" symbol = "LEFT" [/layout]
|
||||
[layout] type = "tile_top" symbol = "TOP" [/layout]
|
||||
@ -88,7 +89,7 @@
|
||||
[layout] type = "tile_grid_vertical" symbol = "GRID_V" [/layout]
|
||||
[layout] type = "mirror_vertical" symbol = "MIRROR_V" [/layout]
|
||||
[layout] type = "mirror_horizontal" symbol = "MIRROR_H" [/layout]
|
||||
[layout] type = "split" symbol = "$PLIT" [/layout]
|
||||
# [layout] type = "split" symbol = "$PLIT" [/layout]
|
||||
|
||||
# Other layouts.
|
||||
[layout] type = "max" symbol = "MAX" [/layout]
|
||||
@ -101,7 +102,7 @@
|
||||
name = "new tag"
|
||||
mwfact = 0.5
|
||||
nmaster = 1
|
||||
layout = "tile_right"
|
||||
layout = "tile"
|
||||
resizehint = false
|
||||
infobar_position = "top"
|
||||
[/default_tag]
|
||||
@ -154,7 +155,7 @@
|
||||
[/tag]
|
||||
|
||||
# clients option is *DEPRECATED* but works, see [rules] section
|
||||
[tag] name = "two" clients = {"Browser"} [/tag]
|
||||
[tag] name = "two" [/tag]
|
||||
[tag] name = "three" [/tag]
|
||||
[tag] name = "four" [/tag]
|
||||
[tag] name = "five" [/tag]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user