Xinqi Bao's Git
projects
/
dwm.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
keep master ratio on resizecol -> arrange
[dwm.git]
/
main.c
diff --git
a/main.c
b/main.c
index
d2da0c1
..
53a7c3c
100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-19,13
+19,14
@@
char stext[1024];
Bool *seltag;
char stext[1024];
Bool *seltag;
-int
screen, sx, sy, sw, sh, bx, by, bw, bh, mw
;
-unsigned int
ntags, numlockmask, modew
;
+int
bx, by, bw, bh, bmw, masterd, screen, sx, sy, sw, sh
;
+unsigned int
master, ntags, numlockmask
;
Atom wmatom[WMLast], netatom[NetLast];
Bool running = True;
Bool issel = True;
Client *clients = NULL;
Client *sel = NULL;
Atom wmatom[WMLast], netatom[NetLast];
Bool running = True;
Bool issel = True;
Client *clients = NULL;
Client *sel = NULL;
+Client *stack = NULL;
Cursor cursor[CurLast];
Display *dpy;
DC dc = {0};
Cursor cursor[CurLast];
Display *dpy;
DC dc = {0};
@@
-37,8
+38,7
@@
static int (*xerrorxlib)(Display *, XErrorEvent *);
static Bool otherwm, readin;
static void
static Bool otherwm, readin;
static void
-cleanup()
-{
+cleanup(void) {
close(STDIN_FILENO);
while(sel) {
resize(sel, True, TopLeft);
close(STDIN_FILENO);
while(sel) {
resize(sel, True, TopLeft);
@@
-54,11
+54,11
@@
cleanup()
XDestroyWindow(dpy, barwin);
XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
XSync(dpy, False);
XDestroyWindow(dpy, barwin);
XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
XSync(dpy, False);
+ free(seltag);
}
static void
}
static void
-scan()
-{
+scan(void) {
unsigned int i, num;
Window *wins, d1, d2;
XWindowAttributes wa;
unsigned int i, num;
Window *wins, d1, d2;
XWindowAttributes wa;
@@
-79,8
+79,7
@@
scan()
}
static void
}
static void
-setup()
-{
+setup(void) {
int i, j;
unsigned int mask;
Window w;
int i, j;
unsigned int mask;
Window w;
@@
-109,7
+108,8
@@
setup()
}
XFree(modmap);
}
XFree(modmap);
- wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask | EnterWindowMask | LeaveWindowMask;
+ wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
+ | EnterWindowMask | LeaveWindowMask;
wa.cursor = cursor[CurNormal];
XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa);
wa.cursor = cursor[CurNormal];
XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa);
@@
-128,12
+128,15
@@
setup()
dc.status[ColBG] = getcolor(STATUSBGCOLOR);
dc.status[ColFG] = getcolor(STATUSFGCOLOR);
setfont(FONT);
dc.status[ColBG] = getcolor(STATUSBGCOLOR);
dc.status[ColFG] = getcolor(STATUSFGCOLOR);
setfont(FONT);
-
- modew = textw(FLOATSYMBOL) > textw(TILESYMBOL) ? textw(FLOATSYMBOL) : textw(TILESYMBOL);
+
+ bmw = textw(VSTACKSYMBOL) > textw(BSTACKSYMBOL) ?
+ textw(VSTACKSYMBOL) : textw(BSTACKSYMBOL);
+ bmw = bmw > textw(FLOATSYMBOL) ?
+ bmw : textw(FLOATSYMBOL);
sx = sy = 0;
sw = DisplayWidth(dpy, screen);
sh = DisplayHeight(dpy, screen);
sx = sy = 0;
sw = DisplayWidth(dpy, screen);
sh = DisplayHeight(dpy, screen);
- m
w = (sw * MASTERW) / 100
;
+ m
aster = MASTER
;
bx = by = 0;
bw = sw;
bx = by = 0;
bw = sw;
@@
-160,8
+163,7
@@
setup()
* is already running.
*/
static int
* is already running.
*/
static int
-xerrorstart(Display *dsply, XErrorEvent *ee)
-{
+xerrorstart(Display *dsply, XErrorEvent *ee) {
otherwm = True;
return -1;
}
otherwm = True;
return -1;
}
@@
-169,8
+171,7
@@
xerrorstart(Display *dsply, XErrorEvent *ee)
/* extern */
int
/* extern */
int
-getproto(Window w)
-{
+getproto(Window w) {
int i, format, protos, status;
unsigned long extra, res;
Atom *protocols, real;
int i, format, protos, status;
unsigned long extra, res;
Atom *protocols, real;
@@
-188,8
+189,7
@@
getproto(Window w)
}
void
}
void
-sendevent(Window w, Atom a, long value)
-{
+sendevent(Window w, Atom a, long value) {
XEvent e;
e.type = ClientMessage;
XEvent e;
e.type = ClientMessage;
@@
-203,35
+203,33
@@
sendevent(Window w, Atom a, long value)
}
void
}
void
-quit(Arg *arg)
-{
+quit(Arg *arg) {
readin = running = False;
}
/*
* There's no way to check accesses to destroyed windows, thus those cases are
* ignored (especially on UnmapNotify's). Other types of errors call Xlibs
readin = running = False;
}
/*
* There's no way to check accesses to destroyed windows, thus those cases are
* ignored (especially on UnmapNotify's). Other types of errors call Xlibs
- * default error handler, which
calls exit()
.
+ * default error handler, which
may call exit
.
*/
int
*/
int
-xerror(Display *dpy, XErrorEvent *ee)
-{
+xerror(Display *dpy, XErrorEvent *ee) {
if(ee->error_code == BadWindow
|| (ee->request_code == X_SetInputFocus && ee->error_code == BadMatch)
|| (ee->request_code == X_PolyText8 && ee->error_code == BadDrawable)
|| (ee->request_code == X_PolyFillRectangle && ee->error_code == BadDrawable)
|| (ee->request_code == X_PolySegment && ee->error_code == BadDrawable)
|| (ee->request_code == X_ConfigureWindow && ee->error_code == BadMatch)
if(ee->error_code == BadWindow
|| (ee->request_code == X_SetInputFocus && ee->error_code == BadMatch)
|| (ee->request_code == X_PolyText8 && ee->error_code == BadDrawable)
|| (ee->request_code == X_PolyFillRectangle && ee->error_code == BadDrawable)
|| (ee->request_code == X_PolySegment && ee->error_code == BadDrawable)
|| (ee->request_code == X_ConfigureWindow && ee->error_code == BadMatch)
- || (ee->request_code == X_GrabKey && ee->error_code == BadAccess))
+ || (ee->request_code == X_GrabKey && ee->error_code == BadAccess)
+ || (ee->request_code == X_CopyArea && ee->error_code == BadDrawable))
return 0;
fprintf(stderr, "dwm: fatal error: request code=%d, error code=%d\n",
ee->request_code, ee->error_code);
return 0;
fprintf(stderr, "dwm: fatal error: request code=%d, error code=%d\n",
ee->request_code, ee->error_code);
- return xerrorxlib(dpy, ee); /* may call exit
()
*/
+ return xerrorxlib(dpy, ee); /* may call exit */
}
int
}
int
-main(int argc, char *argv[])
-{
+main(int argc, char *argv[]) {
int r, xfd;
fd_set rd;
int r, xfd;
fd_set rd;