Have wmiimenu take colors from WMII_(NORM FOCUS)COLORS. Get rid of 'extern' from function decls.

This commit is contained in:
Kris Maglione 2007-02-23 23:09:58 -05:00
parent e4cf02d8f4
commit 2c387d4d99
12 changed files with 165 additions and 162 deletions

2
bar.c
View File

@ -31,7 +31,7 @@ create_bar(Bar **b_link, char *name) {
break;
b->next = *i;
*i = b;
return b;
}

View File

@ -254,7 +254,7 @@ unmap_client(Client *c, int state) {
void
set_cursor(Client *c, Cursor cur) {
XSetWindowAttributes wa;
if(c->cursor != cur) {
c->cursor = cur;
wa.cursor = cur;
@ -413,13 +413,15 @@ prop_client(Client *c, XPropertyEvent *e) {
void
gravitate_client(Client *c, Bool invert) {
int dx = 0, dy = 0;
int gravity = NorthWestGravity;
int dx, dy;
int gravity;
gravity = NorthWestGravity;
if(c->size.flags & PWinGravity) {
gravity = c->size.win_gravity;
}
/* y */
dy = 0;
switch (gravity) {
case StaticGravity:
case NorthWestGravity:
@ -440,7 +442,8 @@ gravitate_client(Client *c, Bool invert) {
default:
break;
}
/* x */
dx = 0;
switch (gravity) {
case StaticGravity:
case NorthWestGravity:

View File

@ -44,7 +44,7 @@ buttonpress(XEvent *e) {
Frame *f;
Bool inclient;
XButtonPressedEvent *ev;
ev = &e->xbutton;
if((f = frame_of_win(ev->window))) {
inclient = (ev->subwindow == f->client->win);
@ -344,7 +344,7 @@ static void
motionnotify(XEvent *e) {
XMotionEvent *ev = &e->xmotion;
Frame *f;
if((f = frame_of_win(ev->window)))
set_frame_cursor(f, ev->x, ev->y);
}

View File

@ -78,16 +78,16 @@ resize_frame(Frame *f, XRectangle *r) {
f->rect = *r;
f->crect = *r;
match_sizehints(c, &f->crect, f->area->floating, stickycorner);
if(f->area->floating)
f->rect = f->crect;
if(f->rect.height < frame_delta_h() + labelh(&def.font)) {
f->rect.height = frame_delta_h();
f->collapsed = True;
}else
f->collapsed = False;
if(f->rect.width < labelh(&def.font)) {
f->rect.width = frame_delta_h();
f->collapsed = True;
@ -251,7 +251,7 @@ draw_frame(Frame *f) {
br.rect.width -= br.rect.x;
br.rect.height = labelh(&def.font);
draw_label(&br, f->client->name);
br.border = 1;
br.rect.width += br.rect.x;
br.rect.x = 0;

4
fs.c
View File

@ -202,12 +202,12 @@ write_to_buf(P9Req *r, void *buf, uint *len, uint max) {
count = max - offset;
*len = offset + count;
if(max == 0) {
*(void **)buf = erealloc(*(void **)buf, *len + 1);
buf = *(void **)buf;
}
memcpy(buf + offset, r->ifcall.data, count);
r->ofcall.count = count;
((char *)buf)[offset+count] = '\0';

3
key.c
View File

@ -195,7 +195,8 @@ void
kpress(Window w, ulong mod, KeyCode keycode) {
Key *k, *found;
for(k=key; k; k->tnext=k->lnext, k=k->lnext);
for(k=key; k; k=k->lnext)
k->tnext=k->lnext;
found = match_keys(key, mod, keycode, False);
if(!found) {
XBell(blz.dpy, 0);

3
main.c
View File

@ -18,9 +18,6 @@
#include <sys/wait.h>
#include <unistd.h>
Bool verbose;
Bool starting;
Client c_magic = { 0 };
static Bool check_other_wm;
static int (*x_error_handler) (Display *, XErrorEvent *);
static char version[] = "wmiiwm - " VERSION ", (C)opyright MMIV-MMVI Anselm R. Garbe\n";

14
mouse.c
View File

@ -67,16 +67,16 @@ typedef struct {
static void
snap_line(SnapArgs *a) {
int i, t_xy;
/* horizontal */
if(a->y1 == a->y2 && (a->mask & (NORTH|SOUTH))) {
for(i=0; i < a->num; i++) {
if(!(r_east(&a->rects[i]) < a->x1) ||
(a->rects[i].x > a->x2)) {
if(abs(a->rects[i].y - a->y1) <= abs(*a->delta))
*a->delta = a->rects[i].y - a->y1;
t_xy = r_south(&a->rects[i]);
if(abs(t_xy - a->y1) < abs(*a->delta))
*a->delta = t_xy - a->y1;
@ -89,10 +89,10 @@ snap_line(SnapArgs *a) {
for(i=0; i < a->num; i++) {
if(!(r_south(&a->rects[i]) < a->y1) ||
(a->rects[i].y > a->y2)) {
if(abs(a->rects[i].x - a->x1) <= abs(*a->delta))
*a->delta = a->rects[i].x - a->x1;
t_xy = r_east(&a->rects[i]);
if(abs(t_xy - a->x1) < abs(*a->delta))
*a->delta = t_xy - a->x1;
@ -120,7 +120,7 @@ snap_rect(XRectangle *rects, int num, XRectangle *current,
a.y2 = a.y1 = r_south(current);
snap_line(&a);
}
a.y1 = current->y;
a.y2 = r_south(current);
a.delta = &dx;
@ -132,7 +132,7 @@ snap_rect(XRectangle *rects, int num, XRectangle *current,
a.x1 = a.x2 = current->x;
snap_line(&a);
}
rect_morph_xy(current, abs(dx) <= snap ? dx : 0,
abs(dy) <= snap ? dy : 0, mask);

View File

@ -130,7 +130,7 @@ ServerTime(Time time)
if(0)
sprintf(buffer, "%lu day%s %02lu:%02lu:%02lu.%03lu",
day, day == 1 ? "" : "(s)", hr, min, sec, msec);
sprintf(buffer, "%lud%luh%lum%lu.%03lds", day, hr, min, sec, msec);
return (buffer);
}
@ -773,7 +773,7 @@ VerbVisibility(XVisibilityEvent *ev)
char *eventtype(XEvent *ev)
{
static char buffer[20];
switch (ev->type) {
case KeyPress:
return ("KeyPress");

View File

@ -11,14 +11,16 @@ LEFT=h
RIGHT=l
WMII_FONT='fixed'
WMII_NORMCOLORS='#222222 #5FBF77 #2A7F3F'
WMII_FOCUSCOLORS='#ffffff #153F1F #2A7F3F'
WMII_NORMCOLORS=('#222222' '#5FBF77' '#2A7F3F')
WMII_FOCUSCOLORS=('#ffffff' '#153F1F' '#2A7F3F')
WMII_BACKGROUND='#333333'
WMII_TERM=(xterm)
fn wmiimenu {
dmenu -b -fn $WMII_FONT -nb '#5FBF7e' -nf '#222222' -sb '#153F1F' -sf '#ffffff'
dmenu -b -fn $WMII_FONT \
-nf $WMII_NORMCOLORS(1) -nb $WMII_NORMCOLORS(2) \
-sf $WMII_FOCUSCOLORS(1) -sb $WMII_FOCUSCOLORS(2)
}
# Column Rules

2
rule.c
View File

@ -20,7 +20,7 @@ void
trim(char *str, const char *chars) {
const char *cp;
char *sp, *sn;
for(cp = chars; *cp; cp++) {
for(sp = sn = str; *sn; sn++) {
if(*sn != *cp)

262
wmii.h
View File

@ -260,172 +260,172 @@ Pixmap pmap;
void (*handler[LASTEvent]) (XEvent *);
/* Misc */
extern Bool starting;
extern Bool verbose;
Bool starting;
Bool verbose;
/* wm.c */
extern char *message_root(char *message);
char *message_root(char *message);
/* area.c */
extern Area *create_area(View *v, Area *pos, uint w);
extern void destroy_area(Area *a);
extern Area *area_of_id(View *t, ushort id);
extern void focus_area(Area *a);
extern char *select_area(Area *a, char *arg);
extern void send_to_area(Area *to, Frame *f);
extern void attach_to_area(Area *a, Frame *f, Bool send);
extern void detach_from_area(Frame *f);
extern Client *sel_client_of_area(Area *a);
Area *create_area(View *v, Area *pos, uint w);
void destroy_area(Area *a);
Area *area_of_id(View *t, ushort id);
void focus_area(Area *a);
char *select_area(Area *a, char *arg);
void send_to_area(Area *to, Frame *f);
void attach_to_area(Area *a, Frame *f, Bool send);
void detach_from_area(Frame *f);
Client *sel_client_of_area(Area *a);
/* bar.c */
extern Bar *create_bar(Bar **b_link, char *name);
extern void destroy_bar(Bar **b_link, Bar *b);
extern void draw_bar(WMScreen *s);
Bar *create_bar(Bar **b_link, char *name);
void destroy_bar(Bar **b_link, Bar *b);
void draw_bar(WMScreen *s);
void draw_border(BlitzBrush *b);
extern void resize_bar();
extern Bar *bar_of_name(Bar *b_link, const char *name);
void resize_bar();
Bar *bar_of_name(Bar *b_link, const char *name);
/* client.c */
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 map_client(Client *c);
extern void unmap_client(Client *c, int state);
extern void map_frame(Client *c);
extern void unmap_frame(Client *c);
extern void set_cursor(Client *c, Cursor cur);
extern void focus_frame(Frame *f, Bool restack);
extern void reparent_client(Client *c, Window w, int x, int y);
extern void manage_client(Client *c);
extern void focus(Client *c, Bool restack);
extern void focus_client(Client *c);
extern void resize_client(Client *c, XRectangle *r);
extern void match_sizehints(Client *c, XRectangle *r, Bool floating, BlitzAlign sticky);
extern char *send_client(Frame *f, char *arg, Bool swap);
extern char * message_client(Client *c, char *message);
extern void move_client(Client *c, char *arg);
extern void size_client(Client *c, char *arg);
extern Client *sel_client();
extern Frame *frame_of_win(Window w);
extern Client *client_of_win(Window w);
extern void update_client_grab(Client *c);
extern void apply_rules(Client *c);
extern void apply_tags(Client *c, const char *tags);
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 map_client(Client *c);
void unmap_client(Client *c, int state);
void map_frame(Client *c);
void unmap_frame(Client *c);
void set_cursor(Client *c, Cursor cur);
void focus_frame(Frame *f, Bool restack);
void reparent_client(Client *c, Window w, int x, int y);
void manage_client(Client *c);
void focus(Client *c, Bool restack);
void focus_client(Client *c);
void resize_client(Client *c, XRectangle *r);
void match_sizehints(Client *c, XRectangle *r, Bool floating, BlitzAlign sticky);
char *send_client(Frame *f, char *arg, Bool swap);
char * message_client(Client *c, char *message);
void move_client(Client *c, char *arg);
void size_client(Client *c, char *arg);
Client *sel_client();
Frame *frame_of_win(Window w);
Client *client_of_win(Window w);
void update_client_grab(Client *c);
void apply_rules(Client *c);
void apply_tags(Client *c, const char *tags);
/* column.c */
extern void arrange_column(Area *a, Bool dirty);
extern void resize_column(Client *c, XRectangle *r);
extern int column_mode_of_str(char *arg);
extern char *str_of_column_mode(int mode);
extern Area *new_column(View *v, Area *pos, uint w);
void arrange_column(Area *a, Bool dirty);
void resize_column(Client *c, XRectangle *r);
int column_mode_of_str(char *arg);
char *str_of_column_mode(int mode);
Area *new_column(View *v, Area *pos, uint w);
/* draw.c */
extern int loadcolor(Blitz *blitz, BlitzColor *c);
extern void draw_label(BlitzBrush *b, char *text);
extern void draw_tile(BlitzBrush *b);
extern void draw_rect(BlitzBrush *b);
int loadcolor(Blitz *blitz, BlitzColor *c);
void draw_label(BlitzBrush *b, char *text);
void draw_tile(BlitzBrush *b);
void draw_rect(BlitzBrush *b);
extern void drawbg(Display *dpy, Drawable drawable, GC gc,
void drawbg(Display *dpy, Drawable drawable, GC gc,
XRectangle *rect, BlitzColor c, Bool fill, Bool border);
extern void drawcursor(Display *dpy, Drawable drawable, GC gc,
void drawcursor(Display *dpy, Drawable drawable, GC gc,
int x, int y, uint h, BlitzColor c);
extern uint textwidth(BlitzFont *font, char *text);
extern uint textwidth_l(BlitzFont *font, char *text, uint len);
extern void loadfont(Blitz *blitz, BlitzFont *font);
extern uint labelh(BlitzFont *font);
extern char *parse_colors(char **buf, int *buflen, BlitzColor *col);
uint textwidth(BlitzFont *font, char *text);
uint textwidth_l(BlitzFont *font, char *text, uint len);
void loadfont(Blitz *blitz, BlitzFont *font);
uint labelh(BlitzFont *font);
char *parse_colors(char **buf, int *buflen, BlitzColor *col);
/* event.c */
extern void check_x_event(IXPConn *c);
extern uint flush_masked_events(long even_mask);
void check_x_event(IXPConn *c);
uint flush_masked_events(long even_mask);
/* frame.c */
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 resize_frame(Frame *f, XRectangle *r);
extern Bool frame_to_top(Frame *f);
extern void set_frame_cursor(Frame *f, int x, int y);
extern void swap_frames(Frame *fa, Frame *fb);
extern int frame_delta_h();
extern void draw_frame(Frame *f);
extern void draw_frames();
extern void update_frame_widget_colors(Frame *f);
Frame *create_frame(Client *c, View *v);
void remove_frame(Frame *f);
void insert_frame(Frame *pos, Frame *f, Bool before);
void resize_frame(Frame *f, XRectangle *r);
Bool frame_to_top(Frame *f);
void set_frame_cursor(Frame *f, int x, int y);
void swap_frames(Frame *fa, Frame *fb);
int frame_delta_h();
void draw_frame(Frame *f);
void draw_frames();
void update_frame_widget_colors(Frame *f);
void check_frame_constraints(XRectangle *rect);
/* fs.c */
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, ...);
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, ...);
/* geom.c */
extern Bool ispointinrect(int x, int y, XRectangle * r);
extern BlitzAlign quadofcoord(XRectangle *rect, int x, int y);
extern Cursor cursor_of_quad(BlitzAlign align);
extern int strtorect(XRectangle *r, const char *val);
extern BlitzAlign get_sticky(XRectangle *src, XRectangle *dst);
extern int r_east(XRectangle *r);
extern int r_south(XRectangle *r);
Bool ispointinrect(int x, int y, XRectangle * r);
BlitzAlign quadofcoord(XRectangle *rect, int x, int y);
Cursor cursor_of_quad(BlitzAlign align);
int strtorect(XRectangle *r, const char *val);
BlitzAlign get_sticky(XRectangle *src, XRectangle *dst);
int r_east(XRectangle *r);
int r_south(XRectangle *r);
/* key.c */
extern void kpress(Window w, ulong mod, KeyCode keycode);
extern void update_keys();
extern void init_lock_keys();
extern ulong mod_key_of_str(char *val);
void kpress(Window w, ulong mod, KeyCode keycode);
void update_keys();
void init_lock_keys();
ulong mod_key_of_str(char *val);
/* mouse.c */
extern void do_mouse_resize(Client *c, Bool grabbox, BlitzAlign align);
extern void grab_mouse(Window w, ulong mod, ulong button);
extern void ungrab_mouse(Window w, ulong mod, uint button);
extern BlitzAlign snap_rect(XRectangle *rects, int num, XRectangle *current,
void do_mouse_resize(Client *c, Bool grabbox, BlitzAlign align);
void grab_mouse(Window w, ulong mod, ulong button);
void ungrab_mouse(Window w, ulong mod, uint button);
BlitzAlign snap_rect(XRectangle *rects, int num, XRectangle *current,
BlitzAlign *mask, int snap);
extern void grab_button(Window w, uint button, ulong mod);
void grab_button(Window w, uint button, ulong mod);
/* rule.c */
extern void update_rules(Rule **rule, const char *data);
extern void trim(char *str, const char *chars);
void update_rules(Rule **rule, const char *data);
void trim(char *str, const char *chars);
/* util.c */
extern uint tokenize(char *res[], uint reslen, char *str, char delim);
extern char *estrdup(const char *str);
extern void *erealloc(void *ptr, uint size);
extern void *emallocz(uint size);
extern void *emalloc(uint size);
extern void fatal(const char *fmt, ...);
extern int max(int a, int b);
extern char *str_nil(char *s);
uint tokenize(char *res[], uint reslen, char *str, char delim);
char *estrdup(const char *str);
void *erealloc(void *ptr, uint size);
void *emallocz(uint size);
void *emalloc(uint size);
void fatal(const char *fmt, ...);
int max(int a, int b);
char *str_nil(char *s);
/* view.c */
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, uint *num, Frame *ignore);
extern View *view_of_id(ushort 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 uchar *view_index(View *v);
extern void destroy_view(View *v);
extern void update_views();
extern uint newcolw_of_view(View *v);
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, uint *num, Frame *ignore);
View *view_of_id(ushort 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);
uchar *view_index(View *v);
void destroy_view(View *v);
void update_views();
uint newcolw_of_view(View *v);
/* wm.c */
extern int wmii_error_handler(Display *dpy, XErrorEvent *error);
extern int win_proto(Window w);
int wmii_error_handler(Display *dpy, XErrorEvent *error);
int win_proto(Window w);