Rename Auto to Maybe in Fuzzy; add Auto as Position; add support for titlebar as rule

This commit is contained in:
Julien Danjou 2008-03-14 17:33:10 +01:00
parent 54c2170178
commit 8b217359e9
8 changed files with 58 additions and 49 deletions

View File

@ -347,8 +347,57 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
/* propagates border_width, if size doesn't change */
window_configure(c->win, c->geometry, c->border);
/* update window title */
client_updatetitle(c);
/* update hints */
flags = client_updatesizehints(c);
client_updatewmhints(c);
/* Try to load props if any */
retloadprops = client_loadprops(c, screen);
/* Then check clients hints */
ewmh_check_client_hints(c);
/* default titlebar position */
c->titlebar.position = globalconf.screens[screen].titlebar_default_position;
/* Then apply rules if no props */
if(!retloadprops)
{
/* Get the client's rule */
if((rule = rule_matching_client(c)))
{
if(rule->screen != RULE_NOSCREEN)
move_client_to_screen(c, rule->screen, True);
else
move_client_to_screen(c, screen, True);
tag_client_with_rule(c, rule);
switch(rule->isfloating)
{
case Maybe:
break;
case Yes:
client_setfloating(c, True);
break;
case No:
client_setfloating(c, False);
break;
}
if(rule->opacity >= 0.0f)
window_settrans(c->win, rule->opacity);
if(rule->titlebar != Auto)
c->titlebar.position = rule->titlebar;
}
else
move_client_to_screen(c, screen, True);
}
switch(c->titlebar.position)
{
case Top:
@ -366,49 +415,6 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
default:
break;
}
/* update window title */
client_updatetitle(c);
/* update hints */
flags = client_updatesizehints(c);
client_updatewmhints(c);
/* Try to load props if any */
retloadprops = client_loadprops(c, screen);
/* Then check clients hints */
ewmh_check_client_hints(c);
/* Then apply rules if no props */
if(!retloadprops)
{
/* Get the client's rule */
if((rule = rule_matching_client(c)))
{
if(rule->screen != RULE_NOSCREEN)
move_client_to_screen(c, rule->screen, True);
else
move_client_to_screen(c, screen, True);
tag_client_with_rule(c, rule);
switch(rule->isfloating)
{
case Auto:
break;
case Yes:
client_setfloating(c, True);
break;
case No:
client_setfloating(c, False);
break;
}
if(rule->opacity >= 0.0f)
window_settrans(c->win, rule->opacity);
}
else
move_client_to_screen(c, screen, True);
}
/* check for transient and set tags like its parent,
* XGetTransientForHint returns 1 on success
@ -446,7 +452,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
case No:
client_list_append(&globalconf.clients, c);
break;
case Auto:
case Maybe:
rule = NULL;
break;
}

View File

@ -280,6 +280,7 @@ cfg_opt_t rule_opts[] =
CFG_STR((char *) "icon", NULL, CFGF_NONE),
CFG_STR((char *) "float", (char *) "auto", CFGF_NONE),
CFG_STR((char *) "master", (char *) "auto", CFGF_NONE),
CFG_STR((char *) "titlebar", (char *) "auto", CFGF_NONE),
CFG_INT((char *) "screen", RULE_NOSCREEN, CFGF_NONE),
CFG_FLOAT((char *) "opacity", -1.0f, CFGF_NONE),
CFG_AWESOME_END()

View File

@ -526,6 +526,7 @@ config_parse(const char *confpatharg)
rule->isfloating = rules_get_fuzzy_from_str(cfg_getstr(cfgsectmp, "float"));
rule->screen = cfg_getint(cfgsectmp, "screen");
rule->ismaster = rules_get_fuzzy_from_str(cfg_getstr(cfgsectmp, "master"));
rule->titlebar = position_get_from_str(cfg_getstr(cfgsectmp, "titlebar"));
rule->opacity = cfg_getfloat(cfgsectmp, "opacity");
if(rule->screen >= globalconf.screens_info->nscreen)
rule->screen = 0;

View File

@ -117,7 +117,7 @@ event_handle_buttonpress(XEvent *e)
return;
}
break;
case Off:
default:
break;
}
/* return if no widget match */

View File

@ -115,7 +115,7 @@ rules_get_fuzzy_from_str(const char *str)
else if(!a_strcmp(str, "false") || !a_strcmp(str, "no"))
return No;
return Auto;
return Maybe;
}
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80

View File

@ -61,7 +61,7 @@ screen_get_area(int screen, Statusbar *statusbar, Padding *padding)
case Right:
area.width -= sb->height;
break;
case Off:
default:
break;
}

View File

@ -62,7 +62,7 @@ statusbar_update_position(Statusbar *statusbar)
case Right:
simplewindow_move(statusbar->sw, area.x + area.width, area.y);
break;
case Off:
default:
XUnmapWindow(globalconf.display, statusbar->sw->window);
break;
}

View File

@ -33,7 +33,7 @@ typedef enum
{
No = False,
Yes = True,
Auto
Maybe
} Fuzzy;
/** Cursors */
@ -49,6 +49,7 @@ struct Rule
int screen;
Fuzzy isfloating;
Fuzzy ismaster;
Position titlebar;
double opacity;
regex_t *prop_r;
regex_t *tags_r;