summaryrefslogtreecommitdiff
path: root/dwm.c
diff options
context:
space:
mode:
authorrafa_99 <rafa99@protonmail.com>2020-07-04 23:00:39 +0000
committerrafa_99 <rafa99@protonmail.com>2020-07-04 23:00:39 +0000
commit499be7039104021a532ed75745b33dbd4b98d540 (patch)
tree7af4e910a9d29035a3b8f7dd56102e619c8ccba7 /dwm.c
parentf2fd38fb84f1d146413659d7efa51fd83592a90a (diff)
Stocked Out
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c437
1 files changed, 52 insertions, 385 deletions
diff --git a/dwm.c b/dwm.c
index cfe4dc8..9fd0286 100644
--- a/dwm.c
+++ b/dwm.c
@@ -40,8 +40,6 @@
#include <X11/extensions/Xinerama.h>
#endif /* XINERAMA */
#include <X11/Xft/Xft.h>
-#include <X11/Xlib-xcb.h>
-#include <xcb/res.h>
#include "drw.h"
#include "util.h"
@@ -94,11 +92,9 @@ struct Client {
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
int bw, oldbw;
unsigned int tags;
- int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, isterminal, noswallow;
- pid_t pid;
+ int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
Client *next;
Client *snext;
- Client *swallowing;
Monitor *mon;
Window win;
};
@@ -123,10 +119,6 @@ struct Monitor {
int by; /* bar geometry */
int mx, my, mw, mh; /* screen size */
int wx, wy, ww, wh; /* window area */
- int gappih; /* horizontal gap between windows */
- int gappiv; /* vertical gap between windows */
- int gappoh; /* horizontal outer gaps */
- int gappov; /* vertical outer gaps */
unsigned int seltags;
unsigned int sellt;
unsigned int tagset[2];
@@ -146,8 +138,6 @@ typedef struct {
const char *title;
unsigned int tags;
int isfloating;
- int isterminal;
- int noswallow;
int monitor;
} Rule;
@@ -173,8 +163,6 @@ static void detachstack(Client *c);
static Monitor *dirtomon(int dir);
static void drawbar(Monitor *m);
static void drawbars(void);
-static void enqueue(Client *c);
-static void enqueuestack(Client *c);
static void enternotify(XEvent *e);
static void expose(XEvent *e);
static void focus(Client *c);
@@ -205,7 +193,6 @@ static void resize(Client *c, int x, int y, int w, int h, int interact);
static void resizeclient(Client *c, int x, int y, int w, int h);
static void resizemouse(const Arg *arg);
static void restack(Monitor *m);
-static void rotatestack(const Arg *arg);
static void run(void);
static void scan(void);
static int sendevent(Client *c, Atom proto);
@@ -219,16 +206,12 @@ static void setup(void);
static void seturgent(Client *c, int urg);
static void showhide(Client *c);
static void sigchld(int unused);
-static void sighup(int unused);
-static void sigterm(int unused);
static void spawn(const Arg *arg);
static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
-static void tagtoleft(const Arg *arg);
-static void tagtoright(const Arg *arg);
+static void tile(Monitor *);
static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg);
-static void togglefullscr(const Arg *arg);
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
static void unfocus(Client *c, int setfocus);
@@ -245,8 +228,6 @@ static void updatetitle(Client *c);
static void updatewindowtype(Client *c);
static void updatewmhints(Client *c);
static void view(const Arg *arg);
-static void viewtoleft(const Arg *arg);
-static void viewtoright(const Arg *arg);
static Client *wintoclient(Window w);
static Monitor *wintomon(Window w);
static int xerror(Display *dpy, XErrorEvent *ee);
@@ -254,22 +235,13 @@ static int xerrordummy(Display *dpy, XErrorEvent *ee);
static int xerrorstart(Display *dpy, XErrorEvent *ee);
static void zoom(const Arg *arg);
-static pid_t getparentprocess(pid_t p);
-static int isdescprocess(pid_t p, pid_t c);
-static Client *swallowingclient(Window w);
-static Client *termforwin(const Client *c);
-static pid_t winpid(Window w);
-
/* variables */
static const char broken[] = "broken";
static char stext[256];
-static int scanner;
static int screen;
static int sw, sh; /* X display screen geometry width, height */
static int bh, blw = 0; /* bar geometry */
static int lrpad; /* sum of left and right padding for text */
-static int vp; /* vertical padding for bar */
-static int sp; /* side padding for bar */
static int (*xerrorxlib)(Display *, XErrorEvent *);
static unsigned int numlockmask = 0;
static void (*handler[LASTEvent]) (XEvent *) = {
@@ -289,7 +261,6 @@ static void (*handler[LASTEvent]) (XEvent *) = {
[UnmapNotify] = unmapnotify
};
static Atom wmatom[WMLast], netatom[NetLast];
-static int restart = 0;
static int running = 1;
static Cur *cursor[CurLast];
static Clr **scheme;
@@ -298,8 +269,6 @@ static Drw *drw;
static Monitor *mons, *selmon;
static Window root, wmcheckwin;
-static xcb_connection_t *xcon;
-
/* configuration, allows nested code to access above variables */
#include "config.h"
@@ -317,7 +286,6 @@ applyrules(Client *c)
XClassHint ch = { NULL, NULL };
/* rule matching */
- c->noswallow = -1;
c->isfloating = 0;
c->tags = 0;
XGetClassHint(dpy, c->win, &ch);
@@ -330,8 +298,6 @@ applyrules(Client *c)
&& (!r->class || strstr(class, r->class))
&& (!r->instance || strstr(instance, r->instance)))
{
- c->isterminal = r->isterminal;
- c->noswallow = r->noswallow;
c->isfloating = r->isfloating;
c->tags |= r->tags;
for (m = mons; m && m->num != r->monitor; m = m->next);
@@ -449,64 +415,9 @@ attachstack(Client *c)
}
void
-swallow(Client *p, Client *c)
-{
- Client *s;
-
- if (c->noswallow > 0 || c->isterminal)
- return;
- if (c->noswallow < 0 && !swallowfloating && c->isfloating)
- return;
-
- detach(c);
- detachstack(c);
-
- setclientstate(c, WithdrawnState);
- XUnmapWindow(dpy, p->win);
-
- p->swallowing = c;
- c->mon = p->mon;
-
- Window w = p->win;
- p->win = c->win;
- c->win = w;
-
- XChangeProperty(dpy, c->win, netatom[NetClientList], XA_WINDOW, 32, PropModeReplace,
- (unsigned char *) &(p->win), 1);
-
- updatetitle(p);
- s = scanner ? c : p;
- XMoveResizeWindow(dpy, p->win, s->x, s->y, s->w, s->h);
- arrange(p->mon);
- configure(p);
- updateclientlist();
-}
-
-void
-unswallow(Client *c)
-{
- c->win = c->swallowing->win;
-
- free(c->swallowing);
- c->swallowing = NULL;
-
- XDeleteProperty(dpy, c->win, netatom[NetClientList]);
-
- /* unfullscreen the client */
- setfullscreen(c, 0);
- updatetitle(c);
- arrange(c->mon);
- XMapWindow(dpy, c->win);
- XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
- setclientstate(c, NormalState);
- focus(NULL);
- arrange(c->mon);
-}
-
-void
buttonpress(XEvent *e)
{
- unsigned int i, x, click, occ = 0;
+ unsigned int i, x, click;
Arg arg = {0};
Client *c;
Monitor *m;
@@ -521,14 +432,9 @@ buttonpress(XEvent *e)
}
if (ev->window == selmon->barwin) {
i = x = 0;
- for (c = m->clients; c; c = c->next)
- occ |= c->tags == 255 ? 0 : c->tags;
- do {
- /* do not reserve space for vacant tags */
- if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
- continue;
+ do
x += TEXTW(tags[i]);
- } while (ev->x >= x && ++i < LENGTH(tags));
+ while (ev->x >= x && ++i < LENGTH(tags));
if (i < LENGTH(tags)) {
click = ClkTagBar;
arg.ui = 1 << i;
@@ -662,7 +568,7 @@ configurenotify(XEvent *e)
for (c = m->clients; c; c = c->next)
if (c->isfullscreen)
resizeclient(c, m->mx, m->my, m->mw, m->mh);
- XMoveResizeWindow(dpy, m->barwin, m->wx + sp, m->by + vp, m->ww - 2 * sp, bh);
+ XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh);
}
focus(NULL);
arrange(NULL);
@@ -733,10 +639,6 @@ createmon(void)
m->nmaster = nmaster;
m->showbar = showbar;
m->topbar = topbar;
- m->gappih = gappih;
- m->gappiv = gappiv;
- m->gappoh = gappoh;
- m->gappov = gappov;
m->lt[0] = &layouts[0];
m->lt[1] = &layouts[1 % LENGTH(layouts)];
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
@@ -751,9 +653,6 @@ destroynotify(XEvent *e)
if ((c = wintoclient(ev->window)))
unmanage(c, 1);
-
- else if ((c = swallowingclient(ev->window)))
- unmanage(c->swallowing, 1);
}
void
@@ -807,23 +706,23 @@ drawbar(Monitor *m)
if (m == selmon) { /* status is only drawn on selected monitor */
drw_setscheme(drw, scheme[SchemeNorm]);
tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
- drw_text(drw, m->ww - tw - 2 * sp, 0, tw, bh, 0, stext, 0);
+ drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
}
for (c = m->clients; c; c = c->next) {
- occ |= c->tags == 255 ? 0 : c->tags;
+ occ |= c->tags;
if (c->isurgent)
urg |= c->tags;
}
x = 0;
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]);
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
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;
}
w = blw = TEXTW(m->ltsymbol);
@@ -833,12 +732,12 @@ drawbar(Monitor *m)
if ((w = m->ww - tw - x) > bh) {
if (m->sel) {
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
- drw_text(drw, x, 0, w - 2 * sp, bh, lrpad / 2, m->sel->name, 0);
+ drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
if (m->sel->isfloating)
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
} else {
drw_setscheme(drw, scheme[SchemeNorm]);
- drw_rect(drw, x, 0, w - 2 * sp, bh, 1, 1);
+ drw_rect(drw, x, 0, w, bh, 1, 1);
}
}
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
@@ -854,28 +753,6 @@ drawbars(void)
}
void
-enqueue(Client *c)
-{
- Client *l;
- for (l = c->mon->clients; l && l->next; l = l->next);
- if (l) {
- l->next = c;
- c->next = NULL;
- }
-}
-
-void
-enqueuestack(Client *c)
-{
- Client *l;
- for (l = c->mon->stack; l && l->snext; l = l->snext);
- if (l) {
- l->snext = c;
- c->snext = NULL;
- }
-}
-
-void
enternotify(XEvent *e)
{
Client *c;
@@ -1141,13 +1018,12 @@ killclient(const Arg *arg)
void
manage(Window w, XWindowAttributes *wa)
{
- Client *c, *t = NULL, *term = NULL;
+ Client *c, *t = NULL;
Window trans = None;
XWindowChanges wc;
c = ecalloc(1, sizeof(Client));
c->win = w;
- c->pid = winpid(w);
/* geometry */
c->x = c->oldx = wa->x;
c->y = c->oldy = wa->y;
@@ -1162,7 +1038,6 @@ manage(Window w, XWindowAttributes *wa)
} else {
c->mon = selmon;
applyrules(c);
- term = termforwin(c);
}
if (c->x + WIDTH(c) > c->mon->mx + c->mon->mw)
@@ -1199,8 +1074,6 @@ manage(Window w, XWindowAttributes *wa)
c->mon->sel = c;
arrange(c->mon);
XMapWindow(dpy, c->win);
- if (term)
- swallow(term, c);
focus(NULL);
}
@@ -1376,7 +1249,6 @@ propertynotify(XEvent *e)
void
quit(const Arg *arg)
{
- if(arg->i) restart = 1;
running = 0;
}
@@ -1499,38 +1371,6 @@ restack(Monitor *m)
}
void
-rotatestack(const Arg *arg)
-{
- Client *c = NULL, *f;
-
- if (!selmon->sel)
- return;
- f = selmon->sel;
- if (arg->i > 0) {
- for (c = nexttiled(selmon->clients); c && nexttiled(c->next); c = nexttiled(c->next));
- if (c){
- detach(c);
- attach(c);
- detachstack(c);
- attachstack(c);
- }
- } else {
- if ((c = nexttiled(selmon->clients))){
- detach(c);
- enqueue(c);
- detachstack(c);
- enqueuestack(c);
- }
- }
- if (c){
- arrange(selmon);
- //unfocus(f, 1);
- focus(f);
- restack(selmon);
- }
-}
-
-void
run(void)
{
XEvent ev;
@@ -1544,9 +1384,7 @@ run(void)
void
scan(void)
{
- scanner = 1;
unsigned int i, num;
- char swin[256];
Window d1, d2, *wins = NULL;
XWindowAttributes wa;
@@ -1557,8 +1395,6 @@ scan(void)
continue;
if (wa.map_state == IsViewable || getstate(wins[i]) == IconicState)
manage(wins[i], &wa);
- else if (gettextprop(wins[i], netatom[NetClientList], swin, sizeof swin))
- manage(wins[i], &wa);
}
for (i = 0; i < num; i++) { /* now the transients */
if (!XGetWindowAttributes(dpy, wins[i], &wa))
@@ -1570,7 +1406,6 @@ scan(void)
if (wins)
XFree(wins);
}
- scanner = 0;
}
void
@@ -1598,28 +1433,6 @@ setclientstate(Client *c, long state)
PropModeReplace, (unsigned char *)data, 2);
}
-void
-tagtoleft(const Arg *arg) {
- if(selmon->sel != NULL
- && __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
- && selmon->tagset[selmon->seltags] > 1) {
- selmon->sel->tags >>= 1;
- focus(NULL);
- arrange(selmon);
- }
-}
-
-void
-tagtoright(const Arg *arg) {
- if(selmon->sel != NULL
- && __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
- && selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) {
- selmon->sel->tags <<= 1;
- focus(NULL);
- arrange(selmon);
- }
-}
-
int
sendevent(Client *c, Atom proto)
{
@@ -1724,9 +1537,6 @@ setup(void)
/* clean up any zombies immediately */
sigchld(0);
- signal(SIGHUP, sighup);
- signal(SIGTERM, sigterm);
-
/* init screen */
screen = DefaultScreen(dpy);
sw = DisplayWidth(dpy, screen);
@@ -1738,9 +1548,6 @@ setup(void)
lrpad = drw->fonts->h;
bh = drw->fonts->h + 2;
updategeom();
- sp = sidepad;
- vp = (topbar == 1) ? vertpad : - vertpad;
-
/* init atoms */
utf8string = XInternAtom(dpy, "UTF8_STRING", False);
wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
@@ -1767,7 +1574,6 @@ setup(void)
/* init bars */
updatebars();
updatestatus();
- updatebarpos(selmon);
/* supporting window for NetWMCheck */
wmcheckwin = XCreateSimpleWindow(dpy, root, 0, 0, 1, 1, 0, 0, 0);
XChangeProperty(dpy, wmcheckwin, netatom[NetWMCheck], XA_WINDOW, 32,
@@ -1832,20 +1638,6 @@ sigchld(int unused)
}
void
-sighup(int unused)
-{
- Arg a = {.i = 1};
- quit(&a);
-}
-
-void
-sigterm(int unused)
-{
- Arg a = {.i = 0};
- quit(&a);
-}
-
-void
spawn(const Arg *arg)
{
if (arg->v == dmenucmd)
@@ -1880,11 +1672,39 @@ tagmon(const Arg *arg)
}
void
+tile(Monitor *m)
+{
+ unsigned int i, n, h, mw, my, ty;
+ Client *c;
+
+ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
+ if (n == 0)
+ return;
+
+ if (n > m->nmaster)
+ mw = m->nmaster ? m->ww * m->mfact : 0;
+ else
+ mw = m->ww;
+ for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
+ if (i < m->nmaster) {
+ h = (m->wh - my) / (MIN(n, m->nmaster) - i);
+ resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
+ if (my + HEIGHT(c) < m->wh)
+ my += HEIGHT(c);
+ } else {
+ h = (m->wh - ty) / (n - i);
+ resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
+ if (ty + HEIGHT(c) < m->wh)
+ ty += HEIGHT(c);
+ }
+}
+
+void
togglebar(const Arg *arg)
{
selmon->showbar = !selmon->showbar;
updatebarpos(selmon);
- XMoveResizeWindow(dpy, selmon->barwin, selmon->wx + sp, selmon->by + vp, selmon->ww - 2 * sp, bh);
+ XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
arrange(selmon);
}
@@ -1903,13 +1723,6 @@ togglefloating(const Arg *arg)
}
void
-togglefullscr(const Arg *arg)
-{
- if(selmon->sel)
- setfullscreen(selmon->sel, !selmon->sel->isfullscreen);
-}
-
-void
toggletag(const Arg *arg)
{
unsigned int newtags;
@@ -1955,20 +1768,6 @@ unmanage(Client *c, int destroyed)
Monitor *m = c->mon;
XWindowChanges wc;
- if (c->swallowing) {
- unswallow(c);
- return;
- }
-
- Client *s = swallowingclient(c->win);
- if (s) {
- free(s->swallowing);
- s->swallowing = NULL;
- arrange(m);
- focus(NULL);
- return;
- }
-
detach(c);
detachstack(c);
if (!destroyed) {
@@ -1983,12 +1782,9 @@ unmanage(Client *c, int destroyed)
XUngrabServer(dpy);
}
free(c);
-
- if (!s) {
- arrange(m);
- focus(NULL);
- updateclientlist();
- }
+ focus(NULL);
+ updateclientlist();
+ arrange(m);
}
void
@@ -2018,7 +1814,7 @@ updatebars(void)
for (m = mons; m; m = m->next) {
if (m->barwin)
continue;
- m->barwin = XCreateWindow(dpy, root, m->wx + sp, m->by + vp, m->ww - 2 * sp, bh, 0, DefaultDepth(dpy, screen),
+ m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen),
CopyFromParent, DefaultVisual(dpy, screen),
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
@@ -2033,11 +1829,11 @@ updatebarpos(Monitor *m)
m->wy = m->my;
m->wh = m->mh;
if (m->showbar) {
- m->wh = m->wh - vertpad - bh;
- m->by = m->topbar ? m->wy : m->wy + m->wh + vertpad;
- m->wy = m->topbar ? m->wy + bh + vp : m->wy;
+ m->wh -= bh;
+ m->by = m->topbar ? m->wy : m->wy + m->wh;
+ m->wy = m->topbar ? m->wy + bh : m->wy;
} else
- m->by = -bh - vp;
+ m->by = -bh;
}
void
@@ -2251,132 +2047,6 @@ view(const Arg *arg)
arrange(selmon);
}
-void
-viewtoleft(const Arg *arg) {
- if(__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
- && selmon->tagset[selmon->seltags] > 1) {
- selmon->seltags ^= 1; /* toggle sel tagset */
- selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] >> 1;
- focus(NULL);
- arrange(selmon);
- }
-}
-
-void
-viewtoright(const Arg *arg) {
- if(__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
- && selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) {
- selmon->seltags ^= 1; /* toggle sel tagset */
- selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] << 1;
- focus(NULL);
- arrange(selmon);
- }
-}
-
-pid_t
-winpid(Window w)
-{
- pid_t result = 0;
-
- xcb_res_client_id_spec_t spec = {0};
- spec.client = w;
- spec.mask = XCB_RES_CLIENT_ID_MASK_LOCAL_CLIENT_PID;
-
- xcb_generic_error_t *e = NULL;
- xcb_res_query_client_ids_cookie_t c = xcb_res_query_client_ids(xcon, 1, &spec);
- xcb_res_query_client_ids_reply_t *r = xcb_res_query_client_ids_reply(xcon, c, &e);
-
- if (!r)
- return (pid_t)0;
-
- xcb_res_client_id_value_iterator_t i = xcb_res_query_client_ids_ids_iterator(r);
- for (; i.rem; xcb_res_client_id_value_next(&i)) {
- spec = i.data->spec;
- if (spec.mask & XCB_RES_CLIENT_ID_MASK_LOCAL_CLIENT_PID) {
- uint32_t *t = xcb_res_client_id_value_value(i.data);
- result = *t;
- break;
- }
- }
-
- free(r);
-
- if (result == (pid_t)-1)
- result = 0;
- return result;
-}
-
-pid_t
-getparentprocess(pid_t p)
-{
- unsigned int v = 0;
-
-#if defined(__linux__)
- FILE *f;
- char buf[256];
- snprintf(buf, sizeof(buf) - 1, "/proc/%u/stat", (unsigned)p);
-
- if (!(f = fopen(buf, "r")))
- return (pid_t)0;
-
- if (fscanf(f, "%*u %*s %*c %u", (unsigned *)&v) != 1)
- v = (pid_t)0;
- fclose(f);
-#elif defined(__FreeBSD__)
- struct kinfo_proc *proc = kinfo_getproc(p);
- if (!proc)
- return (pid_t)0;
-
- v = proc->ki_ppid;
- free(proc);
-#endif
- return (pid_t)v;
-}
-
-int
-isdescprocess(pid_t p, pid_t c)
-{
- while (p != c && c != 0)
- c = getparentprocess(c);
-
- return (int)c;
-}
-
-Client *
-termforwin(const Client *w)
-{
- Client *c;
- Monitor *m;
-
- if (!w->pid || w->isterminal)
- return NULL;
-
- for (m = mons; m; m = m->next) {
- for (c = m->clients; c; c = c->next) {
- if (c->isterminal && !c->swallowing && c->pid && isdescprocess(c->pid, w->pid))
- return c;
- }
- }
-
- return NULL;
-}
-
-Client *
-swallowingclient(Window w)
-{
- Client *c;
- Monitor *m;
-
- for (m = mons; m; m = m->next) {
- for (c = m->clients; c; c = c->next) {
- if (c->swallowing && c->swallowing->win == w)
- return c;
- }
- }
-
- return NULL;
-}
-
Client *
wintoclient(Window w)
{
@@ -2468,8 +2138,6 @@ main(int argc, char *argv[])
fputs("warning: no locale support\n", stderr);
if (!(dpy = XOpenDisplay(NULL)))
die("dwm: cannot open display");
- if (!(xcon = XGetXCBConnection(dpy)))
- die("dwm: cannot get xcb connection\n");
checkotherwm();
setup();
#ifdef __OpenBSD__
@@ -2478,7 +2146,6 @@ main(int argc, char *argv[])
#endif /* __OpenBSD__ */
scan();
run();
- if(restart) execvp(argv[0], argv);
cleanup();
XCloseDisplay(dpy);
return EXIT_SUCCESS;