wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

commit ac473e4ebd1ba1cb190196d56df47725efab6892
parent a1081f75bf8fc399f0289517e37158a335788e43
Author: Anselm R. Garbe <garbeam@wmii.de>
Date:   Tue, 13 Jun 2006 15:49:28 +0200

removed more crap from liblitz


Diffstat:
liblitz/blitz.c | 9---------
liblitz/blitz.h | 50+++++++++++---------------------------------------
liblitz/window.c | 17+++++------------
3 files changed, 16 insertions(+), 60 deletions(-)

diff --git a/liblitz/blitz.c b/liblitz/blitz.c @@ -14,13 +14,4 @@ blitz_x11_init(Display *dpy) __blitz.display = dpy; __blitz.screen = DefaultScreen(dpy); __blitz.root = DefaultRootWindow(dpy); - __blitz.wins = nil; -} - -void -blitz_process_x11_event() -{ - - - } diff --git a/liblitz/blitz.h b/liblitz/blitz.h @@ -9,38 +9,20 @@ #define BLITZ_FONT "fixed" #define BLITZ_SELCOLORS "#ffffff #335577 #447799" #define BLITZ_NORMCOLORS "#222222 #eeeeee #666666" -#define BLITZ_FRAME_MASK SubstructureRedirectMask | SubstructureNotifyMask \ - | ExposureMask | ButtonPressMask | ButtonReleaseMask; - -enum {BLITZ_LABEL, BLITZ_LAYOUT, BLITZ_LAST}; typedef struct Blitz Blitz; typedef enum BlitzAlign BlitzAlign; typedef struct BlitzColor BlitzColor; typedef struct BlitzFont BlitzFont; typedef struct BlitzLabel BlitzLabel; -typedef struct BlitzLayoutItem BlitzLayoutItem; typedef struct BlitzLayout BlitzLayout; -typedef struct BlitzWin BlitzWin; typedef union BlitzWidget BlitzWidget; +typedef struct BlitzWin BlitzWin; struct Blitz { Display *display; int screen; Window root; - BlitzWin *wins; -}; - -struct BlitzWin{ - Drawable drawable; - GC gc; - XRectangle rect; - void (*enter)(XEvent *e); - void (*expose)(XEvent *e); - void (*kpress)(XEvent *e); - void (*bpress)(XEvent *e); - void (*brelease)(XEvent *e); - BlitzWin *next; }; enum BlitzAlign { @@ -68,33 +50,28 @@ struct BlitzFont { int descent; }; -struct BlitzLayout { - int type; - BlitzWin *win; +struct BlitzWin{ + Drawable drawable; + GC gc; XRectangle rect; - /* widget specific */ - BlitzLayoutItem *items; - BlitzLayout *next; }; -struct BlitzLayoutItem { - Bool expand; - BlitzWidget *widget; - BlitzLayoutItem *next; +struct BlitzLayout { + BlitzWin *win; + BlitzWidget *widgets; + void (*scale)(BlitzLayout *l); + void (*draw)(BlitzLayout *l); }; struct BlitzLabel { int type; - BlitzWin *win; XRectangle rect; /* widget specific */ BlitzColor color; BlitzAlign align; BlitzFont font; - char *data; - void (*bpress)(XEvent *e); - void (*brelease)(XEvent *e); - void (*draw)(char *text); /* also called on expose */ + char *text; + void (*draw)(BlitzLayout *l); }; union BlitzWidget { @@ -117,16 +94,11 @@ Blitz __blitz; /* blitz.c */ void blitz_x11_init(Display *dpy); -void blitz_process_x11_event(); /* draw.c */ void blitz_drawlabel(BlitzDraw *d); void blitz_drawborder(BlitzDraw *d); -/* label.c */ -BlitzWidget *blitz_create_label(BlitzWin *win); -void blitz_destroy_label(BlitzWidget *widget); - /* font.c */ unsigned int blitz_textwidth(BlitzFont *font, char *text); void blitz_loadfont(BlitzFont *font, char *fontstr); diff --git a/liblitz/window.c b/liblitz/window.c @@ -22,13 +22,7 @@ blitz_create_win(unsigned long mask, int x, int y, int w, int h) CopyFromParent, DefaultVisual(__blitz.display, __blitz.screen), CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); win->gc = XCreateGC(__blitz.display, win->drawable, 0, 0); - win->rect.x = x; - win->rect.y = y; - win->rect.width = w; - win->rect.height = h; - - win->next = __blitz.wins; - __blitz.wins = win; + blitz_resize_win(win, x, y, w, h); return win; } @@ -36,17 +30,16 @@ blitz_create_win(unsigned long mask, int x, int y, int w, int h) void blitz_resize_win(BlitzWin *win, int x, int y, int w, int h) { + win->rect.x = x; + win->rect.y = y; + win->rect.width = w; + win->rect.height = h; XMoveResizeWindow(__blitz.display, win->drawable, x, y, w, h); } void blitz_destroy_win(BlitzWin *win) { - BlitzWin **w; - for(w = &__blitz.wins; *w && *w != win; w = &(*w)->next); - cext_assert(*w != win); - *w = win->next; XFreeGC(__blitz.display, win->gc); XDestroyWindow(__blitz.display, win->drawable); - free(win); }