setborderpx compatibility improvements

pull/48/head
bakkeby 4 years ago
parent b3d336322e
commit c44b14e3dd

@ -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;

@ -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);

@ -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);
}
}
#endif // SETBORDERPX_PATCH
Loading…
Cancel
Save