aboutsummaryrefslogtreecommitdiffstats
path: root/draw.c
diff options
context:
space:
mode:
authorgotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2>2007-08-17 18:48:04 +0000
committergotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2>2007-08-17 18:48:04 +0000
commit620127f00ef1aa4c30e013c56dc00c2b1b47a4c5 (patch)
tree5aae3393205bf41bf2e59625eb1b273e0b67a87d /draw.c
parent39d56054fb02d5a67b2f5dab1a87e05d546aaaf1 (diff)
downloaddzen-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.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/draw.c b/draw.c
index de67d8e..4440084 100644
--- a/draw.c
+++ b/draw.c
@@ -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;
}