Xinqi Bao's Git
94dbd8c293bbcf523b19810912c4e9297906d2e3
1 /* See LICENSE file for copyright and license details. */
4 enum { BarTop
, BarBot
, BarOff
}; /* bar position */
5 enum { CurNormal
, CurResize
, CurMove
, CurLast
}; /* cursor */
6 enum { ColBorder
, ColFG
, ColBG
, ColLast
}; /* color */
7 enum { NetSupported
, NetWMName
, NetLast
}; /* EWMH atoms */
8 enum { WMProtocols
, WMDelete
, WMName
, WMState
, WMLast
};/* default atoms */
11 typedef struct Client Client
;
15 int rx
, ry
, rw
, rh
; /* revert geometry */
16 int basew
, baseh
, incw
, inch
, maxw
, maxh
, minw
, minh
;
17 int minax
, maxax
, minay
, maxay
;
19 unsigned int border
, oldborder
;
20 Bool isbanned
, isfixed
, ismax
, isfloating
, wasfloating
;
30 unsigned long norm
[ColLast
];
31 unsigned long sel
[ColLast
];
41 } DC
; /* draw context */
46 void (*func
)(const char *arg
);
52 void (*arrange
)(void);
67 void applyrules(Client
*c
);
69 void attach(Client
*c
);
70 void attachstack(Client
*c
);
72 void buttonpress(XEvent
*e
);
73 void checkotherwm(void);
75 void compileregs(void);
76 void configure(Client
*c
);
77 void configurenotify(XEvent
*e
);
78 void configurerequest(XEvent
*e
);
79 void destroynotify(XEvent
*e
);
80 void detach(Client
*c
);
81 void detachstack(Client
*c
);
83 void drawsquare(Bool filled
, Bool empty
, unsigned long col
[ColLast
]);
84 void drawtext(const char *text
, unsigned long col
[ColLast
]);
85 void *emallocz(unsigned int size
);
86 void enternotify(XEvent
*e
);
87 void eprint(const char *errstr
, ...);
88 void expose(XEvent
*e
);
89 void floating(void); /* default floating layout */
90 void focus(Client
*c
);
91 void focusnext(const char *arg
);
92 void focusprev(const char *arg
);
93 Client
*getclient(Window w
);
94 unsigned long getcolor(const char *colstr
);
95 long getstate(Window w
);
96 Bool
gettextprop(Window w
, Atom atom
, char *text
, unsigned int size
);
97 void grabbuttons(Client
*c
, Bool focused
);
98 unsigned int idxoftag(const char *tag
);
99 void initfont(const char *fontstr
);
100 Bool
isarrange(void (*func
)());
101 Bool
isoccupied(unsigned int t
);
102 Bool
isprotodel(Client
*c
);
103 Bool
isvisible(Client
*c
);
104 void keypress(XEvent
*e
);
105 void killclient(const char *arg
);
106 void leavenotify(XEvent
*e
);
107 void manage(Window w
, XWindowAttributes
*wa
);
108 void mappingnotify(XEvent
*e
);
109 void maprequest(XEvent
*e
);
110 void movemouse(Client
*c
);
111 Client
*nexttiled(Client
*c
);
112 void propertynotify(XEvent
*e
);
113 void quit(const char *arg
);
114 void resize(Client
*c
, int x
, int y
, int w
, int h
, Bool sizehints
);
115 void resizemouse(Client
*c
);
119 void setclientstate(Client
*c
, long state
);
120 void setlayout(const char *arg
);
121 void setmwfact(const char *arg
);
123 void spawn(const char *arg
);
124 void tag(const char *arg
);
125 unsigned int textnw(const char *text
, unsigned int len
);
126 unsigned int textw(const char *text
);
128 void togglebar(const char *arg
);
129 void togglefloating(const char *arg
);
130 void togglemax(const char *arg
);
131 void toggletag(const char *arg
);
132 void toggleview(const char *arg
);
133 void unban(Client
*c
);
134 void unmanage(Client
*c
);
135 void unmapnotify(XEvent
*e
);
136 void updatebarpos(void);
137 void updatesizehints(Client
*c
);
138 void updatetitle(Client
*c
);
139 void view(const char *arg
);
140 void viewprevtag(const char *arg
); /* views previous selected tags */
141 int xerror(Display
*dpy
, XErrorEvent
*ee
);
142 int xerrordummy(Display
*dsply
, XErrorEvent
*ee
);
143 int xerrorstart(Display
*dsply
, XErrorEvent
*ee
);
144 void zoom(const char *arg
);
149 int screen
, sx
, sy
, sw
, sh
, wax
, way
, waw
, wah
;
150 int (*xerrorxlib
)(Display
*, XErrorEvent
*);
151 unsigned int bh
, bpos
;
152 unsigned int blw
= 0;
153 unsigned int ltidx
= 0; /* default */
154 unsigned int nlayouts
= 0;
155 unsigned int nrules
= 0;
156 unsigned int numlockmask
= 0;
157 void (*handler
[LASTEvent
]) (XEvent
*) = {
158 [ButtonPress
] = buttonpress
,
159 [ConfigureRequest
] = configurerequest
,
160 [ConfigureNotify
] = configurenotify
,
161 [DestroyNotify
] = destroynotify
,
162 [EnterNotify
] = enternotify
,
163 [LeaveNotify
] = leavenotify
,
165 [KeyPress
] = keypress
,
166 [MappingNotify
] = mappingnotify
,
167 [MapRequest
] = maprequest
,
168 [PropertyNotify
] = propertynotify
,
169 [UnmapNotify
] = unmapnotify
171 Atom wmatom
[WMLast
], netatom
[NetLast
];
172 Bool otherwm
, readin
;
174 Bool selscreen
= True
;
175 Client
*clients
= NULL
;
177 Client
*stack
= NULL
;
178 Cursor cursor
[CurLast
];
184 /* configuration, allows nested code to access above variables */
187 /* statically define the number of tags. */
188 unsigned int ntags
= sizeof tags
/ sizeof tags
[0];
189 Bool seltags
[sizeof tags
/ sizeof tags
[0]] = {[0] = True
};
190 Bool prevtags
[sizeof tags
/ sizeof tags
[0]] = {[0] = True
};