mirror of https://github.com/0intro/wmii
some C sanitizing
This commit is contained in:
parent
33f735eb86
commit
8f4873efa5
5
Makefile
5
Makefile
|
@ -5,11 +5,10 @@ include config.mk
|
|||
|
||||
SUBDIRS = libcext liblitz libixp cmd
|
||||
|
||||
BIN = cmd/wm/wmii cmd/wm/wmiiwm cmd/wmiimenu cmd/wmiipsel \
|
||||
BIN = cmd/wm/wmii cmd/wm/wmiiwm cmd/wmiipsel \
|
||||
cmd/wmiir cmd/wmiisetsid cmd/wmiiwarp
|
||||
|
||||
MAN1 = cmd/wm/wmii.1 cmd/wm/wmiiwm.1 \
|
||||
cmd/wmiimenu.1 cmd/wmiir.1
|
||||
MAN1 = cmd/wm/wmii.1 cmd/wm/wmiiwm.1 cmd/wmiir.1
|
||||
|
||||
all:
|
||||
@echo wmii build options:
|
||||
|
|
|
@ -7,7 +7,7 @@ CFLAGS += -I../liblitz -I../libixp -I../libcext
|
|||
LDFLAGS += -L../libixp -lixp -L../libcext -lcext
|
||||
X11LDFLAGS += -L../liblitz -llitz -L../libcext -lcext
|
||||
|
||||
X11SRC = wmiimenu.c wmiipsel.c wmiiwarp.c
|
||||
X11SRC = wmiipsel.c wmiiwarp.c
|
||||
SRC = wmiir.c wmiisetsid.c
|
||||
ALLSRC = ${SRC} ${X11SRC}
|
||||
|
||||
|
|
|
@ -589,6 +589,14 @@ newcol_client(Client *c, char *arg)
|
|||
flush_masked_events(EnterWindowMask);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
swap_client(Client *c, char *arg)
|
||||
{
|
||||
/* TODO: */
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
move_client(Client *c, char *arg)
|
||||
{
|
||||
|
@ -757,7 +765,6 @@ apply_tags(Client *c, const char *tags)
|
|||
int len;
|
||||
char buf[256];
|
||||
char *toks[32];
|
||||
Frame *f;
|
||||
|
||||
cext_strlcpy(buf, tags, sizeof(buf));
|
||||
if(!(n = cext_tokenize(toks, 31, buf, '+')))
|
||||
|
@ -789,9 +796,6 @@ apply_tags(Client *c, const char *tags)
|
|||
|
||||
XChangeProperty(blz.dpy, c->win, tags_atom, XA_STRING, 8,
|
||||
PropModeReplace, (unsigned char *)c->tags, strlen(c->tags));
|
||||
|
||||
for(f = c->frame; f; f = f->cnext)
|
||||
blitz_setinput(&f->tagbar, c->tags);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -21,7 +21,6 @@ static void expose(XEvent *e);
|
|||
static void keypress(XEvent *e);
|
||||
static void mappingnotify(XEvent *e);
|
||||
static void maprequest(XEvent *e);
|
||||
static void motionnotify(XEvent *e);
|
||||
static void propertynotify(XEvent *e);
|
||||
static void unmapnotify(XEvent *e);
|
||||
|
||||
|
@ -34,7 +33,6 @@ void (*handler[LASTEvent]) (XEvent *) = {
|
|||
[LeaveNotify] = leavenotify,
|
||||
[Expose] = expose,
|
||||
[KeyPress] = keypress,
|
||||
[MotionNotify] = motionnotify,
|
||||
[MappingNotify] = mappingnotify,
|
||||
[MapRequest] = maprequest,
|
||||
[PropertyNotify]= propertynotify,
|
||||
|
@ -77,19 +75,8 @@ buttonrelease(XEvent *e)
|
|||
return write_event("RightBarClick %d %s\n",
|
||||
ev->button, b->name);
|
||||
}
|
||||
else if((f = frame_of_win(ev->window))) {
|
||||
blitz_brelease_input(&f->tagbar, ev->button, ev->x, ev->y, ev->time);
|
||||
else if((f = frame_of_win(ev->window)))
|
||||
write_event("ClientClick %d %d\n", idx_of_client(f->client), ev->button);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
motionnotify(XEvent *e)
|
||||
{
|
||||
Frame *f;
|
||||
XMotionEvent *ev = &e->xmotion;
|
||||
if((f = frame_of_win(ev->window)))
|
||||
blitz_bmotion_input(&f->tagbar, ev->x, ev->y);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -100,7 +87,6 @@ buttonpress(XEvent *e)
|
|||
|
||||
if((f = frame_of_win(ev->window))) {
|
||||
ev->state &= valid_mask;
|
||||
blitz_bpress_input(&f->tagbar, ev->button, ev->x, ev->y);
|
||||
if((ev->state & def.mod) == def.mod) {
|
||||
focus(f->client, True);
|
||||
switch(ev->button) {
|
||||
|
@ -270,7 +256,6 @@ keypress(XEvent *e)
|
|||
|| IsPFKey(k) || IsPrivateKeypadKey(k))
|
||||
return;
|
||||
buf[n] = 0;
|
||||
blitz_kpress_input(&f->tagbar, ev->state, k, buf);
|
||||
}
|
||||
else
|
||||
kpress(blz.root, ev->state, (KeyCode) ev->keycode);
|
||||
|
|
|
@ -38,21 +38,6 @@ create_frame(Client *c, View *v)
|
|||
f->grabbox = f->titlebar = f->tile;
|
||||
f->titlebar.align = WEST;
|
||||
|
||||
f->tagbar.blitz = &blz;
|
||||
f->tagbar.drawable = pmap;
|
||||
f->tagbar.win = c->framewin;
|
||||
f->tagbar.gc = c->gc;
|
||||
f->tagbar.font = &def.font;
|
||||
f->tagbar.cursor = f->tagbar.def = cursor[CurNormal];
|
||||
f->tagbar.input = cursor[CurInput];
|
||||
f->tagbar.color = def.normcolor;
|
||||
f->tagbar.bcolor[0] = def.bcolor[0];
|
||||
f->tagbar.bcolor[1] = def.bcolor[1];
|
||||
f->tagbar.bcolor[2] = def.bcolor[2];
|
||||
f->tagbar.aux = f;
|
||||
f->tagbar.draw = (void (*)(void *))draw_frame;
|
||||
blitz_setinput(&f->tagbar, c->tags);
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
|
@ -84,13 +69,10 @@ insert_frame(Frame *pos, Frame *f, Bool before)
|
|||
void
|
||||
update_frame_widget_colors(Frame *f)
|
||||
{
|
||||
f->tagbar.bcolor[0] = def.bcolor[0];
|
||||
f->tagbar.bcolor[1] = def.bcolor[1];
|
||||
f->tagbar.bcolor[2] = def.bcolor[2];
|
||||
if(sel_screen && (f->client == sel_client()))
|
||||
f->tagbar.color = f->tile.color = f->titlebar.color = def.selcolor;
|
||||
f->tile.color = f->titlebar.color = def.selcolor;
|
||||
else
|
||||
f->tagbar.color = f->tile.color = f->titlebar.color = def.normcolor;
|
||||
f->tile.color = f->titlebar.color = def.normcolor;
|
||||
|
||||
if(f->area->sel == f)
|
||||
f->grabbox.color = def.selcolor;
|
||||
|
@ -112,17 +94,10 @@ draw_frame(Frame *f)
|
|||
|
||||
f->titlebar.rect = f->grabbox.rect;
|
||||
f->titlebar.rect.x = f->grabbox.rect.x + f->grabbox.rect.width;
|
||||
f->titlebar.rect.width = f->rect.width / 2;
|
||||
|
||||
/* tag bar */
|
||||
f->tagbar.rect = f->grabbox.rect;
|
||||
f->tagbar.rect.x = f->titlebar.rect.x + f->titlebar.rect.width;
|
||||
f->tagbar.rect.width =
|
||||
f->rect.width - (f->grabbox.rect.width + f->titlebar.rect.width);
|
||||
f->titlebar.rect.width = f->rect.width - f->titlebar.rect.x;
|
||||
|
||||
blitz_draw_tile(&f->tile);
|
||||
blitz_draw_tile(&f->grabbox);
|
||||
blitz_draw_input(&f->tagbar);
|
||||
blitz_draw_label(&f->titlebar, f->client->name);
|
||||
XCopyArea(blz.dpy, pmap, f->client->framewin, f->client->gc,
|
||||
0, 0, f->rect.width, f->rect.height, 0, 0);
|
||||
|
|
220
cmd/wm/wm.h
220
cmd/wm/wm.h
|
@ -12,34 +12,16 @@
|
|||
#include <blitz.h>
|
||||
|
||||
/* WM atoms */
|
||||
enum {
|
||||
WMProtocols,
|
||||
WMDelete,
|
||||
WMLast
|
||||
};
|
||||
enum { WMProtocols, WMDelete, WMLast };
|
||||
|
||||
/* NET atoms */
|
||||
enum {
|
||||
NetSupported,
|
||||
NetWMName,
|
||||
NetLast
|
||||
};
|
||||
enum { NetSupported, NetWMName, NetLast };
|
||||
|
||||
/* Column modes */
|
||||
enum {
|
||||
Coldefault,
|
||||
Colstack,
|
||||
Colmax
|
||||
};
|
||||
enum { Coldefault, Colstack, Colmax };
|
||||
|
||||
/* Cursor */
|
||||
enum {
|
||||
CurNormal,
|
||||
CurResize,
|
||||
CurMove,
|
||||
CurInput,
|
||||
CurLast
|
||||
};
|
||||
enum { CurNormal, CurResize, CurMove, CurInput, CurLast };
|
||||
|
||||
enum { NCOL = 16 };
|
||||
enum { WM_PROTOCOL_DELWIN = 1 };
|
||||
|
@ -87,7 +69,6 @@ struct Frame {
|
|||
Bool collapsed;
|
||||
BlitzBrush tile;
|
||||
BlitzBrush grabbox;
|
||||
BlitzInput tagbar;
|
||||
BlitzBrush titlebar;
|
||||
};
|
||||
|
||||
|
@ -202,126 +183,127 @@ void (*handler[LASTEvent]) (XEvent *);
|
|||
Bool starting;
|
||||
|
||||
/* wm.c */
|
||||
char *message_root(char *message);
|
||||
extern char *message_root(char *message);
|
||||
|
||||
/* area.c */
|
||||
Area *create_area(View *v, Area *pos, unsigned int w);
|
||||
void destroy_area(Area *a);
|
||||
Area *area_of_id(View *t, unsigned short id);
|
||||
char *select_area(Area *a, char *arg);
|
||||
void send_to_area(Area *to, Area *from, Frame *f);
|
||||
void attach_to_area(Area *a, Frame *f, Bool send);
|
||||
void detach_from_area(Area *a, Frame *f);
|
||||
Client *sel_client_of_area(Area *a);
|
||||
extern Area *create_area(View *v, Area *pos, unsigned int w);
|
||||
extern void destroy_area(Area *a);
|
||||
extern Area *area_of_id(View *t, unsigned short id);
|
||||
extern char *select_area(Area *a, char *arg);
|
||||
extern void send_to_area(Area *to, Area *from, Frame *f);
|
||||
extern void attach_to_area(Area *a, Frame *f, Bool send);
|
||||
extern void detach_from_area(Area *a, Frame *f);
|
||||
extern Client *sel_client_of_area(Area *a);
|
||||
|
||||
/* bar.c */
|
||||
Bar *create_bar(Bar **b_link, char *name);
|
||||
void destroy_bar(Bar **b_link, Bar *b);
|
||||
void draw_bar(WMScreen *s);
|
||||
void resize_bar();
|
||||
Bar *bar_of_name(Bar *b_link, const char *name);
|
||||
extern Bar *create_bar(Bar **b_link, char *name);
|
||||
extern void destroy_bar(Bar **b_link, Bar *b);
|
||||
extern void draw_bar(WMScreen *s);
|
||||
extern void resize_bar();
|
||||
extern Bar *bar_of_name(Bar *b_link, const char *name);
|
||||
|
||||
/* client.c */
|
||||
Client *create_client(Window w, XWindowAttributes *wa);
|
||||
void destroy_client(Client *c);
|
||||
void configure_client(Client *c);
|
||||
void prop_client(Client *c, XPropertyEvent *e);
|
||||
void kill_client(Client *c);
|
||||
void gravitate_client(Client *c, Bool invert);
|
||||
void unmap_client(Client *c);
|
||||
void map_client(Client *c);
|
||||
void reparent_client(Client *c, Window w, int x, int y);
|
||||
void manage_client(Client *c);
|
||||
void focus_client(Client *c, Bool restack);
|
||||
void focus(Client *c, Bool restack);
|
||||
void resize_client(Client *c, XRectangle *r, Bool ignore_xcall);
|
||||
void match_sizehints(Client *c, XRectangle *r, Bool floating, BlitzAlign sticky);
|
||||
char *send_client(Frame *f, char *arg);
|
||||
char * message_client(Client *c, char *message);
|
||||
void move_client(Client *c, char *arg);
|
||||
void size_client(Client *c, char *arg);
|
||||
void newcol_client(Client *c, char *arg);
|
||||
Client *sel_client();
|
||||
Frame *frame_of_win(Window w);
|
||||
Client *client_of_win(Window w);
|
||||
int idx_of_client(Client *c);
|
||||
void update_client_grab(Client *c, Bool is_sel);
|
||||
void apply_rules(Client *c);
|
||||
void apply_tags(Client *c, const char *tags);
|
||||
extern Client *create_client(Window w, XWindowAttributes *wa);
|
||||
extern void destroy_client(Client *c);
|
||||
extern void configure_client(Client *c);
|
||||
extern void prop_client(Client *c, XPropertyEvent *e);
|
||||
extern void kill_client(Client *c);
|
||||
extern void gravitate_client(Client *c, Bool invert);
|
||||
extern void unmap_client(Client *c);
|
||||
extern void map_client(Client *c);
|
||||
extern void reparent_client(Client *c, Window w, int x, int y);
|
||||
extern void manage_client(Client *c);
|
||||
extern void focus_client(Client *c, Bool restack);
|
||||
extern void focus(Client *c, Bool restack);
|
||||
extern void resize_client(Client *c, XRectangle *r, Bool ignore_xcall);
|
||||
extern void match_sizehints(Client *c, XRectangle *r, Bool floating, BlitzAlign sticky);
|
||||
extern char *send_client(Frame *f, char *arg);
|
||||
extern char * message_client(Client *c, char *message);
|
||||
extern void swap_client(Client *c, char *arg);
|
||||
extern void move_client(Client *c, char *arg);
|
||||
extern void size_client(Client *c, char *arg);
|
||||
extern void newcol_client(Client *c, char *arg);
|
||||
extern Client *sel_client();
|
||||
extern Frame *frame_of_win(Window w);
|
||||
extern Client *client_of_win(Window w);
|
||||
extern int idx_of_client(Client *c);
|
||||
extern void update_client_grab(Client *c, Bool is_sel);
|
||||
extern void apply_rules(Client *c);
|
||||
extern void apply_tags(Client *c, const char *tags);
|
||||
|
||||
/* column.c */
|
||||
void arrange_column(Area *a, Bool dirty);
|
||||
void scale_column(Area *a, float h);
|
||||
void resize_column(Client *c, XRectangle *r, XPoint *pt);
|
||||
int column_mode_of_str(char *arg);
|
||||
char *str_of_column_mode(int mode);
|
||||
Area *new_column(View *v, Area *pos, unsigned int w);
|
||||
extern void arrange_column(Area *a, Bool dirty);
|
||||
extern void scale_column(Area *a, float h);
|
||||
extern void resize_column(Client *c, XRectangle *r, XPoint *pt);
|
||||
extern int column_mode_of_str(char *arg);
|
||||
extern char *str_of_column_mode(int mode);
|
||||
extern Area *new_column(View *v, Area *pos, unsigned int w);
|
||||
|
||||
/* event.c */
|
||||
void check_x_event(IXPConn *c);
|
||||
unsigned int flush_masked_events(long even_mask);
|
||||
extern void check_x_event(IXPConn *c);
|
||||
extern unsigned int flush_masked_events(long even_mask);
|
||||
|
||||
/* frame.c */
|
||||
Frame *create_frame(Client *c, View *v);
|
||||
void remove_frame(Frame *f);
|
||||
void insert_frame(Frame *pos, Frame *f, Bool before);
|
||||
void draw_frame(Frame *f);
|
||||
void draw_frames();
|
||||
void update_frame_widget_colors(Frame *f);
|
||||
extern Frame *create_frame(Client *c, View *v);
|
||||
extern void remove_frame(Frame *f);
|
||||
extern void insert_frame(Frame *pos, Frame *f, Bool before);
|
||||
extern void draw_frame(Frame *f);
|
||||
extern void draw_frames();
|
||||
extern void update_frame_widget_colors(Frame *f);
|
||||
|
||||
/* fs.c */
|
||||
void fs_attach(P9Req *r);
|
||||
void fs_clunk(P9Req *r);
|
||||
void fs_create(P9Req *r);
|
||||
void fs_flush(P9Req *r);
|
||||
void fs_freefid(Fid *f);
|
||||
void fs_open(P9Req *r);
|
||||
void fs_read(P9Req *r);
|
||||
void fs_remove(P9Req *r);
|
||||
void fs_stat(P9Req *r);
|
||||
void fs_walk(P9Req *r);
|
||||
void fs_write(P9Req *r);
|
||||
void write_event(char *format, ...);
|
||||
extern void fs_attach(P9Req *r);
|
||||
extern void fs_clunk(P9Req *r);
|
||||
extern void fs_create(P9Req *r);
|
||||
extern void fs_flush(P9Req *r);
|
||||
extern void fs_freefid(Fid *f);
|
||||
extern void fs_open(P9Req *r);
|
||||
extern void fs_read(P9Req *r);
|
||||
extern void fs_remove(P9Req *r);
|
||||
extern void fs_stat(P9Req *r);
|
||||
extern void fs_walk(P9Req *r);
|
||||
extern void fs_write(P9Req *r);
|
||||
extern void write_event(char *format, ...);
|
||||
|
||||
/* geom.c */
|
||||
BlitzAlign quadofcoord(XRectangle *rect, int x, int y);
|
||||
int strtorect(XRectangle *r, const char *val);
|
||||
extern BlitzAlign quadofcoord(XRectangle *rect, int x, int y);
|
||||
extern int strtorect(XRectangle *r, const char *val);
|
||||
|
||||
/* key.c */
|
||||
void kpress(Window w, unsigned long mod, KeyCode keycode);
|
||||
void update_keys();
|
||||
void init_lock_keys();
|
||||
unsigned long mod_key_of_str(char *val);
|
||||
extern void kpress(Window w, unsigned long mod, KeyCode keycode);
|
||||
extern void update_keys();
|
||||
extern void init_lock_keys();
|
||||
extern unsigned long mod_key_of_str(char *val);
|
||||
|
||||
/* mouse.c */
|
||||
void do_mouse_resize(Client *c,BlitzAlign align);
|
||||
void grab_mouse(Window w, unsigned long mod, unsigned int button);
|
||||
void ungrab_mouse(Window w, unsigned long mod, unsigned int button);
|
||||
BlitzAlign snap_rect(XRectangle *rects, int num, XRectangle *current,
|
||||
extern void do_mouse_resize(Client *c,BlitzAlign align);
|
||||
extern void grab_mouse(Window w, unsigned long mod, unsigned int button);
|
||||
extern void ungrab_mouse(Window w, unsigned long mod, unsigned int button);
|
||||
extern BlitzAlign snap_rect(XRectangle *rects, int num, XRectangle *current,
|
||||
BlitzAlign *mask, int snap);
|
||||
|
||||
/* rule.c */
|
||||
void update_rules(Rule **rule, const char *data);
|
||||
extern void update_rules(Rule **rule, const char *data);
|
||||
|
||||
/* view.c */
|
||||
void arrange_view(View *v);
|
||||
void scale_view(View *v, float w);
|
||||
View *get_view(const char *name);
|
||||
View *create_view(const char *name);
|
||||
void focus_view(WMScreen *s, View *v);
|
||||
void update_client_views(Client *c, char **tags);
|
||||
XRectangle *rects_of_view(View *v, unsigned int *num);
|
||||
View *view_of_id(unsigned short id);
|
||||
void select_view(const char *arg);
|
||||
void attach_to_view(View *v, Frame *f);
|
||||
Client *sel_client_of_view(View *v);
|
||||
char *message_view(View *v, char *message);
|
||||
void restack_view(View *v);
|
||||
unsigned char *view_index(View *v);
|
||||
void destroy_view(View *v);
|
||||
void update_views();
|
||||
unsigned int newcolw_of_view(View *v);
|
||||
extern void arrange_view(View *v);
|
||||
extern void scale_view(View *v, float w);
|
||||
extern View *get_view(const char *name);
|
||||
extern View *create_view(const char *name);
|
||||
extern void focus_view(WMScreen *s, View *v);
|
||||
extern void update_client_views(Client *c, char **tags);
|
||||
extern XRectangle *rects_of_view(View *v, unsigned int *num);
|
||||
extern View *view_of_id(unsigned short id);
|
||||
extern void select_view(const char *arg);
|
||||
extern void attach_to_view(View *v, Frame *f);
|
||||
extern Client *sel_client_of_view(View *v);
|
||||
extern char *message_view(View *v, char *message);
|
||||
extern void restack_view(View *v);
|
||||
extern unsigned char *view_index(View *v);
|
||||
extern void destroy_view(View *v);
|
||||
extern void update_views();
|
||||
extern unsigned int newcolw_of_view(View *v);
|
||||
|
||||
/* wm.c */
|
||||
int wmii_error_handler(Display *dpy, XErrorEvent *error);
|
||||
int win_proto(Window w);
|
||||
extern int wmii_error_handler(Display *dpy, XErrorEvent *error);
|
||||
extern int win_proto(Window w);
|
||||
|
|
|
@ -10,29 +10,29 @@
|
|||
#endif
|
||||
|
||||
/* asprintf.c */
|
||||
int cext_asprintf(char **str, char const *fmt, ...);
|
||||
extern int cext_asprintf(char **str, char const *fmt, ...);
|
||||
|
||||
/* malloc.c */
|
||||
void *cext_emallocz(unsigned int size);
|
||||
void *cext_emalloc(unsigned int size);
|
||||
void *cext_erealloc(void *ptr, unsigned int size);
|
||||
char *cext_estrdup(const char *str);
|
||||
extern void *cext_emallocz(unsigned int size);
|
||||
extern void *cext_emalloc(unsigned int size);
|
||||
extern void *cext_erealloc(void *ptr, unsigned int size);
|
||||
extern char *cext_estrdup(const char *str);
|
||||
|
||||
/* strlcat.c */
|
||||
unsigned int cext_strlcat(char *dst, const char *src, unsigned int siz);
|
||||
extern unsigned int cext_strlcat(char *dst, const char *src, unsigned int siz);
|
||||
|
||||
/* strlcpy.c */
|
||||
unsigned int cext_strlcpy(char *dst, const char *src, unsigned int siz);
|
||||
extern unsigned int cext_strlcpy(char *dst, const char *src, unsigned int siz);
|
||||
|
||||
/* tokenize.c */
|
||||
unsigned int cext_tokenize(char **result, unsigned int reslen, char *str, char delim);
|
||||
extern unsigned int cext_tokenize(char **result, unsigned int reslen, char *str, char delim);
|
||||
|
||||
/* trim.c */
|
||||
void cext_trim(char *str, const char *chars);
|
||||
extern void cext_trim(char *str, const char *chars);
|
||||
|
||||
/* assert.c */
|
||||
#define cext_assert(a) do { \
|
||||
if(!(a)) \
|
||||
cext_failed_assert(#a, __FILE__, __LINE__); \
|
||||
} while (0)
|
||||
void cext_failed_assert(char *a, char *file, int line);
|
||||
extern void cext_failed_assert(char *a, char *file, int line);
|
||||
|
|
112
libixp/ixp.h
112
libixp/ixp.h
|
@ -286,84 +286,84 @@ typedef struct P9Srv {
|
|||
} P9Srv;
|
||||
|
||||
/* client.c */
|
||||
int ixp_client_dial(IXPClient *c, char *address, unsigned int rootfid);
|
||||
void ixp_client_hangup(IXPClient *c);
|
||||
int ixp_client_remove(IXPClient *c, unsigned int newfid, char *filepath);
|
||||
int ixp_client_create(IXPClient *c, unsigned int dirfid, char *name,
|
||||
extern int ixp_client_dial(IXPClient *c, char *address, unsigned int rootfid);
|
||||
extern void ixp_client_hangup(IXPClient *c);
|
||||
extern int ixp_client_remove(IXPClient *c, unsigned int newfid, char *filepath);
|
||||
extern int ixp_client_create(IXPClient *c, unsigned int dirfid, char *name,
|
||||
unsigned int perm, unsigned char mode);
|
||||
int ixp_client_walk(IXPClient *c, unsigned int newfid, char *filepath);
|
||||
int ixp_client_stat(IXPClient *c, unsigned int newfid, char *filepath);
|
||||
int ixp_client_walkopen(IXPClient *c, unsigned int newfid, char *filepath,
|
||||
extern int ixp_client_walk(IXPClient *c, unsigned int newfid, char *filepath);
|
||||
extern int ixp_client_stat(IXPClient *c, unsigned int newfid, char *filepath);
|
||||
extern int ixp_client_walkopen(IXPClient *c, unsigned int newfid, char *filepath,
|
||||
unsigned char mode);
|
||||
int ixp_client_open(IXPClient *c, unsigned int newfid, unsigned char mode);
|
||||
int ixp_client_read(IXPClient *c, unsigned int fid,
|
||||
extern int ixp_client_open(IXPClient *c, unsigned int newfid, unsigned char mode);
|
||||
extern int ixp_client_read(IXPClient *c, unsigned int fid,
|
||||
unsigned long long offset, void *result,
|
||||
unsigned int res_len);
|
||||
int ixp_client_write(IXPClient *c, unsigned int fid,
|
||||
extern int ixp_client_write(IXPClient *c, unsigned int fid,
|
||||
unsigned long long offset,
|
||||
unsigned int count, unsigned char *data);
|
||||
int ixp_client_close(IXPClient *c, unsigned int fid);
|
||||
int ixp_client_do_fcall(IXPClient * c);
|
||||
extern int ixp_client_close(IXPClient *c, unsigned int fid);
|
||||
extern int ixp_client_do_fcall(IXPClient * c);
|
||||
|
||||
/* convert.c */
|
||||
void ixp_pack_u8(unsigned char **msg, int *msize, unsigned char val);
|
||||
void ixp_unpack_u8(unsigned char **msg, int *msize, unsigned char *val);
|
||||
void ixp_pack_u16(unsigned char **msg, int *msize, unsigned short val);
|
||||
void ixp_unpack_u16(unsigned char **msg, int *msize, unsigned short *val);
|
||||
void ixp_pack_u32(unsigned char **msg, int *msize, unsigned int val);
|
||||
void ixp_unpack_u32(unsigned char **msg, int *msize, unsigned int *val);
|
||||
void ixp_pack_u64(unsigned char **msg, int *msize, unsigned long long val);
|
||||
void ixp_unpack_u64(unsigned char **msg, int *msize, unsigned long long *val);
|
||||
void ixp_pack_string(unsigned char **msg, int *msize, const char *s);
|
||||
void ixp_unpack_strings(unsigned char **msg, int *msize, unsigned short n, char **strings);
|
||||
void ixp_unpack_string(unsigned char **msg, int *msize, char **string, unsigned short *len);
|
||||
void ixp_pack_data(unsigned char **msg, int *msize, unsigned char *data,
|
||||
extern void ixp_pack_u8(unsigned char **msg, int *msize, unsigned char val);
|
||||
extern void ixp_unpack_u8(unsigned char **msg, int *msize, unsigned char *val);
|
||||
extern void ixp_pack_u16(unsigned char **msg, int *msize, unsigned short val);
|
||||
extern void ixp_unpack_u16(unsigned char **msg, int *msize, unsigned short *val);
|
||||
extern void ixp_pack_u32(unsigned char **msg, int *msize, unsigned int val);
|
||||
extern void ixp_unpack_u32(unsigned char **msg, int *msize, unsigned int *val);
|
||||
extern void ixp_pack_u64(unsigned char **msg, int *msize, unsigned long long val);
|
||||
extern void ixp_unpack_u64(unsigned char **msg, int *msize, unsigned long long *val);
|
||||
extern void ixp_pack_string(unsigned char **msg, int *msize, const char *s);
|
||||
extern void ixp_unpack_strings(unsigned char **msg, int *msize, unsigned short n, char **strings);
|
||||
extern void ixp_unpack_string(unsigned char **msg, int *msize, char **string, unsigned short *len);
|
||||
extern void ixp_pack_data(unsigned char **msg, int *msize, unsigned char *data,
|
||||
unsigned int datalen);
|
||||
void ixp_unpack_data(unsigned char **msg, int *msize, unsigned char **data,
|
||||
extern void ixp_unpack_data(unsigned char **msg, int *msize, unsigned char **data,
|
||||
unsigned int datalen);
|
||||
void ixp_pack_prefix(unsigned char *msg, unsigned int size,
|
||||
extern void ixp_pack_prefix(unsigned char *msg, unsigned int size,
|
||||
unsigned char id, unsigned short tag);
|
||||
void ixp_unpack_prefix(unsigned char **msg, unsigned int *size,
|
||||
extern void ixp_unpack_prefix(unsigned char **msg, unsigned int *size,
|
||||
unsigned char *id, unsigned short *tag);
|
||||
void ixp_pack_qid(unsigned char **msg, int *msize, Qid *qid);
|
||||
void ixp_unpack_qid(unsigned char **msg, int *msize, Qid *qid);
|
||||
void ixp_pack_stat(unsigned char **msg, int *msize, Stat *stat);
|
||||
void ixp_unpack_stat(unsigned char **msg, int *msize, Stat *stat);
|
||||
extern void ixp_pack_qid(unsigned char **msg, int *msize, Qid *qid);
|
||||
extern void ixp_unpack_qid(unsigned char **msg, int *msize, Qid *qid);
|
||||
extern void ixp_pack_stat(unsigned char **msg, int *msize, Stat *stat);
|
||||
extern void ixp_unpack_stat(unsigned char **msg, int *msize, Stat *stat);
|
||||
|
||||
/* request.c */
|
||||
void respond(P9Req *r, char *error);
|
||||
void serve_9pcon(IXPConn *c);
|
||||
extern void respond(P9Req *r, char *error);
|
||||
extern void serve_9pcon(IXPConn *c);
|
||||
|
||||
/* intmap.c */
|
||||
void initmap(Intmap *m, unsigned long nhash, void *hash);
|
||||
void incref_map(Intmap *m);
|
||||
void decref_map(Intmap *m);
|
||||
void freemap(Intmap *map, void (*destroy)(void*));
|
||||
void execmap(Intmap *map, void (*destroy)(void*));
|
||||
void* lookupkey(Intmap *map, unsigned long id);
|
||||
void* insertkey(Intmap *map, unsigned long id, void *v);
|
||||
int caninsertkey(Intmap *map, unsigned long id, void *v);
|
||||
void* deletekey(Intmap *map, unsigned long id);
|
||||
extern void initmap(Intmap *m, unsigned long nhash, void *hash);
|
||||
extern void incref_map(Intmap *m);
|
||||
extern void decref_map(Intmap *m);
|
||||
extern void freemap(Intmap *map, void (*destroy)(void*));
|
||||
extern void execmap(Intmap *map, void (*destroy)(void*));
|
||||
extern void* lookupkey(Intmap *map, unsigned long id);
|
||||
extern void* insertkey(Intmap *map, unsigned long id, void *v);
|
||||
extern int caninsertkey(Intmap *map, unsigned long id, void *v);
|
||||
extern void* deletekey(Intmap *map, unsigned long id);
|
||||
|
||||
/* message.c */
|
||||
unsigned short ixp_sizeof_stat(Stat *stat);
|
||||
unsigned int ixp_fcall2msg(void *msg, Fcall *fcall, unsigned int msglen);
|
||||
unsigned int ixp_msg2fcall(Fcall *call, void *msg, unsigned int msglen);
|
||||
extern unsigned short ixp_sizeof_stat(Stat *stat);
|
||||
extern unsigned int ixp_fcall2msg(void *msg, Fcall *fcall, unsigned int msglen);
|
||||
extern unsigned int ixp_msg2fcall(Fcall *call, void *msg, unsigned int msglen);
|
||||
|
||||
/* server.c */
|
||||
IXPConn *ixp_server_open_conn(IXPServer *s, int fd, void *aux,
|
||||
extern IXPConn *ixp_server_open_conn(IXPServer *s, int fd, void *aux,
|
||||
void (*read)(IXPConn *c), void (*close)(IXPConn *c));
|
||||
void ixp_server_close_conn(IXPConn *c);
|
||||
char *ixp_server_loop(IXPServer *s);
|
||||
unsigned int ixp_server_receive_fcall(IXPConn *c, Fcall *fcall);
|
||||
int ixp_server_respond_fcall(IXPConn *c, Fcall *fcall);
|
||||
int ixp_server_respond_error(IXPConn *c, Fcall *fcall, char *errstr);
|
||||
void ixp_server_close(IXPServer *s);
|
||||
extern void ixp_server_close_conn(IXPConn *c);
|
||||
extern char *ixp_server_loop(IXPServer *s);
|
||||
extern unsigned int ixp_server_receive_fcall(IXPConn *c, Fcall *fcall);
|
||||
extern int ixp_server_respond_fcall(IXPConn *c, Fcall *fcall);
|
||||
extern int ixp_server_respond_error(IXPConn *c, Fcall *fcall, char *errstr);
|
||||
extern void ixp_server_close(IXPServer *s);
|
||||
|
||||
/* socket.c */
|
||||
int ixp_connect_sock(char *address);
|
||||
int ixp_create_sock(char *address, char **errstr);
|
||||
extern int ixp_connect_sock(char *address);
|
||||
extern int ixp_create_sock(char *address, char **errstr);
|
||||
|
||||
/* transport.c */
|
||||
unsigned int ixp_send_message(int fd, void *msg, unsigned int msize, char **errstr);
|
||||
unsigned int ixp_recv_message(int fd, void *msg, unsigned int msglen, char **errstr);
|
||||
extern unsigned int ixp_send_message(int fd, void *msg, unsigned int msize, char **errstr);
|
||||
extern unsigned int ixp_recv_message(int fd, void *msg, unsigned int msglen, char **errstr);
|
||||
|
|
|
@ -6,7 +6,7 @@ include ../config.mk
|
|||
CFLAGS += -I../libixp -I../libcext
|
||||
LDFLAGS += -L../libixp -lixp -L../libcext -lcext
|
||||
|
||||
SRC = blitz.c brush.c color.c draw.c font.c input.c
|
||||
SRC = blitz.c brush.c color.c draw.c font.c
|
||||
OBJ = ${SRC:.c=.o}
|
||||
|
||||
all: liblitz.a
|
||||
|
|
|
@ -11,6 +11,13 @@
|
|||
|
||||
#include "blitz.h"
|
||||
|
||||
Bool
|
||||
blitz_ispointinrect(int x, int y, XRectangle * r)
|
||||
{
|
||||
return (x >= r->x) && (x <= r->x + r->width)
|
||||
&& (y >= r->y) && (y <= r->y + r->height);
|
||||
}
|
||||
|
||||
void
|
||||
blitz_selrequest(Blitz *blitz, XSelectionRequestEvent *rq, char *text)
|
||||
{
|
||||
|
|
|
@ -65,61 +65,26 @@ struct BlitzBrush {
|
|||
XRectangle rect; /* relative rect */
|
||||
};
|
||||
|
||||
struct BlitzInput {
|
||||
Blitz *blitz;
|
||||
char *text;
|
||||
char *curstart;
|
||||
char *curend;
|
||||
Cursor cursor;
|
||||
Cursor input;
|
||||
Cursor def;
|
||||
Bool drag;
|
||||
unsigned int size;
|
||||
unsigned int len;
|
||||
unsigned long tdbclk;
|
||||
int xdbclk, ydbclk;
|
||||
int button;
|
||||
Drawable drawable;
|
||||
Window win;
|
||||
GC gc;
|
||||
BlitzColor color;
|
||||
BlitzColor bcolor[3];
|
||||
BlitzFont *font;
|
||||
XRectangle rect; /* relative rect */
|
||||
void *aux;
|
||||
void (*draw)(void *aux);
|
||||
};
|
||||
|
||||
/* blitz.c */
|
||||
unsigned char *blitz_getselection(unsigned long offset,
|
||||
extern unsigned char *blitz_getselection(unsigned long offset,
|
||||
unsigned long *len, unsigned long *remain);
|
||||
void blitz_selrequest(Blitz *blitz, XSelectionRequestEvent *rq, char *text);
|
||||
extern void blitz_selrequest(Blitz *blitz, XSelectionRequestEvent *rq, char *text);
|
||||
|
||||
/* brush.c */
|
||||
void blitz_draw_label(BlitzBrush *b, char *text);
|
||||
void blitz_draw_tile(BlitzBrush *b);
|
||||
extern void blitz_draw_label(BlitzBrush *b, char *text);
|
||||
extern void blitz_draw_tile(BlitzBrush *b);
|
||||
|
||||
/* color.c */
|
||||
int blitz_loadcolor(Blitz *blitz, BlitzColor *c);
|
||||
extern int blitz_loadcolor(Blitz *blitz, BlitzColor *c);
|
||||
|
||||
/* draw.c */
|
||||
void blitz_drawbg(Display *dpy, Drawable drawable, GC gc,
|
||||
extern void blitz_drawbg(Display *dpy, Drawable drawable, GC gc,
|
||||
XRectangle rect, BlitzColor c, Bool border);
|
||||
void blitz_drawcursor(Display *dpy, Drawable drawable, GC gc,
|
||||
extern void blitz_drawcursor(Display *dpy, Drawable drawable, GC gc,
|
||||
int x, int y, unsigned int h, BlitzColor c);
|
||||
|
||||
/* font.c */
|
||||
unsigned int blitz_textwidth(BlitzFont *font, char *text);
|
||||
unsigned int blitz_textwidth_l(BlitzFont *font, char *text, unsigned int len);
|
||||
void blitz_loadfont(Blitz *blitz, BlitzFont *font);
|
||||
unsigned int blitz_labelh(BlitzFont *font);
|
||||
|
||||
/* input.c */
|
||||
void blitz_draw_input(BlitzInput *i);
|
||||
/* blitz_b* functions return True on expose */
|
||||
void blitz_bpress_input(BlitzInput *i, int button, int x, int y);
|
||||
void blitz_brelease_input(BlitzInput *i, int button, int x, int y, unsigned long time);
|
||||
void blitz_bmotion_input(BlitzInput *i, int x, int y);
|
||||
Bool blitz_ispointinrect(int x, int y, XRectangle * r);
|
||||
void blitz_setinput(BlitzInput *i, char *text);
|
||||
void blitz_kpress_input(BlitzInput *i, unsigned long mod, KeySym k, char *text);
|
||||
extern unsigned int blitz_textwidth(BlitzFont *font, char *text);
|
||||
extern unsigned int blitz_textwidth_l(BlitzFont *font, char *text, unsigned int len);
|
||||
extern void blitz_loadfont(Blitz *blitz, BlitzFont *font);
|
||||
extern unsigned int blitz_labelh(BlitzFont *font);
|
||||
|
|
Loading…
Reference in New Issue