[dwm] Make swallow use new window size
This commit is contained in:
parent
6c01ce4dd8
commit
9a8bf0cce8
@ -9,7 +9,7 @@ alpha
|
|||||||
|
|
||||||
warp
|
warp
|
||||||
|
|
||||||
vanitygaps (customised to have 16:9 windows)
|
vanitygaps
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
Clone the repo.
|
Clone the repo.
|
||||||
|
@ -10,8 +10,6 @@ static const unsigned int gappih = 35; /* horiz inner gap between windo
|
|||||||
static const unsigned int gappiv = 40; /* vert inner gap between windows */
|
static const unsigned int gappiv = 40; /* vert inner gap between windows */
|
||||||
static const unsigned int gappoh = 30; /* horiz outer gap between windows and screen edge */
|
static const unsigned int gappoh = 30; /* horiz outer gap between windows and screen edge */
|
||||||
static const unsigned int gappov = 40; /* vert outer gap between windows and screen edge */
|
static const unsigned int gappov = 40; /* vert outer gap between windows and screen edge */
|
||||||
static const unsigned int ratioa = 16; /* ratio to use for gap sizes instead of actual values */
|
|
||||||
static const unsigned int ratiob = 9; /* set to zero to disable */
|
|
||||||
static int smartgaps = 0; /* 1 means no outer gap when there is only one window */
|
static int smartgaps = 0; /* 1 means no outer gap when there is only one window */
|
||||||
static int passthrough = 0; /* 1 means to ignore most shortcuts */
|
static int passthrough = 0; /* 1 means to ignore most shortcuts */
|
||||||
static const int showbar = 1; /* 0 means no bar */
|
static const int showbar = 1; /* 0 means no bar */
|
||||||
|
@ -129,6 +129,10 @@ struct Monitor {
|
|||||||
int by; /* bar geometry */
|
int by; /* bar geometry */
|
||||||
int mx, my, mw, mh; /* screen size */
|
int mx, my, mw, mh; /* screen size */
|
||||||
int wx, wy, ww, wh; /* window area */
|
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 seltags;
|
||||||
unsigned int sellt;
|
unsigned int sellt;
|
||||||
unsigned int tagset[2];
|
unsigned int tagset[2];
|
||||||
@ -220,7 +224,6 @@ static void showhide(Client *c);
|
|||||||
static void spawn(const Arg *arg);
|
static void spawn(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 togglebar(const Arg *arg);
|
static void togglebar(const Arg *arg);
|
||||||
static void togglealtbar(const Arg *arg);
|
static void togglealtbar(const Arg *arg);
|
||||||
static void togglefloating(const Arg *arg);
|
static void togglefloating(const Arg *arg);
|
||||||
@ -457,24 +460,20 @@ attachstack(Client *c)
|
|||||||
void
|
void
|
||||||
swallow(Client *p, Client *c)
|
swallow(Client *p, Client *c)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (c->noswallow || c->isterminal)
|
if (c->noswallow || c->isterminal)
|
||||||
return;
|
return;
|
||||||
if (c->noswallow && !swallowfloating && c->isfloating)
|
if (c->noswallow && !swallowfloating && c->isfloating)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
detach(c);
|
detach(p);
|
||||||
detachstack(c);
|
detachstack(p);
|
||||||
|
|
||||||
setclientstate(c, WithdrawnState);
|
setclientstate(p, WithdrawnState);
|
||||||
XUnmapWindow(dpy, p->win);
|
XUnmapWindow(dpy, p->win);
|
||||||
|
|
||||||
p->swallowing = c;
|
c->swallowing = p;
|
||||||
c->mon = p->mon;
|
c->mon = p->mon;
|
||||||
|
|
||||||
Window w = p->win;
|
|
||||||
p->win = c->win;
|
|
||||||
c->win = w;
|
|
||||||
updatetitle(p);
|
updatetitle(p);
|
||||||
XMoveResizeWindow(dpy, p->win, p->x, p->y, p->w, p->h);
|
XMoveResizeWindow(dpy, p->win, p->x, p->y, p->w, p->h);
|
||||||
arrange(p->mon);
|
arrange(p->mon);
|
||||||
@ -485,9 +484,14 @@ swallow(Client *p, Client *c)
|
|||||||
void
|
void
|
||||||
unswallow(Client *c)
|
unswallow(Client *c)
|
||||||
{
|
{
|
||||||
c->win = c->swallowing->win;
|
Client old = *c;
|
||||||
|
memcpy(c, c->swallowing, sizeof(Client));
|
||||||
|
|
||||||
free(c->swallowing);
|
c->next = old.next;
|
||||||
|
c->snext = old.snext;
|
||||||
|
c->mon = old.mon;
|
||||||
|
|
||||||
|
free(old.swallowing);
|
||||||
c->swallowing = NULL;
|
c->swallowing = NULL;
|
||||||
|
|
||||||
/* unfullscreen the client */
|
/* unfullscreen the client */
|
||||||
@ -723,6 +727,10 @@ createmon(void)
|
|||||||
m->nmaster = nmaster;
|
m->nmaster = nmaster;
|
||||||
m->showbar = showbar;
|
m->showbar = showbar;
|
||||||
m->topbar = topbar;
|
m->topbar = topbar;
|
||||||
|
m->gappih = gappih;
|
||||||
|
m->gappiv = gappiv;
|
||||||
|
m->gappoh = gappoh;
|
||||||
|
m->gappov = gappov;
|
||||||
m->lt[0] = &layouts[0];
|
m->lt[0] = &layouts[0];
|
||||||
m->lt[1] = &layouts[1 % LENGTH(layouts)];
|
m->lt[1] = &layouts[1 % LENGTH(layouts)];
|
||||||
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
|
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
|
||||||
@ -1781,34 +1789,6 @@ tagmon(const Arg *arg)
|
|||||||
sendmon(selmon->sel, dirtomon(arg->i));
|
sendmon(selmon->sel, dirtomon(arg->i));
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
void
|
||||||
togglebar(const Arg *arg)
|
togglebar(const Arg *arg)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user