merged, and proceeded with liblitz stuff

This commit is contained in:
Anselm R. Garbe 2006-06-13 11:21:06 +02:00
commit 8df05a7709
5 changed files with 66 additions and 24 deletions

View File

@ -285,7 +285,7 @@ main(int argc, char *argv[])
/* X server */
ixp_server_open_conn(&srv, ConnectionNumber(dpy), check_x_event, nil);
init_x_event_handler();
blitz_init(dpy);
blitz_x11_init(dpy);
view = nil;
client = nil;

View File

@ -386,7 +386,7 @@ main(int argc, char *argv[])
usleep(1000);
/* set font and colors */
blitz_init(dpy);
blitz_x11_init(dpy);
fontstr = getenv("WMII_FONT");
if (!fontstr)
fontstr = strdup(BLITZ_FONT);

View File

@ -113,7 +113,7 @@ create_inet_sock(char *host, char **errstr)
addr.sin_family = AF_INET;
addr.sin_port = htons(prt);
if(!strncmp(host, "*", 1))
if(!strncmp(host, "*", 2))
addr.sin_addr.s_addr = htonl(INADDR_ANY);
else if((hp = gethostbyname(host)))
bcopy(hp->h_addr, &addr.sin_addr, hp->h_length);

View File

@ -7,9 +7,17 @@
/* blitz.c */
void
blitz_init(Display *dpy)
blitz_x11_init(Display *dpy)
{
__blitz.display = dpy;
__blitz.screen = DefaultScreen(dpy);
__blitz.root = DefaultRootWindow(dpy);
}
void
blitz_process_x11_event()
{
}

View File

@ -12,42 +12,71 @@
#define BLITZ_FRAME_MASK SubstructureRedirectMask | SubstructureNotifyMask \
| ExposureMask | ButtonPressMask | ButtonReleaseMask;
typedef struct {
enum {BLITZ_LABEL, BLITZ_LAST};
typedef struct Blitz Blitz;
typedef enum BlitzAlign BlitzAlign;
typedef struct BlitzColor BlitzColor;
typedef struct BlitzFont BlitzFont;
typedef struct BlitzLabel BlitzLabel;
typedef struct BlitzWin BlitzWin;
typedef union BlitzWidget BlitzWidget;
struct Blitz {
Display *display;
int screen;
Window root;
} Blitz;
typedef struct {
};
struct BlitzWin{
Drawable drawable;
GC gc;
XRectangle rect;
} BlitzWin;
typedef enum {
NORTH = 0x01,
EAST = 0x02,
SOUTH = 0x04,
WEST = 0x08,
NEAST = NORTH | EAST,
NWEST = NORTH | WEST,
SEAST = SOUTH | EAST,
SWEST = SOUTH | WEST,
CENTER = NEAST | SWEST
} BlitzAlign;
};
typedef struct {
enum BlitzAlign {
NORTH = 0x01,
EAST = 0x02,
SOUTH = 0x04,
WEST = 0x08,
NEAST = NORTH | EAST,
NWEST = NORTH | WEST,
SEAST = SOUTH | EAST,
SWEST = SOUTH | WEST,
CENTER = NEAST | SWEST
};
struct BlitzColor {
unsigned long bg;
unsigned long fg;
unsigned long border;
} BlitzColor;
};
typedef struct {
struct BlitzFont {
XFontStruct *xfont;
XFontSet set;
int ascent;
int descent;
} BlitzFont;
};
struct BlitzLabel {
int type;
BlitzWin *win;
XRectangle rect;
BlitzColor color;
/* widget specific */
BlitzAlign align;
BlitzFont font;
char *data;
void (*draw)(char *text); /* also called on expose */
};
union BlitzWidget {
int type;
BlitzLabel label;
};
typedef struct {
BlitzAlign align;
@ -63,12 +92,17 @@ typedef struct {
Blitz __blitz;
/* blitz.c */
void blitz_init(Display *dpy);
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);