aboutsummaryrefslogtreecommitdiffstats
path: root/dzen.h
diff options
context:
space:
mode:
authorgotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2>2007-03-28 17:11:37 +0000
committergotmor <gotmor@f2baff5b-bf2c-0410-a398-912abdc3d8b2>2007-03-28 17:11:37 +0000
commit4b54df524a318680d93382f8253c8da5a7546b58 (patch)
tree24cb2f61910d7591856616af9330e9c7d3b60f64 /dzen.h
downloaddzen-4b54df524a318680d93382f8253c8da5a7546b58.tar.gz
dzen-4b54df524a318680d93382f8253c8da5a7546b58.zip
0.1.9 initial svn release
git-svn-id: http://dzen.googlecode.com/svn/trunk@1 f2baff5b-bf2c-0410-a398-912abdc3d8b2
Diffstat (limited to 'dzen.h')
-rw-r--r--dzen.h120
1 files changed, 120 insertions, 0 deletions
diff --git a/dzen.h b/dzen.h
new file mode 100644
index 0000000..8b92e9d
--- /dev/null
+++ b/dzen.h
@@ -0,0 +1,120 @@
+/*
+ * (C)opyright MMVII Robert Manea <rob dot manea at gmail dot com>
+ * See LICENSE file for license details.
+ */
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/keysym.h>
+
+#define FONT "-*-fixed-*-*-*-*-*-*-*-*-*-*-*-*"
+#define BGCOLOR "#ab0b0b"
+#define FGCOLOR "#efefef"
+
+#define BUF_SIZE 4096
+
+/* gui data structures */
+enum { ColFG, ColBG, ColLast };
+
+typedef struct DZEN Dzen;
+typedef struct Fnt Fnt;
+typedef struct TW TWIN;
+typedef struct SW SWIN;
+
+struct Fnt {
+ XFontStruct *xfont;
+ XFontSet set;
+ int ascent;
+ int descent;
+ int height;
+};
+
+/* title window */
+struct TW {
+ int x, y, width, height;
+ int screen;
+ char *fnt;
+ char *bg;
+ char *fg;
+
+ Window win;
+ Drawable drawable;
+ Bool autohide;
+ Bool ishidden;
+};
+
+/* slave window */
+struct SW {
+ int x, y, width, height;
+ int screen;
+ char *fnt;
+ char *bg;
+ char *fg;
+
+ Window win;
+ Window *line;
+ Drawable drawable;
+
+ char *tbuf[BUF_SIZE];
+ int tcnt;
+ int max_lines;
+ int first_line_vis;
+ int last_line_vis;
+ int sel_line;
+
+ Bool ismenu;
+ Bool issticky;
+ Bool ispersistent;
+ Bool ismapped;
+};
+
+/* TODO: Remove unused variables */
+struct DZEN {
+ int x, y, w, h;
+ int sx, sy, sw, sh;
+ Bool running;
+ unsigned long norm[ColLast];
+
+ TWIN title_win;
+ SWIN slave_win;
+
+ /* to be removed */
+ char *fnt;
+ char *bg;
+ char *fg;
+ int mw, mh;
+ /*---------------*/
+
+ Display *dpy;
+ int screen;
+ unsigned int depth;
+
+ Visual *visual;
+ GC gc, rgc;
+ Fnt font;
+
+ /* position */
+ int hx, hy, hw;
+ int cur_line;
+
+ pthread_t read_thread;
+ pthread_mutex_t mt;
+
+ int ret_val;
+};
+
+extern Dzen dzen;
+
+/* draw.c */
+extern void drawtext(const char *text,
+ int reverse,
+ int line);
+extern unsigned long getcolor(const char *colstr); /* returns color of colstr */
+extern void setfont(const char *fontstr); /* sets global font */
+extern unsigned int textw(const char *text); /* returns width of text in px */
+
+/* util.c */
+extern void *emalloc(unsigned int size); /* allocates memory, exits on error */
+extern void eprint(const char *errstr, ...); /* prints errstr and exits with 1 */
+extern char *estrdup(const char *str); /* duplicates str, exits on allocation error */
+extern void spawn(const char *arg); /* execute arg */