aboutsummaryrefslogtreecommitdiffstats
path: root/draw.c
diff options
context:
space:
mode:
authorgotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2>2007-05-16 14:32:48 +0000
committergotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2>2007-05-16 14:32:48 +0000
commit69f1775e563c2caf3f05071a0fee87b240fc0c07 (patch)
treed0f9364cf13a761e25d681fc765bc7e78b6a80d4 /draw.c
parentaddd0c2984fd77a6eacce8f7e9f5eb051983eba1 (diff)
downloaddzen-69f1775e563c2caf3f05071a0fee87b240fc0c07.tar.gz
dzen-69f1775e563c2caf3f05071a0fee87b240fc0c07.zip
fixed alignment oddities
git-svn-id: http://dzen.googlecode.com/svn/trunk@26 f2baff5b-bf2c-0410-a398-912abdc3d8b2
Diffstat (limited to 'draw.c')
-rw-r--r--draw.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/draw.c b/draw.c
index 6efea32..274dcea 100644
--- a/draw.c
+++ b/draw.c
@@ -18,7 +18,7 @@ textnw(const char *text, unsigned int len) {
return XTextWidth(dzen.font.xfont, text, len);
}
-void drawtext(const char *text, int reverse, int line, int aligne) {
+void drawtext(const char *text, int reverse, int line, int align) {
int x, y, w, h;
static char buf[1024];
unsigned int len, olen;
@@ -28,14 +28,10 @@ void drawtext(const char *text, int reverse, int line, int aligne) {
mgc = reverse ? dzen.gc : dzen.rgc;
- /* title win */
- if(line == -1) {
+ if(line == -1)
XFillRectangles(dzen.dpy, dzen.title_win.drawable, mgc, &r, 1);
- }
- /* slave win */
- else {
+ else
XFillRectangles(dzen.dpy, dzen.slave_win.drawable, mgc, &r, 1);
- }
if(!text)
return;
@@ -60,17 +56,16 @@ void drawtext(const char *text, int reverse, int line, int aligne) {
}
if(line != -1) {
- x = h/2;
- if(!aligne)
- x = (dzen.w - textw(buf)+h)/2;
- else if(aligne == ALIGNELEFT)
+ if(align == ALIGNLEFT)
x = h/2;
+ else if(align == ALIGNCENTER)
+ x = (dzen.slave_win.width - textw(buf)+h)/2;
else
x = dzen.slave_win.width - textw(buf);
} else {
- if(!aligne)
+ if(!align)
x = (dzen.w - textw(buf)+h)/2;
- else if(aligne == ALIGNELEFT)
+ else if(align == ALIGNLEFT)
x = h/2;
else
x = dzen.title_win.width - textw(buf);
@@ -160,7 +155,7 @@ drawheader(char * text) {
dzen.h = dzen.mh;
if(text)
- drawtext(text, 0, -1, dzen.title_win.alignement);
+ drawtext(text, 0, -1, dzen.title_win.alignment);
XCopyArea(dzen.dpy, dzen.title_win.drawable, dzen.title_win.win,
dzen.gc, 0, 0, dzen.title_win.width, dzen.mh, 0, 0);
}