aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2>2008-01-13 16:09:04 +0000
committergotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2>2008-01-13 16:09:04 +0000
commit53e6f6bab32f2f775a6ed779adbb6edbc733c2d6 (patch)
tree8bda050546a251e9e11cb1c9a0c7301c8597509f
parentbf5146d67135ef33c07bbf49129cd003d68ea97e (diff)
downloaddzen-53e6f6bab32f2f775a6ed779adbb6edbc733c2d6.tar.gz
dzen-53e6f6bab32f2f775a6ed779adbb6edbc733c2d6.zip
more positioning fixes
git-svn-id: http://dzen.googlecode.com/svn/trunk@201 f2baff5b-bf2c-0410-a398-912abdc3d8b2
-rw-r--r--draw.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/draw.c b/draw.c
index ff5e388..8a840a6 100644
--- a/draw.c
+++ b/draw.c
@@ -289,7 +289,7 @@ get_pos_vals(char *s, int *d, int *a) {
if(i) {
buf[i]='\0';
*d=atoi(buf);
- ret=1;
+ //ret=1;
} else
ret=2;
@@ -298,19 +298,32 @@ get_pos_vals(char *s, int *d, int *a) {
} else
ret = 1;
+ //printf("s=<%s> x=%d, y=%d, ret=%d\n", s, *d, *a, ret);
return ret;
}
char *
parse_line(const char *line, int lnr, int align, int reverse, int nodraw) {
+ /* bitmaps */
unsigned int bm_w, bm_h;
int bm_xh, bm_yh;
+ /* rectangles, cirlcles*/
int rectw, recth, rectx, recty;
+ /* positioning */
int n_posx, n_posy, set_posy=0;
- int i, next_pos=0, j=0, px=0, py=0, xorig, h=0, tw, ow;
+ int px=0, py=0, xorig;
+ int i, next_pos=0, j=0, h=0, tw, ow;
+ /* fonts */
+ int font_was_set=0;
+
+ /* temp buffers */
char lbuf[MAX_LINE_LEN], *rbuf = NULL;
+
+ /* parser state */
int t=-1, nobg=0;
char *tval=NULL;
+
+ /* X stuff */
long lastfg = dzen.norm[ColFG], lastbg = dzen.norm[ColBG];
XGCValues gcv;
Drawable *pm, bm;
@@ -537,7 +550,8 @@ parse_line(const char *line, int lnr, int align, int reverse, int nodraw) {
gcv.font = dzen.font.xfont->fid;
XChangeGC(dzen.dpy, dzen.tgc, GCFont, &gcv);
}
- py = (dzen.line_height - dzen.font.height) / 2;
+ py = set_posy ? py : (dzen.line_height - dzen.font.height) / 2;
+ font_was_set = 1;
break;
/*
case sa:
@@ -729,7 +743,8 @@ parse_line(const char *line, int lnr, int align, int reverse, int nodraw) {
gcv.font = dzen.font.xfont->fid;
XChangeGC(dzen.dpy, dzen.tgc, GCFont, &gcv);
}
- py = (dzen.line_height - dzen.font.height) / 2;
+ py = set_posy ? py : (dzen.line_height - dzen.font.height) / 2;
+ font_was_set = 1;
break;
/*
case sa:
@@ -820,6 +835,10 @@ parse_line(const char *line, int lnr, int align, int reverse, int nodraw) {
}
XFreePixmap(dzen.dpy, *pm);
+ /* reset font to default */
+ if(font_was_set)
+ setfont(dzen.fnt ? dzen.fnt : FONT);
+
#ifdef DZEN_XPM
if(free_xpm_attrib) {
XFreeColors(dzen.dpy, xpma.colormap, xpma.pixels, xpma.npixels, xpma.depth);