--- main.c.orig 2007-03-05 00:08:26.000000000 +0100 +++ main.c 2007-03-05 01:02:41.000000000 +0100 @@ -65,10 +65,15 @@ dc.w = mw; dc.h = mh; - if(text) + if(text) { + int tmp = dc.w; // hack + if (dc.isbutton) dc.w = dc.isbutton; // hack drawtext(text, dc.norm, -1); + dc.w = tmp; // hack + } - XCopyArea(dc.dpy, dc.drawable, dc.win, dc.gc, 0, 0, mw, mh, 0, 0); + XCopyArea(dc.dpy, dc.drawable, dc.win, dc.gc, 0, 0, + (dc.isbutton)?dc.isbutton:mw, mh, 0, 0); XSync(dc.dpy, False); XFlush(dc.dpy); } @@ -124,7 +129,6 @@ } } - static void event_loop(void *ptr) { XEvent ev; @@ -171,15 +175,12 @@ if(ev.xbutton.window == dc.win) running = False; if(dc.max_lines && (ev.xbutton.window == dc.swin)) { - if(ev.xbutton.button == Button1){ + if(ev.xbutton.button == Button1) dc.issticky = (dc.issticky ? False : True); - } - if(ev.xbutton.button == Button4) { + if(ev.xbutton.button == Button4) x_scroll_window_up(); - } - if(ev.xbutton.button == Button5) { + if(ev.xbutton.button == Button5) x_scroll_window_down(); - } } break; /* TODO: KeyPress @@ -254,7 +255,7 @@ /* header window */ dc.win = XCreateWindow(dc.dpy, root, - dc.hx, dc.hy, mw, mh, 0, + dc.hx, dc.hy, dc.isbutton?dc.isbutton:mw, mh, 0, DefaultDepth(dc.dpy, dc.screen), CopyFromParent, DefaultVisual(dc.dpy, dc.screen), CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); @@ -296,15 +297,19 @@ dc.hx = 0; dc.hy = 0; dc.hw = 0; + dc.isbutton = 0; dc.fnt = FONT; dc.bg = BGCOLOR; dc.fg = FGCOLOR; /* cmdline args */ for(i = 1; i < argc; i++) - if(!strncmp(argv[i], "-m", 3)) { + if(!strncmp(argv[i], "-l", 3)) { if(++i < argc) dc.max_lines = atoi(argv[i]); } + else if(!strncmp(argv[i], "-b", 3)) { + dc.isbutton = atoi(argv[++i]); + } else if(!strncmp(argv[i], "-p", 3)) { dc.ispersistent = True; } @@ -332,7 +337,6 @@ eprint("usage: dzen [-p] [-v] [-x ] [-y ] [-w ]\n" " [-m ] [-fn ] [-bg ] [-fg ]\n"); - if(!XInitThreads()) eprint("dzen: no multithreading support in xlib.\n"); if(!setlocale(LC_ALL, "") || !XSupportsLocale()) --- dzen.h.orig 2007-03-05 00:11:37.000000000 +0100 +++ dzen.h 2007-03-05 01:22:01.000000000 +0100 @@ -61,6 +61,7 @@ int last_line_vis; Bool issticky; + Bool isbutton; Bool ispersistent; };