diff options
| author | bakkeby <[email protected]> | 2020-08-27 07:34:21 +0200 |
|---|---|---|
| committer | bakkeby <[email protected]> | 2020-08-27 07:34:21 +0200 |
| commit | b3d336322e56637c7e157a44695dab6def2fcb05 (patch) | |
| tree | 6a64e4bf744bdbcd01eeccdaa00c5281403014be /patch | |
| parent | 376b48e4d21258e6de5e8da014e555aca399703b (diff) | |
| download | dwm-flexipatch-b3d336322e56637c7e157a44695dab6def2fcb05.tar.gz dwm-flexipatch-b3d336322e56637c7e157a44695dab6def2fcb05.zip | |
Adding aspectresize patch
Diffstat (limited to 'patch')
| -rw-r--r-- | patch/aspectresize.c | 24 | ||||
| -rw-r--r-- | patch/aspectresize.h | 1 | ||||
| -rw-r--r-- | patch/include.c | 3 | ||||
| -rw-r--r-- | patch/include.h | 3 |
4 files changed, 31 insertions, 0 deletions
diff --git a/patch/aspectresize.c b/patch/aspectresize.c new file mode 100644 index 0000000..73a0342 --- /dev/null +++ b/patch/aspectresize.c @@ -0,0 +1,24 @@ +void +aspectresize(const Arg *arg) +{ + /* only floating windows can be moved */ + Client *c; + c = selmon->sel; + float ratio; + int w, h,nw, nh; + + if (!c || !arg) + return; + if (selmon->lt[selmon->sellt]->arrange && !c->isfloating) + return; + + ratio = (float)c->w / (float)c->h; + h = arg->i; + w = (int)(ratio * h); + + nw = c->w + w; + nh = c->h + h; + + XRaiseWindow(dpy, c->win); + resize(c, c->x, c->y, nw, nh, True); +}
\ No newline at end of file diff --git a/patch/aspectresize.h b/patch/aspectresize.h new file mode 100644 index 0000000..ad0d054 --- /dev/null +++ b/patch/aspectresize.h @@ -0,0 +1 @@ +static void aspectresize(const Arg *arg);
\ No newline at end of file diff --git a/patch/include.c b/patch/include.c index 606377e..e13348e 100644 --- a/patch/include.c +++ b/patch/include.c @@ -82,6 +82,9 @@ #endif /* Other patches */ +#if ASPECTRESIZE_PATCH +#include "aspectresize.c" +#endif #if ATTACHABOVE_PATCH || ATTACHASIDE_PATCH || ATTACHBELOW_PATCH || ATTACHBOTTOM_PATCH #include "attachx.c" #endif diff --git a/patch/include.h b/patch/include.h index 3961d41..9130311 100644 --- a/patch/include.h +++ b/patch/include.h @@ -79,6 +79,9 @@ #endif /* Other patches */ +#if ASPECTRESIZE_PATCH +#include "aspectresize.h" +#endif #if ATTACHABOVE_PATCH || ATTACHASIDE_PATCH || ATTACHBELOW_PATCH || ATTACHBOTTOM_PATCH #include "attachx.h" #endif |
