diff options
author | gotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2> | 2007-08-17 18:48:04 +0000 |
---|---|---|
committer | gotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2> | 2007-08-17 18:48:04 +0000 |
commit | 620127f00ef1aa4c30e013c56dc00c2b1b47a4c5 (patch) | |
tree | 5aae3393205bf41bf2e59625eb1b273e0b67a87d /draw.c | |
parent | 39d56054fb02d5a67b2f5dab1a87e05d546aaaf1 (diff) | |
download | dzen-620127f00ef1aa4c30e013c56dc00c2b1b47a4c5.tar.gz dzen-620127f00ef1aa4c30e013c56dc00c2b1b47a4c5.zip |
fixed broking drawing to title window
relative positioning can also take negative values
git-svn-id: http://dzen.googlecode.com/svn/trunk@156 f2baff5b-bf2c-0410-a398-912abdc3d8b2
Diffstat (limited to 'draw.c')
-rw-r--r-- | draw.c | 34 |
1 files changed, 24 insertions, 10 deletions
@@ -308,7 +308,7 @@ parse_line(const char *line, int lnr, int align, int reverse, int nodraw) { XChangeGC(dzen.dpy, dzen.tgc, GCFont, &gcv); } - if( (lnr + dzen.slave_win.first_line_vis) >= dzen.slave_win.tcnt) { + if( lnr != -1 && (lnr + dzen.slave_win.first_line_vis >= dzen.slave_win.tcnt)) { XCopyArea(dzen.dpy, pm, dzen.slave_win.drawable[lnr], dzen.gc, 0, 0, px, dzen.line_height, xorig, 0); XFreePixmap(dzen.dpy, pm); @@ -387,9 +387,13 @@ parse_line(const char *line, int lnr, int align, int reverse, int nodraw) { break; case pos: - if((n_pos = atoi(tval)) < 0) - n_pos *= -1; - setcolor(&pm, px, n_pos, lastfg, lastbg, reverse, nobg); + if((n_pos = atoi(tval)) < 0) { + n_pos = px + n_pos < 0 ? 0 : n_pos; + setcolor(&pm, n_pos, px, lastfg, lastbg, reverse, nobg); + } + else + setcolor(&pm, px, n_pos, lastfg, lastbg, reverse, nobg); + px += n_pos; break; @@ -520,9 +524,13 @@ parse_line(const char *line, int lnr, int align, int reverse, int nodraw) { break; case pos: - if((n_pos = atoi(tval)) < 0) - n_pos *= -1; - setcolor(&pm, px, n_pos, lastfg, lastbg, reverse, nobg); + if((n_pos = atoi(tval)) < 0) { + n_pos = px + n_pos < 0 ? 0 : px + n_pos; + setcolor(&pm, n_pos, px, lastfg, lastbg, reverse, nobg); + } + else + setcolor(&pm, px, n_pos, lastfg, lastbg, reverse, nobg); + px += n_pos; break; @@ -610,7 +618,10 @@ parse_line(const char *line, int lnr, int align, int reverse, int nodraw) { void drawheader(const char * text) { if(text){ - XFillRectangle(dzen.dpy, dzen.title_win.drawable, dzen.rgc, 0, 0, dzen.title_win.width, dzen.line_height); + dzen.w = dzen.title_win.width; + dzen.h = dzen.line_height; + + XFillRectangle(dzen.dpy, dzen.title_win.drawable, dzen.rgc, 0, 0, dzen.w, dzen.h); parse_line(text, -1, dzen.title_win.alignment, 0, 0); } @@ -627,10 +638,13 @@ drawbody(char * text) { the actual parsing process */ if((ec = strstr(text, "^tw()")) && (*(ec-1) != '^')) { - XFillRectangle(dzen.dpy, dzen.title_win.drawable, dzen.rgc, 0, 0, dzen.title_win.width, dzen.line_height); + dzen.w = dzen.title_win.width; + dzen.h = dzen.line_height; + + XFillRectangle(dzen.dpy, dzen.title_win.drawable, dzen.rgc, 0, 0, dzen.w, dzen.h); parse_line(ec+5, -1, dzen.title_win.alignment, 0, 0); XCopyArea(dzen.dpy, dzen.title_win.drawable, dzen.title_win.win, - dzen.gc, 0, 0, dzen.title_win.width, dzen.line_height, 0, 0); + dzen.gc, 0, 0, dzen.w, dzen.h, 0, 0); return; } |