commit 8df05a7709b05ad1c1849f11a51bf116a650d21a
parent e3a8c8f2654f9f5f53580072fa2c76c0eb04c1f5
Author: Anselm R. Garbe <garbeam@wmii.de>
Date: Tue, 13 Jun 2006 11:21:06 +0200
merged, and proceeded with liblitz stuff
Diffstat:
5 files changed, 67 insertions(+), 25 deletions(-)
diff --git a/cmd/wm/wm.c b/cmd/wm/wm.c
@@ -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;
diff --git a/cmd/wmiimenu.c b/cmd/wmiimenu.c
@@ -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);
diff --git a/libixp/socket.c b/libixp/socket.c
@@ -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);
diff --git a/liblitz/blitz.c b/liblitz/blitz.c
@@ -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()
+{
+
+
+
+}
diff --git a/liblitz/blitz.h b/liblitz/blitz.h
@@ -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);