mfwm

A tiling fork of dylanaraps sowm.
git clone git://depsterr.com/git/mfwm
Log | Files | Refs | README | LICENSE

commit 60ee489f450a9208a4bf497f2e3245a465ef7393
parent 71f2ffe59340cd477316eb6f9255624d78562aad
Author: depsterr <depsterr@protonmail.com>
Date:   Tue, 16 Jun 2020 01:25:00 +0200

moved mfwm to sowm

Diffstat:
Dmfwm.c | 72------------------------------------------------------------------------
Msowm.c | 74+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 73 insertions(+), 73 deletions(-)

diff --git a/mfwm.c b/mfwm.c @@ -1,72 +0,0 @@ -const int gappx = 10; -const float mfact = 0.5; - -void client_focus(client* c) { - client *c; - - if (list) { - list->prev->next = c; - c->prev = list->prev; - list->prev = c; - c->next = list; - } else { - list = c; - list->prev = list->next = list; - } - - ws_save(ws); -} - -void organize() { - if (!list) - return; - - int i, nx, ny, nw, nh; - - nx = wx; - ny = 0; - nw = ww - gappx; - nh = wh - gappx; - - for win { - if((i % 2 && nh / 2 > 2 * c->bw) - || (!(i % 2) && nw / 2 > 2 * c->bw)) { - if(i < n - 1) { - if(i % 2) - nh /= 2; - else - nw /= 2; - if((i % 4) == 2 && !s) - nx += nw; - else if((i % 4) == 3 && !s) - ny += nh; - } - if((i % 4) == 0) { - if(s) - ny += nh; - else - ny -= nh; - } - else if((i % 4) == 1) - nx += nw; - else if((i % 4) == 2) - ny += nh; - else if((i % 4) == 3) { - if(s) - nx += nw; - else - nx -= nw; - } - if(i == 0) - { - if(n != 1) - nw = mfact; - ny = mon->wy; - } - else if(i == 1) - nw = mon->ww - nw - gappx; - i++; - } - resize(c, nx + gappx, ny + gappx, nw - 2 * c->bw - gappx, nh - 2 * c->bw - gappx, False); - } -} diff --git a/sowm.c b/sowm.c @@ -9,12 +9,14 @@ #include <unistd.h> #include "sowm.h" -#include "mfwm.c" static client *list = {0}, *ws_list[10] = {0}, *cur; static int ws = 1, sw, sh, wx, wy, numlock = 0; static unsigned int ww, wh; +const int gappx = 10; +const float mfact = 0.5; + static Display *d; static XButtonEvent mouse; static Window root; @@ -275,3 +277,73 @@ int main(void) { while (1 && !XNextEvent(d, &ev)) // 1 && will forever be here. if (events[ev.type]) events[ev.type](&ev); } + +void client_focus(client* c) { + client *c; + + if (list) { + list->prev->next = c; + c->prev = list->prev; + list->prev = c; + c->next = list; + } else { + list = c; + list->prev = list->next = list; + } + + ws_save(ws); +} + +void organize() { + if (!list) + return; + + int i, nx, ny, nw, nh; + + nx = wx; + ny = 0; + nw = ww - gappx; + nh = wh - gappx; + + for win { + if((i % 2 && nh / 2 > 2 * c->bw) + || (!(i % 2) && nw / 2 > 2 * c->bw)) { + if(i < n - 1) { + if(i % 2) + nh /= 2; + else + nw /= 2; + if((i % 4) == 2 && !s) + nx += nw; + else if((i % 4) == 3 && !s) + ny += nh; + } + if((i % 4) == 0) { + if(s) + ny += nh; + else + ny -= nh; + } + else if((i % 4) == 1) + nx += nw; + else if((i % 4) == 2) + ny += nh; + else if((i % 4) == 3) { + if(s) + nx += nw; + else + nx -= nw; + } + if(i == 0) + { + if(n != 1) + nw = mfact; + ny = mon->wy; + } + else if(i == 1) + nw = mon->ww - nw - gappx; + i++; + } + resize(c, nx + gappx, ny + gappx, nw - 2 * c->bw - gappx, nh - 2 * c->bw - gappx, False); + } +}