From c44b14e3dd063cbe85ac152229991411c67de3dc Mon Sep 17 00:00:00 2001 From: bakkeby Date: Thu, 27 Aug 2020 21:05:34 +0200 Subject: [PATCH] setborderpx compatibility improvements --- patch/decorationhints.c | 10 +++++++--- patch/exresize.c | 9 +++++++-- patch/maximize.c | 22 +++++++++++++++++++++- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/patch/decorationhints.c b/patch/decorationhints.c index a7498ee..6636998 100644 --- a/patch/decorationhints.c +++ b/patch/decorationhints.c @@ -14,16 +14,20 @@ updatemotifhints(Client *c) return; if (XGetWindowProperty(dpy, c->win, motifatom, 0L, 5L, False, motifatom, - &real, &format, &n, &extra, &p) == Success && p != NULL) { + &real, &format, &n, &extra, &p) == Success && p != NULL) { motif = (unsigned long*)p; if (motif[MWM_HINTS_FLAGS_FIELD] & MWM_HINTS_DECORATIONS) { width = WIDTH(c); height = HEIGHT(c); if (motif[MWM_HINTS_DECORATIONS_FIELD] & MWM_DECOR_ALL || - motif[MWM_HINTS_DECORATIONS_FIELD] & MWM_DECOR_BORDER || - motif[MWM_HINTS_DECORATIONS_FIELD] & MWM_DECOR_TITLE) + motif[MWM_HINTS_DECORATIONS_FIELD] & MWM_DECOR_BORDER || + motif[MWM_HINTS_DECORATIONS_FIELD] & MWM_DECOR_TITLE) + #if SETBORDERPX_PATCH + c->bw = c->oldbw = c->mon->borderpx; + #else c->bw = c->oldbw = borderpx; + #endif // SETBORDERPX_PATCH else c->bw = c->oldbw = 0; diff --git a/patch/exresize.c b/patch/exresize.c index 4d8d4b0..e9786b3 100644 --- a/patch/exresize.c +++ b/patch/exresize.c @@ -117,6 +117,11 @@ expand(unsigned char mask) { XEvent ev; int nx1, ny1, nx2, ny2; + #if SETBORDERPX_PATCH + int bp = selmon->borderpx; + #else + int bp = borderpx; + #endif // SETBORDERPX_PATCH unsigned char curmask; unsigned char newmask; @@ -142,7 +147,7 @@ expand(unsigned char mask) nx2 = calculate_expand(mask, curmask, &newmask, EXPAND_RIGHT, &selmon->sel->expandx2, selmon->sel->x + selmon->sel->w, - selmon->wx + selmon->ww - 2*borderpx, + selmon->wx + selmon->ww - 2*bp, selmon->sel->oldw + selmon->sel->x); ny1 = calculate_expand(mask, curmask, &newmask, EXPAND_UP, &selmon->sel->expandy1, @@ -152,7 +157,7 @@ expand(unsigned char mask) ny2 = calculate_expand(mask, curmask, &newmask, EXPAND_DOWN, &selmon->sel->expandy2, selmon->sel->y + selmon->sel->h, - selmon->wy + selmon->wh - 2*borderpx, + selmon->wy + selmon->wh - 2*bp, selmon->sel->oldh + selmon->sel->y); diff --git a/patch/maximize.c b/patch/maximize.c index 77775f3..53336eb 100644 --- a/patch/maximize.c +++ b/patch/maximize.c @@ -30,6 +30,25 @@ maximize(int x, int y, int w, int h) while (XCheckMaskEvent(dpy, EnterWindowMask, &ev)); } +#if SETBORDERPX_PATCH +void +togglemax(const Arg *arg) +{ + maximize(selmon->wx, selmon->wy, selmon->ww - 2 * selmon->borderpx, selmon->wh - 2 * selmon->borderpx); +} + +void +toggleverticalmax(const Arg *arg) +{ + maximize(selmon->sel->x, selmon->wy, selmon->sel->w, selmon->wh - 2 * selmon->borderpx); +} + +void +togglehorizontalmax(const Arg *arg) +{ + maximize(selmon->wx, selmon->sel->y, selmon->ww - 2 * selmon->borderpx, selmon->sel->h); +} +#else void togglemax(const Arg *arg) { @@ -46,4 +65,5 @@ void togglehorizontalmax(const Arg *arg) { maximize(selmon->wx, selmon->sel->y, selmon->ww - 2 * borderpx, selmon->sel->h); -} \ No newline at end of file +} +#endif // SETBORDERPX_PATCH \ No newline at end of file