diff options
| author | bakkeby <[email protected]> | 2019-10-04 22:46:47 +0200 |
|---|---|---|
| committer | bakkeby <[email protected]> | 2019-10-04 22:46:47 +0200 |
| commit | 2de0c0e30758021f0e4fb4f734942a60e146c31e (patch) | |
| tree | 3a0543f2620658063cf8cbbb535f21b09a71c0c5 /patch | |
| parent | 853c64fbb7adf09743af0723c6f2a55e83451c99 (diff) | |
| download | dwm-flexipatch-2de0c0e30758021f0e4fb4f734942a60e146c31e.tar.gz dwm-flexipatch-2de0c0e30758021f0e4fb4f734942a60e146c31e.zip | |
Adding maximize patch
Diffstat (limited to 'patch')
| -rw-r--r-- | patch/include.c | 4 | ||||
| -rw-r--r-- | patch/include.h | 4 | ||||
| -rw-r--r-- | patch/maximize.c | 45 | ||||
| -rw-r--r-- | patch/maximize.h | 4 |
4 files changed, 57 insertions, 0 deletions
diff --git a/patch/include.c b/patch/include.c index ca231a0..3db5a6d 100644 --- a/patch/include.c +++ b/patch/include.c @@ -52,6 +52,10 @@ #include "holdbar.c" #endif +#if MAXIMIZE_PATCH +#include "maximize.c" +#endif + #if PERTAG_PATCH #include "pertag.c" #endif diff --git a/patch/include.h b/patch/include.h index 2522376..afdbf87 100644 --- a/patch/include.h +++ b/patch/include.h @@ -52,6 +52,10 @@ #include "holdbar.h" #endif +#if MAXIMIZE_PATCH +#include "maximize.h" +#endif + #if PERTAG_PATCH #include "pertag.h" #endif diff --git a/patch/maximize.c b/patch/maximize.c new file mode 100644 index 0000000..6f89538 --- /dev/null +++ b/patch/maximize.c @@ -0,0 +1,45 @@ +void +maximize(int x, int y, int w, int h) { + XEvent ev; + + if(!selmon->sel || selmon->sel->isfixed) + return; + XRaiseWindow(dpy, selmon->sel->win); + if(!selmon->sel->ismax) { + if(!selmon->lt[selmon->sellt]->arrange || selmon->sel->isfloating) + selmon->sel->wasfloating = True; + else { + togglefloating(NULL); + selmon->sel->wasfloating = False; + } + selmon->sel->oldx = selmon->sel->x; + selmon->sel->oldy = selmon->sel->y; + selmon->sel->oldw = selmon->sel->w; + selmon->sel->oldh = selmon->sel->h; + resize(selmon->sel, x, y, w, h, True); + selmon->sel->ismax = True; + } + else { + resize(selmon->sel, selmon->sel->oldx, selmon->sel->oldy, selmon->sel->oldw, selmon->sel->oldh, True); + if(!selmon->sel->wasfloating) + togglefloating(NULL); + selmon->sel->ismax = False; + } + drawbar(selmon); + while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); +} + +void +togglemaximize(const Arg *arg) { + maximize(selmon->wx, selmon->wy, selmon->ww - 2 * borderpx, selmon->wh - 2 * borderpx); +} + +void +toggleverticalmax(const Arg *arg) { + maximize(selmon->sel->x, selmon->wy, selmon->sel->w, selmon->wh - 2 * borderpx); +} + +void +togglehorizontalmax(const Arg *arg) { + maximize(selmon->wx, selmon->sel->y, selmon->ww - 2 * borderpx, selmon->sel->h); +}
\ No newline at end of file diff --git a/patch/maximize.h b/patch/maximize.h new file mode 100644 index 0000000..a71226a --- /dev/null +++ b/patch/maximize.h @@ -0,0 +1,4 @@ +static void maximize(int x, int y, int w, int h); +static void togglemaximize(const Arg *arg); +static void toggleverticalmax(const Arg *arg); +static void togglehorizontalmax(const Arg *arg);
\ No newline at end of file |
