wmii

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

commit a1081f75bf8fc399f0289517e37158a335788e43
parent 8df05a7709b05ad1c1849f11a51bf116a650d21a
Author: Anselm R. Garbe <garbeam@wmii.de>
Date:   Tue, 13 Jun 2006 15:03:46 +0200

added window list to Blitz 


Diffstat:
liblitz/blitz.c | 3+++
liblitz/blitz.h | 32++++++++++++++++++++++++++++----
liblitz/window.c | 8++++++++
3 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/liblitz/blitz.c b/liblitz/blitz.c @@ -3,6 +3,8 @@ * See LICENSE file for license details. */ +#include <cext.h> + #include "blitz.h" /* blitz.c */ @@ -12,6 +14,7 @@ blitz_x11_init(Display *dpy) __blitz.display = dpy; __blitz.screen = DefaultScreen(dpy); __blitz.root = DefaultRootWindow(dpy); + __blitz.wins = nil; } void diff --git a/liblitz/blitz.h b/liblitz/blitz.h @@ -12,13 +12,15 @@ #define BLITZ_FRAME_MASK SubstructureRedirectMask | SubstructureNotifyMask \ | ExposureMask | ButtonPressMask | ButtonReleaseMask; -enum {BLITZ_LABEL, BLITZ_LAST}; +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; @@ -26,14 +28,19 @@ 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 { @@ -61,15 +68,32 @@ struct BlitzFont { int descent; }; +struct BlitzLayout { + int type; + BlitzWin *win; + XRectangle rect; + /* widget specific */ + BlitzLayoutItem *items; + BlitzLayout *next; +}; + +struct BlitzLayoutItem { + Bool expand; + BlitzWidget *widget; + BlitzLayoutItem *next; +}; + struct BlitzLabel { int type; BlitzWin *win; XRectangle rect; - BlitzColor color; /* 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 */ }; diff --git a/liblitz/window.c b/liblitz/window.c @@ -26,6 +26,10 @@ blitz_create_win(unsigned long mask, int x, int y, int w, int h) win->rect.y = y; win->rect.width = w; win->rect.height = h; + + win->next = __blitz.wins; + __blitz.wins = win; + return win; } @@ -38,6 +42,10 @@ blitz_resize_win(BlitzWin *win, int x, int y, int w, int 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);