mirror of
https://github.com/0intro/wmii
synced 2025-01-12 21:29:19 +03:00
removed more crap from liblitz
This commit is contained in:
parent
a1081f75bf
commit
ac473e4ebd
@ -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()
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user