dwm-meillo

annotate dwm.h @ 65:4f7b232bd72d

if stdin writer stops working, dwm consumed much IO load because it still tried to select on this fd, fixed
author Anselm R. Garbe <garbeam@wmii.de>
date Fri, 14 Jul 2006 17:30:37 +0200
parents 5d4653de9a1c
children 50450aa24a46
rev   line source
garbeam@0 1 /*
garbeam@0 2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
garbeam@0 3 * See LICENSE file for license details.
garbeam@0 4 */
garbeam@0 5
garbeam@32 6 #include <X11/Xlib.h>
garbeam@2 7
garbeam@32 8 /********** CUSTOMIZE **********/
garbeam@0 9
garbeam@51 10 #define FONT "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*"
garbeam@51 11 #define BGCOLOR "#666699"
garbeam@59 12 #define FGCOLOR "#eeeeee"
garbeam@51 13 #define BORDERCOLOR "#9999CC"
garbeam@51 14 #define MASTERW 52 /* percent */
garbeam@51 15 #define WM_PROTOCOL_DELWIN 1
garbeam@13 16
garbeam@32 17 /* tags */
garbeam@59 18 enum { Tscratch, Tdev, Twww, Twork, TLast };
garbeam@32 19
garbeam@32 20 /********** CUSTOMIZE **********/
garbeam@32 21
garbeam@51 22 typedef union Arg Arg;
garbeam@34 23 typedef struct DC DC;
garbeam@18 24 typedef struct Client Client;
garbeam@32 25 typedef struct Fnt Fnt;
garbeam@18 26 typedef struct Key Key;
garbeam@51 27 typedef struct Rule Rule;
garbeam@49 28
garbeam@49 29 union Arg {
garbeam@49 30 const char **argv;
garbeam@49 31 int i;
garbeam@49 32 };
garbeam@18 33
garbeam@5 34 /* atoms */
garbeam@13 35 enum { WMProtocols, WMDelete, WMLast };
garbeam@0 36 enum { NetSupported, NetWMName, NetLast };
garbeam@0 37
garbeam@5 38 /* cursor */
garbeam@0 39 enum { CurNormal, CurResize, CurMove, CurInput, CurLast };
garbeam@0 40
garbeam@32 41 struct Fnt {
garbeam@32 42 XFontStruct *xfont;
garbeam@32 43 XFontSet set;
garbeam@32 44 int ascent;
garbeam@32 45 int descent;
garbeam@32 46 int height;
garbeam@32 47 };
garbeam@32 48
garbeam@34 49 struct DC { /* draw context */
garbeam@32 50 GC gc;
garbeam@32 51 Drawable drawable;
garbeam@32 52 int x, y, w, h;
garbeam@32 53 Fnt font;
garbeam@32 54 unsigned long bg;
garbeam@32 55 unsigned long fg;
garbeam@32 56 unsigned long border;
garbeam@32 57 };
garbeam@32 58
garbeam@0 59 struct Client {
garbeam@31 60 char name[256];
garbeam@31 61 char *tags[TLast];
garbeam@13 62 int proto;
garbeam@20 63 int x, y, w, h;
garbeam@22 64 int tx, ty, tw, th;
garbeam@20 65 int basew, baseh, incw, inch, maxw, maxh, minw, minh;
garbeam@29 66 int grav;
garbeam@29 67 unsigned int border;
garbeam@20 68 long flags;
garbeam@53 69 Bool floating;
garbeam@0 70 Window win;
garbeam@0 71 Window title;
garbeam@0 72 Client *next;
garbeam@50 73 Client *revert;
garbeam@0 74 };
garbeam@0 75
garbeam@51 76 struct Rule {
garbeam@51 77 const char *class;
garbeam@51 78 const char *instance;
garbeam@51 79 char *tags[TLast];
garbeam@53 80 Bool floating;
garbeam@51 81 };
garbeam@51 82
garbeam@8 83 struct Key {
garbeam@8 84 unsigned long mod;
garbeam@8 85 KeySym keysym;
garbeam@49 86 void (*func)(Arg *arg);
garbeam@49 87 Arg arg;
garbeam@8 88 };
garbeam@8 89
garbeam@0 90 extern Display *dpy;
garbeam@57 91 extern Window root, barwin;
garbeam@13 92 extern Atom wm_atom[WMLast], net_atom[NetLast];
garbeam@0 93 extern Cursor cursor[CurLast];
garbeam@31 94 extern Bool running, issel;
garbeam@53 95 extern void (*handler[LASTEvent])(XEvent *);
garbeam@53 96 extern void (*arrange)(Arg *);
garbeam@0 97
garbeam@57 98 extern int tsel, screen, sx, sy, sw, sh, bx, by, bw, bh, mw;
garbeam@57 99 extern char *tags[TLast], stext[1024];
garbeam@3 100
garbeam@34 101 extern DC dc;
garbeam@50 102 extern Client *clients, *sel;
garbeam@3 103
garbeam@57 104 /* bar.c */
garbeam@57 105 extern void draw_bar();
garbeam@58 106 extern void barclick(XButtonPressedEvent *e);
garbeam@57 107
garbeam@5 108 /* client.c */
garbeam@10 109 extern void manage(Window w, XWindowAttributes *wa);
garbeam@13 110 extern void unmanage(Client *c);
garbeam@13 111 extern Client *getclient(Window w);
garbeam@13 112 extern void focus(Client *c);
garbeam@13 113 extern void update_name(Client *c);
garbeam@16 114 extern void draw_client(Client *c);
garbeam@52 115 extern void resize(Client *c, Bool inc);
garbeam@20 116 extern void update_size(Client *c);
garbeam@23 117 extern Client *gettitle(Window w);
garbeam@32 118 extern void craise(Client *c);
garbeam@26 119 extern void lower(Client *c);
garbeam@49 120 extern void ckill(Arg *arg);
garbeam@49 121 extern void nextc(Arg *arg);
garbeam@49 122 extern void prevc(Arg *arg);
garbeam@49 123 extern void max(Arg *arg);
garbeam@49 124 extern void floating(Arg *arg);
garbeam@49 125 extern void tiling(Arg *arg);
garbeam@53 126 extern void ttrunc(Arg *arg);
garbeam@53 127 extern void tappend(Arg *arg);
garbeam@50 128 extern void view(Arg *arg);
garbeam@50 129 extern void zoom(Arg *arg);
garbeam@29 130 extern void gravitate(Client *c, Bool invert);
garbeam@13 131
garbeam@33 132 /* draw.c */
garbeam@57 133 extern void drawtext(const char *text, Bool border);
garbeam@43 134 extern unsigned long initcolor(const char *colstr);
garbeam@43 135 extern void initfont(const char *fontstr);
garbeam@43 136 extern unsigned int textnw(char *text, unsigned int len);
garbeam@43 137 extern unsigned int textw(char *text);
garbeam@43 138 extern unsigned int texth(void);
garbeam@33 139
garbeam@42 140 /* dev.c */
garbeam@33 141 extern void update_keys(void);
garbeam@9 142 extern void keypress(XEvent *e);
garbeam@18 143 extern void mresize(Client *c);
garbeam@18 144 extern void mmove(Client *c);
garbeam@18 145
garbeam@43 146 /* main.c */
garbeam@43 147 extern int error_handler(Display *dsply, XErrorEvent *e);
garbeam@43 148 extern void send_message(Window w, Atom a, long value);
garbeam@43 149 extern int win_proto(Window w);
garbeam@49 150 extern void quit(Arg *arg);
garbeam@43 151
garbeam@32 152 /* util.c */
garbeam@33 153 extern void error(const char *errstr, ...);
garbeam@32 154 extern void *emallocz(unsigned int size);
garbeam@49 155 extern void spawn(Arg *arg);
garbeam@32 156 extern void swap(void **p1, void **p2);