diff options
author | julian T <julian@jtle.dk> | 2019-01-28 12:42:17 +0100 |
---|---|---|
committer | julian T <julian@jtle.dk> | 2019-01-28 12:42:17 +0100 |
commit | 7e5f1a57aa53e8b49bf53f4e038fae5e26c4b456 (patch) | |
tree | 2ee2633b2db91075bf3b3b4c5290783b48a0b567 /keepfloatingposition.c | |
parent | 67949b8b32c6ccadf689097221e375cd2c221c7f (diff) |
Added single-tagset patch
Diffstat (limited to 'keepfloatingposition.c')
-rw-r--r-- | keepfloatingposition.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/keepfloatingposition.c b/keepfloatingposition.c new file mode 100644 index 0000000..f888df2 --- /dev/null +++ b/keepfloatingposition.c @@ -0,0 +1,31 @@ +static void +keepfloatingposition(Client *c) { + Monitor *m; + int cmmx = c->mon->mx; + int cmmy = c->mon->my; + int cmmw = c->mon->mw; + int cmmh = c->mon->mh; + int mmx, mmy; + if(!(cmmx <= c->x && + cmmx + cmmw - 1 >= c->x && + cmmy <= c->y && + cmmy + cmmh - 1 >= c->y)) + for(m = mons; m; m = m->next) { + mmx = m->mx; + mmy = m->my; + if(mmx <= c->x && + mmx + m->mw - 1 >= c->x && + mmy <= c->y && + mmy + m->mh - 1 >= c->y) { + c->x = c->x - mmx + cmmx; + c->y = c->y - mmy + cmmy; + if(c->x + c->w + 2 * c->bw > cmmx + cmmw - 1) + c->x -= c->x + c->w + 2 * c->bw - cmmx - cmmw; + if(c->y + c->h + 2 * c->bw > cmmy + cmmh - 1) + c->y -= c->y + c->h + 2 * c->bw - cmmy - cmmh; + resizeclient(c, c->x, c->y, c->w, c->h); + break; + } + } +} + |