summaryrefslogtreecommitdiff
path: root/src/bar.c
diff options
context:
space:
mode:
authorsabetts <sabetts>2002-02-01 09:17:35 +0000
committersabetts <sabetts>2002-02-01 09:17:35 +0000
commit5ca712fc606b1839de5bcbe80833fa9d3a17332d (patch)
treea7daabf975a14649cbbaf4f054508b7ab59cd657 /src/bar.c
parent7457d9f3ac419123239f0e02fbcdfd0db1013138 (diff)
downloadratpoison-5ca712fc606b1839de5bcbe80833fa9d3a17332d.zip
* src/actions.c (command): bail out if alias recursion gets too deep.
* src/conf.h (MAX_ALIAS_RECURSIVE_DEPTH): new define * src/bar.c (bar_x): update to work with all X11 gravity values. (bar_y): likewise * src/actions.c (cmd_defbargravity): Rename from cmd_defbarloc. Dependant code updated. (cmd_defbargravity): accept all gravity arguments.
Diffstat (limited to 'src/bar.c')
-rw-r--r--src/bar.c56
1 files changed, 46 insertions, 10 deletions
diff --git a/src/bar.c b/src/bar.c
index 44aeac9..617eee2 100644
--- a/src/bar.c
+++ b/src/bar.c
@@ -82,21 +82,57 @@ show_bar (screen_info *s)
int
bar_x (screen_info *s, int width)
{
- if (defaults.bar_location == SouthEastGravity
- || defaults.bar_location == NorthEastGravity)
- return s->root_attr.width - width - defaults.bar_border_width * 2;
- else
- return 0;
+ int x = 0;
+
+ switch (defaults.bar_location)
+ {
+ case NorthWestGravity:
+ case WestGravity:
+ case SouthWestGravity:
+ x = 0;
+ break;
+ case NorthGravity:
+ case CenterGravity:
+ case SouthGravity:
+ x = (s->root_attr.width - width - defaults.bar_border_width * 2) / 2;
+ break;
+ case NorthEastGravity:
+ case EastGravity:
+ case SouthEastGravity:
+ x = s->root_attr.width - width - defaults.bar_border_width * 2;
+ break;
+ }
+
+ return x;
}
int
bar_y (screen_info *s)
{
- if (defaults.bar_location == NorthWestGravity
- || defaults.bar_location == NorthEastGravity )
- return 0;
- else
- return s->root_attr.height - (FONT_HEIGHT (defaults.font) + defaults.bar_y_padding * 2) - defaults.bar_border_width * 2;
+ int y = 0;
+
+ switch (defaults.bar_location)
+ {
+ case NorthEastGravity:
+ case NorthGravity:
+ case NorthWestGravity:
+ y = 0;
+ break;
+ case EastGravity:
+ case CenterGravity:
+ case WestGravity:
+ y = (s->root_attr.height - (FONT_HEIGHT (defaults.font) + defaults.bar_y_padding * 2)
+ - defaults.bar_border_width * 2) / 2;
+ break;
+ case SouthEastGravity:
+ case SouthGravity:
+ case SouthWestGravity:
+ y = (s->root_attr.height - (FONT_HEIGHT (defaults.font) + defaults.bar_y_padding * 2)
+ - defaults.bar_border_width * 2);
+ break;
+ }
+
+ return y;
}
void