Compare commits
19 Commits
Author | SHA1 | Date | |
---|---|---|---|
9ed5de00b6 | |||
28ffff801b | |||
44ef3f5a07 | |||
dafbd0dcb0 | |||
2ddc78720a | |||
7ece30ebc0 | |||
3d48f33025 | |||
19fd903d40 | |||
5732e471ae | |||
042297b27b | |||
a5cb80b86c | |||
7e98db251e | |||
bced9077f9 | |||
82fed986f9 | |||
2c1db7ed35 | |||
ea4827a578 | |||
55be4d6137 | |||
1f18466409 | |||
b65a1e3379 |
4
.hgtags
4
.hgtags
@ -31,3 +31,7 @@ c7f84f23ec5aef29988dcdc4ec22a7352ee8f58e 2.5.1
|
|||||||
3a5910fac3ccb522a98aeeba7af7008530b25092 2.9
|
3a5910fac3ccb522a98aeeba7af7008530b25092 2.9
|
||||||
76b58d21ea98257c05565a3b9c850b9b26a32968 3.0
|
76b58d21ea98257c05565a3b9c850b9b26a32968 3.0
|
||||||
e1c8bef05e6e48df4f26471ea0712aa43ab9d949 3.1
|
e1c8bef05e6e48df4f26471ea0712aa43ab9d949 3.1
|
||||||
|
4ce65f61f01b055fa6c2901c6d2527ef741aa4bf 3.2
|
||||||
|
f2cabc83a18f9b5b548159329ddd4dee904fa31f 3.2.1
|
||||||
|
d3876aa792923f9a95f7ad0c7f0134533404df35 3.2.2
|
||||||
|
0f91934037b04221ff5d1ba3a6c39c1ff26e3661 3.3
|
||||||
|
5
Makefile
5
Makefile
@ -13,7 +13,6 @@ options:
|
|||||||
@echo "CFLAGS = ${CFLAGS}"
|
@echo "CFLAGS = ${CFLAGS}"
|
||||||
@echo "LDFLAGS = ${LDFLAGS}"
|
@echo "LDFLAGS = ${LDFLAGS}"
|
||||||
@echo "CC = ${CC}"
|
@echo "CC = ${CC}"
|
||||||
@echo "LD = ${LD}"
|
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
@echo CC $<
|
@echo CC $<
|
||||||
@ -26,8 +25,8 @@ config.h:
|
|||||||
@cp config.default.h $@
|
@cp config.default.h $@
|
||||||
|
|
||||||
dwm: ${OBJ}
|
dwm: ${OBJ}
|
||||||
@echo LD $@
|
@echo CC -o $@
|
||||||
@${LD} -o $@ ${OBJ} ${LDFLAGS}
|
@${CC} -o $@ ${OBJ} ${LDFLAGS}
|
||||||
@strip $@
|
@strip $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
88
client.c
88
client.c
@ -7,7 +7,7 @@
|
|||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
|
|
||||||
/* static functions */
|
/* static */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
detachstack(Client *c) {
|
detachstack(Client *c) {
|
||||||
@ -53,12 +53,19 @@ grabbuttons(Client *c, Bool focused) {
|
|||||||
GrabModeAsync, GrabModeSync, None, None);
|
GrabModeAsync, GrabModeSync, None, None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
setclientstate(Client *c, long state) {
|
||||||
|
long data[] = {state, None};
|
||||||
|
XChangeProperty(dpy, c->win, wmatom[WMState], wmatom[WMState], 32,
|
||||||
|
PropModeReplace, (unsigned char *)data, 2);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
xerrordummy(Display *dsply, XErrorEvent *ee) {
|
xerrordummy(Display *dsply, XErrorEvent *ee) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* extern functions */
|
/* extern */
|
||||||
|
|
||||||
void
|
void
|
||||||
configure(Client *c) {
|
configure(Client *c) {
|
||||||
@ -113,11 +120,26 @@ getclient(Window w) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Bool
|
||||||
|
isprotodel(Client *c) {
|
||||||
|
int i, n;
|
||||||
|
Atom *protocols;
|
||||||
|
Bool ret = False;
|
||||||
|
|
||||||
|
if(XGetWMProtocols(dpy, c->win, &protocols, &n)) {
|
||||||
|
for(i = 0; !ret && i < n; i++)
|
||||||
|
if(protocols[i] == wmatom[WMDelete])
|
||||||
|
ret = True;
|
||||||
|
XFree(protocols);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
killclient(Arg *arg) {
|
killclient(Arg *arg) {
|
||||||
if(!sel)
|
if(!sel)
|
||||||
return;
|
return;
|
||||||
if(sel->proto & PROTODELWIN)
|
if(isprotodel(sel))
|
||||||
sendevent(sel->win, wmatom[WMProtocols], wmatom[WMDelete]);
|
sendevent(sel->win, wmatom[WMProtocols], wmatom[WMDelete]);
|
||||||
else
|
else
|
||||||
XKillClient(dpy, sel->win);
|
XKillClient(dpy, sel->win);
|
||||||
@ -142,17 +164,16 @@ manage(Window w, XWindowAttributes *wa) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
c->border = BORDERPX;
|
c->border = BORDERPX;
|
||||||
if(c->x < wax)
|
|
||||||
c->x = wax;
|
|
||||||
if(c->y < way)
|
|
||||||
c->y = way;
|
|
||||||
if(c->x + c->w + 2 * c->border > wax + waw)
|
if(c->x + c->w + 2 * c->border > wax + waw)
|
||||||
c->x = wax + waw - c->w - 2 * c->border;
|
c->x = wax + waw - c->w - 2 * c->border;
|
||||||
if(c->y + c->h + 2 * c->border > way + wah)
|
if(c->y + c->h + 2 * c->border > way + wah)
|
||||||
c->y = way + wah - c->h - 2 * c->border;
|
c->y = way + wah - c->h - 2 * c->border;
|
||||||
|
if(c->x < wax)
|
||||||
|
c->x = wax;
|
||||||
|
if(c->y < way)
|
||||||
|
c->y = way;
|
||||||
}
|
}
|
||||||
updatesizehints(c);
|
updatesizehints(c);
|
||||||
c->proto = getproto(c->win);
|
|
||||||
XSelectInput(dpy, c->win,
|
XSelectInput(dpy, c->win,
|
||||||
StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
|
StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
|
||||||
XGetTransientForHint(dpy, c->win, &trans);
|
XGetTransientForHint(dpy, c->win, &trans);
|
||||||
@ -169,6 +190,7 @@ manage(Window w, XWindowAttributes *wa) {
|
|||||||
stack = clients = c;
|
stack = clients = c;
|
||||||
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
|
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
|
||||||
XMapWindow(dpy, c->win);
|
XMapWindow(dpy, c->win);
|
||||||
|
setclientstate(c, NormalState);
|
||||||
if(isvisible(c))
|
if(isvisible(c))
|
||||||
focus(c);
|
focus(c);
|
||||||
arrange();
|
arrange();
|
||||||
@ -176,13 +198,12 @@ manage(Window w, XWindowAttributes *wa) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
resize(Client *c, Bool sizehints) {
|
resize(Client *c, Bool sizehints) {
|
||||||
|
float actual, dx, dy, max, min;
|
||||||
XWindowChanges wc;
|
XWindowChanges wc;
|
||||||
|
|
||||||
|
if(c->w <= 0 || c->h <= 0)
|
||||||
|
return;
|
||||||
if(sizehints) {
|
if(sizehints) {
|
||||||
if(c->incw)
|
|
||||||
c->w -= (c->w - c->basew) % c->incw;
|
|
||||||
if(c->inch)
|
|
||||||
c->h -= (c->h - c->baseh) % c->inch;
|
|
||||||
if(c->minw && c->w < c->minw)
|
if(c->minw && c->w < c->minw)
|
||||||
c->w = c->minw;
|
c->w = c->minw;
|
||||||
if(c->minh && c->h < c->minh)
|
if(c->minh && c->h < c->minh)
|
||||||
@ -191,20 +212,46 @@ resize(Client *c, Bool sizehints) {
|
|||||||
c->w = c->maxw;
|
c->w = c->maxw;
|
||||||
if(c->maxh && c->h > c->maxh)
|
if(c->maxh && c->h > c->maxh)
|
||||||
c->h = c->maxh;
|
c->h = c->maxh;
|
||||||
|
/* inspired by algorithm from fluxbox */
|
||||||
|
if(c->minay > 0 && c->maxay && (c->h - c->baseh) > 0) {
|
||||||
|
dx = (float)(c->w - c->basew);
|
||||||
|
dy = (float)(c->h - c->baseh);
|
||||||
|
min = (float)(c->minax) / (float)(c->minay);
|
||||||
|
max = (float)(c->maxax) / (float)(c->maxay);
|
||||||
|
actual = dx / dy;
|
||||||
|
if(max > 0 && min > 0 && actual > 0) {
|
||||||
|
if(actual < min) {
|
||||||
|
dy = (dx * min + dy) / (min * min + 1);
|
||||||
|
dx = dy * min;
|
||||||
|
c->w = (int)dx + c->basew;
|
||||||
|
c->h = (int)dy + c->baseh;
|
||||||
|
}
|
||||||
|
else if(actual > max) {
|
||||||
|
dy = (dx * min + dy) / (max * max + 1);
|
||||||
|
dx = dy * min;
|
||||||
|
c->w = (int)dx + c->basew;
|
||||||
|
c->h = (int)dy + c->baseh;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(c->incw)
|
||||||
|
c->w -= (c->w - c->basew) % c->incw;
|
||||||
|
if(c->inch)
|
||||||
|
c->h -= (c->h - c->baseh) % c->inch;
|
||||||
}
|
}
|
||||||
if(c->w == sw && c->h == sh)
|
if(c->w == sw && c->h == sh)
|
||||||
c->border = 0;
|
c->border = 0;
|
||||||
else
|
else
|
||||||
c->border = BORDERPX;
|
c->border = BORDERPX;
|
||||||
/* offscreen appearance fixes */
|
/* offscreen appearance fixes */
|
||||||
if(c->x + c->w + 2 * c->border < sx)
|
|
||||||
c->x = sx;
|
|
||||||
if(c->y + c->h + 2 * c->border < sy)
|
|
||||||
c->y = sy;
|
|
||||||
if(c->x > sw)
|
if(c->x > sw)
|
||||||
c->x = sw - c->w - 2 * c->border;
|
c->x = sw - c->w - 2 * c->border;
|
||||||
if(c->y > sh)
|
if(c->y > sh)
|
||||||
c->y = sh - c->h - 2 * c->border;
|
c->y = sh - c->h - 2 * c->border;
|
||||||
|
if(c->x + c->w + 2 * c->border < sx)
|
||||||
|
c->x = sx;
|
||||||
|
if(c->y + c->h + 2 * c->border < sy)
|
||||||
|
c->y = sy;
|
||||||
wc.x = c->x;
|
wc.x = c->x;
|
||||||
wc.y = c->y;
|
wc.y = c->y;
|
||||||
wc.width = c->w;
|
wc.width = c->w;
|
||||||
@ -247,6 +294,14 @@ updatesizehints(Client *c) {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
c->minw = c->minh = 0;
|
c->minw = c->minh = 0;
|
||||||
|
if(c->flags & PAspect) {
|
||||||
|
c->minax = size.min_aspect.x;
|
||||||
|
c->minay = size.min_aspect.y;
|
||||||
|
c->maxax = size.max_aspect.x;
|
||||||
|
c->maxay = size.max_aspect.y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
c->minax = c->minay = c->maxax = c->maxay = 0;
|
||||||
c->isfixed = (c->maxw && c->minw && c->maxh && c->minh &&
|
c->isfixed = (c->maxw && c->minw && c->maxh && c->minh &&
|
||||||
c->maxw == c->minw && c->maxh == c->minh);
|
c->maxw == c->minw && c->maxh == c->minh);
|
||||||
}
|
}
|
||||||
@ -291,6 +346,7 @@ unmanage(Client *c) {
|
|||||||
focus(nc);
|
focus(nc);
|
||||||
}
|
}
|
||||||
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
||||||
|
setclientstate(c, WithdrawnState);
|
||||||
free(c->tags);
|
free(c->tags);
|
||||||
free(c);
|
free(c);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# dwm version
|
# dwm version
|
||||||
VERSION = 3.2
|
VERSION = 3.4
|
||||||
|
|
||||||
# Customize below to fit your system
|
# Customize below to fit your system
|
||||||
|
|
||||||
@ -27,4 +27,3 @@ LDFLAGS = ${LIBS}
|
|||||||
|
|
||||||
# compiler and linker
|
# compiler and linker
|
||||||
CC = cc
|
CC = cc
|
||||||
LD = ${CC}
|
|
||||||
|
16
draw.c
16
draw.c
@ -35,7 +35,6 @@ drawtext(const char *text, unsigned long col[ColLast], Bool filledsquare, Bool e
|
|||||||
unsigned int len, olen;
|
unsigned int len, olen;
|
||||||
XGCValues gcv;
|
XGCValues gcv;
|
||||||
XRectangle r = { dc.x, dc.y, dc.w, dc.h };
|
XRectangle r = { dc.x, dc.y, dc.w, dc.h };
|
||||||
XPoint pt[5];
|
|
||||||
|
|
||||||
XSetForeground(dpy, dc.gc, col[ColBG]);
|
XSetForeground(dpy, dc.gc, col[ColBG]);
|
||||||
XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
|
XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
|
||||||
@ -74,24 +73,15 @@ drawtext(const char *text, unsigned long col[ColLast], Bool filledsquare, Bool e
|
|||||||
XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len);
|
XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len);
|
||||||
}
|
}
|
||||||
x = (h + 2) / 4;
|
x = (h + 2) / 4;
|
||||||
if(filledsquare) {
|
|
||||||
r.x = dc.x + 1;
|
r.x = dc.x + 1;
|
||||||
r.y = dc.y + 1;
|
r.y = dc.y + 1;
|
||||||
|
if(filledsquare) {
|
||||||
r.width = r.height = x + 1;
|
r.width = r.height = x + 1;
|
||||||
XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
|
XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
|
||||||
}
|
}
|
||||||
else if(emptysquare) {
|
else if(emptysquare) {
|
||||||
pt[0].x = dc.x + 1;
|
r.width = r.height = x;
|
||||||
pt[0].y = dc.y + 1;
|
XDrawRectangles(dpy, dc.drawable, dc.gc, &r, 1);
|
||||||
pt[1].x = x;
|
|
||||||
pt[1].y = 0;
|
|
||||||
pt[2].x = 0;
|
|
||||||
pt[2].y = x;
|
|
||||||
pt[3].x = -x;
|
|
||||||
pt[3].y = 0;
|
|
||||||
pt[4].x = 0;
|
|
||||||
pt[4].y = -x;
|
|
||||||
XDrawLines(dpy, dc.drawable, dc.gc, pt, 5, CoordModePrevious);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
dwm.1
6
dwm.1
@ -131,7 +131,9 @@ Resize current window while dragging (floating mode only).
|
|||||||
.SH CUSTOMIZATION
|
.SH CUSTOMIZATION
|
||||||
dwm is customized by creating a custom config.h and (re)compiling the source
|
dwm is customized by creating a custom config.h and (re)compiling the source
|
||||||
code. This keeps it fast, secure and simple.
|
code. This keeps it fast, secure and simple.
|
||||||
.SH CAVEATS
|
.SH SEE ALSO
|
||||||
|
.BR dmenu (1)
|
||||||
|
.SH BUGS
|
||||||
The status bar may display
|
The status bar may display
|
||||||
.BR "EOF"
|
.BR "EOF"
|
||||||
when dwm has been started by an X session manager like
|
when dwm has been started by an X session manager like
|
||||||
@ -145,5 +147,3 @@ you can use JDK 1.4 (which doesn't contain the XToolkit/XAWT backend) or you
|
|||||||
can set the following environment variable (to use the older Motif
|
can set the following environment variable (to use the older Motif
|
||||||
backend instead):
|
backend instead):
|
||||||
.BR AWT_TOOLKIT=MToolkit .
|
.BR AWT_TOOLKIT=MToolkit .
|
||||||
.SH SEE ALSO
|
|
||||||
.BR dmenu (1)
|
|
||||||
|
10
dwm.h
10
dwm.h
@ -36,11 +36,9 @@
|
|||||||
|
|
||||||
/* mask shorthands, used in event.c and client.c */
|
/* mask shorthands, used in event.c and client.c */
|
||||||
#define BUTTONMASK (ButtonPressMask | ButtonReleaseMask)
|
#define BUTTONMASK (ButtonPressMask | ButtonReleaseMask)
|
||||||
/* other stuff used in different places */
|
|
||||||
#define PROTODELWIN 1
|
|
||||||
|
|
||||||
enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */
|
enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */
|
||||||
enum { WMProtocols, WMDelete, WMLast }; /* default atoms */
|
enum { WMProtocols, WMDelete, WMState, WMLast }; /* default atoms */
|
||||||
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
|
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
|
||||||
enum { ColBorder, ColFG, ColBG, ColLast }; /* color */
|
enum { ColBorder, ColFG, ColBG, ColLast }; /* color */
|
||||||
|
|
||||||
@ -69,13 +67,13 @@ typedef struct {
|
|||||||
typedef struct Client Client;
|
typedef struct Client Client;
|
||||||
struct Client {
|
struct Client {
|
||||||
char name[256];
|
char name[256];
|
||||||
int proto;
|
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
int rx, ry, rw, rh; /* revert geometry */
|
int rx, ry, rw, rh; /* revert geometry */
|
||||||
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
||||||
|
int minax, minay, maxax, maxay;
|
||||||
long flags;
|
long flags;
|
||||||
unsigned int border;
|
unsigned int border;
|
||||||
Bool isfloat, isfixed, ismax;
|
Bool isfixed, isfloat, ismax;
|
||||||
Bool *tags;
|
Bool *tags;
|
||||||
Client *next;
|
Client *next;
|
||||||
Client *prev;
|
Client *prev;
|
||||||
@ -104,6 +102,7 @@ extern Window root, barwin;
|
|||||||
extern void configure(Client *c); /* send synthetic configure event */
|
extern void configure(Client *c); /* send synthetic configure event */
|
||||||
extern void focus(Client *c); /* focus c, c may be NULL */
|
extern void focus(Client *c); /* focus c, c may be NULL */
|
||||||
extern Client *getclient(Window w); /* return client of w */
|
extern Client *getclient(Window w); /* return client of w */
|
||||||
|
extern Bool isprotodel(Client *c); /* returns True if c->win supports wmatom[WMDelete] */
|
||||||
extern void killclient(Arg *arg); /* kill c nicely */
|
extern void killclient(Arg *arg); /* kill c nicely */
|
||||||
extern void manage(Window w, XWindowAttributes *wa); /* manage new client */
|
extern void manage(Window w, XWindowAttributes *wa); /* manage new client */
|
||||||
extern void resize(Client *c, Bool sizehints); /* resize c*/
|
extern void resize(Client *c, Bool sizehints); /* resize c*/
|
||||||
@ -122,7 +121,6 @@ extern void grabkeys(void); /* grab all keys defined in config.h */
|
|||||||
extern void procevent(void); /* process pending X events */
|
extern void procevent(void); /* process pending X events */
|
||||||
|
|
||||||
/* main.c */
|
/* main.c */
|
||||||
extern int getproto(Window w); /* return protocol mask of WMProtocols property of w */
|
|
||||||
extern void quit(Arg *arg); /* quit dwm nicely */
|
extern void quit(Arg *arg); /* quit dwm nicely */
|
||||||
extern void sendevent(Window w, Atom a, long value); /* send synthetic event to w */
|
extern void sendevent(Window w, Atom a, long value); /* send synthetic event to w */
|
||||||
extern int xerror(Display *dsply, XErrorEvent *ee); /* dwm's X error handler */
|
extern int xerror(Display *dsply, XErrorEvent *ee); /* dwm's X error handler */
|
||||||
|
4
event.c
4
event.c
@ -308,10 +308,6 @@ propertynotify(XEvent *e) {
|
|||||||
if(ev->state == PropertyDelete)
|
if(ev->state == PropertyDelete)
|
||||||
return; /* ignore */
|
return; /* ignore */
|
||||||
if((c = getclient(ev->window))) {
|
if((c = getclient(ev->window))) {
|
||||||
if(ev->atom == wmatom[WMProtocols]) {
|
|
||||||
c->proto = getproto(c->win);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
switch (ev->atom) {
|
switch (ev->atom) {
|
||||||
default: break;
|
default: break;
|
||||||
case XA_WM_TRANSIENT_FOR:
|
case XA_WM_TRANSIENT_FOR:
|
||||||
|
19
main.c
19
main.c
@ -92,6 +92,7 @@ setup(void) {
|
|||||||
/* init atoms */
|
/* init atoms */
|
||||||
wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
|
wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
|
||||||
wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
|
wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
|
||||||
|
wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False);
|
||||||
netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
|
netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
|
||||||
netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
|
netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
|
||||||
XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,
|
XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,
|
||||||
@ -171,24 +172,6 @@ xerrorstart(Display *dsply, XErrorEvent *ee) {
|
|||||||
|
|
||||||
/* extern */
|
/* extern */
|
||||||
|
|
||||||
int
|
|
||||||
getproto(Window w) {
|
|
||||||
int i, format, protos, status;
|
|
||||||
unsigned long extra, res;
|
|
||||||
Atom *protocols, real;
|
|
||||||
|
|
||||||
protos = 0;
|
|
||||||
status = XGetWindowProperty(dpy, w, wmatom[WMProtocols], 0L, 20L, False,
|
|
||||||
XA_ATOM, &real, &format, &res, &extra, (unsigned char **)&protocols);
|
|
||||||
if(status != Success || protocols == 0)
|
|
||||||
return protos;
|
|
||||||
for(i = 0; i < res; i++)
|
|
||||||
if(protocols[i] == wmatom[WMDelete])
|
|
||||||
protos |= PROTODELWIN;
|
|
||||||
free(protocols);
|
|
||||||
return protos;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
sendevent(Window w, Atom a, long value) {
|
sendevent(Window w, Atom a, long value) {
|
||||||
XEvent e;
|
XEvent e;
|
||||||
|
10
view.c
10
view.c
@ -98,11 +98,11 @@ dotile(void) {
|
|||||||
else { /* tile window */
|
else { /* tile window */
|
||||||
c->x += mw;
|
c->x += mw;
|
||||||
c->w = tw - 2 * BORDERPX;
|
c->w = tw - 2 * BORDERPX;
|
||||||
if(th > bh) {
|
if(th > 2 * BORDERPX) {
|
||||||
c->y += (i - nmaster) * th;
|
c->y += (i - nmaster) * th;
|
||||||
c->h = th - 2 * BORDERPX;
|
c->h = th - 2 * BORDERPX;
|
||||||
}
|
}
|
||||||
else /* fallback if th < bh */
|
else /* fallback if th <= 2 * BORDERPX */
|
||||||
c->h = wah - 2 * BORDERPX;
|
c->h = wah - 2 * BORDERPX;
|
||||||
}
|
}
|
||||||
resize(c, False);
|
resize(c, False);
|
||||||
@ -149,7 +149,8 @@ focusprev(Arg *arg) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
incnmaster(Arg *arg) {
|
incnmaster(Arg *arg) {
|
||||||
if((arrange == dofloat) || (nmaster + arg->i < 1) || (wah / (nmaster + arg->i) < bh))
|
if((arrange == dofloat) || (nmaster + arg->i < 1)
|
||||||
|
|| (wah / (nmaster + arg->i) <= 2 * BORDERPX))
|
||||||
return;
|
return;
|
||||||
nmaster += arg->i;
|
nmaster += arg->i;
|
||||||
if(sel)
|
if(sel)
|
||||||
@ -173,7 +174,8 @@ resizemaster(Arg *arg) {
|
|||||||
if(arg->i == 0)
|
if(arg->i == 0)
|
||||||
master = MASTER;
|
master = MASTER;
|
||||||
else {
|
else {
|
||||||
if(master + arg->i > 950 || master + arg->i < 50)
|
if(waw * (master + arg->i) / 1000 >= waw - 2 * BORDERPX
|
||||||
|
|| waw * (master + arg->i) / 1000 <= 2 * BORDERPX)
|
||||||
return;
|
return;
|
||||||
master += arg->i;
|
master += arg->i;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user