X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=plugins%2Fresistance.c;h=30741d80b83fea40f5e2ef004b0dba320e783ae9;hb=8a6a9710eb9f7a22d5e0cb01b18f1d3aad78e908;hp=2b7bd1dff67e81340d9ec9f84c4470350abdd5f3;hpb=1cbe8af5e32984da6a5a11a2e7aecf8d069921cf;p=chaz%2Fopenbox diff --git a/plugins/resistance.c b/plugins/resistance.c index 2b7bd1df..30741d80 100644 --- a/plugins/resistance.c +++ b/plugins/resistance.c @@ -244,17 +244,27 @@ static void resist_size(Client *c, int *w, int *h, Corner corn) case Corner_TopRight: dlt = lt; drb = rb + *h - c->frame->area.height; + g_message("dlt %d drb %d rb %d ab %d", dlt, drb, rb, ab); if (rb <= ab && drb > ab && drb <= ab + resist.integer) - *h = ar - lt + 1; + *h = ab - lt + 1; break; case Corner_BottomLeft: case Corner_BottomRight: dlt = lt - *h + c->frame->area.height; drb = rb; if (lt >= at && dlt < at && dlt >= at - resist.integer) - *h = rb - al + 1; + *h = rb - at + 1; break; } + + /* round down for size increments */ + *w -= c->frame->area.width + c->frame->size.left + c->frame->size.right; + *w = *w / c->size_inc.width * c->size_inc.width; + *w += c->frame->area.width + c->frame->size.left + c->frame->size.right; + + *h -= c->frame->area.height + c->frame->size.top + c->frame->size.bottom; + *h = *h / c->size_inc.height * c->size_inc.height; + *h += c->frame->area.height + c->frame->size.top + c->frame->size.bottom; } static void event(ObEvent *e, void *foo)