add simple patches
This commit is contained in:
parent
2b6aad54c3
commit
29597ef4b6
203
dwm.c
203
dwm.c
|
@ -47,19 +47,26 @@
|
||||||
/* macros */
|
/* macros */
|
||||||
#define BUTTONMASK (ButtonPressMask|ButtonReleaseMask)
|
#define BUTTONMASK (ButtonPressMask|ButtonReleaseMask)
|
||||||
#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))
|
#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))
|
||||||
|
#define GETINC(X) ((X) - 2000)
|
||||||
|
#define INC(X) ((X) + 2000)
|
||||||
#define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \
|
#define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \
|
||||||
* MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy)))
|
* MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy)))
|
||||||
#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]))
|
#define ISINC(X) ((X) > 1000 && (X) < 3000)
|
||||||
|
#define ISVISIBLEONTAG(C, T) ((C->tags & T))
|
||||||
|
#define ISVISIBLE(C) ISVISIBLEONTAG(C, C->mon->tagset[C->mon->seltags])
|
||||||
|
#define PREVSEL 3000
|
||||||
#define LENGTH(X) (sizeof X / sizeof X[0])
|
#define LENGTH(X) (sizeof X / sizeof X[0])
|
||||||
|
#define MOD(N,M) ((N)%(M) < 0 ? (N)%(M) + (M) : (N)%(M))
|
||||||
#define MOUSEMASK (BUTTONMASK|PointerMotionMask)
|
#define MOUSEMASK (BUTTONMASK|PointerMotionMask)
|
||||||
#define WIDTH(X) ((X)->w + 2 * (X)->bw)
|
#define WIDTH(X) ((X)->w + 2 * (X)->bw)
|
||||||
#define HEIGHT(X) ((X)->h + 2 * (X)->bw)
|
#define HEIGHT(X) ((X)->h + 2 * (X)->bw)
|
||||||
#define TAGMASK ((1 << LENGTH(tags)) - 1)
|
#define TAGMASK ((1 << LENGTH(tags)) - 1)
|
||||||
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
|
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
|
||||||
|
#define TRUNC(X,A,B) (MAX((A), MIN((X), (B))))
|
||||||
|
|
||||||
/* enums */
|
/* enums */
|
||||||
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
|
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
|
||||||
enum { SchemeNorm, SchemeSel }; /* color schemes */
|
enum { SchemeNorm, SchemeSel, SchemeStatus, SchemeTagsSel, SchemeTagsNorm, SchemeInfoSel, SchemeInfoNorm }; /* color schemes */
|
||||||
enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
|
enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
|
||||||
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
|
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
|
||||||
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
|
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
|
||||||
|
@ -147,6 +154,7 @@ static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interac
|
||||||
static void arrange(Monitor *m);
|
static void arrange(Monitor *m);
|
||||||
static void arrangemon(Monitor *m);
|
static void arrangemon(Monitor *m);
|
||||||
static void attach(Client *c);
|
static void attach(Client *c);
|
||||||
|
static void attachtop(Client *c);
|
||||||
static void attachstack(Client *c);
|
static void attachstack(Client *c);
|
||||||
static void bstack(Monitor *m);
|
static void bstack(Monitor *m);
|
||||||
static void bstackhoriz(Monitor *m);
|
static void bstackhoriz(Monitor *m);
|
||||||
|
@ -192,6 +200,7 @@ static void movemouse(const Arg *arg);
|
||||||
static Client *nexttiled(Client *c);
|
static Client *nexttiled(Client *c);
|
||||||
static void pop(Client *c);
|
static void pop(Client *c);
|
||||||
static void propertynotify(XEvent *e);
|
static void propertynotify(XEvent *e);
|
||||||
|
static void pushstack(const Arg *arg);
|
||||||
static void quit(const Arg *arg);
|
static void quit(const Arg *arg);
|
||||||
static Monitor *recttomon(int x, int y, int w, int h);
|
static Monitor *recttomon(int x, int y, int w, int h);
|
||||||
static void resize(Client *c, int x, int y, int w, int h, int interact);
|
static void resize(Client *c, int x, int y, int w, int h, int interact);
|
||||||
|
@ -210,12 +219,16 @@ static void setmfact(const Arg *arg);
|
||||||
static void setup(void);
|
static void setup(void);
|
||||||
static void seturgent(Client *c, int urg);
|
static void seturgent(Client *c, int urg);
|
||||||
static void showhide(Client *c);
|
static void showhide(Client *c);
|
||||||
|
static void sighup(int unused);
|
||||||
|
static void sigterm(int unused);
|
||||||
static void spawn(const Arg *arg);
|
static void spawn(const Arg *arg);
|
||||||
|
static int stackpos(const Arg *arg);
|
||||||
static void tag(const Arg *arg);
|
static void tag(const Arg *arg);
|
||||||
static void tagmon(const Arg *arg);
|
static void tagmon(const Arg *arg);
|
||||||
static void tile(Monitor *m);
|
static void tile(Monitor *m);
|
||||||
static void togglebar(const Arg *arg);
|
static void togglebar(const Arg *arg);
|
||||||
static void togglefloating(const Arg *arg);
|
static void togglefloating(const Arg *arg);
|
||||||
|
static void togglefullscr(const Arg *arg);
|
||||||
static void toggletag(const Arg *arg);
|
static void toggletag(const Arg *arg);
|
||||||
static void toggleview(const Arg *arg);
|
static void toggleview(const Arg *arg);
|
||||||
static void unfocus(Client *c, int setfocus);
|
static void unfocus(Client *c, int setfocus);
|
||||||
|
@ -265,6 +278,7 @@ static void (*handler[LASTEvent]) (XEvent *) = {
|
||||||
[UnmapNotify] = unmapnotify
|
[UnmapNotify] = unmapnotify
|
||||||
};
|
};
|
||||||
static Atom wmatom[WMLast], netatom[NetLast];
|
static Atom wmatom[WMLast], netatom[NetLast];
|
||||||
|
static int restart = 0;
|
||||||
static int running = 1;
|
static int running = 1;
|
||||||
static Cur *cursor[CurLast];
|
static Cur *cursor[CurLast];
|
||||||
static Clr **scheme;
|
static Clr **scheme;
|
||||||
|
@ -413,6 +427,25 @@ attach(Client *c)
|
||||||
c->mon->clients = c;
|
c->mon->clients = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
attachtop(Client *c)
|
||||||
|
{
|
||||||
|
int n;
|
||||||
|
Monitor *m = selmon;
|
||||||
|
Client *below;
|
||||||
|
|
||||||
|
for (n = 1, below = c->mon->clients;
|
||||||
|
below && below->next && (below->isfloating || !ISVISIBLEONTAG(below, c->tags) || n != m->nmaster);
|
||||||
|
n = below->isfloating || !ISVISIBLEONTAG(below, c->tags) ? n + 0 : n + 1, below = below->next);
|
||||||
|
c->next = NULL;
|
||||||
|
if (below) {
|
||||||
|
c->next = below->next;
|
||||||
|
below->next = c;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
c->mon->clients = c;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
attachstack(Client *c)
|
attachstack(Client *c)
|
||||||
{
|
{
|
||||||
|
@ -500,9 +533,15 @@ buttonpress(XEvent *e)
|
||||||
}
|
}
|
||||||
if (ev->window == selmon->barwin) {
|
if (ev->window == selmon->barwin) {
|
||||||
i = x = 0;
|
i = x = 0;
|
||||||
do
|
unsigned int occ = 0;
|
||||||
|
for(c = m->clients; c; c=c->next)
|
||||||
|
occ |= c->tags;
|
||||||
|
do {
|
||||||
|
/* Do not reserve space for vacant tags */
|
||||||
|
if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
|
||||||
|
continue;
|
||||||
x += TEXTW(tags[i]);
|
x += TEXTW(tags[i]);
|
||||||
while (ev->x >= x && ++i < LENGTH(tags));
|
} while (ev->x >= x && ++i < LENGTH(tags));
|
||||||
if (i < LENGTH(tags)) {
|
if (i < LENGTH(tags)) {
|
||||||
click = ClkTagBar;
|
click = ClkTagBar;
|
||||||
arg.ui = 1 << i;
|
arg.ui = 1 << i;
|
||||||
|
@ -879,7 +918,7 @@ drawbar(Monitor *m)
|
||||||
|
|
||||||
/* draw status first so it can be overdrawn by tags later */
|
/* draw status first so it can be overdrawn by tags later */
|
||||||
if (m == selmon) { /* status is only drawn on selected monitor */
|
if (m == selmon) { /* status is only drawn on selected monitor */
|
||||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
drw_setscheme(drw, scheme[SchemeStatus]);
|
||||||
tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
|
tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
|
||||||
drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
|
drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
|
||||||
}
|
}
|
||||||
|
@ -891,22 +930,21 @@ drawbar(Monitor *m)
|
||||||
}
|
}
|
||||||
x = 0;
|
x = 0;
|
||||||
for (i = 0; i < LENGTH(tags); i++) {
|
for (i = 0; i < LENGTH(tags); i++) {
|
||||||
|
/* Do not draw vacant tags */
|
||||||
|
if(!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
|
||||||
|
continue;
|
||||||
w = TEXTW(tags[i]);
|
w = TEXTW(tags[i]);
|
||||||
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
|
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeTagsSel : SchemeTagsNorm]);
|
||||||
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
|
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
|
||||||
if (occ & 1 << i)
|
|
||||||
drw_rect(drw, x + boxs, boxs, boxw, boxw,
|
|
||||||
m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
|
|
||||||
urg & 1 << i);
|
|
||||||
x += w;
|
x += w;
|
||||||
}
|
}
|
||||||
w = TEXTW(m->ltsymbol);
|
w = TEXTW(m->ltsymbol);
|
||||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
drw_setscheme(drw, scheme[SchemeTagsNorm]);
|
||||||
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
||||||
|
|
||||||
if ((w = m->ww - tw - x) > bh) {
|
if ((w = m->ww - tw - x) > bh) {
|
||||||
if (m->sel) {
|
if (m->sel) {
|
||||||
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
|
drw_setscheme(drw, scheme[m == selmon ? SchemeInfoSel : SchemeInfoNorm]);
|
||||||
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
|
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
|
||||||
if (m->sel->isfloating)
|
if (m->sel->isfloating)
|
||||||
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
|
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
|
||||||
|
@ -1008,27 +1046,17 @@ focusmon(const Arg *arg)
|
||||||
void
|
void
|
||||||
focusstack(const Arg *arg)
|
focusstack(const Arg *arg)
|
||||||
{
|
{
|
||||||
Client *c = NULL, *i;
|
// Client *c = NULL, *i;
|
||||||
|
int i = stackpos(arg);
|
||||||
|
Client *c, *p;
|
||||||
|
|
||||||
if (!selmon->sel || (selmon->sel->isfullscreen && lockfullscreen))
|
if (i < 0 || (selmon->sel->isfullscreen && lockfullscreen))
|
||||||
return;
|
return;
|
||||||
if (arg->i > 0) {
|
|
||||||
for (c = selmon->sel->next; c && !ISVISIBLE(c); c = c->next);
|
for(p = NULL, c = selmon->clients; c && (i || !ISVISIBLE(c));
|
||||||
if (!c)
|
i -= ISVISIBLE(c) ? 1 : 0, p = c, c = c->next);
|
||||||
for (c = selmon->clients; c && !ISVISIBLE(c); c = c->next);
|
focus(c ? c : p);
|
||||||
} else {
|
restack(selmon);
|
||||||
for (i = selmon->clients; i != selmon->sel; i = i->next)
|
|
||||||
if (ISVISIBLE(i))
|
|
||||||
c = i;
|
|
||||||
if (!c)
|
|
||||||
for (; i; i = i->next)
|
|
||||||
if (ISVISIBLE(i))
|
|
||||||
c = i;
|
|
||||||
}
|
|
||||||
if (c) {
|
|
||||||
focus(c);
|
|
||||||
restack(selmon);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1280,7 +1308,7 @@ manage(Window w, XWindowAttributes *wa)
|
||||||
c->isfloating = c->oldstate = trans != None || c->isfixed;
|
c->isfloating = c->oldstate = trans != None || c->isfixed;
|
||||||
if (c->isfloating)
|
if (c->isfloating)
|
||||||
XRaiseWindow(dpy, c->win);
|
XRaiseWindow(dpy, c->win);
|
||||||
attach(c);
|
attachtop(c);
|
||||||
attachstack(c);
|
attachstack(c);
|
||||||
XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
|
XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
|
||||||
(unsigned char *) &(c->win), 1);
|
(unsigned char *) &(c->win), 1);
|
||||||
|
@ -1461,9 +1489,33 @@ propertynotify(XEvent *e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
pushstack(const Arg *arg) {
|
||||||
|
int i = stackpos(arg);
|
||||||
|
Client *sel = selmon->sel, *c, *p;
|
||||||
|
|
||||||
|
if(i < 0)
|
||||||
|
return;
|
||||||
|
else if(i == 0) {
|
||||||
|
detach(sel);
|
||||||
|
attach(sel);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for(p = NULL, c = selmon->clients; c; p = c, c = c->next)
|
||||||
|
if(!(i -= (ISVISIBLE(c) && c != sel)))
|
||||||
|
break;
|
||||||
|
c = c ? c : p;
|
||||||
|
detach(sel);
|
||||||
|
sel->next = c->next;
|
||||||
|
c->next = sel;
|
||||||
|
}
|
||||||
|
arrange(selmon);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
quit(const Arg *arg)
|
quit(const Arg *arg)
|
||||||
{
|
{
|
||||||
|
if(arg->i) restart = 1;
|
||||||
running = 0;
|
running = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1507,9 +1559,14 @@ void
|
||||||
resizemouse(const Arg *arg)
|
resizemouse(const Arg *arg)
|
||||||
{
|
{
|
||||||
int ocx, ocy, nw, nh;
|
int ocx, ocy, nw, nh;
|
||||||
|
int ocx2, ocy2, nx, ny;
|
||||||
Client *c;
|
Client *c;
|
||||||
Monitor *m;
|
Monitor *m;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
int horizcorner, vertcorner;
|
||||||
|
int di;
|
||||||
|
unsigned int dui;
|
||||||
|
Window dummy;
|
||||||
Time lasttime = 0;
|
Time lasttime = 0;
|
||||||
|
|
||||||
if (!(c = selmon->sel))
|
if (!(c = selmon->sel))
|
||||||
|
@ -1519,10 +1576,18 @@ resizemouse(const Arg *arg)
|
||||||
restack(selmon);
|
restack(selmon);
|
||||||
ocx = c->x;
|
ocx = c->x;
|
||||||
ocy = c->y;
|
ocy = c->y;
|
||||||
|
ocx2 = c->x + c->w;
|
||||||
|
ocy2 = c->y + c->h;
|
||||||
if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
|
if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
|
||||||
None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess)
|
None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess)
|
||||||
return;
|
return;
|
||||||
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
|
if (!XQueryPointer (dpy, c->win, &dummy, &dummy, &di, &di, &nx, &ny, &dui))
|
||||||
|
return;
|
||||||
|
horizcorner = nx < c->w / 2;
|
||||||
|
vertcorner = ny < c->h / 2;
|
||||||
|
XWarpPointer (dpy, None, c->win, 0, 0, 0, 0,
|
||||||
|
horizcorner ? (-c->bw) : (c->w + c->bw -1),
|
||||||
|
vertcorner ? (-c->bw) : (c->h + c->bw -1));
|
||||||
do {
|
do {
|
||||||
XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
|
XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
|
||||||
switch(ev.type) {
|
switch(ev.type) {
|
||||||
|
@ -1536,8 +1601,11 @@ resizemouse(const Arg *arg)
|
||||||
continue;
|
continue;
|
||||||
lasttime = ev.xmotion.time;
|
lasttime = ev.xmotion.time;
|
||||||
|
|
||||||
nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1);
|
nx = horizcorner ? ev.xmotion.x : c->x;
|
||||||
nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1);
|
ny = vertcorner ? ev.xmotion.y : c->y;
|
||||||
|
nw = MAX(horizcorner ? (ocx2 - nx) : (ev.xmotion.x - ocx - 2 * c->bw + 1), 1);
|
||||||
|
nh = MAX(vertcorner ? (ocy2 - ny) : (ev.xmotion.y - ocy - 2 * c->bw + 1), 1);
|
||||||
|
|
||||||
if (c->mon->wx + nw >= selmon->wx && c->mon->wx + nw <= selmon->wx + selmon->ww
|
if (c->mon->wx + nw >= selmon->wx && c->mon->wx + nw <= selmon->wx + selmon->ww
|
||||||
&& c->mon->wy + nh >= selmon->wy && c->mon->wy + nh <= selmon->wy + selmon->wh)
|
&& c->mon->wy + nh >= selmon->wy && c->mon->wy + nh <= selmon->wy + selmon->wh)
|
||||||
{
|
{
|
||||||
|
@ -1546,11 +1614,13 @@ resizemouse(const Arg *arg)
|
||||||
togglefloating(NULL);
|
togglefloating(NULL);
|
||||||
}
|
}
|
||||||
if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
|
if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
|
||||||
resize(c, c->x, c->y, nw, nh, 1);
|
resize(c, nx, ny, nw, nh, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (ev.type != ButtonRelease);
|
} while (ev.type != ButtonRelease);
|
||||||
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
|
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0,
|
||||||
|
horizcorner ? (-c->bw) : (c->w + c->bw - 1),
|
||||||
|
vertcorner ? (-c->bw) : (c->h + c->bw - 1));
|
||||||
XUngrabPointer(dpy, CurrentTime);
|
XUngrabPointer(dpy, CurrentTime);
|
||||||
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
||||||
if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) {
|
if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) {
|
||||||
|
@ -1633,7 +1703,7 @@ sendmon(Client *c, Monitor *m)
|
||||||
detachstack(c);
|
detachstack(c);
|
||||||
c->mon = m;
|
c->mon = m;
|
||||||
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
|
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
|
||||||
attach(c);
|
attachtop(c);
|
||||||
attachstack(c);
|
attachstack(c);
|
||||||
focus(NULL);
|
focus(NULL);
|
||||||
arrange(NULL);
|
arrange(NULL);
|
||||||
|
@ -1759,6 +1829,9 @@ setup(void)
|
||||||
/* clean up any zombies (inherited from .xinitrc etc) immediately */
|
/* clean up any zombies (inherited from .xinitrc etc) immediately */
|
||||||
while (waitpid(-1, NULL, WNOHANG) > 0);
|
while (waitpid(-1, NULL, WNOHANG) > 0);
|
||||||
|
|
||||||
|
signal(SIGHUP, sighup);
|
||||||
|
signal(SIGTERM, sigterm);
|
||||||
|
|
||||||
/* init screen */
|
/* init screen */
|
||||||
screen = DefaultScreen(dpy);
|
screen = DefaultScreen(dpy);
|
||||||
sw = DisplayWidth(dpy, screen);
|
sw = DisplayWidth(dpy, screen);
|
||||||
|
@ -1850,6 +1923,20 @@ showhide(Client *c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sighup(int unused)
|
||||||
|
{
|
||||||
|
Arg a = {.i = 1};
|
||||||
|
quit(&a);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sigterm(int unused)
|
||||||
|
{
|
||||||
|
Arg a = {.i = 0};
|
||||||
|
quit(&a);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
spawn(const Arg *arg)
|
spawn(const Arg *arg)
|
||||||
{
|
{
|
||||||
|
@ -1864,6 +1951,36 @@ spawn(const Arg *arg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
stackpos(const Arg *arg) {
|
||||||
|
int n, i;
|
||||||
|
Client *c, *l;
|
||||||
|
|
||||||
|
if(!selmon->clients)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if(arg->i == PREVSEL) {
|
||||||
|
for(l = selmon->stack; l && (!ISVISIBLE(l) || l == selmon->sel); l = l->snext);
|
||||||
|
if(!l)
|
||||||
|
return -1;
|
||||||
|
for(i = 0, c = selmon->clients; c != l; i += ISVISIBLE(c) ? 1 : 0, c = c->next);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
else if(ISINC(arg->i)) {
|
||||||
|
if(!selmon->sel)
|
||||||
|
return -1;
|
||||||
|
for(i = 0, c = selmon->clients; c != selmon->sel; i += ISVISIBLE(c) ? 1 : 0, c = c->next);
|
||||||
|
for(n = i; c; n += ISVISIBLE(c) ? 1 : 0, c = c->next);
|
||||||
|
return MOD(i + GETINC(arg->i), n);
|
||||||
|
}
|
||||||
|
else if(arg->i < 0) {
|
||||||
|
for(i = 0, c = selmon->clients; c; i += ISVISIBLE(c) ? 1 : 0, c = c->next);
|
||||||
|
return MAX(i + arg->i, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return arg->i;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tag(const Arg *arg)
|
tag(const Arg *arg)
|
||||||
{
|
{
|
||||||
|
@ -1933,6 +2050,13 @@ togglefloating(const Arg *arg)
|
||||||
arrange(selmon);
|
arrange(selmon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
togglefullscr(const Arg *arg)
|
||||||
|
{
|
||||||
|
if(selmon->sel)
|
||||||
|
setfullscreen(selmon->sel, !selmon->sel->isfullscreen);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
toggletag(const Arg *arg)
|
toggletag(const Arg *arg)
|
||||||
{
|
{
|
||||||
|
@ -2113,7 +2237,7 @@ updategeom(void)
|
||||||
m->clients = c->next;
|
m->clients = c->next;
|
||||||
detachstack(c);
|
detachstack(c);
|
||||||
c->mon = mons;
|
c->mon = mons;
|
||||||
attach(c);
|
attachtop(c);
|
||||||
attachstack(c);
|
attachstack(c);
|
||||||
}
|
}
|
||||||
if (m == selmon)
|
if (m == selmon)
|
||||||
|
@ -2357,6 +2481,7 @@ main(int argc, char *argv[])
|
||||||
#endif /* __OpenBSD__ */
|
#endif /* __OpenBSD__ */
|
||||||
scan();
|
scan();
|
||||||
run();
|
run();
|
||||||
|
if(restart) execvp(argv[0], argv);
|
||||||
cleanup();
|
cleanup();
|
||||||
XCloseDisplay(dpy);
|
XCloseDisplay(dpy);
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
|
Loading…
Reference in New Issue