From 7e5f1a57aa53e8b49bf53f4e038fae5e26c4b456 Mon Sep 17 00:00:00 2001 From: julian T Date: Mon, 28 Jan 2019 12:42:17 +0100 Subject: Added single-tagset patch --- keepfloatingposition.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 keepfloatingposition.c (limited to 'keepfloatingposition.c') 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; + } + } +} + -- cgit v1.2.3