Revert "attachbelow"

This reverts commit 8ff3bf40f4.
This commit is contained in:
Cadey Ratio 2020-06-03 19:04:06 -04:00
parent 14ad3d842e
commit 3889a5ac1d
2 changed files with 3 additions and 139 deletions

3
dwm.1
View File

@ -29,9 +29,6 @@ color. The tags of the focused window are indicated with a filled square in the
top left corner. The tags which are applied to one or more windows are
indicated with an empty square in the top left corner.
.P
The attach below patch makes newly spawned windows attach after the currently
selected window.
.P
dwm draws a small border around windows to indicate the focus state.
.SH OPTIONS
.TP

139
dwm.c
View File

@ -181,7 +181,6 @@ static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interac
static void arrange(Monitor *m);
static void arrangemon(Monitor *m);
static void attach(Client *c);
static void attachBelow(Client *c);
static void attachstack(Client *c);
static int fake_signal(void);
static void buttonpress(XEvent *e);
@ -283,8 +282,6 @@ static int xerrordummy(Display *dpy, XErrorEvent *ee);
static int xerrorstart(Display *dpy, XErrorEvent *ee);
static void xinitvisual();
static void zoom(const Arg *arg);
static void centeredmaster(Monitor *m);
static void centeredfloatingmaster(Monitor *m);
/* variables */
static Systray *systray = NULL;
@ -474,22 +471,6 @@ attach(Client *c)
c->mon->clients = c;
}
void
attachBelow(Client *c)
{
//If there is nothing on the monitor or the selected client is floating, attach as normal
if(c->mon->sel == NULL || c->mon->sel->isfloating) {
attach(c);
return;
}
//Set the new client's next property to the same as the currently selected clients next
c->next = c->mon->sel->next;
//Set the currently selected clients next property to the new client
c->mon->sel->next = c;
}
void
attachstack(Client *c)
{
@ -1282,10 +1263,7 @@ manage(Window w, XWindowAttributes *wa)
c->isfloating = c->oldstate = trans != None || c->isfixed;
if (c->isfloating)
XRaiseWindow(dpy, c->win);
if (attachbelow)
attachBelow(c);
else
attach(c);
attach(c);
attachstack(c);
XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
(unsigned char *) &(c->win), 1);
@ -1737,11 +1715,7 @@ sendmon(Client *c, Monitor *m)
detachstack(c);
c->mon = m;
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
attach(c);
if (attachbelow)
attachBelow(c);
else
attach(c);
attach(c);
attachstack(c);
focus(NULL);
arrange(NULL);
@ -2340,10 +2314,7 @@ updategeom(void)
m->clients = c->next;
detachstack(c);
c->mon = mons;
if (attachbelow)
attachBelow(c);
else
attach(c);
attach(c);
attachstack(c);
}
if (m == selmon)
@ -2799,107 +2770,3 @@ main(int argc, char *argv[])
XCloseDisplay(dpy);
return EXIT_SUCCESS;
}
void
centeredmaster(Monitor *m)
{
unsigned int i, n, h, mw, mx, my, oty, ety, tw;
Client *c;
/* count number of clients in the selected monitor */
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
if (n == 0)
return;
/* initialize areas */
mw = m->ww;
mx = 0;
my = 0;
tw = mw;
if (n > m->nmaster) {
/* go mfact box in the center if more than nmaster clients */
mw = m->nmaster ? m->ww * m->mfact : 0;
tw = m->ww - mw;
if (n - m->nmaster > 1) {
/* only one client */
mx = (m->ww - mw) / 2;
tw = (m->ww - mw) / 2;
}
}
oty = 0;
ety = 0;
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
if (i < m->nmaster) {
/* nmaster clients are stacked vertically, in the center
* of the screen */
h = (m->wh - my) / (MIN(n, m->nmaster) - i);
resize(c, m->wx + mx, m->wy + my, mw - (2*c->bw),
h - (2*c->bw), 0);
my += HEIGHT(c);
} else {
/* stack clients are stacked vertically */
if ((i - m->nmaster) % 2 ) {
h = (m->wh - ety) / ( (1 + n - i) / 2);
resize(c, m->wx, m->wy + ety, tw - (2*c->bw),
h - (2*c->bw), 0);
ety += HEIGHT(c);
} else {
h = (m->wh - oty) / ((1 + n - i) / 2);
resize(c, m->wx + mx + mw, m->wy + oty,
tw - (2*c->bw), h - (2*c->bw), 0);
oty += HEIGHT(c);
}
}
}
void
centeredfloatingmaster(Monitor *m)
{
unsigned int i, n, w, mh, mw, mx, mxo, my, myo, tx;
Client *c;
/* count number of clients in the selected monitor */
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
if (n == 0)
return;
/* initialize nmaster area */
if (n > m->nmaster) {
/* go mfact box in the center if more than nmaster clients */
if (m->ww > m->wh) {
mw = m->nmaster ? m->ww * m->mfact : 0;
mh = m->nmaster ? m->wh * 0.9 : 0;
} else {
mh = m->nmaster ? m->wh * m->mfact : 0;
mw = m->nmaster ? m->ww * 0.9 : 0;
}
mx = mxo = (m->ww - mw) / 2;
my = myo = (m->wh - mh) / 2;
} else {
/* go fullscreen if all clients are in the master area */
mh = m->wh;
mw = m->ww;
mx = mxo = 0;
my = myo = 0;
}
for(i = tx = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
if (i < m->nmaster) {
/* nmaster clients are stacked horizontally, in the center
* of the screen */
w = (mw + mxo - mx) / (MIN(n, m->nmaster) - i);
resize(c, m->wx + mx, m->wy + my, w - (2*c->bw),
mh - (2*c->bw), 0);
mx += WIDTH(c);
} else {
/* stack clients are stacked horizontally */
w = (m->ww - tx) / (n - i);
resize(c, m->wx + tx, m->wy, w - (2*c->bw),
m->wh - (2*c->bw), 0);
tx += WIDTH(c);
}
}